diff --git a/Makefile b/Makefile index c9ee6cc..7798aa7 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,7 @@ test: install cd examples/flow && make cd examples/sitemap && make cd examples/go-generate && make + cd examples/single-package-mode && make # cd examples/go-kit && make .PHONY: docker.build diff --git a/README.md b/README.md index 8b95c60..1ff8bfa 100644 --- a/README.md +++ b/README.md @@ -39,15 +39,21 @@ input.proto templates/doc.txt.tmpl templates/config.json.tmpl doc.txt config.json ``` ---- +### Options -You can specify a custom `template_dir` or enable `debug`: +You can specify custom options, as follow: ```console $> protoc --gotemplate_out=debug=true,template_dir=/path/to/template/directory:. input.proto ``` ---- +| Option | Default Value | Accepted Values | Description +|-----------------------|---------------|---------------------------|----------------------- +| `template_dir`       | `./template` | absolute or relative path | path to look for templates +| `destination_dir`     | `.`           | absolute or relative path | base path to write output +| `single-package-mode` | *false* | `true` or `false` | if *true*, `protoc` won't accept multiple packages to be compiled at once (*!= from `all`*), but will support `Message` lookup across the imported protobuf dependencies +| `debug`               | *false*       | `true` or `false` | if *true*, `protoc` will generate a more verbose output +| `all`                 | *false*       | `true` or `false`         | if *true*, protobuf files without `Service` will also be parsed ##### Hints @@ -61,13 +67,34 @@ See [examples](./examples). This project uses [Masterminds/sprig](https://github.com/Masterminds/sprig) library and additional functions to extend the builtin [text/template](https://golang.org/pkg/text/template) helpers. -Non-exhaustive list of new helpers: +Non-exhaustive list of new helpers:s * **all the functions from [sprig](https://github.com/Masterminds/sprig)** * `json` * `prettyjson` * `first` * `last` +* `splitArray` +* `upperFirst` +* `lowerFirst` +* `camelCase` +* `lowerCamelCase` +* `kebabCase` +* `snakeCase` +* `getProtoFile` +* `getMessageType` +* `getEnumValue` +* `isFieldMessage` +* `isFieldRepeated` +* `goType` +* `goTypeWithPackage` +* `jsType` +* `jsSuffixReserved` +* `namespacedFlowType` +* `httpVerb` +* `httpPath` +* `shortType` +* `urlHasVarsFromMessage` See the project helpers for the complete list. diff --git a/examples/single-package-mode/Makefile b/examples/single-package-mode/Makefile new file mode 100644 index 0000000..a8ee603 --- /dev/null +++ b/examples/single-package-mode/Makefile @@ -0,0 +1,26 @@ +.PHONY: re +re: clean build test + +.PHONY: build +build: + @mkdir -p output + + @# proto-gen-go + protoc -I./proto --go_out=plugins=grpc:output proto/aaa/aaa.proto + protoc -I./proto --go_out=plugins=grpc:output proto/bbb/bbb.proto + @rm -rf output/aaa output/bbb + @mv output/github.com/moul/protoc-gen-gotemplate/examples/single-package-mode/output/* output/ + @rm -rf output/github.com + + @# protoc-gen-gotemplate + protoc -I./proto --gotemplate_out=template_dir=templates,single-package-mode=true:output proto/bbb/bbb.proto + gofmt -w . + +.PHONY: test +test: + go test -i ./output/... + go test -v ./output/... + +.PHONY: clean +clean: + rm -rf output diff --git a/examples/single-package-mode/output/aaa/aaa.pb.go b/examples/single-package-mode/output/aaa/aaa.pb.go new file mode 100644 index 0000000..1db6c9f --- /dev/null +++ b/examples/single-package-mode/output/aaa/aaa.pb.go @@ -0,0 +1,84 @@ +// Code generated by protoc-gen-go. +// source: aaa/aaa.proto +// DO NOT EDIT! + +/* +Package aaa is a generated protocol buffer package. + +It is generated from these files: + aaa/aaa.proto + +It has these top-level messages: + AaaRequest + AaaReply +*/ +package aaa + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type AaaRequest struct { + Blah string `protobuf:"bytes,1,opt,name=blah" json:"blah,omitempty"` +} + +func (m *AaaRequest) Reset() { *m = AaaRequest{} } +func (m *AaaRequest) String() string { return proto.CompactTextString(m) } +func (*AaaRequest) ProtoMessage() {} +func (*AaaRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *AaaRequest) GetBlah() string { + if m != nil { + return m.Blah + } + return "" +} + +type AaaReply struct { + Error string `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` +} + +func (m *AaaReply) Reset() { *m = AaaReply{} } +func (m *AaaReply) String() string { return proto.CompactTextString(m) } +func (*AaaReply) ProtoMessage() {} +func (*AaaReply) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *AaaReply) GetError() string { + if m != nil { + return m.Error + } + return "" +} + +func init() { + proto.RegisterType((*AaaRequest)(nil), "the.aaa.package.AaaRequest") + proto.RegisterType((*AaaReply)(nil), "the.aaa.package.AaaReply") +} + +func init() { proto.RegisterFile("aaa/aaa.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 172 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x2c, 0x8e, 0x31, 0x0b, 0xc2, 0x30, + 0x10, 0x46, 0x29, 0xa8, 0x68, 0x40, 0x84, 0xe0, 0xe0, 0x58, 0x3a, 0xb9, 0xa4, 0x19, 0xfc, 0x05, + 0xba, 0x8b, 0xd0, 0xd1, 0xed, 0x5a, 0x8f, 0xb4, 0x78, 0xe9, 0xc5, 0xf4, 0x02, 0xfa, 0xef, 0xc5, + 0xd8, 0xed, 0x1e, 0xbc, 0xe3, 0x7b, 0x6a, 0x0b, 0x00, 0x16, 0x00, 0xea, 0x10, 0x59, 0x58, 0xef, + 0xa4, 0xc7, 0x3a, 0x23, 0x74, 0x4f, 0x70, 0x58, 0x95, 0x4a, 0x9d, 0x01, 0x1a, 0x7c, 0x25, 0x9c, + 0x44, 0x6b, 0xb5, 0x68, 0x09, 0xfa, 0x43, 0x51, 0x16, 0xc7, 0x4d, 0x93, 0xef, 0xaa, 0x54, 0xeb, + 0x6c, 0x04, 0xfa, 0xe8, 0xbd, 0x5a, 0x62, 0x8c, 0x1c, 0x67, 0xe1, 0x0f, 0x97, 0xdb, 0xfd, 0xea, + 0x06, 0xe9, 0x53, 0x5b, 0x77, 0xec, 0xad, 0xe7, 0x44, 0x36, 0xaf, 0x75, 0xc6, 0xe1, 0x68, 0x1c, + 0x0b, 0xfa, 0x40, 0x20, 0x68, 0xf1, 0x0d, 0x3e, 0x10, 0x4e, 0x76, 0x1a, 0x46, 0x47, 0x68, 0xe6, + 0x08, 0xe3, 0xf9, 0x81, 0x96, 0x93, 0x84, 0x24, 0xbf, 0xd6, 0x76, 0x95, 0xdf, 0x4f, 0xdf, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x93, 0x24, 0x48, 0x9c, 0xbd, 0x00, 0x00, 0x00, +} diff --git a/examples/single-package-mode/output/bbb/bbb.pb.go b/examples/single-package-mode/output/bbb/bbb.pb.go new file mode 100644 index 0000000..4fa356c --- /dev/null +++ b/examples/single-package-mode/output/bbb/bbb.pb.go @@ -0,0 +1,200 @@ +// Code generated by protoc-gen-go. +// source: bbb/bbb.proto +// DO NOT EDIT! + +/* +Package bbb is a generated protocol buffer package. + +It is generated from these files: + bbb/bbb.proto + +It has these top-level messages: + BbbRequest + BbbReply +*/ +package bbb + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import the_aaa_package "github.com/moul/protoc-gen-gotemplate/examples/single-package-mode/output/aaa" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type BbbRequest struct { + Enable bool `protobuf:"varint,1,opt,name=enable" json:"enable,omitempty"` +} + +func (m *BbbRequest) Reset() { *m = BbbRequest{} } +func (m *BbbRequest) String() string { return proto.CompactTextString(m) } +func (*BbbRequest) ProtoMessage() {} +func (*BbbRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *BbbRequest) GetEnable() bool { + if m != nil { + return m.Enable + } + return false +} + +type BbbReply struct { + Done bool `protobuf:"varint,1,opt,name=done" json:"done,omitempty"` +} + +func (m *BbbReply) Reset() { *m = BbbReply{} } +func (m *BbbReply) String() string { return proto.CompactTextString(m) } +func (*BbbReply) ProtoMessage() {} +func (*BbbReply) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *BbbReply) GetDone() bool { + if m != nil { + return m.Done + } + return false +} + +func init() { + proto.RegisterType((*BbbRequest)(nil), "the.bbb.package.BbbRequest") + proto.RegisterType((*BbbReply)(nil), "the.bbb.package.BbbReply") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for BbbService service + +type BbbServiceClient interface { + Aaa(ctx context.Context, in *the_aaa_package.AaaRequest, opts ...grpc.CallOption) (*the_aaa_package.AaaReply, error) + Bbb(ctx context.Context, in *BbbRequest, opts ...grpc.CallOption) (*BbbReply, error) +} + +type bbbServiceClient struct { + cc *grpc.ClientConn +} + +func NewBbbServiceClient(cc *grpc.ClientConn) BbbServiceClient { + return &bbbServiceClient{cc} +} + +func (c *bbbServiceClient) Aaa(ctx context.Context, in *the_aaa_package.AaaRequest, opts ...grpc.CallOption) (*the_aaa_package.AaaReply, error) { + out := new(the_aaa_package.AaaReply) + err := grpc.Invoke(ctx, "/the.bbb.package.BbbService/Aaa", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *bbbServiceClient) Bbb(ctx context.Context, in *BbbRequest, opts ...grpc.CallOption) (*BbbReply, error) { + out := new(BbbReply) + err := grpc.Invoke(ctx, "/the.bbb.package.BbbService/Bbb", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for BbbService service + +type BbbServiceServer interface { + Aaa(context.Context, *the_aaa_package.AaaRequest) (*the_aaa_package.AaaReply, error) + Bbb(context.Context, *BbbRequest) (*BbbReply, error) +} + +func RegisterBbbServiceServer(s *grpc.Server, srv BbbServiceServer) { + s.RegisterService(&_BbbService_serviceDesc, srv) +} + +func _BbbService_Aaa_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(the_aaa_package.AaaRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BbbServiceServer).Aaa(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/the.bbb.package.BbbService/Aaa", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BbbServiceServer).Aaa(ctx, req.(*the_aaa_package.AaaRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _BbbService_Bbb_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BbbRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BbbServiceServer).Bbb(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/the.bbb.package.BbbService/Bbb", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BbbServiceServer).Bbb(ctx, req.(*BbbRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _BbbService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "the.bbb.package.BbbService", + HandlerType: (*BbbServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Aaa", + Handler: _BbbService_Aaa_Handler, + }, + { + MethodName: "Bbb", + Handler: _BbbService_Bbb_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "bbb/bbb.proto", +} + +func init() { proto.RegisterFile("bbb/bbb.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 242 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0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4e, 0xde, 0xe6, 0xbf, + 0xb6, 0xb5, 0xa3, 0xbe, 0x76, 0x2c, 0x14, 0xa2, 0x07, 0x21, 0x4b, 0x9f, 0x10, 0xa2, 0xa7, 0xc1, + 0x0e, 0x5d, 0xef, 0x3c, 0xd5, 0x25, 0xa9, 0x0e, 0xbc, 0x25, 0xcb, 0x49, 0x62, 0x92, 0xf1, 0x92, + 0x38, 0xcd, 0xf6, 0xc7, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe0, 0xe1, 0x26, 0xcb, 0x5b, 0x01, + 0x00, 0x00, +} diff --git a/examples/single-package-mode/output/bbb/service.go b/examples/single-package-mode/output/bbb/service.go new file mode 100644 index 0000000..6f1e6b4 --- /dev/null +++ b/examples/single-package-mode/output/bbb/service.go @@ -0,0 +1,19 @@ +// file generated with protoc-gen-gotemplate +package bbb + +import ( + "fmt" + + "github.com/moul/protoc-gen-gotemplate/examples/single-package-mode/output/aaa" + "golang.org/x/net/context" +) + +type Service struct{} + +func (service Service) Aaa(ctx context.Context, input *aaa.AaaRequest) (*aaa.AaaReply, error) { + return nil, fmt.Errorf("method not implemented") +} + +func (service Service) Bbb(ctx context.Context, input *BbbRequest) (*BbbReply, error) { + return nil, fmt.Errorf("method not implemented") +} diff --git a/examples/single-package-mode/proto/aaa/aaa.proto b/examples/single-package-mode/proto/aaa/aaa.proto new file mode 100644 index 0000000..2959414 --- /dev/null +++ b/examples/single-package-mode/proto/aaa/aaa.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +option go_package = "github.com/moul/protoc-gen-gotemplate/examples/single-package-mode/output/aaa"; + +package the.aaa.package; + +message AaaRequest { + string blah = 1; +} +message AaaReply { + string error = 1; +} \ No newline at end of file diff --git a/examples/single-package-mode/proto/bbb/bbb.proto b/examples/single-package-mode/proto/bbb/bbb.proto new file mode 100644 index 0000000..b41952f --- /dev/null +++ b/examples/single-package-mode/proto/bbb/bbb.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +package the.bbb.package; + +option go_package = "github.com/moul/protoc-gen-gotemplate/examples/single-package-mode/output/bbb"; + +import "aaa/aaa.proto"; + +service BbbService { + rpc Aaa(the.aaa.package.AaaRequest) returns (the.aaa.package.AaaReply); + rpc Bbb(BbbRequest) returns (BbbReply); +} + +message BbbRequest { + bool enable = 1; +} +message BbbReply { + bool done = 1; +} \ No newline at end of file diff --git a/examples/single-package-mode/templates/{{.File.Name|dir}}/service.go.tmpl b/examples/single-package-mode/templates/{{.File.Name|dir}}/service.go.tmpl new file mode 100644 index 0000000..22ea037 --- /dev/null +++ b/examples/single-package-mode/templates/{{.File.Name|dir}}/service.go.tmpl @@ -0,0 +1,26 @@ +// file generated with protoc-gen-gotemplate +package {{.File.Name | dir}} + +{{- $file := .File}} +{{- $currentFile := $file.Name | getProtoFile}} + +import ( + "fmt" + + "golang.org/x/net/context" + + {{- range .File.Dependency}} + {{- $dependency := . | getProtoFile}} + {{$dependency.GoPkg}} + {{end}} +) + +type Service struct {} + +{{- range .Service.Method}} +{{- $in := .InputType | getMessageType $file}} +{{- $out := .OutputType | getMessageType $file}} +func (service Service) {{.Name}}(ctx context.Context, input *{{$in.GoType $currentFile.GoPkg.Path}}) (*{{$out.GoType $currentFile.GoPkg.Path}}, error) { + return nil, fmt.Errorf("method not implemented") +} +{{end}} diff --git a/glide.lock b/glide.lock index 9baa9ce..542c9a4 100644 --- a/glide.lock +++ b/glide.lock @@ -1,12 +1,12 @@ -hash: 952872c40b8721f6bcd8bc1eab4f174aa0aebc5e8d9acb70ecdffb91068845b5 -updated: 2017-03-31T17:55:29.337081111+02:00 +hash: 1944ae13e983e8da7b26c697fc40d79d34326b8c7f56c8939fb16f1ff8caca5b +updated: 2017-05-18T19:20:01.855895064+02:00 imports: - name: github.com/aokoli/goutils - version: 9c37978a95bd5c709a15883b6242714ea6709e64 + version: e57d01ace047c1a43e6a49ecf3ecc50ed2be81d1 - name: github.com/dgrijalva/jwt-go - version: d2709f9f1f31ebcda9651b03077758c1f3a0018c + version: c9eaceb2896dbb515dae7ec352b377a226a52721 - name: github.com/go-kit/kit - version: fadad6fffe0466b19df9efd9acde5c9a52df5fa4 + version: 9f5c614cd1e70102f80b644edbc760805ebf16d5 subpackages: - auth/jwt - endpoint @@ -16,22 +16,28 @@ imports: - name: github.com/go-logfmt/logfmt version: 390ab7935ee28ec6b286364bba9b4dd6410cb3d5 - name: github.com/go-stack/stack - version: 100eb0c0a9c5b306ca2fb4f165df21d80ada4b82 + version: 7a2f19628aabfe68f0766b59e74d6315f8347d22 +- name: github.com/golang/glog + version: 23def4e6c14b4da8ac2ed8007337bc5eb5007998 - name: github.com/golang/protobuf - version: 2bba0603135d7d7f5cb73b2125beeda19c09f4ef + version: 8ee79997227bf9b34611aee7946ae64735e6fd93 subpackages: - proto - protoc-gen-go/descriptor - protoc-gen-go/generator - protoc-gen-go/plugin - name: github.com/gorilla/handlers - version: 13d73096a474cac93275c679c7b8a2dc17ddba82 + version: e1b2144f2167de0e1042d1d35e5cba5119d4fb5d - name: github.com/grpc-ecosystem/grpc-gateway - version: 18d159699f2e83fc5bb9ef2f79465ca3f3122676 + version: 589b126116b5fc961939b3e156c29e4d9d58222f subpackages: - - third_party/googleapis/google/api + - protoc-gen-grpc-gateway/descriptor + - protoc-gen-grpc-gateway/httprule + - utilities - name: github.com/huandu/xstrings version: 3959339b333561bf62a38b424fd41517c2c90f40 +- name: github.com/imdario/mergo + version: 3e95a51e0639b4cf372f2ccf74c86749d747fbdc - name: github.com/kr/fs version: 2788f0dbd16903de03cb8186e5c7d97b69ad387b - name: github.com/kr/logfmt @@ -39,16 +45,16 @@ imports: - name: github.com/Masterminds/semver version: 59c29afe1a994eacb71c833025ca7acf874bb1da - name: github.com/Masterminds/sprig - version: cd9291e11ed2b78cdc1991bdd3e8adf51d6236bb + version: 2f4371ac162f912989f01cc2b6af4ba6660e6a30 - name: github.com/satori/go.uuid version: 879c5887cd475cd7864858769793b2ceb0d44feb - name: golang.org/x/crypto - version: 3cb07270c9455e8ad27956a70891c962d121a228 + version: 0fe963104e9d1877082f8fb38f816fcd97eb1d10 subpackages: - pbkdf2 - scrypt - name: golang.org/x/net - version: ffcf1bedda3b04ebb15a168a59800a73d6dc0f4d + version: da2b4fa28524a3baf148c1b94df4440267063c88 subpackages: - context - context/ctxhttp @@ -59,28 +65,25 @@ imports: - lex/httplex - trace - name: golang.org/x/text - version: c3b0cbb40eb9a862fdc91f79bed8c7ac8e7a36e8 + version: a49bea13b776691cb1b49873e5d8df96ec74831a subpackages: - secure/bidirule - transform - unicode/bidi - unicode/norm - name: google.golang.org/genproto - version: de9f5e90fe9b278809363f08c2072d2f2a429de7 + version: bb3573be0c484136831138976d444b8754777aff subpackages: - googleapis/api/annotations - name: google.golang.org/grpc - version: cdee119ee21e61eef7093a41ba148fa83585e143 + version: 777daa17ff9b5daef1cfdf915088a2ada3332bf0 subpackages: - codes - credentials - grpclog - internal - - keepalive - metadata - naming - peer - - stats - - tap - transport testImports: [] diff --git a/glide.yaml b/glide.yaml index 26f560a..8dce80b 100644 --- a/glide.yaml +++ b/glide.yaml @@ -12,3 +12,5 @@ import: - package: google.golang.org/genproto subpackages: - googleapis/api/annotations +- package: github.com/grpc-ecosystem/grpc-gateway + version: 1.2.2 \ No newline at end of file diff --git a/helpers.go b/helpers.go index 4d85b1e..9ba34c8 100644 --- a/helpers.go +++ b/helpers.go @@ -8,10 +8,10 @@ import ( "text/template" "github.com/Masterminds/sprig" - "github.com/huandu/xstrings" - "github.com/golang/protobuf/proto" "github.com/golang/protobuf/protoc-gen-go/descriptor" + ggdescriptor "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/huandu/xstrings" options "google.golang.org/genproto/googleapis/api/annotations" ) @@ -64,6 +64,7 @@ var ProtoHelpersFuncMap = template.FuncMap{ return strings.Replace(xstrings.ToSnakeCase(s), "_", "-", -1) }, "snakeCase": xstrings.ToSnakeCase, + "getProtoFile": getProtoFile, "getMessageType": getMessageType, "getEnumValue": getEnumValue, "isFieldMessage": isFieldMessage, @@ -85,17 +86,37 @@ func init() { } } -func getMessageType(f *descriptor.FileDescriptorProto, name string) *descriptor.DescriptorProto { +func getProtoFile(name string) *ggdescriptor.File { + if registry == nil { + return nil + } + file, err := registry.LookupFile(name) + if err != nil { + panic(err) + } + return file +} + +func getMessageType(f *descriptor.FileDescriptorProto, name string) *ggdescriptor.Message { + if registry != nil { + msg, err := registry.LookupMsg(".", name) + if err != nil { + panic(err) + } + return msg + } + // name is in the form .packageName.MessageTypeName.InnerMessageTypeName... // e.g. .article.ProductTag splits := strings.Split(name, ".") target := splits[len(splits)-1] for _, m := range f.MessageType { if target == *m.Name { - return m + return &ggdescriptor.Message{ + DescriptorProto: m, + } } } - return nil } diff --git a/main.go b/main.go index 87d74e9..8ea27d8 100644 --- a/main.go +++ b/main.go @@ -9,6 +9,11 @@ import ( "github.com/golang/protobuf/proto" "github.com/golang/protobuf/protoc-gen-go/generator" "github.com/golang/protobuf/protoc-gen-go/plugin" + ggdescriptor "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" +) + +var ( + registry *ggdescriptor.Registry // some helpers need access to registry ) func main() { @@ -30,10 +35,13 @@ func main() { g.CommandLineParameters(g.Request.GetParameter()) // Parse parameters - templateDir := "./templates" - destinationDir := "." - debug := false - all := false + var ( + templateDir = "./templates" + destinationDir = "." + debug = false + all = false + singlePackageMode = false + ) if parameter := g.Request.GetParameter(); parameter != "" { for _, param := range strings.Split(parameter, ",") { parts := strings.Split(param, "=") @@ -48,6 +56,15 @@ func main() { case "destination_dir": destinationDir = parts[1] break + case "single-package-mode": + switch strings.ToLower(parts[1]) { + case "true", "t": + singlePackageMode = true + case "false", "f": + default: + log.Printf("Err: invalid value for single-package-mode: %q", parts[1]) + } + break case "debug": switch strings.ToLower(parts[1]) { case "true", "t": @@ -74,17 +91,29 @@ func main() { tmplMap := make(map[string]*plugin_go.CodeGeneratorResponse_File) concatOrAppend := func(file *plugin_go.CodeGeneratorResponse_File) { - if val, ok := tmplMap[*file.Name]; ok { - *val.Content += *file.Content + if val, ok := tmplMap[file.GetName()]; ok { + *val.Content += file.GetContent() } else { - tmplMap[*file.Name] = file + tmplMap[file.GetName()] = file g.Response.File = append(g.Response.File, file) } } + if singlePackageMode { + registry = ggdescriptor.NewRegistry() + if err := registry.Load(g.Request); err != nil { + g.Error(err, "registry: failed to load the request") + } + } + // Generate the encoders for _, file := range g.Request.GetProtoFile() { if all { + if singlePackageMode { + if _, err := registry.LookupFile(file.GetName()); err != nil { + g.Error(err, "registry: failed to lookup file %q", file.GetName()) + } + } encoder := NewGenericTemplateBasedEncoder(templateDir, file, debug, destinationDir) for _, tmpl := range encoder.Files() { concatOrAppend(tmpl) diff --git a/vendor/github.com/Masterminds/sprig/README.md b/vendor/github.com/Masterminds/sprig/README.md index 097f1c1..25bf3d4 100644 --- a/vendor/github.com/Masterminds/sprig/README.md +++ b/vendor/github.com/Masterminds/sprig/README.md @@ -1,4 +1,6 @@ # Sprig: Template functions for Go templates +[![Stability: Sustained](https://masterminds.github.io/stability/sustained.svg)](https://masterminds.github.io/stability/sustained.html) +[![Build Status](https://travis-ci.org/Masterminds/sprig.svg?branch=master)](https://travis-ci.org/Masterminds/sprig) The Go language comes with a [built-in template language](http://golang.org/pkg/text/template/), but not @@ -6,12 +8,15 @@ very many template functions. This library provides a group of commonly used template functions. It is inspired by the template functions found in -[Twig](http://twig.sensiolabs.org/documentation). - -[![Build Status](https://travis-ci.org/Masterminds/sprig.svg?branch=master)](https://travis-ci.org/Masterminds/sprig) +[Twig](http://twig.sensiolabs.org/documentation) and also in various +JavaScript libraries, such as [underscore.js](http://underscorejs.org/). ## Usage +Template developers can read the [Sprig function documentation](http://masterminds.github.io/sprig/) to +learn about the >100 template functions available. + +For Go developers wishing to include Sprig as a library in their programs, API documentation is available [at GoDoc.org](http://godoc.org/github.com/Masterminds/sprig), but read on for standard usage. @@ -54,241 +59,6 @@ Produces: HELLO!HELLO!HELLO!HELLO!HELLO! ``` -## Functions - -### Date Functions - -- date: Format a date, where a date is an integer type or a time.Time type, and - format is a time.Format formatting string. -- dateModify: Given a date, modify it with a duration: `date_modify "-1.5h" now`. If the duration doesn't -parse, it returns the time unaltered. See `time.ParseDuration` for info on duration strings. -- now: Current time.Time, for feeding into date-related functions. -- htmlDate: Format a date for use in the value field of an HTML "date" form element. -- dateInZone: Like date, but takes three arguments: format, timestamp, - timezone. -- htmlDateInZone: Like htmlDate, but takes two arguments: timestamp, - timezone. - -### String Functions - -- trim: strings.TrimSpace -- trimAll: strings.Trim, but with the argument order reversed `trimAll "$" "$5.00"` or `"$5.00 | trimAll "$"` -- trimSuffix: strings.TrimSuffix, but with the argument order reversed `trimSuffix "-" "5-"` -- trimPrefix: strings.TrimPrefix, but with the argument order reversed `trimPrefix "$" "$5"` -- upper: strings.ToUpper -- lower: strings.ToLower -- title: strings.Title -- repeat: strings.Repeat, but with the arguments switched: `repeat count str`. (This simplifies common pipelines) -- substr: Given string, start, and length, return a substr. -- nospace: Remove all spaces from a string. `h e l l o` becomes - `hello`. -- abbrev: Truncate a string with ellipses -- trunc: Truncate a string (no suffix). `trunc 5 "Hello World"` yields "hello". -- abbrevboth: Truncate both sides of a string with ellipses -- untitle: Remove title case -- intials: Given multiple words, return the first letter of each - word -- randAlphaNum: Generate a random alpha-numeric string -- randAlpha: Generate a random alphabetic string -- randAscii: Generate a random ASCII string, including symbols -- randNumeric: Generate a random numeric string -- wrap: Wrap text at the given column count -- wrapWith: Wrap text at the given column count, and with the given - string for a line terminator: `wrap 50 "\n\t" $string` -- contains: strings.Contains, but with the arguments switched: `contains "cat" "uncatch"`. (This simplifies common pipelines) -- hasPrefix: strings.hasPrefix, but with the arguments switched: `hasPrefix "cat" "catch"`. -- hasSuffix: strings.hasSuffix, but with the arguments switched: `hasSuffix "cat" "ducat"`. -- quote: Wrap strings in double quotes. `quote "a" "b"` returns `"a" - "b"` -- squote: Wrap strings in single quotes. -- cat: Concatenate strings, separating them by spaces. `cat $a $b $c`. -- indent: Indent a string using space characters. `indent 4 "foo\nbar"` produces " foo\n bar" -- replace: Replace an old with a new in a string: `$name | replace " " "-"` -- plural: Choose singular or plural based on length: `len $fish | plural - "one anchovy" "many anchovies"` -- uuidv4: Generate a UUID v4 string -- sha256sum: Generate a hex encoded sha256 hash of the input -- toString: Convert something to a string - -### String Slice Functions: - -- join: strings.Join, but as `join SEP SLICE` -- split: strings.Split, but as `split SEP STRING`. The results are returned - as a map with the indexes set to _N, where N is an integer starting from 0. - Use it like this: `{{$v := "foo/bar/baz" | split "/"}}{{$v._0}}` (Prints `foo`) -- splitList: strings.Split, but as `split SEP STRING`. The results are returned - as an array. -- toStrings: convert a list to a list of strings. 'list 1 2 3 | toStrings' produces '["1" "2" "3"]' -- sortAlpha: sort a list lexicographically. - -### Integer Slice Functions: - -- until: Given an integer, returns a slice of counting integers from 0 to one - less than the given integer: `range $i, $e := until 5` -- untilStep: Given start, stop, and step, return an integer slice starting at - 'start', stopping at `stop`, and incrementing by 'step'. This is the same - as Python's long-form of 'range'. - -### Conversions: - -- atoi: Convert a string to an integer. 0 if the integer could not be parsed. -- int: Convert a string or numeric to an int -- int64: Convert a string or numeric to an int64 -- float64: Convert a string or numeric to a float64 - -### Defaults: - -- default: Give a default value. Used like this: {{trim " "| default "empty"}}. - Since trim produces an empty string, the default value is returned. For - things with a length (strings, slices, maps), len(0) will trigger the default. - For numbers, the value 0 will trigger the default. For booleans, false will - trigger the default. For structs, the default is never returned (there is - no clear empty condition). For everything else, nil value triggers a default. -- empty: Returns true if the given value is the zero value for that - type. Structs are always non-empty. -- coalesce: Given a list of items, return the first non-empty one. - This follows the same rules as 'empty'. `{{ coalesce .someVal 0 "hello" }}` - will return `.someVal` if set, or else return "hello". The 0 is skipped - because it is an empty value. -- compact: Return a copy of a list with all of the empty values removed. - `list 0 1 2 "" | compact` will return `[1 2]` - -### OS: - -- env: Read an environment variable. -- expandenv: Expand all environment variables in a string. - -### File Paths: -- base: Return the last element of a path. https://golang.org/pkg/path#Base -- dir: Remove the last element of a path. https://golang.org/pkg/path#Dir -- clean: Clean a path to the shortest equivalent name. (e.g. remove "foo/.." - from "foo/../bar.html") https://golang.org/pkg/path#Clean -- ext: Get the extension for a file path: https://golang.org/pkg/path#Ext -- isAbs: Returns true if a path is absolute: https://golang.org/pkg/path#IsAbs - -### Encoding: - -- b32enc: Encode a string into a Base32 string -- b32dec: Decode a string from a Base32 string -- b64enc: Encode a string into a Base64 string -- b64dec: Decode a string from a Base64 string - -### Data Structures: - -- tuple: Takes an arbitrary list of items and returns a slice of items. Its - tuple-ish properties are mainly gained through the template idiom, and not - through an API provided here. WARNING: The implementation of tuple will - change in the future. -- list: An arbitrary ordered list of items. (This is prefered over tuple.) -- dict: Takes a list of name/values and returns a map[string]interface{}. - The first parameter is converted to a string and stored as a key, the - second parameter is treated as the value. And so on, with odds as keys and - evens as values. If the function call ends with an odd, the last key will - be assigned the empty string. Non-string keys are converted to strings as - follows: []byte are converted, fmt.Stringers will have String() called. - errors will have Error() called. All others will be passed through - fmt.Sprtinf("%v"). _dicts are unordered_. - -List: - -``` -{{$t := list 1 "a" "foo"}} -{{index $t 2}}{{index $t 0 }}{{index $t 1}} -{{/* Prints foo1a *}} -``` - -Dict: -``` -{{ $t := map "key1" "value1" "key2" "value2" }} -{{ $t.key2 }} -{{ /* Prints value2 *}} -``` - - -### Lists Functions: - -These are used to manipulate lists: `{{ list 1 2 3 | reverse | first }}` - -- first: Get the first item in a 'list'. 'list 1 2 3 | first' prints '1' -- last: Get the last item in a 'list': 'list 1 2 3 | last ' prints '3' -- rest: Get all but the first item in a list: 'list 1 2 3 | rest' returns '[2 3]' -- initial: Get all but the last item in a list: 'list 1 2 3 | initial' returns '[1 2]' -- append: Add an item to the end of a list: 'append $list 4' adds '4' to the end of '$list' -- prepend: Add an item to the beginning of a list: 'prepend $list 4' puts 4 at the beginning of the list. -- reverse: Reverse the items in a list. -- uniq: Remove duplicates from a list. -- without: Return a list with the given values removed: 'without (list 1 2 3) 1' would return '[2 3]' -- has: Return 'tru' if the item is found in the list: 'has "foo" $list' will return 'true' if the list contains "foo" - -### Dict Functions: - -These are used to manipulate dicts. - -- set: Takes a dict, a key, and a value, and sets that key/value pair in - the dict. `set $dict $key $value`. For convenience, it returns the dict, - even though the dict was modified in place. -- unset: Takes a dict and a key, and deletes that key/value pair from the - dict. `unset $dict $key`. This returns the dict for convenience. -- hasKey: Takes a dict and a key, and returns boolean true if the key is in - the dict. -- pluck: Given a key and one or more maps, get all of the values for that key. -- keys: Get an array of all of the keys in a dict. Order is not guaranteed. -- pick: Select just the given keys out of the dict, and return a new dict. -- omit: Return a dict without the given keys. - -### Reflection: - -- typeOf: Takes an interface and returns a string representation of the type. - For pointers, this will return a type prefixed with an asterisk(`*`). So - a pointer to type `Foo` will be `*Foo`. -- typeIs: Compares an interface with a string name, and returns true if they match. - Note that a pointer will not match a reference. For example `*Foo` will not - match `Foo`. -- typeIsLike: returns true if the interface is of the given type, or - is a pointer to the given type. -- kindOf: Takes an interface and returns a string representation of its kind. -- kindIs: Returns true if the given string matches the kind of the given interface. - - Note: None of these can test whether or not something implements a given - interface, since doing so would require compiling the interface in ahead of - time. - - -### Math Functions: - -Integer functions will convert integers of any width to `int64`. If a -string is passed in, functions will attempt to conver with -`strconv.ParseInt(s, 1064)`. If this fails, the value will be treated as 0. - -- add1: Increment an integer by 1 -- add: Sum integers. `add 1 2 3` renders `6` -- sub: Subtract the second integer from the first -- div: Divide the first integer by the second -- mod: Module of first integer divided by second -- mul: Multiply integers integers -- max (biggest): Return the biggest of a series of integers. `max 1 2 3` - returns `3`. -- min: Return the smallest of a series of integers. `min 1 2 3` returns - `1`. - -### Cryptographic Functions: - -- derivePassword: Derive a password from the given parameters according to the "Master Password" algorithm (http://masterpasswordapp.com/algorithm.html) - Given parameters (in order) are: - `counter` (starting with 1), `password_type` (maximum, long, medium, short, basic, or pin), `password`, - `user`, and `site`. The following line generates a long password for the user "user" and with a master-password "password" on the site "example.com": - ``` - {{ derivePassword 1 "long" "password" "user" "example.com" }} - ``` - -## SemVer Functions: - -These functions provide version parsing and comparisons for SemVer 2 version -strings. - -- semver: Parse a semantic version and return a Version object. -- semverCompare: Compare a SemVer range to a particular version. - ## Principles: The following principles were used in deciding on which functions to add, and diff --git a/vendor/github.com/Masterminds/sprig/defaults.go b/vendor/github.com/Masterminds/sprig/defaults.go index 9892f07..a2381d6 100644 --- a/vendor/github.com/Masterminds/sprig/defaults.go +++ b/vendor/github.com/Masterminds/sprig/defaults.go @@ -1,6 +1,7 @@ package sprig import ( + "encoding/json" "reflect" ) @@ -60,3 +61,15 @@ func coalesce(v ...interface{}) interface{} { } return nil } + +// toJson encodes an item into a JSON string +func toJson(v interface{}) string { + output, _ := json.Marshal(v) + return string(output) +} + +// toPrettyJson encodes an item into a pretty (indented) JSON string +func toPrettyJson(v interface{}) string { + output, _ := json.MarshalIndent(v, "", " ") + return string(output) +} diff --git a/vendor/github.com/Masterminds/sprig/defaults_test.go b/vendor/github.com/Masterminds/sprig/defaults_test.go index 6bb48f6..21a8fd9 100644 --- a/vendor/github.com/Masterminds/sprig/defaults_test.go +++ b/vendor/github.com/Masterminds/sprig/defaults_test.go @@ -82,3 +82,26 @@ func TestCoalesce(t *testing.T) { t.Error(err) } } + +func TestToJson(t *testing.T) { + dict := map[string]interface{}{"Top": map[string]interface{}{"bool": true, "string": "test", "number": 42}} + + tpl := `{{.Top | toJson}}` + expected := `{"bool":true,"number":42,"string":"test"}` + if err := runtv(tpl, expected, dict); err != nil { + t.Error(err) + } +} + +func TestToPrettyJson(t *testing.T) { + dict := map[string]interface{}{"Top": map[string]interface{}{"bool": true, "string": "test", "number": 42}} + tpl := `{{.Top | toPrettyJson}}` + expected := `{ + "bool": true, + "number": 42, + "string": "test" +}` + if err := runtv(tpl, expected, dict); err != nil { + t.Error(err) + } +} diff --git a/vendor/github.com/Masterminds/sprig/dict.go b/vendor/github.com/Masterminds/sprig/dict.go index d50e11c..46692d1 100644 --- a/vendor/github.com/Masterminds/sprig/dict.go +++ b/vendor/github.com/Masterminds/sprig/dict.go @@ -1,5 +1,7 @@ package sprig +import "github.com/imdario/mergo" + func set(d map[string]interface{}, key string, value interface{}) map[string]interface{} { d[key] = value return d @@ -72,3 +74,11 @@ func dict(v ...interface{}) map[string]interface{} { } return dict } + +func merge(dst map[string]interface{}, src map[string]interface{}) interface{} { + if err := mergo.Merge(&dst, src); err != nil { + // Swallow errors inside of a template. + return "" + } + return dst +} diff --git a/vendor/github.com/Masterminds/sprig/dict_test.go b/vendor/github.com/Masterminds/sprig/dict_test.go index 2a78647..0206523 100644 --- a/vendor/github.com/Masterminds/sprig/dict_test.go +++ b/vendor/github.com/Masterminds/sprig/dict_test.go @@ -135,3 +135,40 @@ func TestCompact(t *testing.T) { assert.NoError(t, runt(tpl, expect)) } } + +func TestMerge(t *testing.T) { + dict := map[string]interface{}{ + "src": map[string]interface{}{ + "a": 1, + "b": 2, + "d": map[string]interface{}{ + "e": "four", + }, + "g": []int{6, 7}, + }, + "dst": map[string]interface{}{ + "a": "one", + "c": 3, + "d": map[string]interface{}{ + "f": 5, + }, + "g": []int{8, 9}, + }, + } + tpl := `{{merge .dst .src}}` + _, err := runRaw(tpl, dict) + if err != nil { + t.Error(err) + } + expected := map[string]interface{}{ + "a": "one", // key overridden + "b": 2, // merged from src + "c": 3, // merged from dst + "d": map[string]interface{}{ // deep merge + "e": "four", + "f": 5, + }, + "g": []int{8, 9}, // overridden - arrays are not merged + } + assert.Equal(t, expected, dict["dst"]) +} diff --git a/vendor/github.com/Masterminds/sprig/doc.go b/vendor/github.com/Masterminds/sprig/doc.go index 7ecb5e2..0eac8e2 100644 --- a/vendor/github.com/Masterminds/sprig/doc.go +++ b/vendor/github.com/Masterminds/sprig/doc.go @@ -19,7 +19,7 @@ Date Functions - date FORMAT TIME: Format a date, where a date is an integer type or a time.Time type, and format is a time.Format formatting string. - dateModify: Given a date, modify it with a duration: `date_modify "-1.5h" now`. If the duration doesn't - parse, it returns the time unaltered. See `time.ParseDuration` for info on duration strings. + parse, it returns the time unaltered. See `time.ParseDuration` for info on duration strings. - now: Current time.Time, for feeding into date-related functions. - htmlDate TIME: Format a date for use in the value field of an HTML "date" form element. - dateInZone FORMAT TIME TZ: Like date, but takes three arguments: format, timestamp, @@ -68,7 +68,7 @@ String Slice Functions: - split: strings.Split, but as `split SEP STRING`. The results are returned as a map with the indexes set to _N, where N is an integer starting from 0. Use it like this: `{{$v := "foo/bar/baz" | split "/"}}{{$v._0}}` (Prints `foo`) - - splitList: strings.Split, but as `split SEP STRING`. The results are returned + - splitList: strings.Split, but as `split SEP STRING`. The results are returned as an array. - toStrings: convert a list to a list of strings. 'list 1 2 3 | toStrings' produces '["1" "2" "3"]' - sortAlpha: sort a list lexicographically. @@ -114,7 +114,7 @@ File Paths: - base: Return the last element of a path. https://golang.org/pkg/path#Base - dir: Remove the last element of a path. https://golang.org/pkg/path#Dir - clean: Clean a path to the shortest equivalent name. (e.g. remove "foo/.." - from "foo/../bar.html") https://golang.org/pkg/path#Clean + from "foo/../bar.html") https://golang.org/pkg/path#Clean - ext: https://golang.org/pkg/path#Ext - isAbs: https://golang.org/pkg/path#IsAbs diff --git a/vendor/github.com/Masterminds/sprig/docs/dicts.md b/vendor/github.com/Masterminds/sprig/docs/dicts.md index c33140d..fa110c6 100644 --- a/vendor/github.com/Masterminds/sprig/docs/dicts.md +++ b/vendor/github.com/Masterminds/sprig/docs/dicts.md @@ -75,6 +75,15 @@ inserted. A common idiom in Sprig templates is to uses `pluck... | first` to get the first matching key out of a collection of dictionaries. +## merge + +Merge two dictionaries into one, giving precedence to the dest dictionary: + +``` +$newdict := merge $dest $source +``` + +This is a deep merge operation. ## keys diff --git a/vendor/github.com/Masterminds/sprig/docs/flow_control.md b/vendor/github.com/Masterminds/sprig/docs/flow_control.md new file mode 100644 index 0000000..6414640 --- /dev/null +++ b/vendor/github.com/Masterminds/sprig/docs/flow_control.md @@ -0,0 +1,11 @@ +# Flow Control Functions + +## fail + +Unconditionally returns an empty `string` and an `error` with the specified +text. This is useful in scenarios where other conditionals have determined that +template rendering should fail. + +``` +fail "Please accept the end user license agreement" +``` diff --git a/vendor/github.com/Masterminds/sprig/docs/index.md b/vendor/github.com/Masterminds/sprig/docs/index.md index 584b789..0f90da9 100644 --- a/vendor/github.com/Masterminds/sprig/docs/index.md +++ b/vendor/github.com/Masterminds/sprig/docs/index.md @@ -2,21 +2,22 @@ The Sprig library provides over 70 template functions for Go's template language. -- [String Functions](strings.html): `trim`, `wrap`, `randAlpha`, `plural`, etc. - - [String List Functions](string_slice.html): `splitList`, `sortAlpha`, etc. -- [Math Functions](math.html): `add`, `max`, `mul`, etc. - - [Integer Slice Functions](integer_slice.html): `until`, `untilStep` -- [Date Functions](date.html): `now`, `date`, etc. -- [Defaults Functions](defaults.html): `default`, `empty`, `coalesce` -- [Encoding Functions](encoding.html): `b64enc`, `b64dec`, etc. -- [Lists and List Functions](lists.html): `list`, `first`, `uniq`, etc. -- [Dictionaries and Dict Functions](dicts.html): `dict`, `hasKey`, `pluck`, etc. -- [Type Conversion Functions](conversion.html): `atoi`, `int64`, `toString`, etc. -- [File Path Functions](paths.html): `base`, `dir`, `ext`, `clean`, `isAbs` +- [String Functions](strings.md): `trim`, `wrap`, `randAlpha`, `plural`, etc. + - [String List Functions](string_slice.md): `splitList`, `sortAlpha`, etc. +- [Math Functions](math.md): `add`, `max`, `mul`, etc. + - [Integer Slice Functions](integer_slice.md): `until`, `untilStep` +- [Date Functions](date.md): `now`, `date`, etc. +- [Defaults Functions](defaults.md): `default`, `empty`, `coalesce` +- [Encoding Functions](encoding.md): `b64enc`, `b64dec`, etc. +- [Lists and List Functions](lists.md): `list`, `first`, `uniq`, etc. +- [Dictionaries and Dict Functions](dicts.md): `dict`, `hasKey`, `pluck`, etc. +- [Type Conversion Functions](conversion.md): `atoi`, `int64`, `toString`, etc. +- [File Path Functions](paths.md): `base`, `dir`, `ext`, `clean`, `isAbs` +- [Flow Control Functions](flow_control.md): `fail` - Advanced Functions - - [UUID Functions](uuid.html): `uuidv4` - - [OS Functions](os.html): `env`, `expandenv` - - [Version Comparison Functions](semver.html): `semver`, `semverCompare` - - [Reflection](reflection.html): `typeOf`, `kindIs`, `typeIsLike`, etc. - - [Cryptographic and Security Functions](crypto.html): `derivePassword`, `sha256sum`, `genPrivateKey` + - [UUID Functions](uuid.md): `uuidv4` + - [OS Functions](os.md): `env`, `expandenv` + - [Version Comparison Functions](semver.md): `semver`, `semverCompare` + - [Reflection](reflection.md): `typeOf`, `kindIs`, `typeIsLike`, etc. + - [Cryptographic and Security Functions](crypto.md): `derivePassword`, `sha256sum`, `genPrivateKey` diff --git a/vendor/github.com/Masterminds/sprig/docs/strings.md b/vendor/github.com/Masterminds/sprig/docs/strings.md index 3776f01..09cf758 100644 --- a/vendor/github.com/Masterminds/sprig/docs/strings.md +++ b/vendor/github.com/Masterminds/sprig/docs/strings.md @@ -278,6 +278,43 @@ rules. And `0` is considered a plural because the English language treats it as such (`zero anchovies`). The Sprig developers are working on a solution for better internationalization. +## snakecase + +Convert string from camelCase to snake_case. + +Introduced in 2.12.0. + +``` +snakecase "FirstName" +``` + +This above will produce `first_name`. + +## camelcase + +Convert string from snake_case to CamelCase + +Introduced in 2.12.0. + +``` +camelcase "http_server" +``` + +This above will produce `HttpServer`. + +## shuffle + +Shuffle a string. + +Introduced in 2.12.0. + + +``` +shuffle "hello" +``` + +The above will randomize the letters in `hello`, perhaps producing `oelhl`. + ## See Also... The [Conversion Functions](conversion.html) contain functions for converting diff --git a/vendor/github.com/Masterminds/sprig/flow_control_test.go b/vendor/github.com/Masterminds/sprig/flow_control_test.go new file mode 100644 index 0000000..d4e5ebf --- /dev/null +++ b/vendor/github.com/Masterminds/sprig/flow_control_test.go @@ -0,0 +1,16 @@ +package sprig + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestFail(t *testing.T) { + const msg = "This is an error!" + tpl := fmt.Sprintf(`{{fail "%s"}}`, msg) + _, err := runRaw(tpl, nil) + assert.Error(t, err) + assert.Contains(t, err.Error(), msg) +} diff --git a/vendor/github.com/Masterminds/sprig/functions.go b/vendor/github.com/Masterminds/sprig/functions.go index be10836..e7b3068 100644 --- a/vendor/github.com/Masterminds/sprig/functions.go +++ b/vendor/github.com/Masterminds/sprig/functions.go @@ -1,6 +1,7 @@ package sprig import ( + "errors" "html/template" "os" "path" @@ -10,6 +11,7 @@ import ( "time" util "github.com/aokoli/goutils" + "github.com/huandu/xstrings" ) // Produce the function map. @@ -122,6 +124,9 @@ var genericMap = map[string]interface{}{ "randAscii": randAscii, "randNumeric": randNumeric, "swapcase": util.SwapCase, + "shuffle": xstrings.Shuffle, + "snakecase": xstrings.ToSnakeCase, + "camelcase": xstrings.ToCamelCase, "wrap": func(l int, s string) string { return util.Wrap(s, l) }, "wrapWith": func(l int, sep, str string) string { return util.WrapCustom(str, l, sep, true) }, // Switch order so that "foobar" | contains "foo" @@ -185,10 +190,12 @@ var genericMap = map[string]interface{}{ "sortAlpha": sortAlpha, // Defaults - "default": dfault, - "empty": empty, - "coalesce": coalesce, - "compact": compact, + "default": dfault, + "empty": empty, + "coalesce": coalesce, + "compact": compact, + "toJson": toJson, + "toPrettyJson": toPrettyJson, // Reflection "typeOf": typeOf, @@ -225,6 +232,7 @@ var genericMap = map[string]interface{}{ "keys": keys, "pick": pick, "omit": omit, + "merge": merge, "append": push, "push": push, "prepend": prepend, @@ -247,4 +255,7 @@ var genericMap = map[string]interface{}{ // SemVer: "semver": semver, "semverCompare": semverCompare, + + // Flow Control: + "fail": func(msg string) (string, error) { return "", errors.New(msg) }, } diff --git a/vendor/github.com/Masterminds/sprig/functions_test.go b/vendor/github.com/Masterminds/sprig/functions_test.go index 499d488..edf88a3 100644 --- a/vendor/github.com/Masterminds/sprig/functions_test.go +++ b/vendor/github.com/Masterminds/sprig/functions_test.go @@ -3,10 +3,12 @@ package sprig import ( "bytes" "fmt" + "math/rand" "os" "testing" "text/template" + "github.com/aokoli/goutils" "github.com/stretchr/testify/assert" ) @@ -47,6 +49,30 @@ func TestExt(t *testing.T) { assert.NoError(t, runt(`{{ ext "/foo/bar/baz.txt" }}`, ".txt")) } +func TestSnakeCase(t *testing.T) { + assert.NoError(t, runt(`{{ snakecase "FirstName" }}`, "first_name")) + assert.NoError(t, runt(`{{ snakecase "HTTPServer" }}`, "http_server")) + assert.NoError(t, runt(`{{ snakecase "NoHTTPS" }}`, "no_https")) + assert.NoError(t, runt(`{{ snakecase "GO_PATH" }}`, "go_path")) + assert.NoError(t, runt(`{{ snakecase "GO PATH" }}`, "go_path")) + assert.NoError(t, runt(`{{ snakecase "GO-PATH" }}`, "go_path")) +} + +func TestCamelCase(t *testing.T) { + assert.NoError(t, runt(`{{ camelcase "http_server" }}`, "HttpServer")) + assert.NoError(t, runt(`{{ camelcase "_camel_case" }}`, "_CamelCase")) + assert.NoError(t, runt(`{{ camelcase "no_https" }}`, "NoHttps")) + assert.NoError(t, runt(`{{ camelcase "_complex__case_" }}`, "_Complex_Case_")) + assert.NoError(t, runt(`{{ camelcase "all" }}`, "All")) +} + +func TestShuffle(t *testing.T) { + goutils.RANDOM = rand.New(rand.NewSource(1)) + // Because we're using a random number generator, we need these to go in + // a predictable sequence: + assert.NoError(t, runt(`{{ shuffle "Hello World" }}`, "rldo HWlloe")) +} + // runt runs a template and checks that the output exactly matches the expected string. func runt(tpl, expect string) error { return runtv(tpl, expect, map[string]string{}) diff --git a/vendor/github.com/Masterminds/sprig/glide.lock b/vendor/github.com/Masterminds/sprig/glide.lock index 209cefc..faf04f9 100644 --- a/vendor/github.com/Masterminds/sprig/glide.lock +++ b/vendor/github.com/Masterminds/sprig/glide.lock @@ -1,14 +1,24 @@ -hash: c2d7cb87ff32a0aba767b90bff630c3e4c1ca9904fc72568414d20d79a41e70f -updated: 2017-03-13T18:38:30.597881175-06:00 +hash: b9cc40bfd6dde74a94103b96700df1a9ab29a7fff5650216cf5a05f4fe72fb73 +updated: 2017-05-02T16:01:04.617727646-06:00 imports: - name: github.com/aokoli/goutils version: 9c37978a95bd5c709a15883b6242714ea6709e64 +- name: github.com/huandu/xstrings + version: 3959339b333561bf62a38b424fd41517c2c90f40 +- name: github.com/imdario/mergo + version: 3e95a51e0639b4cf372f2ccf74c86749d747fbdc +- name: github.com/Masterminds/goutils + version: 45307ec16e3cd47cd841506c081f7afd8237d210 - name: github.com/Masterminds/semver version: 59c29afe1a994eacb71c833025ca7acf874bb1da - name: github.com/satori/go.uuid version: 879c5887cd475cd7864858769793b2ceb0d44feb +- name: github.com/stretchr/testify + version: e3a8ff8ce36581f87a15341206f205b1da467059 + subpackages: + - assert - name: golang.org/x/crypto - version: 1f22c0103821b9390939b6776727195525381532 + version: d172538b2cfce0c13cee31e647d0367aa8cd2486 subpackages: - pbkdf2 - scrypt @@ -21,7 +31,3 @@ testImports: version: d8ed2627bdf02c080bf22230dbb337003b7aba2d subpackages: - difflib -- name: github.com/stretchr/testify - version: e3a8ff8ce36581f87a15341206f205b1da467059 - subpackages: - - assert diff --git a/vendor/github.com/Masterminds/sprig/glide.yaml b/vendor/github.com/Masterminds/sprig/glide.yaml index b6c8b61..5e82dcf 100644 --- a/vendor/github.com/Masterminds/sprig/glide.yaml +++ b/vendor/github.com/Masterminds/sprig/glide.yaml @@ -1,6 +1,7 @@ package: github.com/Masterminds/sprig import: -- package: github.com/aokoli/goutils +- package: github.com/Masterminds/goutils + version: ^1.0.0 - package: github.com/satori/go.uuid version: ^1.1.0 - package: golang.org/x/crypto @@ -8,3 +9,7 @@ import: - scrypt - package: github.com/Masterminds/semver version: v1.2.2 +- package: github.com/stretchr/testify +- package: github.com/imdario/mergo + version: ~0.2.2 +- package: github.com/huandu/xstrings diff --git a/vendor/github.com/aokoli/goutils/.travis.yml b/vendor/github.com/aokoli/goutils/.travis.yml new file mode 100644 index 0000000..4025e01 --- /dev/null +++ b/vendor/github.com/aokoli/goutils/.travis.yml @@ -0,0 +1,18 @@ +language: go + +go: + - 1.6 + - 1.7 + - 1.8 + - tip + +script: + - go test -v + +notifications: + webhooks: + urls: + - https://webhooks.gitter.im/e/06e3328629952dabe3e0 + on_success: change # options: [always|never|change] default: always + on_failure: always # options: [always|never|change] default: always + on_start: never # options: [always|never|change] default: always diff --git a/vendor/github.com/aokoli/goutils/README.md b/vendor/github.com/aokoli/goutils/README.md index 9d8a42d..163ffe7 100644 --- a/vendor/github.com/aokoli/goutils/README.md +++ b/vendor/github.com/aokoli/goutils/README.md @@ -1,7 +1,10 @@ GoUtils =========== +[![Stability: Maintenance](https://masterminds.github.io/stability/maintenance.svg)](https://masterminds.github.io/stability/maintenance.html) +[![GoDoc](https://godoc.org/github.com/Masterminds/goutils?status.png)](https://godoc.org/github.com/Masterminds/goutils) [![Build Status](https://travis-ci.org/Masterminds/goutils.svg?branch=master)](https://travis-ci.org/Masterminds/goutils) [![Build status](https://ci.appveyor.com/api/projects/status/sc2b1ew0m7f0aiju?svg=true)](https://ci.appveyor.com/project/mattfarina/goutils) -GoUtils provides users with utility functions to manipulate strings in various ways. It is a Go implementation of some + +GoUtils provides users with utility functions to manipulate strings in various ways. It is a Go implementation of some string manipulation libraries of Java Apache Commons. GoUtils includes the following Java Apache Commons classes: * WordUtils * RandomStringUtils @@ -10,25 +13,25 @@ string manipulation libraries of Java Apache Commons. GoUtils includes the follo ## Installation If you have Go set up on your system, from the GOPATH directory within the command line/terminal, enter this: - go get github.com/aokoli/goutils - + go get github.com/Masterminds/goutils + If you do not have Go set up on your system, please follow the [Go installation directions from the documenation](http://golang.org/doc/install), and then follow the instructions above to install GoUtils. -## Documentation -GoUtils doc is available here: [![GoDoc](https://godoc.org/github.com/aokoli/goutils?status.png)](https://godoc.org/github.com/aokoli/goutils) +## Documentation +GoUtils doc is available here: [![GoDoc](https://godoc.org/github.com/Masterminds/goutils?status.png)](https://godoc.org/github.com/Masterminds/goutils) ## Usage The code snippets below show examples of how to use GoUtils. Some functions return errors while others do not. The first instance below, which does not return an error, is the `Initials` function (located within the `wordutils.go` file). package main - + import ( "fmt" - "github.com/aokoli/goutils" + "github.com/Masterminds/goutils" ) - + func main() { // EXAMPLE 1: A goutils function which returns no errors @@ -38,35 +41,30 @@ The code snippets below show examples of how to use GoUtils. Some functions retu Some functions return errors mainly due to illegal arguements used as parameters. The code example below illustrates how to deal with function that returns an error. In this instance, the function is the `Random` function (located within the `randomstringutils.go` file). package main - + import ( "fmt" - "github.com/aokoli/goutils" + "github.com/Masterminds/goutils" ) - + func main() { // EXAMPLE 2: A goutils function which returns an error rand1, err1 := goutils.Random (-1, 0, 0, true, true) - if err1 != nil { + if err1 != nil { fmt.Println(err1) // Prints out error message because -1 was entered as the first parameter in goutils.Random(...) } else { - fmt.Println(rand1) + fmt.Println(rand1) } } ## License -GoUtils is licensed under the Apache License, Version 2.0. Please check the LICENSE.txt file or visit http://www.apache.org/licenses/LICENSE-2.0 for a copy of the license. +GoUtils is licensed under the Apache License, Version 2.0. Please check the LICENSE.txt file or visit http://www.apache.org/licenses/LICENSE-2.0 for a copy of the license. ## Issue Reporting -Make suggestions or report issues using the Git issue tracker: https://github.com/aokoli/goutils/issues +Make suggestions or report issues using the Git issue tracker: https://github.com/Masterminds/goutils/issues ## Website -* [GoUtils webpage](http://aokoli.github.io/goutils/) - -## Mailing List -Contact [okolialex@gmail.com](mailto:okolialex@mail.com) to be added to the mailing list. You will get updates on the -status of the project and the potential direction it will be heading. - +* [GoUtils webpage](http://Masterminds.github.io/goutils/) diff --git a/vendor/github.com/aokoli/goutils/appveyor.yml b/vendor/github.com/aokoli/goutils/appveyor.yml new file mode 100644 index 0000000..657564a --- /dev/null +++ b/vendor/github.com/aokoli/goutils/appveyor.yml @@ -0,0 +1,21 @@ +version: build-{build}.{branch} + +clone_folder: C:\gopath\src\github.com\Masterminds\goutils +shallow_clone: true + +environment: + GOPATH: C:\gopath + +platform: + - x64 + +build: off + +install: + - go version + - go env + +test_script: + - go test -v + +deploy: off diff --git a/vendor/github.com/aokoli/goutils/randomstringutils.go b/vendor/github.com/aokoli/goutils/randomstringutils.go index db395a0..eff2e7d 100644 --- a/vendor/github.com/aokoli/goutils/randomstringutils.go +++ b/vendor/github.com/aokoli/goutils/randomstringutils.go @@ -16,18 +16,16 @@ limitations under the License. package goutils - import ( "fmt" - "unicode" "math" "math/rand" "time" + "unicode" ) - -// Provides the time-based seed used to generate random #s -var RANDOM = rand.New(rand.NewSource(time.Now().UnixNano())) +// RANDOM provides the time-based seed used to generate random numbers +var RANDOM = rand.New(rand.NewSource(time.Now().UnixNano())) /* RandomNonAlphaNumeric creates a random string whose length is the number of characters specified. @@ -40,11 +38,10 @@ Returns: string - the random string error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) */ -func RandomNonAlphaNumeric (count int) (string, error) { - return RandomAlphaNumericCustom(count, false, false) +func RandomNonAlphaNumeric(count int) (string, error) { + return RandomAlphaNumericCustom(count, false, false) } - /* RandomAscii creates a random string whose length is the number of characters specified. Characters will be chosen from the set of characters whose ASCII value is between 32 and 126 (inclusive). @@ -57,10 +54,9 @@ Returns: error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) */ func RandomAscii(count int) (string, error) { - return Random(count, 32, 127, false, false) + return Random(count, 32, 127, false, false) } - /* RandomNumeric creates a random string whose length is the number of characters specified. Characters will be chosen from the set of numeric characters. @@ -72,11 +68,10 @@ Returns: string - the random string error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) */ -func RandomNumeric (count int) (string, error) { - return Random(count, 0, 0, false, true) +func RandomNumeric(count int) (string, error) { + return Random(count, 0, 0, false, true) } - /* RandomAlphabetic creates a random string whose length is the number of characters specified. Characters will be chosen from the set of alpha-numeric characters as indicated by the arguments. @@ -90,11 +85,10 @@ Returns: string - the random string error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) */ -func RandomAlphabetic (count int) (string, error) { - return Random(count, 0, 0, true, false) +func RandomAlphabetic(count int) (string, error) { + return Random(count, 0, 0, true, false) } - /* RandomAlphaNumeric creates a random string whose length is the number of characters specified. Characters will be chosen from the set of alpha-numeric characters. @@ -106,8 +100,8 @@ Returns: string - the random string error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) */ -func RandomAlphaNumeric (count int) (string, error) { - return Random(count, 0, 0, true, true) +func RandomAlphaNumeric(count int) (string, error) { + return Random(count, 0, 0, true, true) } /* @@ -121,16 +115,15 @@ Parameters: Returns: string - the random string - error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) + error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) */ -func RandomAlphaNumericCustom (count int, letters bool, numbers bool) (string, error) { - return Random(count, 0, 0, letters, numbers) +func RandomAlphaNumericCustom(count int, letters bool, numbers bool) (string, error) { + return Random(count, 0, 0, letters, numbers) } - /* Random creates a random string based on a variety of options, using default source of randomness. -This method has exactly the same semantics as RandomSeed(int, int, int, bool, bool, []char, *rand.Rand), but +This method has exactly the same semantics as RandomSeed(int, int, int, bool, bool, []char, *rand.Rand), but instead of using an externally supplied source of randomness, it uses the internal *rand.Rand instance. Parameters: @@ -143,17 +136,16 @@ Parameters: Returns: string - the random string - error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) + error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) */ -func Random (count int, start int, end int, letters bool, numbers bool, chars ...rune) (string, error) { - return RandomSeed (count, start, end, letters, numbers, chars, RANDOM) +func Random(count int, start int, end int, letters bool, numbers bool, chars ...rune) (string, error) { + return RandomSeed(count, start, end, letters, numbers, chars, RANDOM) } - /* RandomSeed creates a random string based on a variety of options, using supplied source of randomness. -If the parameters start and end are both 0, start and end are set to ' ' and 'z', the ASCII printable characters, will be used, -unless letters and numbers are both false, in which case, start and end are set to 0 and math.MaxInt32, respectively. +If the parameters start and end are both 0, start and end are set to ' ' and 'z', the ASCII printable characters, will be used, +unless letters and numbers are both false, in which case, start and end are set to 0 and math.MaxInt32, respectively. If chars is not nil, characters stored in chars that are between start and end are chosen. This method accepts a user-supplied *rand.Rand instance to use as a source of randomness. By seeding a single *rand.Rand instance with a fixed seed and using it for each call, the same random sequence of strings can be generated repeatedly and predictably. @@ -169,91 +161,90 @@ Parameters: Returns: string - the random string - error - an error stemming from invalid parameters: if count < 0; or the provided chars array is empty; or end <= start; or end > len(chars) + error - an error stemming from invalid parameters: if count < 0; or the provided chars array is empty; or end <= start; or end > len(chars) */ -func RandomSeed (count int, start int, end int, letters bool, numbers bool, chars []rune, random *rand.Rand) (string, error) { +func RandomSeed(count int, start int, end int, letters bool, numbers bool, chars []rune, random *rand.Rand) (string, error) { - if count == 0 { - return "", nil - } else if count < 0 { - err := fmt.Errorf("randomstringutils illegal argument: Requested random string length %v is less than 0.", count) // equiv to err := errors.New("...") - return "", err - } - if chars != nil && len(chars) == 0 { - err := fmt.Errorf("randomstringutils illegal argument: The chars array must not be empty") - return "", err - } + if count == 0 { + return "", nil + } else if count < 0 { + err := fmt.Errorf("randomstringutils illegal argument: Requested random string length %v is less than 0.", count) // equiv to err := errors.New("...") + return "", err + } + if chars != nil && len(chars) == 0 { + err := fmt.Errorf("randomstringutils illegal argument: The chars array must not be empty") + return "", err + } - if start == 0 && end == 0 { - if chars != nil { - end = len(chars) - } else { - if !letters && !numbers { - end = math.MaxInt32 - } else { - end = 'z' + 1 - start = ' ' - } - } - } else { - if end <= start { - err := fmt.Errorf("randomstringutils illegal argument: Parameter end (%v) must be greater than start (%v)", end, start) - return "", err - } + if start == 0 && end == 0 { + if chars != nil { + end = len(chars) + } else { + if !letters && !numbers { + end = math.MaxInt32 + } else { + end = 'z' + 1 + start = ' ' + } + } + } else { + if end <= start { + err := fmt.Errorf("randomstringutils illegal argument: Parameter end (%v) must be greater than start (%v)", end, start) + return "", err + } - if chars != nil && end > len(chars) { - err := fmt.Errorf("randomstringutils illegal argument: Parameter end (%v) cannot be greater than len(chars) (%v)", end, len(chars)) - return "", err - } - } + if chars != nil && end > len(chars) { + err := fmt.Errorf("randomstringutils illegal argument: Parameter end (%v) cannot be greater than len(chars) (%v)", end, len(chars)) + return "", err + } + } - buffer := make([]rune, count) - gap := end - start + buffer := make([]rune, count) + gap := end - start + // high-surrogates range, (\uD800-\uDBFF) = 55296 - 56319 + // low-surrogates range, (\uDC00-\uDFFF) = 56320 - 57343 - // high-surrogates range, (\uD800-\uDBFF) = 55296 - 56319 - // low-surrogates range, (\uDC00-\uDFFF) = 56320 - 57343 + for count != 0 { + count-- + var ch rune + if chars == nil { + ch = rune(random.Intn(gap) + start) + } else { + ch = chars[random.Intn(gap)+start] + } - for count != 0 { - count-- - var ch rune - if chars == nil { - ch = rune(random.Intn(gap) + start) - } else { - ch = chars[random.Intn(gap) + start] - } - - if letters && unicode.IsLetter(ch) || numbers && unicode.IsDigit(ch) || !letters && !numbers { - if ch >= 56320 && ch <= 57343 { // low surrogate range - if count == 0 { - count++ - } else { - // Insert low surrogate - buffer[count] = ch - count-- - // Insert high surrogate - buffer[count] = rune(55296 + random.Intn(128)) - } - } else if ch >= 55296 && ch <= 56191 { // High surrogates range (Partial) - if count == 0 { - count++ - } else { - // Insert low surrogate - buffer[count] = rune(56320 + random.Intn(128)) - count-- - // Insert high surrogate - buffer[count] = ch - } - } else if ch >= 56192 && ch <= 56319 { - // private high surrogate, skip it - count++ - } else { - // not one of the surrogates* - buffer[count] = ch - } - } else { - count++ - } - } - return string(buffer), nil + if letters && unicode.IsLetter(ch) || numbers && unicode.IsDigit(ch) || !letters && !numbers { + if ch >= 56320 && ch <= 57343 { // low surrogate range + if count == 0 { + count++ + } else { + // Insert low surrogate + buffer[count] = ch + count-- + // Insert high surrogate + buffer[count] = rune(55296 + random.Intn(128)) + } + } else if ch >= 55296 && ch <= 56191 { // High surrogates range (Partial) + if count == 0 { + count++ + } else { + // Insert low surrogate + buffer[count] = rune(56320 + random.Intn(128)) + count-- + // Insert high surrogate + buffer[count] = ch + } + } else if ch >= 56192 && ch <= 56319 { + // private high surrogate, skip it + count++ + } else { + // not one of the surrogates* + buffer[count] = ch + } + } else { + count++ + } + } + return string(buffer), nil } diff --git a/vendor/github.com/aokoli/goutils/randomstringutils_test.go b/vendor/github.com/aokoli/goutils/randomstringutils_test.go index dba45e9..b990654 100644 --- a/vendor/github.com/aokoli/goutils/randomstringutils_test.go +++ b/vendor/github.com/aokoli/goutils/randomstringutils_test.go @@ -1,92 +1,75 @@ - - - - - - - - - - package goutils import ( -"testing" -"fmt" -"math/rand" + "fmt" + "math/rand" + "testing" ) // ****************************** TESTS ******************************************** func TestRandomSeed(t *testing.T) { - - // count, start, end, letters, numbers := 5, 0, 0, true, true random := rand.New(rand.NewSource(10)) out := "3ip9v" // Test 1: Simulating RandomAlphaNumeric(count int) - if x, _ := RandomSeed (5, 0, 0, true, true, nil, random); x != out { + if x, _ := RandomSeed(5, 0, 0, true, true, nil, random); x != out { t.Errorf("RandomSeed(%v, %v, %v, %v, %v, %v, %v) = %v, want %v", 5, 0, 0, true, true, nil, random, x, out) } // Test 2: Simulating RandomAlphabetic(count int) out = "MBrbj" - if x, _ := RandomSeed (5, 0, 0, true, false, nil, random); x != out { + if x, _ := RandomSeed(5, 0, 0, true, false, nil, random); x != out { t.Errorf("RandomSeed(%v, %v, %v, %v, %v, %v, %v) = %v, want %v", 5, 0, 0, true, false, nil, random, x, out) } - // Test 3: Simulating RandomNumeric(count int) out = "88935" - if x, _ := RandomSeed (5, 0, 0, false, true, nil, random); x != out { + if x, _ := RandomSeed(5, 0, 0, false, true, nil, random); x != out { t.Errorf("RandomSeed(%v, %v, %v, %v, %v, %v, %v) = %v, want %v", 5, 0, 0, false, true, nil, random, x, out) } - // Test 4: Simulating RandomAscii(count int) out = "H_I;E" - if x, _ := RandomSeed (5, 32, 127, false, false, nil, random); x != out { + if x, _ := RandomSeed(5, 32, 127, false, false, nil, random); x != out { t.Errorf("RandomSeed(%v, %v, %v, %v, %v, %v, %v) = %v, want %v", 5, 32, 127, false, false, nil, random, x, out) } - // Test 5: Simulating RandomSeed(...) with custom chars - chars := []rune {'1','2','3','a','b','c'} + chars := []rune{'1', '2', '3', 'a', 'b', 'c'} out = "2b2ca" - if x, _ := RandomSeed (5, 0, 0, false, false, chars, random); x != out { + if x, _ := RandomSeed(5, 0, 0, false, false, chars, random); x != out { t.Errorf("RandomSeed(%v, %v, %v, %v, %v, %v, %v) = %v, want %v", 5, 0, 0, false, false, chars, random, x, out) } } - // ****************************** EXAMPLES ******************************************** - func ExampleRandomSeed() { - var seed int64 = 10 // If you change this seed #, the random sequence below will change - random := rand.New(rand.NewSource(seed)) - chars := []rune {'1','2','3','a','b','c'} + var seed int64 = 10 // If you change this seed #, the random sequence below will change + random := rand.New(rand.NewSource(seed)) + chars := []rune{'1', '2', '3', 'a', 'b', 'c'} - rand1, _ := RandomSeed (5, 0, 0, true, true, nil, random) // RandomAlphaNumeric (Alphabets and numbers possible) - rand2, _ := RandomSeed (5, 0, 0, true, false, nil, random) // RandomAlphabetic (Only alphabets) - rand3, _ := RandomSeed (5, 0, 0, false, true, nil, random) // RandomNumeric (Only numbers) - rand4, _ := RandomSeed (5, 32, 127, false, false, nil, random) // RandomAscii (Alphabets, numbers, and other ASCII chars) - rand5, _ := RandomSeed (5, 0, 0, true, true, chars, random) // RandomSeed with custom characters + rand1, _ := RandomSeed(5, 0, 0, true, true, nil, random) // RandomAlphaNumeric (Alphabets and numbers possible) + rand2, _ := RandomSeed(5, 0, 0, true, false, nil, random) // RandomAlphabetic (Only alphabets) + rand3, _ := RandomSeed(5, 0, 0, false, true, nil, random) // RandomNumeric (Only numbers) + rand4, _ := RandomSeed(5, 32, 127, false, false, nil, random) // RandomAscii (Alphabets, numbers, and other ASCII chars) + rand5, _ := RandomSeed(5, 0, 0, true, true, chars, random) // RandomSeed with custom characters fmt.Println(rand1) fmt.Println(rand2) fmt.Println(rand3) fmt.Println(rand4) fmt.Println(rand5) - // Output: + // Output: // 3ip9v // MBrbj // 88935 diff --git a/vendor/github.com/aokoli/goutils/stringutils.go b/vendor/github.com/aokoli/goutils/stringutils.go index 6a956f2..5037c45 100644 --- a/vendor/github.com/aokoli/goutils/stringutils.go +++ b/vendor/github.com/aokoli/goutils/stringutils.go @@ -16,27 +16,25 @@ limitations under the License. package goutils - import ( - "fmt" - "unicode" "bytes" + "fmt" "strings" + "unicode" ) // Typically returned by functions where a searched item cannot be found -const INDEX_NOT_FOUND = -1 - +const INDEX_NOT_FOUND = -1 /* Abbreviate abbreviates a string using ellipses. This will turn the string "Now is the time for all good men" into "Now is the time for..." -Specifically, the algorithm is as follows: +Specifically, the algorithm is as follows: - - If str is less than maxWidth characters long, return it. - - Else abbreviate it to (str[0:maxWidth - 3] + "..."). - - If maxWidth is less than 4, return an illegal argument error. - - In no case will it return a string of length greater than maxWidth. + - If str is less than maxWidth characters long, return it. + - Else abbreviate it to (str[0:maxWidth - 3] + "..."). + - If maxWidth is less than 4, return an illegal argument error. + - In no case will it return a string of length greater than maxWidth. Parameters: str - the string to check @@ -46,15 +44,14 @@ Returns: string - abbreviated string error - if the width is too small */ -func Abbreviate (str string, maxWidth int) (string, error) { +func Abbreviate(str string, maxWidth int) (string, error) { return AbbreviateFull(str, 0, maxWidth) } - /* AbbreviateFull abbreviates a string using ellipses. This will turn the string "Now is the time for all good men" into "...is the time for..." -This function works like Abbreviate(string, int), but allows you to specify a "left edge" offset. Note that this left edge is not -necessarily going to be the leftmost character in the result, or the first character following the ellipses, but it will appear +This function works like Abbreviate(string, int), but allows you to specify a "left edge" offset. Note that this left edge is not +necessarily going to be the leftmost character in the result, or the first character following the ellipses, but it will appear somewhere in the result. In no case will it return a string of length greater than maxWidth. @@ -67,39 +64,38 @@ Returns: string - abbreviated string error - if the width is too small */ -func AbbreviateFull (str string, offset int, maxWidth int) (string, error) { - if str == "" { - return "", nil - } - if maxWidth < 4 { - err := fmt.Errorf("stringutils illegal argument: Minimum abbreviation width is 4") - return "", err - } - if len(str) <= maxWidth { - return str, nil - } - if offset > len(str) { - offset = len(str) - } - if len(str) - offset < (maxWidth - 3) { // 15 - 5 < 10 - 3 = 10 < 7 - offset = len(str) - (maxWidth - 3) - } - abrevMarker := "..." - if offset <= 4 { - return str[0:maxWidth - 3] + abrevMarker, nil// str.substring(0, maxWidth - 3) + abrevMarker; - } - if maxWidth < 7 { - err := fmt.Errorf("stringutils illegal argument: Minimum abbreviation width with offset is 7") - return "", err - } - if (offset + maxWidth - 3) < len(str) { // 5 + (10-3) < 15 = 12 < 15 - abrevStr, _ := Abbreviate(str[offset:len(str)], (maxWidth - 3)) - return abrevMarker + abrevStr, nil// abrevMarker + abbreviate(str.substring(offset), maxWidth - 3); - } - return abrevMarker + str[(len(str) - (maxWidth - 3)):len(str)], nil // abrevMarker + str.substring(str.length() - (maxWidth - 3)); +func AbbreviateFull(str string, offset int, maxWidth int) (string, error) { + if str == "" { + return "", nil + } + if maxWidth < 4 { + err := fmt.Errorf("stringutils illegal argument: Minimum abbreviation width is 4") + return "", err + } + if len(str) <= maxWidth { + return str, nil + } + if offset > len(str) { + offset = len(str) + } + if len(str)-offset < (maxWidth - 3) { // 15 - 5 < 10 - 3 = 10 < 7 + offset = len(str) - (maxWidth - 3) + } + abrevMarker := "..." + if offset <= 4 { + return str[0:maxWidth-3] + abrevMarker, nil // str.substring(0, maxWidth - 3) + abrevMarker; + } + if maxWidth < 7 { + err := fmt.Errorf("stringutils illegal argument: Minimum abbreviation width with offset is 7") + return "", err + } + if (offset + maxWidth - 3) < len(str) { // 5 + (10-3) < 15 = 12 < 15 + abrevStr, _ := Abbreviate(str[offset:len(str)], (maxWidth - 3)) + return abrevMarker + abrevStr, nil // abrevMarker + abbreviate(str.substring(offset), maxWidth - 3); + } + return abrevMarker + str[(len(str)-(maxWidth-3)):len(str)], nil // abrevMarker + str.substring(str.length() - (maxWidth - 3)); } - /* DeleteWhiteSpace deletes all whitespaces from a string as defined by unicode.IsSpace(rune). It returns the string without whitespaces. @@ -111,26 +107,25 @@ Returns: the string without whitespaces */ func DeleteWhiteSpace(str string) string { - if str == "" { - return str - } - sz := len(str) - var chs bytes.Buffer - count := 0 - for i := 0; i < sz; i++ { - ch := rune(str[i]) - if !unicode.IsSpace(ch) { - chs.WriteRune(ch) - count++ - } - } - if count == sz { - return str - } - return chs.String() + if str == "" { + return str + } + sz := len(str) + var chs bytes.Buffer + count := 0 + for i := 0; i < sz; i++ { + ch := rune(str[i]) + if !unicode.IsSpace(ch) { + chs.WriteRune(ch) + count++ + } + } + if count == sz { + return str + } + return chs.String() } - /* IndexOfDifference compares two strings, and returns the index at which the strings begin to differ. @@ -142,26 +137,24 @@ Returns: the index where str1 and str2 begin to differ; -1 if they are equal */ func IndexOfDifference(str1 string, str2 string) int { - if str1 == str2 { - return INDEX_NOT_FOUND - } - if IsEmpty(str1) || IsEmpty(str2) { - return 0 - } - var i int; - for i = 0; i < len(str1) && i < len(str2); i++ { - if rune(str1[i]) != rune(str2[i]) { - break - } - } - if i < len(str2) || i < len(str1) { - return i - } - return INDEX_NOT_FOUND + if str1 == str2 { + return INDEX_NOT_FOUND + } + if IsEmpty(str1) || IsEmpty(str2) { + return 0 + } + var i int + for i = 0; i < len(str1) && i < len(str2); i++ { + if rune(str1[i]) != rune(str2[i]) { + break + } + } + if i < len(str2) || i < len(str1) { + return i + } + return INDEX_NOT_FOUND } - - /* IsBlank checks if a string is whitespace or empty (""). Observe the following behavior: @@ -169,7 +162,7 @@ IsBlank checks if a string is whitespace or empty (""). Observe the following be goutils.IsBlank(" ") = true goutils.IsBlank("bob") = false goutils.IsBlank(" bob ") = false - + Parameter: str - the string to check @@ -177,24 +170,23 @@ Returns: true - if the string is whitespace or empty ("") */ func IsBlank(str string) bool { - strLen := len(str) - if str == "" || strLen == 0 { - return true - } - for i := 0; i < strLen; i++ { - if unicode.IsSpace(rune(str[i])) == false { - return false - } - } - return true + strLen := len(str) + if str == "" || strLen == 0 { + return true + } + for i := 0; i < strLen; i++ { + if unicode.IsSpace(rune(str[i])) == false { + return false + } + } + return true } - -/* -IndexOf returns the index of the first instance of sub in str, with the search beginning from the +/* +IndexOf returns the index of the first instance of sub in str, with the search beginning from the index start point specified. -1 is returned if sub is not present in str. -An empty string ("") will return -1 (INDEX_NOT_FOUND). A negative start position is treated as zero. +An empty string ("") will return -1 (INDEX_NOT_FOUND). A negative start position is treated as zero. A start position greater than the string length returns -1. Parameters: @@ -207,26 +199,26 @@ Returns: */ func IndexOf(str string, sub string, start int) int { - if (start < 0) { - start = 0 - } + if start < 0 { + start = 0 + } - if len(str) < start { - return INDEX_NOT_FOUND - } + if len(str) < start { + return INDEX_NOT_FOUND + } - if IsEmpty(str) || IsEmpty(sub) { - return INDEX_NOT_FOUND - } + if IsEmpty(str) || IsEmpty(sub) { + return INDEX_NOT_FOUND + } - partialIndex := strings.Index(str[start:len(str)], sub) - if partialIndex == -1 { - return INDEX_NOT_FOUND - } - return partialIndex + start + partialIndex := strings.Index(str[start:len(str)], sub) + if partialIndex == -1 { + return INDEX_NOT_FOUND + } + return partialIndex + start } // IsEmpty checks if a string is empty (""). Returns true if empty, and false otherwise. func IsEmpty(str string) bool { - return len(str) == 0 + return len(str) == 0 } diff --git a/vendor/github.com/aokoli/goutils/stringutils_test.go b/vendor/github.com/aokoli/goutils/stringutils_test.go index 27482b4..dae9313 100644 --- a/vendor/github.com/aokoli/goutils/stringutils_test.go +++ b/vendor/github.com/aokoli/goutils/stringutils_test.go @@ -1,8 +1,8 @@ package goutils import ( -"testing" -"fmt" + "fmt" + "testing" ) // ****************************** TESTS ******************************************** @@ -26,7 +26,6 @@ func TestAbbreviate(t *testing.T) { t.Errorf("Abbreviate(%v, %v) = %v, want %v", in, maxWidth, x, out) } - // Test 3 out = "a..." maxWidth = 4 @@ -36,7 +35,6 @@ func TestAbbreviate(t *testing.T) { } } - func TestAbbreviateFull(t *testing.T) { // Test 1 @@ -58,20 +56,16 @@ func TestAbbreviateFull(t *testing.T) { t.Errorf("AbbreviateFull(%v, %v, %v) = %v, want %v", in, offset, maxWidth, x, out) } - // Test 3 out = "...ijklmno" offset = 12 maxWidth = 10 - if x, _ := AbbreviateFull(in, offset, maxWidth); x != out { t.Errorf("AbbreviateFull(%v, %v, %v) = %v, want %v", in, offset, maxWidth, x, out) } } - - func TestIndexOf(t *testing.T) { // Test 1 @@ -100,7 +94,6 @@ func TestIndexOf(t *testing.T) { t.Errorf("IndexOf(%v, %v, %v) = %v, want %v", str, sub, start, x, out) } - // Test 4 sub = "z" out = -1 @@ -109,8 +102,7 @@ func TestIndexOf(t *testing.T) { t.Errorf("IndexOf(%v, %v, %v) = %v, want %v", str, sub, start, x, out) } -} - +} func TestIsBlank(t *testing.T) { @@ -137,9 +129,7 @@ func TestIsBlank(t *testing.T) { if x := IsBlank(str); x != out { t.Errorf("IndexOf(%v) = %v, want %v", str, x, out) } -} - - +} func TestDeleteWhiteSpace(t *testing.T) { @@ -158,8 +148,7 @@ func TestDeleteWhiteSpace(t *testing.T) { if x := DeleteWhiteSpace(str); x != out { t.Errorf("IndexOf(%v) = %v, want %v", str, x, out) } -} - +} func TestIndexOfDifference(t *testing.T) { @@ -170,8 +159,7 @@ func TestIndexOfDifference(t *testing.T) { if x := IndexOfDifference(str1, str2); x != out { t.Errorf("IndexOfDifference(%v, %v) = %v, want %v", str1, str2, x, out) } -} - +} // ****************************** EXAMPLES ******************************************** @@ -184,13 +172,12 @@ func ExampleAbbreviate() { out4, _ := Abbreviate(str, 4) _, err1 := Abbreviate(str, 3) - fmt.Println(out1) fmt.Println(out2) fmt.Println(out3) fmt.Println(out4) fmt.Println(err1) - // Output: + // Output: // abc... // abcdefg // abcdefg @@ -198,7 +185,6 @@ func ExampleAbbreviate() { // stringutils illegal argument: Minimum abbreviation width is 4 } - func ExampleAbbreviateFull() { str := "abcdefghijklmno" @@ -215,7 +201,6 @@ func ExampleAbbreviateFull() { _, err1 := AbbreviateFull(str2, 0, 3) _, err2 := AbbreviateFull(str2, 5, 6) - fmt.Println(out1) fmt.Println(out2) fmt.Println(out3) @@ -227,7 +212,7 @@ func ExampleAbbreviateFull() { fmt.Println(out9) fmt.Println(err1) fmt.Println(err2) - // Output: + // Output: // abcdefg... // abcdefg... // abcdefg... @@ -238,10 +223,9 @@ func ExampleAbbreviateFull() { // ...ijklmno // ...ijklmno // stringutils illegal argument: Minimum abbreviation width is 4 - // stringutils illegal argument: Minimum abbreviation width with offset is 7 + // stringutils illegal argument: Minimum abbreviation width with offset is 7 } - func ExampleIsBlank() { out1 := IsBlank("") @@ -253,14 +237,13 @@ func ExampleIsBlank() { fmt.Println(out2) fmt.Println(out3) fmt.Println(out4) - // Output: + // Output: // true // true // false // false } - func ExampleDeleteWhiteSpace() { out1 := DeleteWhiteSpace(" ") @@ -272,18 +255,17 @@ func ExampleDeleteWhiteSpace() { fmt.Println(out2) fmt.Println(out3) fmt.Println(out4) - // Output: - // + // Output: + // // bob // bob // bob } - func ExampleIndexOf() { str := "abcdefgehije" - out1 := IndexOf(str, "e", 0) + out1 := IndexOf(str, "e", 0) out2 := IndexOf(str, "e", 5) out3 := IndexOf(str, "e", 8) out4 := IndexOf(str, "eh", 0) @@ -298,7 +280,7 @@ func ExampleIndexOf() { fmt.Println(out5) fmt.Println(out6) fmt.Println(out7) - // Output: + // Output: // 4 // 7 // 11 @@ -307,12 +289,10 @@ func ExampleIndexOf() { // -1 // -1 } - - func ExampleIndexOfDifference() { - out1 := IndexOfDifference("abc", "abc") + out1 := IndexOfDifference("abc", "abc") out2 := IndexOfDifference("ab", "abxyz") out3 := IndexOfDifference("", "abc") out4 := IndexOfDifference("abcde", "abxyz") @@ -321,7 +301,7 @@ func ExampleIndexOfDifference() { fmt.Println(out2) fmt.Println(out3) fmt.Println(out4) - // Output: + // Output: // -1 // 2 // 0 diff --git a/vendor/github.com/aokoli/goutils/wordutils.go b/vendor/github.com/aokoli/goutils/wordutils.go index 872964a..e92dd39 100644 --- a/vendor/github.com/aokoli/goutils/wordutils.go +++ b/vendor/github.com/aokoli/goutils/wordutils.go @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -/* +/* Package goutils provides utility functions to manipulate strings in various ways. -The code snippets below show examples of how to use goutils. Some functions return +The code snippets below show examples of how to use goutils. Some functions return errors while others do not, so usage would vary as a result. Example: @@ -36,21 +36,21 @@ Example: // EXAMPLE 2: A goutils function which returns an error - rand1, err1 := goutils.Random (-1, 0, 0, true, true) + rand1, err1 := goutils.Random (-1, 0, 0, true, true) - if err1 != nil { + if err1 != nil { fmt.Println(err1) // Prints out error message because -1 was entered as the first parameter in goutils.Random(...) } else { - fmt.Println(rand1) + fmt.Println(rand1) } } */ package goutils import ( - "bytes" + "bytes" "strings" - "unicode" + "unicode" ) // VERSION indicates the current version of goutils @@ -68,8 +68,8 @@ Parameters: Returns: a line with newlines inserted */ -func Wrap (str string, wrapLength int) string { - return WrapCustom (str, wrapLength, "", false) +func Wrap(str string, wrapLength int) string { + return WrapCustom(str, wrapLength, "", false) } /* @@ -85,75 +85,74 @@ Parameters: Returns: a line with newlines inserted */ -func WrapCustom (str string, wrapLength int, newLineStr string, wrapLongWords bool) string { +func WrapCustom(str string, wrapLength int, newLineStr string, wrapLongWords bool) string { if str == "" { return "" } if newLineStr == "" { - newLineStr = "\n" // TODO Assumes "\n" is seperator. Explore SystemUtils.LINE_SEPARATOR from Apache Commons + newLineStr = "\n" // TODO Assumes "\n" is seperator. Explore SystemUtils.LINE_SEPARATOR from Apache Commons } if wrapLength < 1 { wrapLength = 1 } - inputLineLength := len(str) - offset := 0 + inputLineLength := len(str) + offset := 0 - var wrappedLine bytes.Buffer + var wrappedLine bytes.Buffer - for inputLineLength-offset > wrapLength { - - if rune(str[offset]) == ' ' { + for inputLineLength-offset > wrapLength { + + if rune(str[offset]) == ' ' { offset++ continue } end := wrapLength + offset + 1 - spaceToWrapAt := strings.LastIndex(str[offset:end], " ") + offset + spaceToWrapAt := strings.LastIndex(str[offset:end], " ") + offset - if spaceToWrapAt >= offset { + if spaceToWrapAt >= offset { // normal word (not longer than wrapLength) - wrappedLine.WriteString(str[offset:spaceToWrapAt]) - wrappedLine.WriteString(newLineStr) + wrappedLine.WriteString(str[offset:spaceToWrapAt]) + wrappedLine.WriteString(newLineStr) offset = spaceToWrapAt + 1 - } else { - // long word or URL - if wrapLongWords { - end := wrapLength + offset - // long words are wrapped one line at a time - wrappedLine.WriteString(str[offset:end]) - wrappedLine.WriteString(newLineStr) - offset += wrapLength - } else { - // long words aren't wrapped, just extended beyond limit - end := wrapLength + offset - spaceToWrapAt = strings.IndexRune(str[end:len(str)], ' ') + end - if spaceToWrapAt >= 0 { - wrappedLine.WriteString(str[offset:spaceToWrapAt]) - wrappedLine.WriteString(newLineStr) - offset = spaceToWrapAt + 1 - } else { - wrappedLine.WriteString(str[offset:len(str)]) - offset = inputLineLength - } - } + } else { + // long word or URL + if wrapLongWords { + end := wrapLength + offset + // long words are wrapped one line at a time + wrappedLine.WriteString(str[offset:end]) + wrappedLine.WriteString(newLineStr) + offset += wrapLength + } else { + // long words aren't wrapped, just extended beyond limit + end := wrapLength + offset + spaceToWrapAt = strings.IndexRune(str[end:len(str)], ' ') + end + if spaceToWrapAt >= 0 { + wrappedLine.WriteString(str[offset:spaceToWrapAt]) + wrappedLine.WriteString(newLineStr) + offset = spaceToWrapAt + 1 + } else { + wrappedLine.WriteString(str[offset:len(str)]) + offset = inputLineLength + } + } } } - wrappedLine.WriteString(str[offset:len(str)]) + wrappedLine.WriteString(str[offset:len(str)]) - return wrappedLine.String() + return wrappedLine.String() } - /* -Capitalize capitalizes all the delimiter separated words in a string. Only the first letter of each word is changed. +Capitalize capitalizes all the delimiter separated words in a string. Only the first letter of each word is changed. To convert the rest of each word to lowercase at the same time, use CapitalizeFully(str string, delimiters ...rune). -The delimiters represent a set of characters understood to separate words. The first string character -and the first non-delimiter character after a delimiter will be capitalized. A "" input string returns "". +The delimiters represent a set of characters understood to separate words. The first string character +and the first non-delimiter character after a delimiter will be capitalized. A "" input string returns "". Capitalization uses the Unicode title case, normally equivalent to upper case. Parameters: @@ -163,41 +162,39 @@ Parameters: Returns: capitalized string */ -func Capitalize (str string, delimiters ...rune) string { +func Capitalize(str string, delimiters ...rune) string { var delimLen int - - if delimiters == nil { + + if delimiters == nil { delimLen = -1 } else { delimLen = len(delimiters) } - if str == "" || delimLen == 0 { - return str; - } + if str == "" || delimLen == 0 { + return str + } - buffer := []rune(str) - capitalizeNext := true - for i := 0; i < len(buffer); i++ { - ch := buffer[i] - if isDelimiter(ch, delimiters...) { - capitalizeNext = true - } else if capitalizeNext { - buffer[i] = unicode.ToTitle(ch) - capitalizeNext = false - } - } - return string(buffer) + buffer := []rune(str) + capitalizeNext := true + for i := 0; i < len(buffer); i++ { + ch := buffer[i] + if isDelimiter(ch, delimiters...) { + capitalizeNext = true + } else if capitalizeNext { + buffer[i] = unicode.ToTitle(ch) + capitalizeNext = false + } + } + return string(buffer) } - - /* -CapitalizeFully converts all the delimiter separated words in a string into capitalized words, that is each word is made up of a -titlecase character and then a series of lowercase characters. The delimiters represent a set of characters understood -to separate words. The first string character and the first non-delimiter character after a delimiter will be capitalized. +CapitalizeFully converts all the delimiter separated words in a string into capitalized words, that is each word is made up of a +titlecase character and then a series of lowercase characters. The delimiters represent a set of characters understood +to separate words. The first string character and the first non-delimiter character after a delimiter will be capitalized. Capitalization uses the Unicode title case, normally equivalent to upper case. Parameters: @@ -207,29 +204,27 @@ Parameters: Returns: capitalized string */ -func CapitalizeFully (str string, delimiters ...rune) string { +func CapitalizeFully(str string, delimiters ...rune) string { - var delimLen int + var delimLen int - if delimiters == nil { - delimLen = -1 - } else { + if delimiters == nil { + delimLen = -1 + } else { delimLen = len(delimiters) } - - if str == "" || delimLen == 0 { - return str; - } - str = strings.ToLower(str) - return Capitalize(str, delimiters...); + if str == "" || delimLen == 0 { + return str + } + str = strings.ToLower(str) + return Capitalize(str, delimiters...) } - /* Uncapitalize uncapitalizes all the whitespace separated words in a string. Only the first letter of each word is changed. -The delimiters represent a set of characters understood to separate words. The first string character and the first non-delimiter -character after a delimiter will be uncapitalized. Whitespace is defined by unicode.IsSpace(char). +The delimiters represent a set of characters understood to separate words. The first string character and the first non-delimiter +character after a delimiter will be uncapitalized. Whitespace is defined by unicode.IsSpace(char). Parameters: str - the string to uncapitalize fully @@ -238,46 +233,45 @@ Parameters: Returns: uncapitalized string */ -func Uncapitalize (str string, delimiters ...rune) string { +func Uncapitalize(str string, delimiters ...rune) string { var delimLen int - - if delimiters == nil { + + if delimiters == nil { delimLen = -1 } else { delimLen = len(delimiters) } - if str == "" || delimLen == 0 { - return str; - } + if str == "" || delimLen == 0 { + return str + } - buffer := []rune(str) - uncapitalizeNext := true // TODO Always makes capitalize/un apply to first char. - for i := 0; i < len(buffer); i++ { - ch := buffer[i] - if isDelimiter(ch, delimiters...) { - uncapitalizeNext = true - } else if uncapitalizeNext { - buffer[i] = unicode.ToLower(ch) - uncapitalizeNext = false - } - } - return string(buffer) + buffer := []rune(str) + uncapitalizeNext := true // TODO Always makes capitalize/un apply to first char. + for i := 0; i < len(buffer); i++ { + ch := buffer[i] + if isDelimiter(ch, delimiters...) { + uncapitalizeNext = true + } else if uncapitalizeNext { + buffer[i] = unicode.ToLower(ch) + uncapitalizeNext = false + } + } + return string(buffer) } - /* SwapCase swaps the case of a string using a word based algorithm. Conversion algorithm: - Upper case character converts to Lower case - Title case character converts to Lower case - Lower case character after Whitespace or at start converts to Title case - Other Lower case character converts to Upper case + Upper case character converts to Lower case + Title case character converts to Lower case + Lower case character after Whitespace or at start converts to Title case + Other Lower case character converts to Upper case Whitespace is defined by unicode.IsSpace(char). - + Parameters: str - the string to swap case @@ -285,39 +279,38 @@ Returns: the changed string */ func SwapCase(str string) string { - if str == "" { - return str - } - buffer := []rune(str) + if str == "" { + return str + } + buffer := []rune(str) - whitespace := true + whitespace := true - for i := 0; i < len(buffer); i++ { - ch := buffer[i] - if unicode.IsUpper(ch) { - buffer[i] = unicode.ToLower(ch) - whitespace = false - } else if unicode.IsTitle(ch) { - buffer[i] = unicode.ToLower(ch) - whitespace = false - } else if unicode.IsLower(ch) { - if whitespace { - buffer[i] = unicode.ToTitle(ch) - whitespace = false - } else { - buffer[i] = unicode.ToUpper(ch) - } - } else { - whitespace = unicode.IsSpace(ch) - } - } - return string(buffer); + for i := 0; i < len(buffer); i++ { + ch := buffer[i] + if unicode.IsUpper(ch) { + buffer[i] = unicode.ToLower(ch) + whitespace = false + } else if unicode.IsTitle(ch) { + buffer[i] = unicode.ToLower(ch) + whitespace = false + } else if unicode.IsLower(ch) { + if whitespace { + buffer[i] = unicode.ToTitle(ch) + whitespace = false + } else { + buffer[i] = unicode.ToUpper(ch) + } + } else { + whitespace = unicode.IsSpace(ch) + } + } + return string(buffer) } - /* -Initials extracts the initial letters from each word in the string. The first letter of the string and all first -letters after the defined delimiters are returned as a new string. Their case is not changed. If the delimiters +Initials extracts the initial letters from each word in the string. The first letter of the string and all first +letters after the defined delimiters are returned as a new string. Their case is not changed. If the delimiters parameter is excluded, then Whitespace is used. Whitespace is defined by unicode.IsSpacea(char). An empty delimiter array returns an empty string. Parameters: @@ -327,39 +320,37 @@ Returns: string of initial letters */ func Initials(str string, delimiters ...rune) string { - if str == "" { - return str - } - if delimiters != nil && len(delimiters) == 0 { - return "" - } - strLen := len(str) - var buf bytes.Buffer - lastWasGap := true - for i := 0; i < strLen; i++ { - ch := rune(str[i]) + if str == "" { + return str + } + if delimiters != nil && len(delimiters) == 0 { + return "" + } + strLen := len(str) + var buf bytes.Buffer + lastWasGap := true + for i := 0; i < strLen; i++ { + ch := rune(str[i]) - if isDelimiter(ch, delimiters...) { - lastWasGap = true - } else if lastWasGap { - buf.WriteRune(ch) - lastWasGap = false - } - } - return buf.String() - } + if isDelimiter(ch, delimiters...) { + lastWasGap = true + } else if lastWasGap { + buf.WriteRune(ch) + lastWasGap = false + } + } + return buf.String() +} - - - // private function (lower case func name) +// private function (lower case func name) func isDelimiter(ch rune, delimiters ...rune) bool { - if delimiters == nil { - return unicode.IsSpace(ch) - } - for _, delimiter := range delimiters { - if ch == delimiter { - return true - } - } - return false -} \ No newline at end of file + if delimiters == nil { + return unicode.IsSpace(ch) + } + for _, delimiter := range delimiters { + if ch == delimiter { + return true + } + } + return false +} diff --git a/vendor/github.com/aokoli/goutils/wordutils_test.go b/vendor/github.com/aokoli/goutils/wordutils_test.go index 632eb73..377d943 100644 --- a/vendor/github.com/aokoli/goutils/wordutils_test.go +++ b/vendor/github.com/aokoli/goutils/wordutils_test.go @@ -1,8 +1,8 @@ package goutils import ( -"testing" -"fmt" + "fmt" + "testing" ) // ****************************** TESTS ******************************************** @@ -18,7 +18,6 @@ func TestWrapNormalWord(t *testing.T) { } } - func TestWrapCustomLongWordFalse(t *testing.T) { in := "BobManuelBob Bob" @@ -32,7 +31,6 @@ func TestWrapCustomLongWordFalse(t *testing.T) { } } - func TestWrapCustomLongWordTrue(t *testing.T) { in := "BobManuelBob Bob" @@ -46,96 +44,86 @@ func TestWrapCustomLongWordTrue(t *testing.T) { } } - func TestCapitalize(t *testing.T) { - // Test 1: Checks if function works with 1 parameter, and default whitespace delimiter - in := "test is going.well.thank.you.for inquiring" - out := "Test Is Going.well.thank.you.for Inquiring" + in := "test is going.well.thank.you.for inquiring" + out := "Test Is Going.well.thank.you.for Inquiring" if x := Capitalize(in); x != out { t.Errorf("Capitalize(%v) = %v, want %v", in, x, out) } - // Test 2: Checks if function works with both parameters, with param 2 containing whitespace and '.' - out = "Test Is Going.Well.Thank.You.For Inquiring" - delimiters := []rune{' ', '.'} + out = "Test Is Going.Well.Thank.You.For Inquiring" + delimiters := []rune{' ', '.'} if x := Capitalize(in, delimiters...); x != out { t.Errorf("Capitalize(%v) = %v, want %v", in, x, out) } } - - func TestCapitalizeFully(t *testing.T) { // Test 1 - in := "tEsT iS goiNG.wELL.tHaNk.yOU.for inqUIrING" - out := "Test Is Going.well.thank.you.for Inquiring" + in := "tEsT iS goiNG.wELL.tHaNk.yOU.for inqUIrING" + out := "Test Is Going.well.thank.you.for Inquiring" if x := CapitalizeFully(in); x != out { t.Errorf("CapitalizeFully(%v) = %v, want %v", in, x, out) } - // Test 2 - out = "Test Is Going.Well.Thank.You.For Inquiring" - delimiters := []rune{' ', '.'} + out = "Test Is Going.Well.Thank.You.For Inquiring" + delimiters := []rune{' ', '.'} if x := CapitalizeFully(in, delimiters...); x != out { t.Errorf("CapitalizeFully(%v) = %v, want %v", in, x, out) } } - func TestUncapitalize(t *testing.T) { // Test 1: Checks if function works with 1 parameter, and default whitespace delimiter - in := "This Is A.Test" - out := "this is a.Test" + in := "This Is A.Test" + out := "this is a.Test" if x := Uncapitalize(in); x != out { t.Errorf("Uncapitalize(%v) = %v, want %v", in, x, out) } // Test 2: Checks if function works with both parameters, with param 2 containing whitespace and '.' - out = "this is a.test" - delimiters := []rune{' ', '.'} + out = "this is a.test" + delimiters := []rune{' ', '.'} if x := Uncapitalize(in, delimiters...); x != out { t.Errorf("Uncapitalize(%v) = %v, want %v", in, x, out) } } - func TestSwapCase(t *testing.T) { - in := "This Is A.Test" - out := "tHIS iS a.tEST" + in := "This Is A.Test" + out := "tHIS iS a.tEST" if x := SwapCase(in); x != out { t.Errorf("SwapCase(%v) = %v, want %v", in, x, out) } } - func TestInitials(t *testing.T) { // Test 1 - in := "John Doe.Ray" - out := "JD" + in := "John Doe.Ray" + out := "JD" if x := Initials(in); x != out { t.Errorf("Initials(%v) = %v, want %v", in, x, out) } - // Test 2 - out = "JDR" - delimiters := []rune{' ','.'} + out = "JDR" + delimiters := []rune{' ', '.'} if x := Initials(in, delimiters...); x != out { t.Errorf("Initials(%v) = %v, want %v", in, x, out) @@ -143,24 +131,19 @@ func TestInitials(t *testing.T) { } - - - - // ****************************** EXAMPLES ******************************************** func ExampleWrap() { - in := "Bob Manuel Bob Manuel" + in := "Bob Manuel Bob Manuel" wrapLength := 10 - fmt.Println (Wrap(in, wrapLength)) - // Output: + fmt.Println(Wrap(in, wrapLength)) + // Output: // Bob Manuel // Bob Manuel } - func ExampleWrapCustom_1() { in := "BobManuelBob Bob" @@ -168,12 +151,11 @@ func ExampleWrapCustom_1() { newLineStr := "" wrapLongWords := false - fmt.Println (WrapCustom(in, wrapLength, newLineStr, wrapLongWords)) - // Output: + fmt.Println(WrapCustom(in, wrapLength, newLineStr, wrapLongWords)) + // Output: // BobManuelBobBob } - func ExampleWrapCustom_2() { in := "BobManuelBob Bob" @@ -181,72 +163,63 @@ func ExampleWrapCustom_2() { newLineStr := "" wrapLongWords := true - fmt.Println (WrapCustom(in, wrapLength, newLineStr, wrapLongWords)) - // Output: + fmt.Println(WrapCustom(in, wrapLength, newLineStr, wrapLongWords)) + // Output: // BobManuelBob Bob } - - func ExampleCapitalize() { in := "test is going.well.thank.you.for inquiring" // Compare input to CapitalizeFully example - delimiters := []rune{' ', '.'} + delimiters := []rune{' ', '.'} - fmt.Println (Capitalize(in)) - fmt.Println (Capitalize(in, delimiters...)) + fmt.Println(Capitalize(in)) + fmt.Println(Capitalize(in, delimiters...)) // Output: // Test Is Going.well.thank.you.for Inquiring - // Test Is Going.Well.Thank.You.For Inquiring + // Test Is Going.Well.Thank.You.For Inquiring } - - func ExampleCapitalizeFully() { + in := "tEsT iS goiNG.wELL.tHaNk.yOU.for inqUIrING" // Notice scattered capitalization + delimiters := []rune{' ', '.'} - in := "tEsT iS goiNG.wELL.tHaNk.yOU.for inqUIrING" // Notice scattered capitalization - delimiters := []rune{' ', '.'} - - fmt.Println (CapitalizeFully(in)) - fmt.Println (CapitalizeFully(in, delimiters...)) + fmt.Println(CapitalizeFully(in)) + fmt.Println(CapitalizeFully(in, delimiters...)) // Output: // Test Is Going.well.thank.you.for Inquiring - // Test Is Going.Well.Thank.You.For Inquiring + // Test Is Going.Well.Thank.You.For Inquiring } - func ExampleUncapitalize() { - in := "This Is A.Test" - delimiters := []rune{' ', '.'} + in := "This Is A.Test" + delimiters := []rune{' ', '.'} - fmt.Println (Uncapitalize(in)) - fmt.Println (Uncapitalize(in, delimiters...)) + fmt.Println(Uncapitalize(in)) + fmt.Println(Uncapitalize(in, delimiters...)) // Output: // this is a.Test - // this is a.test + // this is a.test } - func ExampleSwapCase() { - in := "This Is A.Test" - fmt.Println (SwapCase(in)) + in := "This Is A.Test" + fmt.Println(SwapCase(in)) // Output: // tHIS iS a.tEST } - func ExampleInitials() { - in := "John Doe.Ray" - delimiters := []rune{' ','.'} + in := "John Doe.Ray" + delimiters := []rune{' ', '.'} - fmt.Println (Initials(in)) - fmt.Println (Initials(in, delimiters...)) + fmt.Println(Initials(in)) + fmt.Println(Initials(in, delimiters...)) // Output: // JD // JDR } - diff --git a/vendor/github.com/dgrijalva/jwt-go/README.md b/vendor/github.com/dgrijalva/jwt-go/README.md index 00f6136..f48365f 100644 --- a/vendor/github.com/dgrijalva/jwt-go/README.md +++ b/vendor/github.com/dgrijalva/jwt-go/README.md @@ -25,8 +25,8 @@ This library supports the parsing and verification as well as the generation and See [the project documentation](https://godoc.org/github.com/dgrijalva/jwt-go) for examples of usage: -* [Simple example of parsing and validating a token](https://godoc.org/github.com/dgrijalva/jwt-go#example_Parse_hmac) -* [Simple example of building and signing a token](https://godoc.org/github.com/dgrijalva/jwt-go#example_New_hmac) +* [Simple example of parsing and validating a token](https://godoc.org/github.com/dgrijalva/jwt-go#example-Parse--Hmac) +* [Simple example of building and signing a token](https://godoc.org/github.com/dgrijalva/jwt-go#example-New--Hmac) * [Directory of Examples](https://godoc.org/github.com/dgrijalva/jwt-go#pkg-examples) ## Extensions diff --git a/vendor/github.com/dgrijalva/jwt-go/parser.go b/vendor/github.com/dgrijalva/jwt-go/parser.go index 7020c52..7bf1c4e 100644 --- a/vendor/github.com/dgrijalva/jwt-go/parser.go +++ b/vendor/github.com/dgrijalva/jwt-go/parser.go @@ -8,8 +8,9 @@ import ( ) type Parser struct { - ValidMethods []string // If populated, only these methods will be considered valid - UseJSONNumber bool // Use JSON Number format in JSON decoder + ValidMethods []string // If populated, only these methods will be considered valid + UseJSONNumber bool // Use JSON Number format in JSON decoder + SkipClaimsValidation bool // Skip claims validation during token parsing } // Parse, validate, and return a token. @@ -101,14 +102,16 @@ func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyf vErr := &ValidationError{} // Validate Claims - if err := token.Claims.Valid(); err != nil { + if !p.SkipClaimsValidation { + if err := token.Claims.Valid(); err != nil { - // If the Claims Valid returned an error, check if it is a validation error, - // If it was another error type, create a ValidationError with a generic ClaimsInvalid flag set - if e, ok := err.(*ValidationError); !ok { - vErr = &ValidationError{Inner: err, Errors: ValidationErrorClaimsInvalid} - } else { - vErr = e + // If the Claims Valid returned an error, check if it is a validation error, + // If it was another error type, create a ValidationError with a generic ClaimsInvalid flag set + if e, ok := err.(*ValidationError); !ok { + vErr = &ValidationError{Inner: err, Errors: ValidationErrorClaimsInvalid} + } else { + vErr = e + } } } diff --git a/vendor/github.com/dgrijalva/jwt-go/parser_test.go b/vendor/github.com/dgrijalva/jwt-go/parser_test.go index 0c86801..e62714d 100644 --- a/vendor/github.com/dgrijalva/jwt-go/parser_test.go +++ b/vendor/github.com/dgrijalva/jwt-go/parser_test.go @@ -172,6 +172,15 @@ var jwtTestData = []struct { jwt.ValidationErrorNotValidYet | jwt.ValidationErrorExpired, &jwt.Parser{UseJSONNumber: true}, }, + { + "SkipClaimsValidation during token parsing", + "", // autogen + defaultKeyFunc, + jwt.MapClaims{"foo": "bar", "nbf": json.Number(fmt.Sprintf("%v", time.Now().Unix()+100))}, + true, + 0, + &jwt.Parser{UseJSONNumber: true, SkipClaimsValidation: true}, + }, } func TestParser_Parse(t *testing.T) { diff --git a/vendor/github.com/go-kit/kit/.gitignore b/vendor/github.com/go-kit/kit/.gitignore index 6062401..716bfff 100644 --- a/vendor/github.com/go-kit/kit/.gitignore +++ b/vendor/github.com/go-kit/kit/.gitignore @@ -5,7 +5,7 @@ examples/profilesvc/profilesvc examples/stringsvc1/stringsvc1 examples/stringsvc2/stringsvc2 examples/stringsvc3/stringsvc3 -*.coverprofile +gover.coverprofile # Compiled Object files, Static and Dynamic libs (Shared Objects) *.o diff --git a/vendor/github.com/go-kit/kit/.travis.yml b/vendor/github.com/go-kit/kit/.travis.yml index b6074eb..76adc06 100644 --- a/vendor/github.com/go-kit/kit/.travis.yml +++ b/vendor/github.com/go-kit/kit/.travis.yml @@ -3,6 +3,7 @@ language: go script: go test -race -v ./... go: - - 1.7.5 - - 1.8 + - 1.5.4 + - 1.6.3 + - 1.7.1 - tip diff --git a/vendor/github.com/go-kit/kit/README.md b/vendor/github.com/go-kit/kit/README.md index 542d7e0..e65c7ee 100644 --- a/vendor/github.com/go-kit/kit/README.md +++ b/vendor/github.com/go-kit/kit/README.md @@ -1,4 +1,4 @@ -# Go kit [![Circle CI](https://circleci.com/gh/go-kit/kit.svg?style=svg)](https://circleci.com/gh/go-kit/kit) [![Travis CI](https://travis-ci.org/go-kit/kit.svg?branch=master)](https://travis-ci.org/go-kit/kit) [![GoDoc](https://godoc.org/github.com/go-kit/kit?status.svg)](https://godoc.org/github.com/go-kit/kit) [![Coverage Status](https://coveralls.io/repos/go-kit/kit/badge.svg?branch=master&service=github)](https://coveralls.io/github/go-kit/kit?branch=master) [![Go Report Card](https://goreportcard.com/badge/go-kit/kit)](https://goreportcard.com/report/go-kit/kit) [![Sourcegraph](https://sourcegraph.com/github.com/go-kit/kit/-/badge.svg)](https://sourcegraph.com/github.com/go-kit/kit?badge) +# Go kit [![Circle CI](https://circleci.com/gh/go-kit/kit.svg?style=svg)](https://circleci.com/gh/go-kit/kit) [![Drone.io](https://drone.io/github.com/go-kit/kit/status.png)](https://drone.io/github.com/go-kit/kit/latest) [![Travis CI](https://travis-ci.org/go-kit/kit.svg?branch=master)](https://travis-ci.org/go-kit/kit) [![GoDoc](https://godoc.org/github.com/go-kit/kit?status.svg)](https://godoc.org/github.com/go-kit/kit) [![Coverage Status](https://coveralls.io/repos/go-kit/kit/badge.svg?branch=master&service=github)](https://coveralls.io/github/go-kit/kit?branch=master) [![Go Report Card](https://goreportcard.com/badge/go-kit/kit)](https://goreportcard.com/report/go-kit/kit) **Go kit** is a **distributed programming toolkit** for building microservices in large organizations. We solve common problems in distributed systems, so @@ -108,14 +108,10 @@ Projects with a ★ have had particular influence on Go kit's design (or vice-ve - [Goji](https://github.com/zenazn/goji) - [Martini](https://github.com/go-martini/martini) - [Beego](http://beego.me/) -- [Revel](https://revel.github.io/) (considered [harmful](https://github.com/go-kit/kit/issues/350)) +- [Revel](https://revel.github.io/) (considered harmful) ## Additional reading - [Architecting for the Cloud](http://fr.slideshare.net/stonse/architecting-for-the-cloud-using-netflixoss-codemash-workshop-29852233) — Netflix - [Dapper, a Large-Scale Distributed Systems Tracing Infrastructure](http://research.google.com/pubs/pub36356.html) — Google - [Your Server as a Function](http://monkey.org/~marius/funsrv.pdf) (PDF) — Twitter - ---- - -Development supported by [DigitalOcean](https://digitalocean.com). diff --git a/vendor/github.com/go-kit/kit/auth/jwt/README.md b/vendor/github.com/go-kit/kit/auth/jwt/README.md index d435e0f..bec4f67 100644 --- a/vendor/github.com/go-kit/kit/auth/jwt/README.md +++ b/vendor/github.com/go-kit/kit/auth/jwt/README.md @@ -92,7 +92,7 @@ Example of use in a server: ```go import ( - "context" + "golang.org/x/net/context" "github.com/go-kit/kit/auth/jwt" "github.com/go-kit/kit/log" diff --git a/vendor/github.com/go-kit/kit/auth/jwt/middleware.go b/vendor/github.com/go-kit/kit/auth/jwt/middleware.go index b5ccf0b..8b5f826 100644 --- a/vendor/github.com/go-kit/kit/auth/jwt/middleware.go +++ b/vendor/github.com/go-kit/kit/auth/jwt/middleware.go @@ -1,10 +1,10 @@ package jwt import ( - "context" "errors" jwt "github.com/dgrijalva/jwt-go" + "golang.org/x/net/context" "github.com/go-kit/kit/endpoint" ) @@ -15,8 +15,7 @@ const ( // JWTTokenContextKey holds the key used to store a JWT Token in the // context. JWTTokenContextKey contextKey = "JWTToken" - - // JWTClaimsContextKey holds the key used to store the JWT Claims in the + // JWTClaimsContxtKey holds the key used to store the JWT Claims in the // context. JWTClaimsContextKey contextKey = "JWTClaims" ) @@ -25,26 +24,20 @@ var ( // ErrTokenContextMissing denotes a token was not passed into the parsing // middleware's context. ErrTokenContextMissing = errors.New("token up for parsing was not passed through the context") - // ErrTokenInvalid denotes a token was not able to be validated. ErrTokenInvalid = errors.New("JWT Token was invalid") - // ErrTokenExpired denotes a token's expire header (exp) has since passed. ErrTokenExpired = errors.New("JWT Token is expired") - // ErrTokenMalformed denotes a token was not formatted as a JWT token. ErrTokenMalformed = errors.New("JWT Token is malformed") - // ErrTokenNotActive denotes a token's not before header (nbf) is in the // future. ErrTokenNotActive = errors.New("token is not valid yet") - - // ErrUnexpectedSigningMethod denotes a token was signed with an unexpected + // ErrUncesptedSigningMethod denotes a token was signed with an unexpected // signing method. ErrUnexpectedSigningMethod = errors.New("unexpected signing method") ) -// Claims is a map of arbitrary claim data. type Claims map[string]interface{} // NewSigner creates a new JWT token generating middleware, specifying key ID, diff --git a/vendor/github.com/go-kit/kit/auth/jwt/middleware_test.go b/vendor/github.com/go-kit/kit/auth/jwt/middleware_test.go index 99b943c..46bae68 100644 --- a/vendor/github.com/go-kit/kit/auth/jwt/middleware_test.go +++ b/vendor/github.com/go-kit/kit/auth/jwt/middleware_test.go @@ -1,10 +1,11 @@ package jwt import ( - "context" "testing" jwt "github.com/dgrijalva/jwt-go" + + "golang.org/x/net/context" ) var ( diff --git a/vendor/github.com/go-kit/kit/auth/jwt/transport.go b/vendor/github.com/go-kit/kit/auth/jwt/transport.go index 7be7db4..f4ab4d8 100644 --- a/vendor/github.com/go-kit/kit/auth/jwt/transport.go +++ b/vendor/github.com/go-kit/kit/auth/jwt/transport.go @@ -1,11 +1,11 @@ package jwt import ( - "context" "fmt" stdhttp "net/http" "strings" + "golang.org/x/net/context" "google.golang.org/grpc/metadata" "github.com/go-kit/kit/transport/grpc" @@ -44,10 +44,10 @@ func FromHTTPContext() http.RequestFunc { // ToGRPCContext moves JWT token from grpc metadata to context. Particularly // userful for servers. -func ToGRPCContext() grpc.ServerRequestFunc { - return func(ctx context.Context, md metadata.MD) context.Context { +func ToGRPCContext() grpc.RequestFunc { + return func(ctx context.Context, md *metadata.MD) context.Context { // capital "Key" is illegal in HTTP/2. - authHeader, ok := md["authorization"] + authHeader, ok := (*md)["authorization"] if !ok { return ctx } @@ -63,7 +63,7 @@ func ToGRPCContext() grpc.ServerRequestFunc { // FromGRPCContext moves JWT token from context to grpc metadata. Particularly // useful for clients. -func FromGRPCContext() grpc.ClientRequestFunc { +func FromGRPCContext() grpc.RequestFunc { return func(ctx context.Context, md *metadata.MD) context.Context { token, ok := ctx.Value(JWTTokenContextKey).(string) if ok { diff --git a/vendor/github.com/go-kit/kit/auth/jwt/transport_test.go b/vendor/github.com/go-kit/kit/auth/jwt/transport_test.go index b04d76f..829d87f 100644 --- a/vendor/github.com/go-kit/kit/auth/jwt/transport_test.go +++ b/vendor/github.com/go-kit/kit/auth/jwt/transport_test.go @@ -1,12 +1,13 @@ package jwt import ( - "context" "fmt" "net/http" "testing" "google.golang.org/grpc/metadata" + + "golang.org/x/net/context" ) func TestToHTTPContext(t *testing.T) { @@ -69,7 +70,7 @@ func TestToGRPCContext(t *testing.T) { reqFunc := ToGRPCContext() // No Authorization header is passed - ctx := reqFunc(context.Background(), md) + ctx := reqFunc(context.Background(), &md) token := ctx.Value(JWTTokenContextKey) if token != nil { t.Error("Context should not contain a JWT Token") @@ -77,7 +78,7 @@ func TestToGRPCContext(t *testing.T) { // Invalid Authorization header is passed md["authorization"] = []string{fmt.Sprintf("%s", signedKey)} - ctx = reqFunc(context.Background(), md) + ctx = reqFunc(context.Background(), &md) token = ctx.Value(JWTTokenContextKey) if token != nil { t.Error("Context should not contain a JWT Token") @@ -85,7 +86,7 @@ func TestToGRPCContext(t *testing.T) { // Authorization header is correct md["authorization"] = []string{fmt.Sprintf("Bearer %s", signedKey)} - ctx = reqFunc(context.Background(), md) + ctx = reqFunc(context.Background(), &md) token, ok := ctx.Value(JWTTokenContextKey).(string) if !ok { t.Fatal("JWT Token not passed to context correctly") diff --git a/vendor/github.com/go-kit/kit/circle.yml b/vendor/github.com/go-kit/kit/circle.yml deleted file mode 100644 index 0c35bb2..0000000 --- a/vendor/github.com/go-kit/kit/circle.yml +++ /dev/null @@ -1,26 +0,0 @@ -machine: - pre: - - curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s -- 1.10.0 - - sudo rm -rf /usr/local/go - - curl -sSL https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz | sudo tar xz -C /usr/local - services: - - docker - -dependencies: - pre: - - sudo curl -L "https://github.com/docker/compose/releases/download/1.10.0/docker-compose-linux-x86_64" -o /usr/local/bin/docker-compose - - sudo chmod +x /usr/local/bin/docker-compose - - docker-compose -f docker-compose-integration.yml up -d --force-recreate - -test: - pre: - - mkdir -p /home/ubuntu/.go_workspace/src/github.com/go-kit - - mv /home/ubuntu/kit /home/ubuntu/.go_workspace/src/github.com/go-kit - - ln -s /home/ubuntu/.go_workspace/src/github.com/go-kit/kit /home/ubuntu/kit - - go get github.com/go-kit/kit/... - override: - - go test -v -race -tags integration github.com/go-kit/kit/...: - environment: - ETCD_ADDR: http://localhost:2379 - CONSUL_ADDR: localhost:8500 - ZK_ADDR: localhost:2181 diff --git a/vendor/github.com/go-kit/kit/circuitbreaker/gobreaker.go b/vendor/github.com/go-kit/kit/circuitbreaker/gobreaker.go index cf06304..b00de95 100644 --- a/vendor/github.com/go-kit/kit/circuitbreaker/gobreaker.go +++ b/vendor/github.com/go-kit/kit/circuitbreaker/gobreaker.go @@ -1,9 +1,8 @@ package circuitbreaker import ( - "context" - "github.com/sony/gobreaker" + "golang.org/x/net/context" "github.com/go-kit/kit/endpoint" ) diff --git a/vendor/github.com/go-kit/kit/circuitbreaker/handy_breaker.go b/vendor/github.com/go-kit/kit/circuitbreaker/handy_breaker.go index a5b60be..5875d4f 100644 --- a/vendor/github.com/go-kit/kit/circuitbreaker/handy_breaker.go +++ b/vendor/github.com/go-kit/kit/circuitbreaker/handy_breaker.go @@ -1,10 +1,10 @@ package circuitbreaker import ( - "context" "time" "github.com/streadway/handy/breaker" + "golang.org/x/net/context" "github.com/go-kit/kit/endpoint" ) diff --git a/vendor/github.com/go-kit/kit/circuitbreaker/hystrix.go b/vendor/github.com/go-kit/kit/circuitbreaker/hystrix.go index 3c59ec4..5e7b144 100644 --- a/vendor/github.com/go-kit/kit/circuitbreaker/hystrix.go +++ b/vendor/github.com/go-kit/kit/circuitbreaker/hystrix.go @@ -1,9 +1,8 @@ package circuitbreaker import ( - "context" - "github.com/afex/hystrix-go/hystrix" + "golang.org/x/net/context" "github.com/go-kit/kit/endpoint" ) diff --git a/vendor/github.com/go-kit/kit/circuitbreaker/util_test.go b/vendor/github.com/go-kit/kit/circuitbreaker/util_test.go index 2512380..b5c0391 100644 --- a/vendor/github.com/go-kit/kit/circuitbreaker/util_test.go +++ b/vendor/github.com/go-kit/kit/circuitbreaker/util_test.go @@ -1,7 +1,6 @@ package circuitbreaker_test import ( - "context" "errors" "fmt" "path/filepath" @@ -9,6 +8,8 @@ import ( "testing" "time" + "golang.org/x/net/context" + "github.com/go-kit/kit/endpoint" ) @@ -66,7 +67,7 @@ func testFailingEndpoint( type mock struct { through int - err error + err error } func (m *mock) endpoint(context.Context, interface{}) (interface{}, error) { diff --git a/vendor/github.com/go-kit/kit/docker-compose-integration.yml b/vendor/github.com/go-kit/kit/docker-compose-integration.yml deleted file mode 100644 index f316a13..0000000 --- a/vendor/github.com/go-kit/kit/docker-compose-integration.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: '2' -services: - etcd: - image: quay.io/coreos/etcd - ports: - - "2379:2379" - command: /usr/local/bin/etcd -advertise-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 -listen-client-urls "http://0.0.0.0:2379,http://0.0.0.0:4001" - consul: - image: progrium/consul - ports: - - "8500:8500" - command: -server -bootstrap - zk: - image: zookeeper - ports: - - "2181:2181" diff --git a/vendor/github.com/go-kit/kit/endpoint/endpoint.go b/vendor/github.com/go-kit/kit/endpoint/endpoint.go index 1b64f50..786a288 100644 --- a/vendor/github.com/go-kit/kit/endpoint/endpoint.go +++ b/vendor/github.com/go-kit/kit/endpoint/endpoint.go @@ -1,7 +1,7 @@ package endpoint import ( - "context" + "golang.org/x/net/context" ) // Endpoint is the fundamental building block of servers and clients. diff --git a/vendor/github.com/go-kit/kit/endpoint/endpoint_example_test.go b/vendor/github.com/go-kit/kit/endpoint/endpoint_example_test.go index e950623..dd25ec7 100644 --- a/vendor/github.com/go-kit/kit/endpoint/endpoint_example_test.go +++ b/vendor/github.com/go-kit/kit/endpoint/endpoint_example_test.go @@ -1,9 +1,10 @@ package endpoint_test import ( - "context" "fmt" + "golang.org/x/net/context" + "github.com/go-kit/kit/endpoint" ) diff --git a/vendor/github.com/go-kit/kit/examples/addsvc/client/http/client.go b/vendor/github.com/go-kit/kit/examples/addsvc/client/http/client.go index be8d8e2..c2587be 100644 --- a/vendor/github.com/go-kit/kit/examples/addsvc/client/http/client.go +++ b/vendor/github.com/go-kit/kit/examples/addsvc/client/http/client.go @@ -67,10 +67,10 @@ func New(instance string, tracer stdopentracing.Tracer, logger log.Logger) (adds ).Endpoint() concatEndpoint = opentracing.TraceClient(tracer, "Concat")(concatEndpoint) concatEndpoint = limiter(concatEndpoint) - concatEndpoint = circuitbreaker.Gobreaker(gobreaker.NewCircuitBreaker(gobreaker.Settings{ + sumEndpoint = circuitbreaker.Gobreaker(gobreaker.NewCircuitBreaker(gobreaker.Settings{ Name: "Concat", Timeout: 30 * time.Second, - }))(concatEndpoint) + }))(sumEndpoint) } return addsvc.Endpoints{ diff --git a/vendor/github.com/go-kit/kit/examples/addsvc/cmd/addcli/main.go b/vendor/github.com/go-kit/kit/examples/addsvc/cmd/addcli/main.go index feaf40a..a2d6478 100644 --- a/vendor/github.com/go-kit/kit/examples/addsvc/cmd/addcli/main.go +++ b/vendor/github.com/go-kit/kit/examples/addsvc/cmd/addcli/main.go @@ -1,7 +1,6 @@ package main import ( - "context" "flag" "fmt" "os" @@ -13,6 +12,7 @@ import ( "github.com/lightstep/lightstep-tracer-go" stdopentracing "github.com/opentracing/opentracing-go" zipkin "github.com/openzipkin/zipkin-go-opentracing" + "golang.org/x/net/context" "google.golang.org/grpc" "sourcegraph.com/sourcegraph/appdash" appdashot "sourcegraph.com/sourcegraph/appdash/opentracing" @@ -40,8 +40,7 @@ func main() { thriftProtocol = flag.String("thrift.protocol", "binary", "binary, compact, json, simplejson") thriftBufferSize = flag.Int("thrift.buffer.size", 0, "0 for unbuffered") thriftFramed = flag.Bool("thrift.framed", false, "true to enable framing") - zipkinAddr = flag.String("zipkin.addr", "", "Enable Zipkin tracing via a Zipkin HTTP Collector endpoint") - zipkinKafkaAddr = flag.String("zipkin.kafka.addr", "", "Enable Zipkin tracing via a Kafka server host:port") + zipkinAddr = flag.String("zipkin.addr", "", "Enable Zipkin tracing via a Kafka Collector host:port") appdashAddr = flag.String("appdash.addr", "", "Enable Appdash tracing via an Appdash server host:port") lightstepToken = flag.String("lightstep.token", "", "Enable LightStep tracing via a LightStep access token") method = flag.String("method", "sum", "sum, concat") @@ -58,34 +57,16 @@ func main() { var tracer stdopentracing.Tracer { if *zipkinAddr != "" { - // endpoint typically looks like: http://zipkinhost:9411/api/v1/spans - collector, err := zipkin.NewHTTPCollector(*zipkinAddr) - if err != nil { - fmt.Fprintf(os.Stderr, "%v\n", err) - os.Exit(1) - } - defer collector.Close() - - tracer, err = zipkin.NewTracer( - zipkin.NewRecorder(collector, false, "0.0.0.0:0", "addcli"), - ) - if err != nil { - fmt.Fprintf(os.Stderr, "%v\n", err) - os.Exit(1) - } - } else if *zipkinKafkaAddr != "" { collector, err := zipkin.NewKafkaCollector( - strings.Split(*zipkinKafkaAddr, ","), + strings.Split(*zipkinAddr, ","), zipkin.KafkaLogger(log.NewNopLogger()), ) if err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) os.Exit(1) } - defer collector.Close() - tracer, err = zipkin.NewTracer( - zipkin.NewRecorder(collector, false, "0.0.0.0:0", "addcli"), + zipkin.NewRecorder(collector, false, "localhost:8000", "addcli"), ) if err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) diff --git a/vendor/github.com/go-kit/kit/examples/addsvc/cmd/addsvc/main.go b/vendor/github.com/go-kit/kit/examples/addsvc/cmd/addsvc/main.go index 247a028..b58d64d 100644 --- a/vendor/github.com/go-kit/kit/examples/addsvc/cmd/addsvc/main.go +++ b/vendor/github.com/go-kit/kit/examples/addsvc/cmd/addsvc/main.go @@ -1,7 +1,6 @@ -package main +package main import ( - "context" "flag" "fmt" "net" @@ -17,6 +16,7 @@ import ( stdopentracing "github.com/opentracing/opentracing-go" zipkin "github.com/openzipkin/zipkin-go-opentracing" stdprometheus "github.com/prometheus/client_golang/prometheus" + "golang.org/x/net/context" "google.golang.org/grpc" "sourcegraph.com/sourcegraph/appdash" appdashot "sourcegraph.com/sourcegraph/appdash/opentracing" @@ -40,8 +40,7 @@ func main() { thriftProtocol = flag.String("thrift.protocol", "binary", "binary, compact, json, simplejson") thriftBufferSize = flag.Int("thrift.buffer.size", 0, "0 for unbuffered") thriftFramed = flag.Bool("thrift.framed", false, "true to enable framing") - zipkinAddr = flag.String("zipkin.addr", "", "Enable Zipkin tracing via a Zipkin HTTP Collector endpoint") - zipkinKafkaAddr = flag.String("zipkin.kafka.addr", "", "Enable Zipkin tracing via a Kafka server host:port") + zipkinAddr = flag.String("zipkin.addr", "", "Enable Zipkin tracing via a Kafka server host:port") appdashAddr = flag.String("appdash.addr", "", "Enable Appdash tracing via an Appdash server host:port") lightstepToken = flag.String("lightstep.token", "", "Enable LightStep tracing via a LightStep access token") ) @@ -51,8 +50,8 @@ func main() { var logger log.Logger { logger = log.NewLogfmtLogger(os.Stdout) - logger = log.With(logger, "ts", log.DefaultTimestampUTC) - logger = log.With(logger, "caller", log.DefaultCaller) + logger = log.NewContext(logger).With("ts", log.DefaultTimestampUTC) + logger = log.NewContext(logger).With("caller", log.DefaultCaller) } logger.Log("msg", "hello") defer logger.Log("msg", "goodbye") @@ -86,38 +85,16 @@ func main() { var tracer stdopentracing.Tracer { if *zipkinAddr != "" { - logger := log.With(logger, "tracer", "ZipkinHTTP") + logger := log.NewContext(logger).With("tracer", "Zipkin") logger.Log("addr", *zipkinAddr) - - // endpoint typically looks like: http://zipkinhost:9411/api/v1/spans - collector, err := zipkin.NewHTTPCollector(*zipkinAddr) - if err != nil { - logger.Log("err", err) - os.Exit(1) - } - defer collector.Close() - - tracer, err = zipkin.NewTracer( - zipkin.NewRecorder(collector, false, "localhost:80", "addsvc"), - ) - if err != nil { - logger.Log("err", err) - os.Exit(1) - } - } else if *zipkinKafkaAddr != "" { - logger := log.With(logger, "tracer", "ZipkinKafka") - logger.Log("addr", *zipkinKafkaAddr) - collector, err := zipkin.NewKafkaCollector( - strings.Split(*zipkinKafkaAddr, ","), - zipkin.KafkaLogger(log.NewNopLogger()), + strings.Split(*zipkinAddr, ","), + zipkin.KafkaLogger(logger), ) if err != nil { logger.Log("err", err) os.Exit(1) } - defer collector.Close() - tracer, err = zipkin.NewTracer( zipkin.NewRecorder(collector, false, "localhost:80", "addsvc"), ) @@ -126,18 +103,18 @@ func main() { os.Exit(1) } } else if *appdashAddr != "" { - logger := log.With(logger, "tracer", "Appdash") + logger := log.NewContext(logger).With("tracer", "Appdash") logger.Log("addr", *appdashAddr) tracer = appdashot.NewTracer(appdash.NewRemoteCollector(*appdashAddr)) } else if *lightstepToken != "" { - logger := log.With(logger, "tracer", "LightStep") + logger := log.NewContext(logger).With("tracer", "LightStep") logger.Log() // probably don't want to print out the token :) tracer = lightstep.NewTracer(lightstep.Options{ AccessToken: *lightstepToken, }) defer lightstep.FlushLightStepTracer(tracer) } else { - logger := log.With(logger, "tracer", "none") + logger := log.NewContext(logger).With("tracer", "none") logger.Log() tracer = stdopentracing.GlobalTracer() // no-op } @@ -155,7 +132,7 @@ func main() { var sumEndpoint endpoint.Endpoint { sumDuration := duration.With("method", "Sum") - sumLogger := log.With(logger, "method", "Sum") + sumLogger := log.NewContext(logger).With("method", "Sum") sumEndpoint = addsvc.MakeSumEndpoint(service) sumEndpoint = opentracing.TraceServer(tracer, "Sum")(sumEndpoint) @@ -165,7 +142,7 @@ func main() { var concatEndpoint endpoint.Endpoint { concatDuration := duration.With("method", "Concat") - concatLogger := log.With(logger, "method", "Concat") + concatLogger := log.NewContext(logger).With("method", "Concat") concatEndpoint = addsvc.MakeConcatEndpoint(service) concatEndpoint = opentracing.TraceServer(tracer, "Concat")(concatEndpoint) @@ -190,7 +167,7 @@ func main() { // Debug listener. go func() { - logger := log.With(logger, "transport", "debug") + logger := log.NewContext(logger).With("transport", "debug") m := http.NewServeMux() m.Handle("/debug/pprof/", http.HandlerFunc(pprof.Index)) @@ -206,15 +183,15 @@ func main() { // HTTP transport. go func() { - logger := log.With(logger, "transport", "HTTP") - h := addsvc.MakeHTTPHandler(endpoints, tracer, logger) + logger := log.NewContext(logger).With("transport", "HTTP") + h := addsvc.MakeHTTPHandler(ctx, endpoints, tracer, logger) logger.Log("addr", *httpAddr) errc <- http.ListenAndServe(*httpAddr, h) }() // gRPC transport. go func() { - logger := log.With(logger, "transport", "gRPC") + logger := log.NewContext(logger).With("transport", "gRPC") ln, err := net.Listen("tcp", *grpcAddr) if err != nil { @@ -222,7 +199,7 @@ func main() { return } - srv := addsvc.MakeGRPCServer(endpoints, tracer, logger) + srv := addsvc.MakeGRPCServer(ctx, endpoints, tracer, logger) s := grpc.NewServer() pb.RegisterAddServer(s, srv) @@ -232,7 +209,7 @@ func main() { // Thrift transport. go func() { - logger := log.With(logger, "transport", "Thrift") + logger := log.NewContext(logger).With("transport", "Thrift") var protocolFactory thrift.TProtocolFactory switch *thriftProtocol { diff --git a/vendor/github.com/go-kit/kit/examples/addsvc/endpoints.go b/vendor/github.com/go-kit/kit/examples/addsvc/endpoints.go index 1da33e4..6c13d99 100644 --- a/vendor/github.com/go-kit/kit/examples/addsvc/endpoints.go +++ b/vendor/github.com/go-kit/kit/examples/addsvc/endpoints.go @@ -6,10 +6,11 @@ package addsvc // formats. It also includes endpoint middlewares. import ( - "context" "fmt" "time" + "golang.org/x/net/context" + "github.com/go-kit/kit/endpoint" "github.com/go-kit/kit/log" "github.com/go-kit/kit/metrics" diff --git a/vendor/github.com/go-kit/kit/examples/addsvc/service.go b/vendor/github.com/go-kit/kit/examples/addsvc/service.go index 971590c..65d72bf 100644 --- a/vendor/github.com/go-kit/kit/examples/addsvc/service.go +++ b/vendor/github.com/go-kit/kit/examples/addsvc/service.go @@ -4,10 +4,11 @@ package addsvc // implementation. It also includes service middlewares. import ( - "context" "errors" "time" + "golang.org/x/net/context" + "github.com/go-kit/kit/log" "github.com/go-kit/kit/metrics" ) diff --git a/vendor/github.com/go-kit/kit/examples/addsvc/transport_grpc.go b/vendor/github.com/go-kit/kit/examples/addsvc/transport_grpc.go index dcfc03a..6ad30cb 100644 --- a/vendor/github.com/go-kit/kit/examples/addsvc/transport_grpc.go +++ b/vendor/github.com/go-kit/kit/examples/addsvc/transport_grpc.go @@ -4,10 +4,8 @@ package addsvc // It utilizes the transport/grpc.Server. import ( - "context" - stdopentracing "github.com/opentracing/opentracing-go" - oldcontext "golang.org/x/net/context" + "golang.org/x/net/context" "github.com/go-kit/kit/examples/addsvc/pb" "github.com/go-kit/kit/log" @@ -16,18 +14,20 @@ import ( ) // MakeGRPCServer makes a set of endpoints available as a gRPC AddServer. -func MakeGRPCServer(endpoints Endpoints, tracer stdopentracing.Tracer, logger log.Logger) pb.AddServer { +func MakeGRPCServer(ctx context.Context, endpoints Endpoints, tracer stdopentracing.Tracer, logger log.Logger) pb.AddServer { options := []grpctransport.ServerOption{ grpctransport.ServerErrorLogger(logger), } return &grpcServer{ sum: grpctransport.NewServer( + ctx, endpoints.SumEndpoint, DecodeGRPCSumRequest, EncodeGRPCSumResponse, append(options, grpctransport.ServerBefore(opentracing.FromGRPCRequest(tracer, "Sum", logger)))..., ), concat: grpctransport.NewServer( + ctx, endpoints.ConcatEndpoint, DecodeGRPCConcatRequest, EncodeGRPCConcatResponse, @@ -41,7 +41,7 @@ type grpcServer struct { concat grpctransport.Handler } -func (s *grpcServer) Sum(ctx oldcontext.Context, req *pb.SumRequest) (*pb.SumReply, error) { +func (s *grpcServer) Sum(ctx context.Context, req *pb.SumRequest) (*pb.SumReply, error) { _, rep, err := s.sum.ServeGRPC(ctx, req) if err != nil { return nil, err @@ -49,7 +49,7 @@ func (s *grpcServer) Sum(ctx oldcontext.Context, req *pb.SumRequest) (*pb.SumRep return rep.(*pb.SumReply), nil } -func (s *grpcServer) Concat(ctx oldcontext.Context, req *pb.ConcatRequest) (*pb.ConcatReply, error) { +func (s *grpcServer) Concat(ctx context.Context, req *pb.ConcatRequest) (*pb.ConcatReply, error) { _, rep, err := s.concat.ServeGRPC(ctx, req) if err != nil { return nil, err diff --git a/vendor/github.com/go-kit/kit/examples/addsvc/transport_http.go b/vendor/github.com/go-kit/kit/examples/addsvc/transport_http.go index 75a9b83..e2d8f6d 100644 --- a/vendor/github.com/go-kit/kit/examples/addsvc/transport_http.go +++ b/vendor/github.com/go-kit/kit/examples/addsvc/transport_http.go @@ -5,13 +5,13 @@ package addsvc import ( "bytes" - "context" "encoding/json" "errors" "io/ioutil" "net/http" stdopentracing "github.com/opentracing/opentracing-go" + "golang.org/x/net/context" "github.com/go-kit/kit/log" "github.com/go-kit/kit/tracing/opentracing" @@ -20,19 +20,21 @@ import ( // MakeHTTPHandler returns a handler that makes a set of endpoints available // on predefined paths. -func MakeHTTPHandler(endpoints Endpoints, tracer stdopentracing.Tracer, logger log.Logger) http.Handler { +func MakeHTTPHandler(ctx context.Context, endpoints Endpoints, tracer stdopentracing.Tracer, logger log.Logger) http.Handler { options := []httptransport.ServerOption{ httptransport.ServerErrorEncoder(errorEncoder), httptransport.ServerErrorLogger(logger), } m := http.NewServeMux() m.Handle("/sum", httptransport.NewServer( + ctx, endpoints.SumEndpoint, DecodeHTTPSumRequest, EncodeHTTPGenericResponse, append(options, httptransport.ServerBefore(opentracing.FromHTTPRequest(tracer, "Sum", logger)))..., )) m.Handle("/concat", httptransport.NewServer( + ctx, endpoints.ConcatEndpoint, DecodeHTTPConcatRequest, EncodeHTTPGenericResponse, @@ -45,9 +47,18 @@ func errorEncoder(_ context.Context, err error, w http.ResponseWriter) { code := http.StatusInternalServerError msg := err.Error() - switch err { - case ErrTwoZeroes, ErrMaxSizeExceeded, ErrIntOverflow: - code = http.StatusBadRequest + if e, ok := err.(httptransport.Error); ok { + msg = e.Err.Error() + switch e.Domain { + case httptransport.DomainDecode: + code = http.StatusBadRequest + + case httptransport.DomainDo: + switch e.Err { + case ErrTwoZeroes, ErrMaxSizeExceeded, ErrIntOverflow: + code = http.StatusBadRequest + } + } } w.WriteHeader(code) diff --git a/vendor/github.com/go-kit/kit/examples/addsvc/transport_thrift.go b/vendor/github.com/go-kit/kit/examples/addsvc/transport_thrift.go index 593cd31..23b1f1c 100644 --- a/vendor/github.com/go-kit/kit/examples/addsvc/transport_thrift.go +++ b/vendor/github.com/go-kit/kit/examples/addsvc/transport_thrift.go @@ -7,7 +7,7 @@ package addsvc // yet. See https://github.com/go-kit/kit/issues/184. import ( - "context" + "golang.org/x/net/context" "github.com/go-kit/kit/endpoint" thriftadd "github.com/go-kit/kit/examples/addsvc/thrift/gen-go/addsvc" diff --git a/vendor/github.com/go-kit/kit/examples/apigateway/main.go b/vendor/github.com/go-kit/kit/examples/apigateway/main.go index bedb368..01367ec 100644 --- a/vendor/github.com/go-kit/kit/examples/apigateway/main.go +++ b/vendor/github.com/go-kit/kit/examples/apigateway/main.go @@ -2,7 +2,6 @@ package main import ( "bytes" - "context" "encoding/json" "flag" "fmt" @@ -19,6 +18,7 @@ import ( "github.com/gorilla/mux" "github.com/hashicorp/consul/api" stdopentracing "github.com/opentracing/opentracing-go" + "golang.org/x/net/context" "github.com/go-kit/kit/endpoint" "github.com/go-kit/kit/examples/addsvc" @@ -44,8 +44,8 @@ func main() { var logger log.Logger { logger = log.NewLogfmtLogger(os.Stderr) - logger = log.With(logger, "ts", log.DefaultTimestampUTC) - logger = log.With(logger, "caller", log.DefaultCaller) + logger = log.NewContext(logger).With("ts", log.DefaultTimestampUTC) + logger = log.NewContext(logger).With("caller", log.DefaultCaller) } // Service discovery domain. In this example we use Consul. @@ -104,7 +104,7 @@ func main() { // HTTP handler, and just install it under a particular path prefix in // our router. - r.PathPrefix("/addsvc").Handler(http.StripPrefix("/addsvc", addsvc.MakeHTTPHandler(endpoints, tracer, logger))) + r.PathPrefix("addsvc/").Handler(addsvc.MakeHTTPHandler(ctx, endpoints, tracer, logger)) } // stringsvc routes. @@ -140,8 +140,8 @@ func main() { // have to do provide it with the encode and decode functions for our // stringsvc methods. - r.Handle("/stringsvc/uppercase", httptransport.NewServer(uppercase, decodeUppercaseRequest, encodeJSONResponse)) - r.Handle("/stringsvc/count", httptransport.NewServer(count, decodeCountRequest, encodeJSONResponse)) + r.Handle("/stringsvc/uppercase", httptransport.NewServer(ctx, uppercase, decodeUppercaseRequest, encodeJSONResponse)) + r.Handle("/stringsvc/count", httptransport.NewServer(ctx, count, decodeCountRequest, encodeJSONResponse)) } // Interrupt handler. diff --git a/vendor/github.com/go-kit/kit/examples/profilesvc/cmd/profilesvc/main.go b/vendor/github.com/go-kit/kit/examples/profilesvc/cmd/profilesvc/main.go index 58c5cdd..a340e69 100644 --- a/vendor/github.com/go-kit/kit/examples/profilesvc/cmd/profilesvc/main.go +++ b/vendor/github.com/go-kit/kit/examples/profilesvc/cmd/profilesvc/main.go @@ -1,4 +1,4 @@ -package main +package main import ( "flag" @@ -8,6 +8,8 @@ import ( "os/signal" "syscall" + "golang.org/x/net/context" + "github.com/go-kit/kit/examples/profilesvc" "github.com/go-kit/kit/log" ) @@ -21,8 +23,13 @@ func main() { var logger log.Logger { logger = log.NewLogfmtLogger(os.Stderr) - logger = log.With(logger, "ts", log.DefaultTimestampUTC) - logger = log.With(logger, "caller", log.DefaultCaller) + logger = log.NewContext(logger).With("ts", log.DefaultTimestampUTC) + logger = log.NewContext(logger).With("caller", log.DefaultCaller) + } + + var ctx context.Context + { + ctx = context.Background() } var s profilesvc.Service @@ -33,7 +40,7 @@ func main() { var h http.Handler { - h = profilesvc.MakeHTTPHandler(s, log.With(logger, "component", "HTTP")) + h = profilesvc.MakeHTTPHandler(ctx, s, log.NewContext(logger).With("component", "HTTP")) } errs := make(chan error) diff --git a/vendor/github.com/go-kit/kit/examples/profilesvc/endpoints.go b/vendor/github.com/go-kit/kit/examples/profilesvc/endpoints.go index 3da29b4..6dd129f 100644 --- a/vendor/github.com/go-kit/kit/examples/profilesvc/endpoints.go +++ b/vendor/github.com/go-kit/kit/examples/profilesvc/endpoints.go @@ -1,10 +1,11 @@ package profilesvc import ( - "context" "net/url" "strings" + "golang.org/x/net/context" + "github.com/go-kit/kit/endpoint" httptransport "github.com/go-kit/kit/transport/http" ) diff --git a/vendor/github.com/go-kit/kit/examples/profilesvc/middlewares.go b/vendor/github.com/go-kit/kit/examples/profilesvc/middlewares.go index 1b738f5..76708e5 100644 --- a/vendor/github.com/go-kit/kit/examples/profilesvc/middlewares.go +++ b/vendor/github.com/go-kit/kit/examples/profilesvc/middlewares.go @@ -1,9 +1,10 @@ package profilesvc import ( - "context" "time" + "golang.org/x/net/context" + "github.com/go-kit/kit/log" ) diff --git a/vendor/github.com/go-kit/kit/examples/profilesvc/service.go b/vendor/github.com/go-kit/kit/examples/profilesvc/service.go index cd34ecd..4ae6756 100644 --- a/vendor/github.com/go-kit/kit/examples/profilesvc/service.go +++ b/vendor/github.com/go-kit/kit/examples/profilesvc/service.go @@ -1,9 +1,10 @@ package profilesvc import ( - "context" "errors" "sync" + + "golang.org/x/net/context" ) // Service is a simple CRUD interface for user profiles. diff --git a/vendor/github.com/go-kit/kit/examples/profilesvc/transport.go b/vendor/github.com/go-kit/kit/examples/profilesvc/transport.go index a0136ee..aab78ab 100644 --- a/vendor/github.com/go-kit/kit/examples/profilesvc/transport.go +++ b/vendor/github.com/go-kit/kit/examples/profilesvc/transport.go @@ -4,14 +4,15 @@ package profilesvc import ( "bytes" - "context" "encoding/json" "errors" "io/ioutil" "net/http" + "net/url" "github.com/gorilla/mux" + "golang.org/x/net/context" "github.com/go-kit/kit/log" httptransport "github.com/go-kit/kit/transport/http" @@ -25,7 +26,7 @@ var ( // MakeHTTPHandler mounts all of the service endpoints into an http.Handler. // Useful in a profilesvc server. -func MakeHTTPHandler(s Service, logger log.Logger) http.Handler { +func MakeHTTPHandler(ctx context.Context, s Service, logger log.Logger) http.Handler { r := mux.NewRouter() e := MakeServerEndpoints(s) options := []httptransport.ServerOption{ @@ -44,54 +45,63 @@ func MakeHTTPHandler(s Service, logger log.Logger) http.Handler { // DELETE /profiles/:id/addresses/:addressID remove an address r.Methods("POST").Path("/profiles/").Handler(httptransport.NewServer( + ctx, e.PostProfileEndpoint, decodePostProfileRequest, encodeResponse, options..., )) r.Methods("GET").Path("/profiles/{id}").Handler(httptransport.NewServer( + ctx, e.GetProfileEndpoint, decodeGetProfileRequest, encodeResponse, options..., )) r.Methods("PUT").Path("/profiles/{id}").Handler(httptransport.NewServer( + ctx, e.PutProfileEndpoint, decodePutProfileRequest, encodeResponse, options..., )) r.Methods("PATCH").Path("/profiles/{id}").Handler(httptransport.NewServer( + ctx, e.PatchProfileEndpoint, decodePatchProfileRequest, encodeResponse, options..., )) r.Methods("DELETE").Path("/profiles/{id}").Handler(httptransport.NewServer( + ctx, e.DeleteProfileEndpoint, decodeDeleteProfileRequest, encodeResponse, options..., )) r.Methods("GET").Path("/profiles/{id}/addresses/").Handler(httptransport.NewServer( + ctx, e.GetAddressesEndpoint, decodeGetAddressesRequest, encodeResponse, options..., )) r.Methods("GET").Path("/profiles/{id}/addresses/{addressID}").Handler(httptransport.NewServer( + ctx, e.GetAddressEndpoint, decodeGetAddressRequest, encodeResponse, options..., )) r.Methods("POST").Path("/profiles/{id}/addresses/").Handler(httptransport.NewServer( + ctx, e.PostAddressEndpoint, decodePostAddressRequest, encodeResponse, options..., )) r.Methods("DELETE").Path("/profiles/{id}/addresses/{addressID}").Handler(httptransport.NewServer( + ctx, e.DeleteAddressEndpoint, decodeDeleteAddressRequest, encodeResponse, @@ -395,6 +405,16 @@ func codeFrom(err error) int { case ErrAlreadyExists, ErrInconsistentIDs: return http.StatusBadRequest default: + if e, ok := err.(httptransport.Error); ok { + switch e.Domain { + case httptransport.DomainDecode: + return http.StatusBadRequest + case httptransport.DomainDo: + return http.StatusServiceUnavailable + default: + return http.StatusInternalServerError + } + } return http.StatusInternalServerError } } diff --git a/vendor/github.com/go-kit/kit/examples/shipping/booking/endpoint.go b/vendor/github.com/go-kit/kit/examples/shipping/booking/endpoint.go index abe83f7..fe74955 100644 --- a/vendor/github.com/go-kit/kit/examples/shipping/booking/endpoint.go +++ b/vendor/github.com/go-kit/kit/examples/shipping/booking/endpoint.go @@ -1,9 +1,10 @@ package booking import ( - "context" "time" + "golang.org/x/net/context" + "github.com/go-kit/kit/endpoint" "github.com/go-kit/kit/examples/shipping/cargo" @@ -42,10 +43,10 @@ type loadCargoResponse struct { func (r loadCargoResponse) error() error { return r.Err } -func makeLoadCargoEndpoint(s Service) endpoint.Endpoint { +func makeLoadCargoEndpoint(bs Service) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (interface{}, error) { req := request.(loadCargoRequest) - c, err := s.LoadCargo(req.ID) + c, err := bs.LoadCargo(req.ID) return loadCargoResponse{Cargo: &c, Err: err}, nil } } diff --git a/vendor/github.com/go-kit/kit/examples/shipping/booking/transport.go b/vendor/github.com/go-kit/kit/examples/shipping/booking/transport.go index 6592a9d..e445773 100644 --- a/vendor/github.com/go-kit/kit/examples/shipping/booking/transport.go +++ b/vendor/github.com/go-kit/kit/examples/shipping/booking/transport.go @@ -1,13 +1,13 @@ package booking import ( - "context" "encoding/json" "errors" "net/http" "time" "github.com/gorilla/mux" + "golang.org/x/net/context" kitlog "github.com/go-kit/kit/log" kithttp "github.com/go-kit/kit/transport/http" @@ -17,49 +17,56 @@ import ( ) // MakeHandler returns a handler for the booking service. -func MakeHandler(bs Service, logger kitlog.Logger) http.Handler { +func MakeHandler(ctx context.Context, bs Service, logger kitlog.Logger) http.Handler { opts := []kithttp.ServerOption{ kithttp.ServerErrorLogger(logger), kithttp.ServerErrorEncoder(encodeError), } bookCargoHandler := kithttp.NewServer( + ctx, makeBookCargoEndpoint(bs), decodeBookCargoRequest, encodeResponse, opts..., ) loadCargoHandler := kithttp.NewServer( + ctx, makeLoadCargoEndpoint(bs), decodeLoadCargoRequest, encodeResponse, opts..., ) requestRoutesHandler := kithttp.NewServer( + ctx, makeRequestRoutesEndpoint(bs), decodeRequestRoutesRequest, encodeResponse, opts..., ) assignToRouteHandler := kithttp.NewServer( + ctx, makeAssignToRouteEndpoint(bs), decodeAssignToRouteRequest, encodeResponse, opts..., ) changeDestinationHandler := kithttp.NewServer( + ctx, makeChangeDestinationEndpoint(bs), decodeChangeDestinationRequest, encodeResponse, opts..., ) listCargosHandler := kithttp.NewServer( + ctx, makeListCargosEndpoint(bs), decodeListCargosRequest, encodeResponse, opts..., ) listLocationsHandler := kithttp.NewServer( + ctx, makeListLocationsEndpoint(bs), decodeListLocationsRequest, encodeResponse, diff --git a/vendor/github.com/go-kit/kit/examples/shipping/handling/endpoint.go b/vendor/github.com/go-kit/kit/examples/shipping/handling/endpoint.go index 555d087..0ee3f22 100644 --- a/vendor/github.com/go-kit/kit/examples/shipping/handling/endpoint.go +++ b/vendor/github.com/go-kit/kit/examples/shipping/handling/endpoint.go @@ -1,9 +1,10 @@ package handling import ( - "context" "time" + "golang.org/x/net/context" + "github.com/go-kit/kit/endpoint" "github.com/go-kit/kit/examples/shipping/cargo" diff --git a/vendor/github.com/go-kit/kit/examples/shipping/handling/transport.go b/vendor/github.com/go-kit/kit/examples/shipping/handling/transport.go index 065bda1..e5d2c44 100644 --- a/vendor/github.com/go-kit/kit/examples/shipping/handling/transport.go +++ b/vendor/github.com/go-kit/kit/examples/shipping/handling/transport.go @@ -1,12 +1,12 @@ package handling import ( - "context" "encoding/json" "net/http" "time" "github.com/gorilla/mux" + "golang.org/x/net/context" kitlog "github.com/go-kit/kit/log" kithttp "github.com/go-kit/kit/transport/http" @@ -17,7 +17,7 @@ import ( ) // MakeHandler returns a handler for the handling service. -func MakeHandler(hs Service, logger kitlog.Logger) http.Handler { +func MakeHandler(ctx context.Context, hs Service, logger kitlog.Logger) http.Handler { r := mux.NewRouter() opts := []kithttp.ServerOption{ @@ -26,6 +26,7 @@ func MakeHandler(hs Service, logger kitlog.Logger) http.Handler { } registerIncidentHandler := kithttp.NewServer( + ctx, makeRegisterIncidentEndpoint(hs), decodeRegisterIncidentRequest, encodeResponse, diff --git a/vendor/github.com/go-kit/kit/examples/shipping/inspection/inspection.go b/vendor/github.com/go-kit/kit/examples/shipping/inspection/inspection.go index 2ebf73d..91cceb0 100644 --- a/vendor/github.com/go-kit/kit/examples/shipping/inspection/inspection.go +++ b/vendor/github.com/go-kit/kit/examples/shipping/inspection/inspection.go @@ -1,9 +1,7 @@ // Package inspection provides means to inspect cargos. package inspection -import ( - "github.com/go-kit/kit/examples/shipping/cargo" -) +import "github.com/go-kit/kit/examples/shipping/cargo" // EventHandler provides means of subscribing to inspection events. type EventHandler interface { diff --git a/vendor/github.com/go-kit/kit/examples/shipping/location/location.go b/vendor/github.com/go-kit/kit/examples/shipping/location/location.go index ee2e5d4..4a9d2f9 100644 --- a/vendor/github.com/go-kit/kit/examples/shipping/location/location.go +++ b/vendor/github.com/go-kit/kit/examples/shipping/location/location.go @@ -1,9 +1,7 @@ // Package location provides the Location aggregate. package location -import ( - "errors" -) +import "errors" // UNLocode is the United Nations location code that uniquely identifies a // particular location. diff --git a/vendor/github.com/go-kit/kit/examples/shipping/main.go b/vendor/github.com/go-kit/kit/examples/shipping/main.go index a4b42f7..4fbcd94 100644 --- a/vendor/github.com/go-kit/kit/examples/shipping/main.go +++ b/vendor/github.com/go-kit/kit/examples/shipping/main.go @@ -1,7 +1,6 @@ package main import ( - "context" "flag" "fmt" "net/http" @@ -12,6 +11,7 @@ import ( "time" stdprometheus "github.com/prometheus/client_golang/prometheus" + "golang.org/x/net/context" "github.com/go-kit/kit/log" kitprometheus "github.com/go-kit/kit/metrics/prometheus" @@ -47,7 +47,7 @@ func main() { var logger log.Logger logger = log.NewLogfmtLogger(os.Stderr) logger = &serializedLogger{Logger: logger} - logger = log.With(logger, "ts", log.DefaultTimestampUTC) + logger = log.NewContext(logger).With("ts", log.DefaultTimestampUTC) var ( cargos = inmem.NewCargoRepository() @@ -78,7 +78,7 @@ func main() { var bs booking.Service bs = booking.NewService(cargos, locations, handlingEvents, rs) - bs = booking.NewLoggingService(log.With(logger, "component", "booking"), bs) + bs = booking.NewLoggingService(log.NewContext(logger).With("component", "booking"), bs) bs = booking.NewInstrumentingService( kitprometheus.NewCounterFrom(stdprometheus.CounterOpts{ Namespace: "api", @@ -97,7 +97,7 @@ func main() { var ts tracking.Service ts = tracking.NewService(cargos, handlingEvents) - ts = tracking.NewLoggingService(log.With(logger, "component", "tracking"), ts) + ts = tracking.NewLoggingService(log.NewContext(logger).With("component", "tracking"), ts) ts = tracking.NewInstrumentingService( kitprometheus.NewCounterFrom(stdprometheus.CounterOpts{ Namespace: "api", @@ -116,7 +116,7 @@ func main() { var hs handling.Service hs = handling.NewService(handlingEvents, handlingEventFactory, handlingEventHandler) - hs = handling.NewLoggingService(log.With(logger, "component", "handling"), hs) + hs = handling.NewLoggingService(log.NewContext(logger).With("component", "handling"), hs) hs = handling.NewInstrumentingService( kitprometheus.NewCounterFrom(stdprometheus.CounterOpts{ Namespace: "api", @@ -133,13 +133,13 @@ func main() { hs, ) - httpLogger := log.With(logger, "component", "http") + httpLogger := log.NewContext(logger).With("component", "http") mux := http.NewServeMux() - mux.Handle("/booking/v1/", booking.MakeHandler(bs, httpLogger)) - mux.Handle("/tracking/v1/", tracking.MakeHandler(ts, httpLogger)) - mux.Handle("/handling/v1/", handling.MakeHandler(hs, httpLogger)) + mux.Handle("/booking/v1/", booking.MakeHandler(ctx, bs, httpLogger)) + mux.Handle("/tracking/v1/", tracking.MakeHandler(ctx, ts, httpLogger)) + mux.Handle("/handling/v1/", handling.MakeHandler(ctx, hs, httpLogger)) http.Handle("/", accessControl(mux)) http.Handle("/metrics", stdprometheus.Handler()) diff --git a/vendor/github.com/go-kit/kit/examples/shipping/routing/proxying.go b/vendor/github.com/go-kit/kit/examples/shipping/routing/proxying.go index 0c9150b..a53f265 100644 --- a/vendor/github.com/go-kit/kit/examples/shipping/routing/proxying.go +++ b/vendor/github.com/go-kit/kit/examples/shipping/routing/proxying.go @@ -1,12 +1,13 @@ package routing import ( - "context" "encoding/json" "net/http" "net/url" "time" + "golang.org/x/net/context" + "github.com/go-kit/kit/circuitbreaker" "github.com/go-kit/kit/endpoint" kithttp "github.com/go-kit/kit/transport/http" diff --git a/vendor/github.com/go-kit/kit/examples/shipping/routing/routing.go b/vendor/github.com/go-kit/kit/examples/shipping/routing/routing.go index 50496f2..dac3690 100644 --- a/vendor/github.com/go-kit/kit/examples/shipping/routing/routing.go +++ b/vendor/github.com/go-kit/kit/examples/shipping/routing/routing.go @@ -3,9 +3,7 @@ // bounded context. package routing -import ( - "github.com/go-kit/kit/examples/shipping/cargo" -) +import "github.com/go-kit/kit/examples/shipping/cargo" // Service provides access to an external routing service. type Service interface { diff --git a/vendor/github.com/go-kit/kit/examples/shipping/tracking/endpoint.go b/vendor/github.com/go-kit/kit/examples/shipping/tracking/endpoint.go index ddb1317..ea105d5 100644 --- a/vendor/github.com/go-kit/kit/examples/shipping/tracking/endpoint.go +++ b/vendor/github.com/go-kit/kit/examples/shipping/tracking/endpoint.go @@ -1,7 +1,7 @@ package tracking import ( - "context" + "golang.org/x/net/context" "github.com/go-kit/kit/endpoint" ) diff --git a/vendor/github.com/go-kit/kit/examples/shipping/tracking/transport.go b/vendor/github.com/go-kit/kit/examples/shipping/tracking/transport.go index 13d17f2..3cdb9b1 100644 --- a/vendor/github.com/go-kit/kit/examples/shipping/tracking/transport.go +++ b/vendor/github.com/go-kit/kit/examples/shipping/tracking/transport.go @@ -1,12 +1,12 @@ package tracking import ( - "context" "encoding/json" "errors" "net/http" "github.com/gorilla/mux" + "golang.org/x/net/context" kitlog "github.com/go-kit/kit/log" kithttp "github.com/go-kit/kit/transport/http" @@ -15,7 +15,7 @@ import ( ) // MakeHandler returns a handler for the tracking service. -func MakeHandler(ts Service, logger kitlog.Logger) http.Handler { +func MakeHandler(ctx context.Context, ts Service, logger kitlog.Logger) http.Handler { r := mux.NewRouter() opts := []kithttp.ServerOption{ @@ -24,6 +24,7 @@ func MakeHandler(ts Service, logger kitlog.Logger) http.Handler { } trackCargoHandler := kithttp.NewServer( + ctx, makeTrackCargoEndpoint(ts), decodeTrackCargoRequest, encodeResponse, diff --git a/vendor/github.com/go-kit/kit/examples/stringsvc1/main.go b/vendor/github.com/go-kit/kit/examples/stringsvc1/main.go index 03fc793..876eb9c 100644 --- a/vendor/github.com/go-kit/kit/examples/stringsvc1/main.go +++ b/vendor/github.com/go-kit/kit/examples/stringsvc1/main.go @@ -1,13 +1,14 @@ package main import ( - "context" "encoding/json" "errors" "log" "net/http" "strings" + "golang.org/x/net/context" + "github.com/go-kit/kit/endpoint" httptransport "github.com/go-kit/kit/transport/http" ) @@ -32,15 +33,18 @@ func (stringService) Count(s string) int { } func main() { + ctx := context.Background() svc := stringService{} uppercaseHandler := httptransport.NewServer( + ctx, makeUppercaseEndpoint(svc), decodeUppercaseRequest, encodeResponse, ) countHandler := httptransport.NewServer( + ctx, makeCountEndpoint(svc), decodeCountRequest, encodeResponse, diff --git a/vendor/github.com/go-kit/kit/examples/stringsvc2/main.go b/vendor/github.com/go-kit/kit/examples/stringsvc2/main.go index d67d2a5..bdcc17d 100644 --- a/vendor/github.com/go-kit/kit/examples/stringsvc2/main.go +++ b/vendor/github.com/go-kit/kit/examples/stringsvc2/main.go @@ -5,6 +5,7 @@ import ( "os" stdprometheus "github.com/prometheus/client_golang/prometheus" + "golang.org/x/net/context" "github.com/go-kit/kit/log" kitprometheus "github.com/go-kit/kit/metrics/prometheus" @@ -12,6 +13,7 @@ import ( ) func main() { + ctx := context.Background() logger := log.NewLogfmtLogger(os.Stderr) fieldKeys := []string{"method", "error"} @@ -40,12 +42,14 @@ func main() { svc = instrumentingMiddleware{requestCount, requestLatency, countResult, svc} uppercaseHandler := httptransport.NewServer( + ctx, makeUppercaseEndpoint(svc), decodeUppercaseRequest, encodeResponse, ) countHandler := httptransport.NewServer( + ctx, makeCountEndpoint(svc), decodeCountRequest, encodeResponse, diff --git a/vendor/github.com/go-kit/kit/examples/stringsvc2/transport.go b/vendor/github.com/go-kit/kit/examples/stringsvc2/transport.go index 297b3ff..a70ad3f 100644 --- a/vendor/github.com/go-kit/kit/examples/stringsvc2/transport.go +++ b/vendor/github.com/go-kit/kit/examples/stringsvc2/transport.go @@ -1,10 +1,11 @@ package main import ( - "context" "encoding/json" "net/http" + "golang.org/x/net/context" + "github.com/go-kit/kit/endpoint" ) diff --git a/vendor/github.com/go-kit/kit/examples/stringsvc3/main.go b/vendor/github.com/go-kit/kit/examples/stringsvc3/main.go index 0e2b6b7..b9b4e89 100644 --- a/vendor/github.com/go-kit/kit/examples/stringsvc3/main.go +++ b/vendor/github.com/go-kit/kit/examples/stringsvc3/main.go @@ -1,12 +1,12 @@ package main import ( - "context" "flag" "net/http" "os" stdprometheus "github.com/prometheus/client_golang/prometheus" + "golang.org/x/net/context" "github.com/go-kit/kit/log" kitprometheus "github.com/go-kit/kit/metrics/prometheus" @@ -22,7 +22,9 @@ func main() { var logger log.Logger logger = log.NewLogfmtLogger(os.Stderr) - logger = log.With(logger, "listen", *listen, "caller", log.DefaultCaller) + logger = log.NewContext(logger).With("listen", *listen).With("caller", log.DefaultCaller) + + ctx := context.Background() fieldKeys := []string{"method", "error"} requestCount := kitprometheus.NewCounterFrom(stdprometheus.CounterOpts{ @@ -46,16 +48,18 @@ func main() { var svc StringService svc = stringService{} - svc = proxyingMiddleware(context.Background(), *proxy, logger)(svc) + svc = proxyingMiddleware(*proxy, ctx, logger)(svc) svc = loggingMiddleware(logger)(svc) svc = instrumentingMiddleware(requestCount, requestLatency, countResult)(svc) uppercaseHandler := httptransport.NewServer( + ctx, makeUppercaseEndpoint(svc), decodeUppercaseRequest, encodeResponse, ) countHandler := httptransport.NewServer( + ctx, makeCountEndpoint(svc), decodeCountRequest, encodeResponse, diff --git a/vendor/github.com/go-kit/kit/examples/stringsvc3/proxying.go b/vendor/github.com/go-kit/kit/examples/stringsvc3/proxying.go index 8d67d38..33bc156 100644 --- a/vendor/github.com/go-kit/kit/examples/stringsvc3/proxying.go +++ b/vendor/github.com/go-kit/kit/examples/stringsvc3/proxying.go @@ -1,7 +1,6 @@ package main import ( - "context" "errors" "fmt" "net/url" @@ -10,6 +9,7 @@ import ( jujuratelimit "github.com/juju/ratelimit" "github.com/sony/gobreaker" + "golang.org/x/net/context" "github.com/go-kit/kit/circuitbreaker" "github.com/go-kit/kit/endpoint" @@ -20,7 +20,7 @@ import ( httptransport "github.com/go-kit/kit/transport/http" ) -func proxyingMiddleware(ctx context.Context, instances string, logger log.Logger) ServiceMiddleware { +func proxyingMiddleware(instances string, ctx context.Context, logger log.Logger) ServiceMiddleware { // If instances is empty, don't proxy. if instances == "" { logger.Log("proxy_to", "none") diff --git a/vendor/github.com/go-kit/kit/examples/stringsvc3/transport.go b/vendor/github.com/go-kit/kit/examples/stringsvc3/transport.go index c17a055..c6341c1 100644 --- a/vendor/github.com/go-kit/kit/examples/stringsvc3/transport.go +++ b/vendor/github.com/go-kit/kit/examples/stringsvc3/transport.go @@ -2,11 +2,12 @@ package main import ( "bytes" - "context" "encoding/json" "io/ioutil" "net/http" + "golang.org/x/net/context" + "github.com/go-kit/kit/endpoint" ) diff --git a/vendor/github.com/go-kit/kit/log/README.md b/vendor/github.com/go-kit/kit/log/README.md index 7222f80..2763f7f 100644 --- a/vendor/github.com/go-kit/kit/log/README.md +++ b/vendor/github.com/go-kit/kit/log/README.md @@ -1,22 +1,20 @@ # package log `package log` provides a minimal interface for structured logging in services. -It may be wrapped to encode conventions, enforce type-safety, provide leveled -logging, and so on. It can be used for both typical application log events, -and log-structured data streams. +It may be wrapped to encode conventions, enforce type-safety, provide leveled logging, and so on. +It can be used for both typical application log events, and log-structured data streams. ## Structured logging -Structured logging is, basically, conceding to the reality that logs are -_data_, and warrant some level of schematic rigor. Using a stricter, -key/value-oriented message format for our logs, containing contextual and -semantic information, makes it much easier to get insight into the -operational activity of the systems we build. Consequently, `package log` is -of the strong belief that "[the benefits of structured logging outweigh the -minimal effort involved](https://www.thoughtworks.com/radar/techniques/structured-logging)". +Structured logging is, basically, conceding to the reality that logs are _data_, + and warrant some level of schematic rigor. +Using a stricter, key/value-oriented message format for our logs, + containing contextual and semantic information, + makes it much easier to get insight into the operational activity of the systems we build. +Consequently, `package log` is of the strong belief that + "[the benefits of structured logging outweigh the minimal effort involved](https://www.thoughtworks.com/radar/techniques/structured-logging)". -Migrating from unstructured to structured logging is probably a lot easier -than you'd expect. +Migrating from unstructured to structured logging is probably a lot easier than you'd expect. ```go // Unstructured @@ -39,17 +37,17 @@ logger.Log("question", "what is the meaning of life?", "answer", 42) // question="what is the meaning of life?" answer=42 ``` -### Contextual Loggers +### Log contexts ```go func main() { var logger log.Logger logger = log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr)) - logger = log.With(logger, "instance_id", 123) + logger = log.NewContext(logger).With("instance_id", 123) logger.Log("msg", "starting") - NewWorker(log.With(logger, "component", "worker")).Run() - NewSlacker(log.With(logger, "component", "slacker")).Run() + NewWorker(log.NewContext(logger).With("component", "worker")).Run() + NewSlacker(log.NewContext(logger).With("component", "slacker")).Run() } // Output: @@ -79,8 +77,9 @@ func main() { // {"msg":"I sure like pie","ts":"2016/01/01 12:34:56"} ``` -Or, if, for legacy reasons, you need to pipe all of your logging through the -stdlib log package, you can redirect Go kit logger to the stdlib logger. +Or, if, for legacy reasons, + you need to pipe all of your logging through the stdlib log package, + you can redirect Go kit logger to the stdlib logger. ```go logger := kitlog.NewLogfmtLogger(kitlog.StdlibWriter{}) @@ -95,7 +94,7 @@ logger.Log("legacy", true, "msg", "at least it's something") ```go var logger log.Logger logger = log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr)) -logger = log.With(logger, "ts", log.DefaultTimestampUTC, "caller", log.DefaultCaller) +logger = log.NewContext(logger).With("ts", log.DefaultTimestampUTC, "caller", log.DefaultCaller) logger.Log("msg", "hello") @@ -105,7 +104,7 @@ logger.Log("msg", "hello") ## Supported output formats -- [Logfmt](https://brandur.org/logfmt) ([see also](https://blog.codeship.com/logfmt-a-log-format-thats-easy-to-read-and-write)) +- [Logfmt](https://brandur.org/logfmt) - JSON ## Enhancements @@ -118,25 +117,27 @@ type Logger interface { } ``` -This interface, and its supporting code like is the product of much iteration -and evaluation. For more details on the evolution of the Logger interface, -see [The Hunt for a Logger Interface](http://go-talks.appspot.com/github.com/ChrisHines/talks/structured-logging/structured-logging.slide#1), -a talk by [Chris Hines](https://github.com/ChrisHines). +This interface, and its supporting code like [log.Context](https://godoc.org/github.com/go-kit/kit/log#Context), + is the product of much iteration and evaluation. +For more details on the evolution of the Logger interface, + see [The Hunt for a Logger Interface](http://go-talks.appspot.com/github.com/ChrisHines/talks/structured-logging/structured-logging.slide#1), + a talk by [Chris Hines](https://github.com/ChrisHines). Also, please see -[#63](https://github.com/go-kit/kit/issues/63), -[#76](https://github.com/go-kit/kit/pull/76), -[#131](https://github.com/go-kit/kit/issues/131), -[#157](https://github.com/go-kit/kit/pull/157), -[#164](https://github.com/go-kit/kit/issues/164), and -[#252](https://github.com/go-kit/kit/pull/252) -to review historical conversations about package log and the Logger interface. + [#63](https://github.com/go-kit/kit/issues/63), + [#76](https://github.com/go-kit/kit/pull/76), + [#131](https://github.com/go-kit/kit/issues/131), + [#157](https://github.com/go-kit/kit/pull/157), + [#164](https://github.com/go-kit/kit/issues/164), and + [#252](https://github.com/go-kit/kit/pull/252) + to review historical conversations about package log and the Logger interface. Value-add packages and suggestions, -like improvements to [the leveled logger](https://godoc.org/github.com/go-kit/kit/log/level), -are of course welcome. Good proposals should + like improvements to [the leveled logger](https://godoc.org/github.com/go-kit/kit/log/levels), + are of course welcome. +Good proposals should -- Be composable with [contextual loggers](https://godoc.org/github.com/go-kit/kit/log#With), -- Not break the behavior of [log.Caller](https://godoc.org/github.com/go-kit/kit/log#Caller) in any wrapped contextual loggers, and +- Be composable with [log.Context](https://godoc.org/github.com/go-kit/kit/log#Context), +- Not break the behavior of [log.Caller](https://godoc.org/github.com/go-kit/kit/log#Caller) in any wrapped context, and - Be friendly to packages that accept only an unadorned log.Logger. ## Benchmarks & comparisons diff --git a/vendor/github.com/go-kit/kit/log/benchmark_test.go b/vendor/github.com/go-kit/kit/log/benchmark_test.go index 126bfa5..d3695b8 100644 --- a/vendor/github.com/go-kit/kit/log/benchmark_test.go +++ b/vendor/github.com/go-kit/kit/log/benchmark_test.go @@ -7,7 +7,7 @@ import ( ) func benchmarkRunner(b *testing.B, logger log.Logger, f func(log.Logger)) { - lc := log.With(logger, "common_key", "common_value") + lc := log.NewContext(logger).With("common_key", "common_value") b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { @@ -17,5 +17,5 @@ func benchmarkRunner(b *testing.B, logger log.Logger, f func(log.Logger)) { var ( baseMessage = func(logger log.Logger) { logger.Log("foo_key", "foo_value") } - withMessage = func(logger log.Logger) { log.With(logger, "a", "b").Log("c", "d") } + withMessage = func(logger log.Logger) { log.NewContext(logger).With("a", "b").Log("c", "d") } ) diff --git a/vendor/github.com/go-kit/kit/log/doc.go b/vendor/github.com/go-kit/kit/log/doc.go index 918c0af..49d3f18 100644 --- a/vendor/github.com/go-kit/kit/log/doc.go +++ b/vendor/github.com/go-kit/kit/log/doc.go @@ -35,15 +35,14 @@ // idea to log simple values without formatting them. This practice allows // the chosen logger to encode values in the most appropriate way. // -// Contextual Loggers +// Log Context // -// A contextual logger stores keyvals that it includes in all log events. -// Building appropriate contextual loggers reduces repetition and aids -// consistency in the resulting log output. With and WithPrefix add context to -// a logger. We can use With to improve the RunTask example. +// A log context stores keyvals that it includes in all log events. Building +// appropriate log contexts reduces repetition and aids consistency in the +// resulting log output. We can use a context to improve the RunTask example. // // func RunTask(task Task, logger log.Logger) string { -// logger = log.With(logger, "taskID", task.ID) +// logger = log.NewContext(logger).With("taskID", task.ID) // logger.Log("event", "starting task") // ... // taskHelper(task.Cmd, logger) @@ -52,18 +51,19 @@ // } // // The improved version emits the same log events as the original for the -// first and last calls to Log. Passing the contextual logger to taskHelper -// enables each log event created by taskHelper to include the task.ID even -// though taskHelper does not have access to that value. Using contextual -// loggers this way simplifies producing log output that enables tracing the -// life cycle of individual tasks. (See the Contextual example for the full -// code of the above snippet.) +// first and last calls to Log. The call to taskHelper highlights that a +// context may be passed as a logger to other functions. Each log event +// created by the called function will include the task.ID even though the +// function does not have access to that value. Using log contexts this way +// simplifies producing log output that enables tracing the life cycle of +// individual tasks. (See the Context example for the full code of the +// above snippet.) // -// Dynamic Contextual Values +// Dynamic Context Values // -// A Valuer function stored in a contextual logger generates a new value each -// time an event is logged. The Valuer example demonstrates how this feature -// works. +// A Valuer function stored in a log context generates a new value each time +// the context logs an event. The Valuer example demonstrates how this +// feature works. // // Valuers provide the basis for consistently logging timestamps and source // code location. The log package defines several valuers for that purpose. @@ -72,7 +72,7 @@ // entries contain a timestamp and source location looks like this: // // logger := log.NewLogfmtLogger(log.NewSyncWriter(os.Stdout)) -// logger = log.With(logger, "ts", log.DefaultTimestampUTC, "caller", log.DefaultCaller) +// logger = log.NewContext(logger).With("ts", log.DefaultTimestampUTC, "caller", log.DefaultCaller) // // Concurrent Safety // @@ -90,27 +90,4 @@ // handled atomically within the wrapped logger, but it typically serializes // both the formatting and output logic. Use a SyncLogger if the formatting // logger may perform multiple writes per log event. -// -// Error Handling -// -// This package relies on the practice of wrapping or decorating loggers with -// other loggers to provide composable pieces of functionality. It also means -// that Logger.Log must return an error because some -// implementations—especially those that output log data to an io.Writer—may -// encounter errors that cannot be handled locally. This in turn means that -// Loggers that wrap other loggers should return errors from the wrapped -// logger up the stack. -// -// Fortunately, the decorator pattern also provides a way to avoid the -// necessity to check for errors every time an application calls Logger.Log. -// An application required to panic whenever its Logger encounters -// an error could initialize its logger as follows. -// -// fmtlogger := log.NewLogfmtLogger(log.NewSyncWriter(os.Stdout)) -// logger := log.LoggerFunc(func(keyvals ...interface{}) error { -// if err := fmtlogger.Log(keyvals...); err != nil { -// panic(err) -// } -// return nil -// }) package log diff --git a/vendor/github.com/go-kit/kit/log/example_test.go b/vendor/github.com/go-kit/kit/log/example_test.go index 9766774..b07ef8e 100644 --- a/vendor/github.com/go-kit/kit/log/example_test.go +++ b/vendor/github.com/go-kit/kit/log/example_test.go @@ -1,9 +1,7 @@ package log_test import ( - "math/rand" "os" - "sync" "time" "github.com/go-kit/kit/log" @@ -29,7 +27,7 @@ func Example_basic() { // taskID=1 event="task complete" } -func Example_contextual() { +func Example_context() { logger := log.NewLogfmtLogger(os.Stdout) type Task struct { @@ -43,7 +41,7 @@ func Example_contextual() { } RunTask := func(task Task, logger log.Logger) { - logger = log.With(logger, "taskID", task.ID) + logger = log.NewContext(logger).With("taskID", task.ID) logger.Log("event", "starting task") taskHelper(task.Cmd, logger) @@ -68,7 +66,7 @@ func Example_valuer() { return count } - logger = log.With(logger, "count", log.Valuer(counter)) + logger = log.NewContext(logger).With("count", log.Valuer(counter)) logger.Log("call", "first") logger.Log("call", "second") @@ -88,7 +86,7 @@ func Example_debugInfo() { return baseTime } - logger = log.With(logger, "time", log.Timestamp(mockTime), "caller", log.DefaultCaller) + logger = log.NewContext(logger).With("time", log.Timestamp(mockTime), "caller", log.DefaultCaller) logger.Log("call", "first") logger.Log("call", "second") @@ -98,40 +96,7 @@ func Example_debugInfo() { logger.Log("call", "third") // Output: - // time=2015-02-03T10:00:01Z caller=example_test.go:93 call=first - // time=2015-02-03T10:00:02Z caller=example_test.go:94 call=second - // time=2015-02-03T10:00:03Z caller=example_test.go:98 call=third -} - -func Example_syncWriter() { - w := log.NewSyncWriter(os.Stdout) - logger := log.NewLogfmtLogger(w) - - type Task struct { - ID int - } - - var wg sync.WaitGroup - - RunTask := func(task Task, logger log.Logger) { - logger.Log("taskID", task.ID, "event", "starting task") - - time.Sleep(time.Duration(rand.Intn(200)) * time.Millisecond) - - logger.Log("taskID", task.ID, "event", "task complete") - wg.Done() - } - - wg.Add(2) - - go RunTask(Task{ID: 1}, logger) - go RunTask(Task{ID: 2}, logger) - - wg.Wait() - - // Unordered output: - // taskID=1 event="starting task" - // taskID=2 event="starting task" - // taskID=1 event="task complete" - // taskID=2 event="task complete" + // time=2015-02-03T10:00:01Z caller=example_test.go:91 call=first + // time=2015-02-03T10:00:02Z caller=example_test.go:92 call=second + // time=2015-02-03T10:00:03Z caller=example_test.go:96 call=third } diff --git a/vendor/github.com/go-kit/kit/log/experimental_level/benchmark_test.go b/vendor/github.com/go-kit/kit/log/experimental_level/benchmark_test.go new file mode 100644 index 0000000..176af24 --- /dev/null +++ b/vendor/github.com/go-kit/kit/log/experimental_level/benchmark_test.go @@ -0,0 +1,65 @@ +package level_test + +import ( + "io/ioutil" + "testing" + + "github.com/go-kit/kit/log" + "github.com/go-kit/kit/log/experimental_level" +) + +func BenchmarkNopBaseline(b *testing.B) { + benchmarkRunner(b, log.NewNopLogger()) +} + +func BenchmarkNopDisallowedLevel(b *testing.B) { + benchmarkRunner(b, level.New(log.NewNopLogger(), level.Config{ + Allowed: level.AllowInfoAndAbove(), + })) +} + +func BenchmarkNopAllowedLevel(b *testing.B) { + benchmarkRunner(b, level.New(log.NewNopLogger(), level.Config{ + Allowed: level.AllowAll(), + })) +} + +func BenchmarkJSONBaseline(b *testing.B) { + benchmarkRunner(b, log.NewJSONLogger(ioutil.Discard)) +} + +func BenchmarkJSONDisallowedLevel(b *testing.B) { + benchmarkRunner(b, level.New(log.NewJSONLogger(ioutil.Discard), level.Config{ + Allowed: level.AllowInfoAndAbove(), + })) +} + +func BenchmarkJSONAllowedLevel(b *testing.B) { + benchmarkRunner(b, level.New(log.NewJSONLogger(ioutil.Discard), level.Config{ + Allowed: level.AllowAll(), + })) +} + +func BenchmarkLogfmtBaseline(b *testing.B) { + benchmarkRunner(b, log.NewLogfmtLogger(ioutil.Discard)) +} + +func BenchmarkLogfmtDisallowedLevel(b *testing.B) { + benchmarkRunner(b, level.New(log.NewLogfmtLogger(ioutil.Discard), level.Config{ + Allowed: level.AllowInfoAndAbove(), + })) +} + +func BenchmarkLogfmtAllowedLevel(b *testing.B) { + benchmarkRunner(b, level.New(log.NewLogfmtLogger(ioutil.Discard), level.Config{ + Allowed: level.AllowAll(), + })) +} + +func benchmarkRunner(b *testing.B, logger log.Logger) { + b.ResetTimer() + b.ReportAllocs() + for i := 0; i < b.N; i++ { + level.Debug(logger).Log("foo", "bar") + } +} diff --git a/vendor/github.com/go-kit/kit/log/experimental_level/doc.go b/vendor/github.com/go-kit/kit/log/experimental_level/doc.go new file mode 100644 index 0000000..7b81a97 --- /dev/null +++ b/vendor/github.com/go-kit/kit/log/experimental_level/doc.go @@ -0,0 +1,27 @@ +// Package level is an EXPERIMENTAL levelled logging package. The API will +// definitely have breaking changes and may be deleted altogether. Be warned! +// +// To use the level package, create a logger as per normal in your func main, +// and wrap it with level.New. +// +// var logger log.Logger +// logger = log.NewLogfmtLogger(os.Stderr) +// logger = level.New(logger, level.Config{Allowed: level.AllowInfoAndAbove}) // <-- +// logger = log.NewContext(logger).With("ts", log.DefaultTimestampUTC) +// +// Then, at the callsites, use one of the level.Debug, Info, Warn, or Error +// helper methods to emit leveled log events. +// +// logger.Log("foo", "bar") // as normal, no level +// level.Debug(logger).Log("request_id", reqID, "trace_data", trace.Get()) +// if value > 100 { +// level.Error(logger).Log("value", value) +// } +// +// The leveled logger allows precise control over what should happen if a log +// event is emitted without a level key, or if a squelched level is used. Check +// the Config struct for details. And, you can easily use non-default level +// values: create new string constants for whatever you want to change, pass +// them explicitly to the Config struct, and write your own level.Foo-style +// helper methods. +package level diff --git a/vendor/github.com/go-kit/kit/log/experimental_level/level.go b/vendor/github.com/go-kit/kit/log/experimental_level/level.go new file mode 100644 index 0000000..6210d5c --- /dev/null +++ b/vendor/github.com/go-kit/kit/log/experimental_level/level.go @@ -0,0 +1,146 @@ +package level + +import ( + "github.com/go-kit/kit/log" +) + +var ( + levelKey = "level" + errorLevelValue = "error" + warnLevelValue = "warn" + infoLevelValue = "info" + debugLevelValue = "debug" +) + +// AllowAll is an alias for AllowDebugAndAbove. +func AllowAll() []string { + return AllowDebugAndAbove() +} + +// AllowDebugAndAbove allows all of the four default log levels. +// Its return value may be provided as the Allowed parameter in the Config. +func AllowDebugAndAbove() []string { + return []string{errorLevelValue, warnLevelValue, infoLevelValue, debugLevelValue} +} + +// AllowInfoAndAbove allows the default info, warn, and error log levels. +// Its return value may be provided as the Allowed parameter in the Config. +func AllowInfoAndAbove() []string { + return []string{errorLevelValue, warnLevelValue, infoLevelValue} +} + +// AllowWarnAndAbove allows the default warn and error log levels. +// Its return value may be provided as the Allowed parameter in the Config. +func AllowWarnAndAbove() []string { + return []string{errorLevelValue, warnLevelValue} +} + +// AllowErrorOnly allows only the default error log level. +// Its return value may be provided as the Allowed parameter in the Config. +func AllowErrorOnly() []string { + return []string{errorLevelValue} +} + +// AllowNone allows none of the default log levels. +// Its return value may be provided as the Allowed parameter in the Config. +func AllowNone() []string { + return []string{} +} + +// Error returns a logger with the level key set to ErrorLevelValue. +func Error(logger log.Logger) log.Logger { + return log.NewContext(logger).With(levelKey, errorLevelValue) +} + +// Warn returns a logger with the level key set to WarnLevelValue. +func Warn(logger log.Logger) log.Logger { + return log.NewContext(logger).With(levelKey, warnLevelValue) +} + +// Info returns a logger with the level key set to InfoLevelValue. +func Info(logger log.Logger) log.Logger { + return log.NewContext(logger).With(levelKey, infoLevelValue) +} + +// Debug returns a logger with the level key set to DebugLevelValue. +func Debug(logger log.Logger) log.Logger { + return log.NewContext(logger).With(levelKey, debugLevelValue) +} + +// Config parameterizes the leveled logger. +type Config struct { + // Allowed enumerates the accepted log levels. If a log event is encountered + // with a level key set to a value that isn't explicitly allowed, the event + // will be squelched, and ErrNotAllowed returned. + Allowed []string + + // ErrNotAllowed is returned to the caller when Log is invoked with a level + // key that hasn't been explicitly allowed. By default, ErrNotAllowed is + // nil; in this case, the log event is squelched with no error. + ErrNotAllowed error + + // SquelchNoLevel will squelch log events with no level key, so that they + // don't proceed through to the wrapped logger. If SquelchNoLevel is set to + // true and a log event is squelched in this way, ErrNoLevel is returned to + // the caller. + SquelchNoLevel bool + + // ErrNoLevel is returned to the caller when SquelchNoLevel is true, and Log + // is invoked without a level key. By default, ErrNoLevel is nil; in this + // case, the log event is squelched with no error. + ErrNoLevel error +} + +// New wraps the logger and implements level checking. See the commentary on the +// Config object for a detailed description of how to configure levels. +func New(next log.Logger, config Config) log.Logger { + return &logger{ + next: next, + allowed: makeSet(config.Allowed), + errNotAllowed: config.ErrNotAllowed, + squelchNoLevel: config.SquelchNoLevel, + errNoLevel: config.ErrNoLevel, + } +} + +type logger struct { + next log.Logger + allowed map[string]struct{} + errNotAllowed error + squelchNoLevel bool + errNoLevel error +} + +func (l *logger) Log(keyvals ...interface{}) error { + var hasLevel, levelAllowed bool + for i := 0; i < len(keyvals); i += 2 { + if k, ok := keyvals[i].(string); !ok || k != levelKey { + continue + } + hasLevel = true + if i >= len(keyvals) { + continue + } + v, ok := keyvals[i+1].(string) + if !ok { + continue + } + _, levelAllowed = l.allowed[v] + break + } + if !hasLevel && l.squelchNoLevel { + return l.errNoLevel + } + if hasLevel && !levelAllowed { + return l.errNotAllowed + } + return l.next.Log(keyvals...) +} + +func makeSet(a []string) map[string]struct{} { + m := make(map[string]struct{}, len(a)) + for _, s := range a { + m[s] = struct{}{} + } + return m +} diff --git a/vendor/github.com/go-kit/kit/log/experimental_level/level_test.go b/vendor/github.com/go-kit/kit/log/experimental_level/level_test.go new file mode 100644 index 0000000..741d398 --- /dev/null +++ b/vendor/github.com/go-kit/kit/log/experimental_level/level_test.go @@ -0,0 +1,154 @@ +package level_test + +import ( + "bytes" + "errors" + "strings" + "testing" + + "github.com/go-kit/kit/log" + "github.com/go-kit/kit/log/experimental_level" +) + +func TestVariousLevels(t *testing.T) { + for _, testcase := range []struct { + allowed []string + want string + }{ + { + level.AllowAll(), + strings.Join([]string{ + `{"level":"debug","this is":"debug log"}`, + `{"level":"info","this is":"info log"}`, + `{"level":"warn","this is":"warn log"}`, + `{"level":"error","this is":"error log"}`, + }, "\n"), + }, + { + level.AllowDebugAndAbove(), + strings.Join([]string{ + `{"level":"debug","this is":"debug log"}`, + `{"level":"info","this is":"info log"}`, + `{"level":"warn","this is":"warn log"}`, + `{"level":"error","this is":"error log"}`, + }, "\n"), + }, + { + level.AllowInfoAndAbove(), + strings.Join([]string{ + `{"level":"info","this is":"info log"}`, + `{"level":"warn","this is":"warn log"}`, + `{"level":"error","this is":"error log"}`, + }, "\n"), + }, + { + level.AllowWarnAndAbove(), + strings.Join([]string{ + `{"level":"warn","this is":"warn log"}`, + `{"level":"error","this is":"error log"}`, + }, "\n"), + }, + { + level.AllowErrorOnly(), + strings.Join([]string{ + `{"level":"error","this is":"error log"}`, + }, "\n"), + }, + { + level.AllowNone(), + ``, + }, + } { + var buf bytes.Buffer + logger := level.New(log.NewJSONLogger(&buf), level.Config{Allowed: testcase.allowed}) + + level.Debug(logger).Log("this is", "debug log") + level.Info(logger).Log("this is", "info log") + level.Warn(logger).Log("this is", "warn log") + level.Error(logger).Log("this is", "error log") + + if want, have := testcase.want, strings.TrimSpace(buf.String()); want != have { + t.Errorf("given Allowed=%v: want\n%s\nhave\n%s", testcase.allowed, want, have) + } + } +} + +func TestErrNotAllowed(t *testing.T) { + myError := errors.New("squelched!") + logger := level.New(log.NewNopLogger(), level.Config{ + Allowed: level.AllowWarnAndAbove(), + ErrNotAllowed: myError, + }) + + if want, have := myError, level.Info(logger).Log("foo", "bar"); want != have { + t.Errorf("want %#+v, have %#+v", want, have) + } + + if want, have := error(nil), level.Warn(logger).Log("foo", "bar"); want != have { + t.Errorf("want %#+v, have %#+v", want, have) + } +} + +func TestErrNoLevel(t *testing.T) { + myError := errors.New("no level specified") + + var buf bytes.Buffer + logger := level.New(log.NewJSONLogger(&buf), level.Config{ + SquelchNoLevel: true, + ErrNoLevel: myError, + }) + + if want, have := myError, logger.Log("foo", "bar"); want != have { + t.Errorf("want %v, have %v", want, have) + } + if want, have := ``, strings.TrimSpace(buf.String()); want != have { + t.Errorf("want %q, have %q", want, have) + } +} + +func TestAllowNoLevel(t *testing.T) { + var buf bytes.Buffer + logger := level.New(log.NewJSONLogger(&buf), level.Config{ + SquelchNoLevel: false, + ErrNoLevel: errors.New("I should never be returned!"), + }) + + if want, have := error(nil), logger.Log("foo", "bar"); want != have { + t.Errorf("want %v, have %v", want, have) + } + if want, have := `{"foo":"bar"}`, strings.TrimSpace(buf.String()); want != have { + t.Errorf("want %q, have %q", want, have) + } +} + +func TestLevelContext(t *testing.T) { + var buf bytes.Buffer + + // Wrapping the level logger with a context allows users to use + // log.DefaultCaller as per normal. + var logger log.Logger + logger = log.NewLogfmtLogger(&buf) + logger = level.New(logger, level.Config{Allowed: level.AllowAll()}) + logger = log.NewContext(logger).With("caller", log.DefaultCaller) + + level.Info(logger).Log("foo", "bar") + if want, have := `caller=level_test.go:134 level=info foo=bar`, strings.TrimSpace(buf.String()); want != have { + t.Errorf("want %q, have %q", want, have) + } +} + +func TestContextLevel(t *testing.T) { + var buf bytes.Buffer + + // Wrapping a context with the level logger still works, but requires users + // to specify a higher callstack depth value. + var logger log.Logger + logger = log.NewLogfmtLogger(&buf) + logger = log.NewContext(logger).With("caller", log.Caller(5)) + logger = level.New(logger, level.Config{Allowed: level.AllowAll()}) + + level.Info(logger).Log("foo", "bar") + if want, have := `caller=level_test.go:150 level=info foo=bar`, strings.TrimSpace(buf.String()); want != have { + t.Errorf("want %q, have %q", want, have) + } +} diff --git a/vendor/github.com/go-kit/kit/log/json_logger_test.go b/vendor/github.com/go-kit/kit/log/json_logger_test.go index 00e6910..42df70c 100644 --- a/vendor/github.com/go-kit/kit/log/json_logger_test.go +++ b/vendor/github.com/go-kit/kit/log/json_logger_test.go @@ -13,7 +13,7 @@ func TestJSONLoggerCaller(t *testing.T) { t.Parallel() buf := &bytes.Buffer{} logger := log.NewJSONLogger(buf) - logger = log.With(logger, "caller", log.DefaultCaller) + logger = log.NewContext(logger).With("caller", log.DefaultCaller) if err := logger.Log(); err != nil { t.Fatal(err) diff --git a/vendor/github.com/go-kit/kit/log/level/benchmark_test.go b/vendor/github.com/go-kit/kit/log/level/benchmark_test.go deleted file mode 100644 index 4fca6f0..0000000 --- a/vendor/github.com/go-kit/kit/log/level/benchmark_test.go +++ /dev/null @@ -1,72 +0,0 @@ -package level_test - -import ( - "io/ioutil" - "testing" - - "github.com/go-kit/kit/log" - "github.com/go-kit/kit/log/level" -) - -func Benchmark(b *testing.B) { - contexts := []struct { - name string - context func(log.Logger) log.Logger - }{ - {"NoContext", func(l log.Logger) log.Logger { - return l - }}, - {"TimeContext", func(l log.Logger) log.Logger { - return log.With(l, "time", log.DefaultTimestampUTC) - }}, - {"CallerContext", func(l log.Logger) log.Logger { - return log.With(l, "caller", log.DefaultCaller) - }}, - {"TimeCallerReqIDContext", func(l log.Logger) log.Logger { - return log.With(l, "time", log.DefaultTimestampUTC, "caller", log.DefaultCaller, "reqID", 29) - }}, - } - - loggers := []struct { - name string - logger log.Logger - }{ - {"Nop", log.NewNopLogger()}, - {"Logfmt", log.NewLogfmtLogger(ioutil.Discard)}, - {"JSON", log.NewJSONLogger(ioutil.Discard)}, - } - - filters := []struct { - name string - filter func(log.Logger) log.Logger - }{ - {"Baseline", func(l log.Logger) log.Logger { - return l - }}, - {"DisallowedLevel", func(l log.Logger) log.Logger { - return level.NewFilter(l, level.AllowInfo()) - }}, - {"AllowedLevel", func(l log.Logger) log.Logger { - return level.NewFilter(l, level.AllowAll()) - }}, - } - - for _, c := range contexts { - b.Run(c.name, func(b *testing.B) { - for _, f := range filters { - b.Run(f.name, func(b *testing.B) { - for _, l := range loggers { - b.Run(l.name, func(b *testing.B) { - logger := c.context(f.filter(l.logger)) - b.ResetTimer() - b.ReportAllocs() - for i := 0; i < b.N; i++ { - level.Debug(logger).Log("foo", "bar") - } - }) - } - }) - } - }) - } -} diff --git a/vendor/github.com/go-kit/kit/log/level/doc.go b/vendor/github.com/go-kit/kit/log/level/doc.go deleted file mode 100644 index e3cbe55..0000000 --- a/vendor/github.com/go-kit/kit/log/level/doc.go +++ /dev/null @@ -1,22 +0,0 @@ -// Package level implements leveled logging on top of package log. To use the -// level package, create a logger as per normal in your func main, and wrap it -// with level.NewFilter. -// -// var logger log.Logger -// logger = log.NewLogfmtLogger(os.Stderr) -// logger = level.NewFilter(logger, level.AllowInfoAndAbove()) // <-- -// logger = log.NewContext(logger).With("ts", log.DefaultTimestampUTC) -// -// Then, at the callsites, use one of the level.Debug, Info, Warn, or Error -// helper methods to emit leveled log events. -// -// logger.Log("foo", "bar") // as normal, no level -// level.Debug(logger).Log("request_id", reqID, "trace_data", trace.Get()) -// if value > 100 { -// level.Error(logger).Log("value", value) -// } -// -// NewFilter allows precise control over what happens when a log event is -// emitted without a level key, or if a squelched level is used. Check the -// Option functions for details. -package level diff --git a/vendor/github.com/go-kit/kit/log/level/example_test.go b/vendor/github.com/go-kit/kit/log/level/example_test.go deleted file mode 100644 index fed52e5..0000000 --- a/vendor/github.com/go-kit/kit/log/level/example_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package level_test - -import ( - "errors" - "os" - - "github.com/go-kit/kit/log" - "github.com/go-kit/kit/log/level" -) - -func Example_basic() { - // setup logger with level filter - logger := log.NewLogfmtLogger(os.Stdout) - logger = level.NewFilter(logger, level.AllowInfo()) - logger = log.With(logger, "caller", log.DefaultCaller) - - // use level helpers to log at different levels - level.Error(logger).Log("err", errors.New("bad data")) - level.Info(logger).Log("event", "data saved") - level.Debug(logger).Log("next item", 17) // filtered - - // Output: - // level=error caller=example_test.go:18 err="bad data" - // level=info caller=example_test.go:19 event="data saved" -} diff --git a/vendor/github.com/go-kit/kit/log/level/level.go b/vendor/github.com/go-kit/kit/log/level/level.go deleted file mode 100644 index 6833b0d..0000000 --- a/vendor/github.com/go-kit/kit/log/level/level.go +++ /dev/null @@ -1,205 +0,0 @@ -package level - -import "github.com/go-kit/kit/log" - -// Error returns a logger that includes a Key/ErrorValue pair. -func Error(logger log.Logger) log.Logger { - return log.WithPrefix(logger, Key(), ErrorValue()) -} - -// Warn returns a logger that includes a Key/WarnValue pair. -func Warn(logger log.Logger) log.Logger { - return log.WithPrefix(logger, Key(), WarnValue()) -} - -// Info returns a logger that includes a Key/InfoValue pair. -func Info(logger log.Logger) log.Logger { - return log.WithPrefix(logger, Key(), InfoValue()) -} - -// Debug returns a logger that includes a Key/DebugValue pair. -func Debug(logger log.Logger) log.Logger { - return log.WithPrefix(logger, Key(), DebugValue()) -} - -// NewFilter wraps next and implements level filtering. See the commentary on -// the Option functions for a detailed description of how to configure levels. -// If no options are provided, all leveled log events created with Debug, -// Info, Warn or Error helper methods are squelched and non-leveled log -// events are passed to next unmodified. -func NewFilter(next log.Logger, options ...Option) log.Logger { - l := &logger{ - next: next, - } - for _, option := range options { - option(l) - } - return l -} - -type logger struct { - next log.Logger - allowed level - squelchNoLevel bool - errNotAllowed error - errNoLevel error -} - -func (l *logger) Log(keyvals ...interface{}) error { - var hasLevel, levelAllowed bool - for i := 1; i < len(keyvals); i += 2 { - if v, ok := keyvals[i].(*levelValue); ok { - hasLevel = true - levelAllowed = l.allowed&v.level != 0 - break - } - } - if !hasLevel && l.squelchNoLevel { - return l.errNoLevel - } - if hasLevel && !levelAllowed { - return l.errNotAllowed - } - return l.next.Log(keyvals...) -} - -// Option sets a parameter for the leveled logger. -type Option func(*logger) - -// AllowAll is an alias for AllowDebug. -func AllowAll() Option { - return AllowDebug() -} - -// AllowDebug allows error, warn, info and debug level log events to pass. -func AllowDebug() Option { - return allowed(levelError | levelWarn | levelInfo | levelDebug) -} - -// AllowInfo allows error, warn and info level log events to pass. -func AllowInfo() Option { - return allowed(levelError | levelWarn | levelInfo) -} - -// AllowWarn allows error and warn level log events to pass. -func AllowWarn() Option { - return allowed(levelError | levelWarn) -} - -// AllowError allows only error level log events to pass. -func AllowError() Option { - return allowed(levelError) -} - -// AllowNone allows no leveled log events to pass. -func AllowNone() Option { - return allowed(0) -} - -func allowed(allowed level) Option { - return func(l *logger) { l.allowed = allowed } -} - -// ErrNotAllowed sets the error to return from Log when it squelches a log -// event disallowed by the configured Allow[Level] option. By default, -// ErrNotAllowed is nil; in this case the log event is squelched with no -// error. -func ErrNotAllowed(err error) Option { - return func(l *logger) { l.errNotAllowed = err } -} - -// SquelchNoLevel instructs Log to squelch log events with no level, so that -// they don't proceed through to the wrapped logger. If SquelchNoLevel is set -// to true and a log event is squelched in this way, the error value -// configured with ErrNoLevel is returned to the caller. -func SquelchNoLevel(squelch bool) Option { - return func(l *logger) { l.squelchNoLevel = squelch } -} - -// ErrNoLevel sets the error to return from Log when it squelches a log event -// with no level. By default, ErrNoLevel is nil; in this case the log event is -// squelched with no error. -func ErrNoLevel(err error) Option { - return func(l *logger) { l.errNoLevel = err } -} - -// NewInjector wraps next and returns a logger that adds a Key/level pair to -// the beginning of log events that don't already contain a level. In effect, -// this gives a default level to logs without a level. -func NewInjector(next log.Logger, level Value) log.Logger { - return &injector{ - next: next, - level: level, - } -} - -type injector struct { - next log.Logger - level interface{} -} - -func (l *injector) Log(keyvals ...interface{}) error { - for i := 1; i < len(keyvals); i += 2 { - if _, ok := keyvals[i].(*levelValue); ok { - return l.next.Log(keyvals...) - } - } - kvs := make([]interface{}, len(keyvals)+2) - kvs[0], kvs[1] = key, l.level - copy(kvs[2:], keyvals) - return l.next.Log(kvs...) -} - -// Value is the interface that each of the canonical level values implement. -// It contains unexported methods that prevent types from other packages from -// implementing it and guaranteeing that NewFilter can distinguish the levels -// defined in this package from all other values. -type Value interface { - String() string - levelVal() -} - -// Key returns the unique key added to log events by the loggers in this -// package. -func Key() interface{} { return key } - -// ErrorValue returns the unique value added to log events by Error. -func ErrorValue() Value { return errorValue } - -// WarnValue returns the unique value added to log events by Warn. -func WarnValue() Value { return warnValue } - -// InfoValue returns the unique value added to log events by Info. -func InfoValue() Value { return infoValue } - -// DebugValue returns the unique value added to log events by Warn. -func DebugValue() Value { return debugValue } - -var ( - // key is of type interfae{} so that it allocates once during package - // initialization and avoids allocating every type the value is added to a - // []interface{} later. - key interface{} = "level" - - errorValue = &levelValue{level: levelError, name: "error"} - warnValue = &levelValue{level: levelWarn, name: "warn"} - infoValue = &levelValue{level: levelInfo, name: "info"} - debugValue = &levelValue{level: levelDebug, name: "debug"} -) - -type level byte - -const ( - levelDebug level = 1 << iota - levelInfo - levelWarn - levelError -) - -type levelValue struct { - name string - level -} - -func (v *levelValue) String() string { return v.name } -func (v *levelValue) levelVal() {} diff --git a/vendor/github.com/go-kit/kit/log/level/level_test.go b/vendor/github.com/go-kit/kit/log/level/level_test.go deleted file mode 100644 index 4d2aca5..0000000 --- a/vendor/github.com/go-kit/kit/log/level/level_test.go +++ /dev/null @@ -1,235 +0,0 @@ -package level_test - -import ( - "bytes" - "errors" - "io" - "strings" - "testing" - - "github.com/go-kit/kit/log" - "github.com/go-kit/kit/log/level" -) - -func TestVariousLevels(t *testing.T) { - testCases := []struct { - name string - allowed level.Option - want string - }{ - { - "AllowAll", - level.AllowAll(), - strings.Join([]string{ - `{"level":"debug","this is":"debug log"}`, - `{"level":"info","this is":"info log"}`, - `{"level":"warn","this is":"warn log"}`, - `{"level":"error","this is":"error log"}`, - }, "\n"), - }, - { - "AllowDebug", - level.AllowDebug(), - strings.Join([]string{ - `{"level":"debug","this is":"debug log"}`, - `{"level":"info","this is":"info log"}`, - `{"level":"warn","this is":"warn log"}`, - `{"level":"error","this is":"error log"}`, - }, "\n"), - }, - { - "AllowDebug", - level.AllowInfo(), - strings.Join([]string{ - `{"level":"info","this is":"info log"}`, - `{"level":"warn","this is":"warn log"}`, - `{"level":"error","this is":"error log"}`, - }, "\n"), - }, - { - "AllowWarn", - level.AllowWarn(), - strings.Join([]string{ - `{"level":"warn","this is":"warn log"}`, - `{"level":"error","this is":"error log"}`, - }, "\n"), - }, - { - "AllowError", - level.AllowError(), - strings.Join([]string{ - `{"level":"error","this is":"error log"}`, - }, "\n"), - }, - { - "AllowNone", - level.AllowNone(), - ``, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - var buf bytes.Buffer - logger := level.NewFilter(log.NewJSONLogger(&buf), tc.allowed) - - level.Debug(logger).Log("this is", "debug log") - level.Info(logger).Log("this is", "info log") - level.Warn(logger).Log("this is", "warn log") - level.Error(logger).Log("this is", "error log") - - if want, have := tc.want, strings.TrimSpace(buf.String()); want != have { - t.Errorf("\nwant:\n%s\nhave:\n%s", want, have) - } - }) - } -} - -func TestErrNotAllowed(t *testing.T) { - myError := errors.New("squelched!") - opts := []level.Option{ - level.AllowWarn(), - level.ErrNotAllowed(myError), - } - logger := level.NewFilter(log.NewNopLogger(), opts...) - - if want, have := myError, level.Info(logger).Log("foo", "bar"); want != have { - t.Errorf("want %#+v, have %#+v", want, have) - } - - if want, have := error(nil), level.Warn(logger).Log("foo", "bar"); want != have { - t.Errorf("want %#+v, have %#+v", want, have) - } -} - -func TestErrNoLevel(t *testing.T) { - myError := errors.New("no level specified") - - var buf bytes.Buffer - opts := []level.Option{ - level.SquelchNoLevel(true), - level.ErrNoLevel(myError), - } - logger := level.NewFilter(log.NewJSONLogger(&buf), opts...) - - if want, have := myError, logger.Log("foo", "bar"); want != have { - t.Errorf("want %v, have %v", want, have) - } - if want, have := ``, strings.TrimSpace(buf.String()); want != have { - t.Errorf("\nwant '%s'\nhave '%s'", want, have) - } -} - -func TestAllowNoLevel(t *testing.T) { - var buf bytes.Buffer - opts := []level.Option{ - level.SquelchNoLevel(false), - level.ErrNoLevel(errors.New("I should never be returned!")), - } - logger := level.NewFilter(log.NewJSONLogger(&buf), opts...) - - if want, have := error(nil), logger.Log("foo", "bar"); want != have { - t.Errorf("want %v, have %v", want, have) - } - if want, have := `{"foo":"bar"}`, strings.TrimSpace(buf.String()); want != have { - t.Errorf("\nwant '%s'\nhave '%s'", want, have) - } -} - -func TestLevelContext(t *testing.T) { - var buf bytes.Buffer - - // Wrapping the level logger with a context allows users to use - // log.DefaultCaller as per normal. - var logger log.Logger - logger = log.NewLogfmtLogger(&buf) - logger = level.NewFilter(logger, level.AllowAll()) - logger = log.With(logger, "caller", log.DefaultCaller) - - level.Info(logger).Log("foo", "bar") - if want, have := `level=info caller=level_test.go:149 foo=bar`, strings.TrimSpace(buf.String()); want != have { - t.Errorf("\nwant '%s'\nhave '%s'", want, have) - } -} - -func TestContextLevel(t *testing.T) { - var buf bytes.Buffer - - // Wrapping a context with the level logger still works, but requires users - // to specify a higher callstack depth value. - var logger log.Logger - logger = log.NewLogfmtLogger(&buf) - logger = log.With(logger, "caller", log.Caller(5)) - logger = level.NewFilter(logger, level.AllowAll()) - - level.Info(logger).Log("foo", "bar") - if want, have := `caller=level_test.go:165 level=info foo=bar`, strings.TrimSpace(buf.String()); want != have { - t.Errorf("\nwant '%s'\nhave '%s'", want, have) - } -} - -func TestLevelFormatting(t *testing.T) { - testCases := []struct { - name string - format func(io.Writer) log.Logger - output string - }{ - { - name: "logfmt", - format: log.NewLogfmtLogger, - output: `level=info foo=bar`, - }, - { - name: "JSON", - format: log.NewJSONLogger, - output: `{"foo":"bar","level":"info"}`, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - var buf bytes.Buffer - - logger := tc.format(&buf) - level.Info(logger).Log("foo", "bar") - if want, have := tc.output, strings.TrimSpace(buf.String()); want != have { - t.Errorf("\nwant: '%s'\nhave '%s'", want, have) - } - }) - } -} - -func TestInjector(t *testing.T) { - var ( - output []interface{} - logger log.Logger - ) - - logger = log.LoggerFunc(func(keyvals ...interface{}) error { - output = keyvals - return nil - }) - logger = level.NewInjector(logger, level.InfoValue()) - - logger.Log("foo", "bar") - if got, want := len(output), 4; got != want { - t.Errorf("missing level not injected: got len==%d, want len==%d", got, want) - } - if got, want := output[0], level.Key(); got != want { - t.Errorf("wrong level key: got %#v, want %#v", got, want) - } - if got, want := output[1], level.InfoValue(); got != want { - t.Errorf("wrong level value: got %#v, want %#v", got, want) - } - - level.Error(logger).Log("foo", "bar") - if got, want := len(output), 4; got != want { - t.Errorf("leveled record modified: got len==%d, want len==%d", got, want) - } - if got, want := output[0], level.Key(); got != want { - t.Errorf("wrong level key: got %#v, want %#v", got, want) - } - if got, want := output[1], level.ErrorValue(); got != want { - t.Errorf("wrong level value: got %#v, want %#v", got, want) - } -} diff --git a/vendor/github.com/go-kit/kit/log/deprecated_levels/levels.go b/vendor/github.com/go-kit/kit/log/levels/levels.go similarity index 90% rename from vendor/github.com/go-kit/kit/log/deprecated_levels/levels.go rename to vendor/github.com/go-kit/kit/log/levels/levels.go index a034212..da6b681 100644 --- a/vendor/github.com/go-kit/kit/log/deprecated_levels/levels.go +++ b/vendor/github.com/go-kit/kit/log/levels/levels.go @@ -7,7 +7,7 @@ import "github.com/go-kit/kit/log" // want a different set of levels, you can create your own levels type very // easily, and you can elide the configuration. type Levels struct { - logger log.Logger + ctx *log.Context levelKey string // We have a choice between storing level values in string fields or @@ -34,7 +34,7 @@ type Levels struct { // New creates a new leveled logger, wrapping the passed logger. func New(logger log.Logger, options ...Option) Levels { l := Levels{ - logger: logger, + ctx: log.NewContext(logger), levelKey: "level", debugValue: "debug", @@ -52,7 +52,7 @@ func New(logger log.Logger, options ...Option) Levels { // With returns a new leveled logger that includes keyvals in all log events. func (l Levels) With(keyvals ...interface{}) Levels { return Levels{ - logger: log.With(l.logger, keyvals...), + ctx: l.ctx.With(keyvals...), levelKey: l.levelKey, debugValue: l.debugValue, infoValue: l.infoValue, @@ -64,27 +64,27 @@ func (l Levels) With(keyvals ...interface{}) Levels { // Debug returns a debug level logger. func (l Levels) Debug() log.Logger { - return log.WithPrefix(l.logger, l.levelKey, l.debugValue) + return l.ctx.WithPrefix(l.levelKey, l.debugValue) } // Info returns an info level logger. func (l Levels) Info() log.Logger { - return log.WithPrefix(l.logger, l.levelKey, l.infoValue) + return l.ctx.WithPrefix(l.levelKey, l.infoValue) } // Warn returns a warning level logger. func (l Levels) Warn() log.Logger { - return log.WithPrefix(l.logger, l.levelKey, l.warnValue) + return l.ctx.WithPrefix(l.levelKey, l.warnValue) } // Error returns an error level logger. func (l Levels) Error() log.Logger { - return log.WithPrefix(l.logger, l.levelKey, l.errorValue) + return l.ctx.WithPrefix(l.levelKey, l.errorValue) } // Crit returns a critical level logger. func (l Levels) Crit() log.Logger { - return log.WithPrefix(l.logger, l.levelKey, l.critValue) + return l.ctx.WithPrefix(l.levelKey, l.critValue) } // Option sets a parameter for leveled loggers. diff --git a/vendor/github.com/go-kit/kit/log/deprecated_levels/levels_test.go b/vendor/github.com/go-kit/kit/log/levels/levels_test.go similarity index 96% rename from vendor/github.com/go-kit/kit/log/deprecated_levels/levels_test.go rename to vendor/github.com/go-kit/kit/log/levels/levels_test.go index 8d4a7f5..270963c 100644 --- a/vendor/github.com/go-kit/kit/log/deprecated_levels/levels_test.go +++ b/vendor/github.com/go-kit/kit/log/levels/levels_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/go-kit/kit/log" - levels "github.com/go-kit/kit/log/deprecated_levels" + "github.com/go-kit/kit/log/levels" ) func TestDefaultLevels(t *testing.T) { diff --git a/vendor/github.com/go-kit/kit/log/log.go b/vendor/github.com/go-kit/kit/log/log.go index 66a9e2f..97990fe 100644 --- a/vendor/github.com/go-kit/kit/log/log.go +++ b/vendor/github.com/go-kit/kit/log/log.go @@ -6,7 +6,7 @@ import "errors" // log event from keyvals, a variadic sequence of alternating keys and values. // Implementations must be safe for concurrent use by multiple goroutines. In // particular, any implementation of Logger that appends to keyvals or -// modifies or retains any of its elements must make a copy first. +// modifies any of its elements must make a copy first. type Logger interface { Log(keyvals ...interface{}) error } @@ -15,100 +15,62 @@ type Logger interface { // the missing value. var ErrMissingValue = errors.New("(MISSING)") -// With returns a new contextual logger with keyvals prepended to those passed -// to calls to Log. If logger is also a contextual logger created by With or -// WithPrefix, keyvals is appended to the existing context. -// -// The returned Logger replaces all value elements (odd indexes) containing a -// Valuer with their generated value for each call to its Log method. -func With(logger Logger, keyvals ...interface{}) Logger { - if len(keyvals) == 0 { - return logger - } - l := newContext(logger) - kvs := append(l.keyvals, keyvals...) - if len(kvs)%2 != 0 { - kvs = append(kvs, ErrMissingValue) - } - return &context{ - logger: l.logger, - // Limiting the capacity of the stored keyvals ensures that a new - // backing array is created if the slice must grow in Log or With. - // Using the extra capacity without copying risks a data race that - // would violate the Logger interface contract. - keyvals: kvs[:len(kvs):len(kvs)], - hasValuer: l.hasValuer || containsValuer(keyvals), +// NewContext returns a new Context that logs to logger. +func NewContext(logger Logger) *Context { + if c, ok := logger.(*Context); ok { + return c } + return &Context{logger: logger} } -// WithPrefix returns a new contextual logger with keyvals prepended to those -// passed to calls to Log. If logger is also a contextual logger created by -// With or WithPrefix, keyvals is prepended to the existing context. -// -// The returned Logger replaces all value elements (odd indexes) containing a -// Valuer with their generated value for each call to its Log method. -func WithPrefix(logger Logger, keyvals ...interface{}) Logger { - if len(keyvals) == 0 { - return logger - } - l := newContext(logger) - // Limiting the capacity of the stored keyvals ensures that a new - // backing array is created if the slice must grow in Log or With. - // Using the extra capacity without copying risks a data race that - // would violate the Logger interface contract. - n := len(l.keyvals) + len(keyvals) - if len(keyvals)%2 != 0 { - n++ - } - kvs := make([]interface{}, 0, n) - kvs = append(kvs, keyvals...) - if len(kvs)%2 != 0 { - kvs = append(kvs, ErrMissingValue) - } - kvs = append(kvs, l.keyvals...) - return &context{ - logger: l.logger, - keyvals: kvs, - hasValuer: l.hasValuer || containsValuer(keyvals), - } -} - -// context is the Logger implementation returned by With and WithPrefix. It -// wraps a Logger and holds keyvals that it includes in all log events. Its -// Log method calls bindValues to generate values for each Valuer in the -// context keyvals. -// -// A context must always have the same number of stack frames between calls to +// Context must always have the same number of stack frames between calls to // its Log method and the eventual binding of Valuers to their value. This // requirement comes from the functional requirement to allow a context to -// resolve application call site information for a Caller stored in the +// resolve application call site information for a log.Caller stored in the // context. To do this we must be able to predict the number of logging // functions on the stack when bindValues is called. // -// Two implementation details provide the needed stack depth consistency. +// Three implementation details provide the needed stack depth consistency. +// The first two of these details also result in better amortized performance, +// and thus make sense even without the requirements regarding stack depth. +// The third detail, however, is subtle and tied to the implementation of the +// Go compiler. // -// 1. newContext avoids introducing an additional layer when asked to -// wrap another context. -// 2. With and WithPrefix avoid introducing an additional layer by -// returning a newly constructed context with a merged keyvals rather -// than simply wrapping the existing context. -type context struct { +// 1. NewContext avoids introducing an additional layer when asked to +// wrap another Context. +// 2. With avoids introducing an additional layer by returning a newly +// constructed Context with a merged keyvals rather than simply +// wrapping the existing Context. +// 3. All of Context's methods take pointer receivers even though they +// do not mutate the Context. +// +// Before explaining the last detail, first some background. The Go compiler +// generates wrapper methods to implement the auto dereferencing behavior when +// calling a value method through a pointer variable. These wrapper methods +// are also used when calling a value method through an interface variable +// because interfaces store a pointer to the underlying concrete value. +// Calling a pointer receiver through an interface does not require generating +// an additional function. +// +// If Context had value methods then calling Context.Log through a variable +// with type Logger would have an extra stack frame compared to calling +// Context.Log through a variable with type Context. Using pointer receivers +// avoids this problem. + +// A Context wraps a Logger and holds keyvals that it includes in all log +// events. When logging, a Context replaces all value elements (odd indexes) +// containing a Valuer with their generated value for each call to its Log +// method. +type Context struct { logger Logger keyvals []interface{} hasValuer bool } -func newContext(logger Logger) *context { - if c, ok := logger.(*context); ok { - return c - } - return &context{logger: logger} -} - // Log replaces all value elements (odd indexes) containing a Valuer in the // stored context with their generated value, appends keyvals, and passes the // result to the wrapped Logger. -func (l *context) Log(keyvals ...interface{}) error { +func (l *Context) Log(keyvals ...interface{}) error { kvs := append(l.keyvals, keyvals...) if len(kvs)%2 != 0 { kvs = append(kvs, ErrMissingValue) @@ -124,6 +86,53 @@ func (l *context) Log(keyvals ...interface{}) error { return l.logger.Log(kvs...) } +// With returns a new Context with keyvals appended to those of the receiver. +func (l *Context) With(keyvals ...interface{}) *Context { + if len(keyvals) == 0 { + return l + } + kvs := append(l.keyvals, keyvals...) + if len(kvs)%2 != 0 { + kvs = append(kvs, ErrMissingValue) + } + return &Context{ + logger: l.logger, + // Limiting the capacity of the stored keyvals ensures that a new + // backing array is created if the slice must grow in Log or With. + // Using the extra capacity without copying risks a data race that + // would violate the Logger interface contract. + keyvals: kvs[:len(kvs):len(kvs)], + hasValuer: l.hasValuer || containsValuer(keyvals), + } +} + +// WithPrefix returns a new Context with keyvals prepended to those of the +// receiver. +func (l *Context) WithPrefix(keyvals ...interface{}) *Context { + if len(keyvals) == 0 { + return l + } + // Limiting the capacity of the stored keyvals ensures that a new + // backing array is created if the slice must grow in Log or With. + // Using the extra capacity without copying risks a data race that + // would violate the Logger interface contract. + n := len(l.keyvals) + len(keyvals) + if len(keyvals)%2 != 0 { + n++ + } + kvs := make([]interface{}, 0, n) + kvs = append(kvs, keyvals...) + if len(kvs)%2 != 0 { + kvs = append(kvs, ErrMissingValue) + } + kvs = append(kvs, l.keyvals...) + return &Context{ + logger: l.logger, + keyvals: kvs, + hasValuer: l.hasValuer || containsValuer(keyvals), + } +} + // LoggerFunc is an adapter to allow use of ordinary functions as Loggers. If // f is a function with the appropriate signature, LoggerFunc(f) is a Logger // object that calls f. diff --git a/vendor/github.com/go-kit/kit/log/log_test.go b/vendor/github.com/go-kit/kit/log/log_test.go index 1bf2972..7c44095 100644 --- a/vendor/github.com/go-kit/kit/log/log_test.go +++ b/vendor/github.com/go-kit/kit/log/log_test.go @@ -16,10 +16,10 @@ func TestContext(t *testing.T) { logger := log.NewLogfmtLogger(buf) kvs := []interface{}{"a", 123} - lc := log.With(logger, kvs...) + lc := log.NewContext(logger).With(kvs...) kvs[1] = 0 // With should copy its key values - lc = log.With(lc, "b", "c") // With should stack + lc = lc.With("b", "c") // With should stack if err := lc.Log("msg", "message"); err != nil { t.Fatal(err) } @@ -28,7 +28,7 @@ func TestContext(t *testing.T) { } buf.Reset() - lc = log.WithPrefix(lc, "p", "first") + lc = lc.WithPrefix("p", "first") if err := lc.Log("msg", "message"); err != nil { t.Fatal(err) } @@ -45,7 +45,17 @@ func TestContextMissingValue(t *testing.T) { return nil })) - log.WithPrefix(log.With(logger, "k1"), "k0").Log("k2") + lc := log.NewContext(logger) + + lc.Log("k") + if want, have := 2, len(output); want != have { + t.Errorf("want len(output) == %v, have %v", want, have) + } + if want, have := log.ErrMissingValue, output[1]; want != have { + t.Errorf("want %#v, have %#v", want, have) + } + + lc.With("k1").WithPrefix("k0").Log("k2") if want, have := 6, len(output); want != have { t.Errorf("want len(output) == %v, have %v", want, have) } @@ -56,8 +66,10 @@ func TestContextMissingValue(t *testing.T) { } } -// Test that context.Log has a consistent function stack depth when binding -// Valuers, regardless of how many times With has been called. +// Test that Context.Log has a consistent function stack depth when binding +// log.Valuers, regardless of how many times Context.With has been called or +// whether Context.Log is called via an interface typed variable or a concrete +// typed variable. func TestContextStackDepth(t *testing.T) { t.Parallel() fn := fmt.Sprintf("%n", stack.Caller(0)) @@ -79,25 +91,32 @@ func TestContextStackDepth(t *testing.T) { return nil }) - logger = log.With(logger, "stack", stackValuer) + concrete := log.NewContext(logger).With("stack", stackValuer) + var iface log.Logger = concrete // Call through interface to get baseline. - logger.Log("k", "v") + iface.Log("k", "v") want := output[1].(int) for len(output) < 10 { - logger.Log("k", "v") + concrete.Log("k", "v") if have := output[1]; have != want { t.Errorf("%d Withs: have %v, want %v", len(output)/2-1, have, want) } - wrapped := log.With(logger) + iface.Log("k", "v") + if have := output[1]; have != want { + t.Errorf("%d Withs: have %v, want %v", len(output)/2-1, have, want) + } + + wrapped := log.NewContext(concrete) wrapped.Log("k", "v") if have := output[1]; have != want { t.Errorf("%d Withs: have %v, want %v", len(output)/2-1, have, want) } - logger = log.With(logger, "k", "v") + concrete = concrete.With("k", "v") + iface = concrete } } @@ -121,7 +140,7 @@ func TestWithConcurrent(t *testing.T) { // With must be careful about handling slices that can grow without // copying the underlying array, so give it a challenge. - l := log.With(logger, make([]interface{}, 0, 2)...) + l := log.NewContext(logger).With(make([]interface{}, 0, 2)...) // Start logging concurrently. Each goroutine logs its id so the logger // can bucket the event counts. @@ -156,7 +175,7 @@ func BenchmarkDiscard(b *testing.B) { func BenchmarkOneWith(b *testing.B) { logger := log.NewNopLogger() - lc := log.With(logger, "k", "v") + lc := log.NewContext(logger).With("k", "v") b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { @@ -166,9 +185,9 @@ func BenchmarkOneWith(b *testing.B) { func BenchmarkTwoWith(b *testing.B) { logger := log.NewNopLogger() - lc := log.With(logger, "k", "v") + lc := log.NewContext(logger).With("k", "v") for i := 1; i < 2; i++ { - lc = log.With(lc, "k", "v") + lc = lc.With("k", "v") } b.ReportAllocs() b.ResetTimer() @@ -179,9 +198,9 @@ func BenchmarkTwoWith(b *testing.B) { func BenchmarkTenWith(b *testing.B) { logger := log.NewNopLogger() - lc := log.With(logger, "k", "v") + lc := log.NewContext(logger).With("k", "v") for i := 1; i < 10; i++ { - lc = log.With(lc, "k", "v") + lc = lc.With("k", "v") } b.ReportAllocs() b.ResetTimer() diff --git a/vendor/github.com/go-kit/kit/log/nop_logger_test.go b/vendor/github.com/go-kit/kit/log/nop_logger_test.go index 908ddd8..70e69cd 100644 --- a/vendor/github.com/go-kit/kit/log/nop_logger_test.go +++ b/vendor/github.com/go-kit/kit/log/nop_logger_test.go @@ -12,7 +12,7 @@ func TestNopLogger(t *testing.T) { if err := logger.Log("abc", 123); err != nil { t.Error(err) } - if err := log.With(logger, "def", "ghi").Log(); err != nil { + if err := log.NewContext(logger).With("def", "ghi").Log(); err != nil { t.Error(err) } } diff --git a/vendor/github.com/go-kit/kit/log/stdlib.go b/vendor/github.com/go-kit/kit/log/stdlib.go index ff96b5d..7ffd1ca 100644 --- a/vendor/github.com/go-kit/kit/log/stdlib.go +++ b/vendor/github.com/go-kit/kit/log/stdlib.go @@ -39,7 +39,7 @@ func TimestampKey(key string) StdlibAdapterOption { return func(a *StdlibAdapter) { a.timestampKey = key } } -// FileKey sets the key for the file and line field. By default, it's "caller". +// FileKey sets the key for the file and line field. By default, it's "file". func FileKey(key string) StdlibAdapterOption { return func(a *StdlibAdapter) { a.fileKey = key } } @@ -55,7 +55,7 @@ func NewStdlibAdapter(logger Logger, options ...StdlibAdapterOption) io.Writer { a := StdlibAdapter{ Logger: logger, timestampKey: "ts", - fileKey: "caller", + fileKey: "file", messageKey: "msg", } for _, option := range options { diff --git a/vendor/github.com/go-kit/kit/log/stdlib_test.go b/vendor/github.com/go-kit/kit/log/stdlib_test.go index 90ebc5f..bdf94e8 100644 --- a/vendor/github.com/go-kit/kit/log/stdlib_test.go +++ b/vendor/github.com/go-kit/kit/log/stdlib_test.go @@ -35,9 +35,9 @@ func TestStdlibAdapterUsage(t *testing.T) { log.Ldate: "ts=" + date + " msg=hello\n", log.Ltime: "ts=" + time + " msg=hello\n", log.Ldate | log.Ltime: "ts=\"" + date + " " + time + "\" msg=hello\n", - log.Lshortfile: "caller=stdlib_test.go:44 msg=hello\n", - log.Lshortfile | log.Ldate: "ts=" + date + " caller=stdlib_test.go:44 msg=hello\n", - log.Lshortfile | log.Ldate | log.Ltime: "ts=\"" + date + " " + time + "\" caller=stdlib_test.go:44 msg=hello\n", + log.Lshortfile: "file=stdlib_test.go:44 msg=hello\n", + log.Lshortfile | log.Ldate: "ts=" + date + " file=stdlib_test.go:44 msg=hello\n", + log.Lshortfile | log.Ldate | log.Ltime: "ts=\"" + date + " " + time + "\" file=stdlib_test.go:44 msg=hello\n", } { buf.Reset() stdlog.SetFlags(flag) @@ -58,11 +58,11 @@ func TestStdLibAdapterExtraction(t *testing.T) { "2009/01/23 01:23:23: hello": "ts=\"2009/01/23 01:23:23\" msg=hello\n", "01:23:23: hello": "ts=01:23:23 msg=hello\n", "2009/01/23 01:23:23.123123: hello": "ts=\"2009/01/23 01:23:23.123123\" msg=hello\n", - "2009/01/23 01:23:23.123123 /a/b/c/d.go:23: hello": "ts=\"2009/01/23 01:23:23.123123\" caller=/a/b/c/d.go:23 msg=hello\n", - "01:23:23.123123 /a/b/c/d.go:23: hello": "ts=01:23:23.123123 caller=/a/b/c/d.go:23 msg=hello\n", - "2009/01/23 01:23:23 /a/b/c/d.go:23: hello": "ts=\"2009/01/23 01:23:23\" caller=/a/b/c/d.go:23 msg=hello\n", - "2009/01/23 /a/b/c/d.go:23: hello": "ts=2009/01/23 caller=/a/b/c/d.go:23 msg=hello\n", - "/a/b/c/d.go:23: hello": "caller=/a/b/c/d.go:23 msg=hello\n", + "2009/01/23 01:23:23.123123 /a/b/c/d.go:23: hello": "ts=\"2009/01/23 01:23:23.123123\" file=/a/b/c/d.go:23 msg=hello\n", + "01:23:23.123123 /a/b/c/d.go:23: hello": "ts=01:23:23.123123 file=/a/b/c/d.go:23 msg=hello\n", + "2009/01/23 01:23:23 /a/b/c/d.go:23: hello": "ts=\"2009/01/23 01:23:23\" file=/a/b/c/d.go:23 msg=hello\n", + "2009/01/23 /a/b/c/d.go:23: hello": "ts=2009/01/23 file=/a/b/c/d.go:23 msg=hello\n", + "/a/b/c/d.go:23: hello": "file=/a/b/c/d.go:23 msg=hello\n", } { buf.Reset() fmt.Fprint(writer, input) diff --git a/vendor/github.com/go-kit/kit/log/term/colorlogger.go b/vendor/github.com/go-kit/kit/log/term/colorlogger.go index 00376ce..76d94ea 100644 --- a/vendor/github.com/go-kit/kit/log/term/colorlogger.go +++ b/vendor/github.com/go-kit/kit/log/term/colorlogger.go @@ -42,7 +42,7 @@ const ( // https://en.wikipedia.org/wiki/ANSI_escape_code#Colors. var ( - resetColorBytes = []byte("\x1b[39;49;22m") + resetColorBytes = []byte("\x1b[39;49m") fgColorBytes [][]byte bgColorBytes [][]byte ) diff --git a/vendor/github.com/go-kit/kit/log/term/colorlogger_test.go b/vendor/github.com/go-kit/kit/log/term/colorlogger_test.go index c27ac59..030651a 100644 --- a/vendor/github.com/go-kit/kit/log/term/colorlogger_test.go +++ b/vendor/github.com/go-kit/kit/log/term/colorlogger_test.go @@ -27,7 +27,7 @@ func TestColorLogger(t *testing.T) { if err := logger.Log("a", 1); err != nil { t.Fatal(err) } - if want, have := "\x1b[32;1m\x1b[47;1ma=1\n\x1b[39;49;22m", buf.String(); want != have { + if want, have := "\x1b[32;1m\x1b[47;1ma=1\n\x1b[39;49m", buf.String(); want != have { t.Errorf("\nwant %#v\nhave %#v", want, have) } } @@ -56,7 +56,7 @@ func TestColorLoggerConcurrency(t *testing.T) { // copied from log/benchmark_test.go func benchmarkRunner(b *testing.B, logger log.Logger, f func(log.Logger)) { - lc := log.With(logger, "common_key", "common_value") + lc := log.NewContext(logger).With("common_key", "common_value") b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { @@ -66,7 +66,7 @@ func benchmarkRunner(b *testing.B, logger log.Logger, f func(log.Logger)) { var ( baseMessage = func(logger log.Logger) { logger.Log("foo_key", "foo_value") } - withMessage = func(logger log.Logger) { log.With(logger, "a", "b").Log("c", "d") } + withMessage = func(logger log.Logger) { log.NewContext(logger).With("a", "b").Log("c", "d") } ) // copied from log/concurrency_test.go diff --git a/vendor/github.com/go-kit/kit/log/value.go b/vendor/github.com/go-kit/kit/log/value.go index 0ce9b01..2b0448e 100644 --- a/vendor/github.com/go-kit/kit/log/value.go +++ b/vendor/github.com/go-kit/kit/log/value.go @@ -6,9 +6,9 @@ import ( "github.com/go-stack/stack" ) -// A Valuer generates a log value. When passed to With or WithPrefix in a -// value element (odd indexes), it represents a dynamic value which is re- -// evaluated with each log event. +// A Valuer generates a log value. When passed to Context.With in a value +// element (odd indexes), it represents a dynamic value which is re-evaluated +// with each log event. type Valuer func() interface{} // bindValues replaces all value elements (odd indexes) containing a Valuer @@ -39,6 +39,16 @@ func Timestamp(t func() time.Time) Valuer { return func() interface{} { return t() } } +var ( + // DefaultTimestamp is a Valuer that returns the current wallclock time, + // respecting time zones, when bound. + DefaultTimestamp Valuer = func() interface{} { return time.Now().Format(time.RFC3339) } + + // DefaultTimestampUTC is a Valuer that returns the current time in UTC + // when bound. + DefaultTimestampUTC Valuer = func() interface{} { return time.Now().UTC().Format(time.RFC3339) } +) + // Caller returns a Valuer that returns a file and line from a specified depth // in the callstack. Users will probably want to use DefaultCaller. func Caller(depth int) Valuer { @@ -46,18 +56,6 @@ func Caller(depth int) Valuer { } var ( - // DefaultTimestamp is a Valuer that returns the current wallclock time, - // respecting time zones, when bound. - DefaultTimestamp = Valuer(func() interface{} { - return time.Now().Format(time.RFC3339Nano) - }) - - // DefaultTimestampUTC is a Valuer that returns the current time in UTC - // when bound. - DefaultTimestampUTC = Valuer(func() interface{} { - return time.Now().UTC().Format(time.RFC3339Nano) - }) - // DefaultCaller is a Valuer that returns the file and line where the Log // method was invoked. It can only be used with log.With. DefaultCaller = Caller(3) diff --git a/vendor/github.com/go-kit/kit/log/value_test.go b/vendor/github.com/go-kit/kit/log/value_test.go index f67eece..44e6478 100644 --- a/vendor/github.com/go-kit/kit/log/value_test.go +++ b/vendor/github.com/go-kit/kit/log/value_test.go @@ -24,7 +24,7 @@ func TestValueBinding(t *testing.T) { return now } - lc := log.With(logger, "ts", log.Timestamp(mocktime), "caller", log.DefaultCaller) + lc := log.NewContext(logger).With("ts", log.Timestamp(mocktime), "caller", log.DefaultCaller) lc.Log("foo", "bar") timestamp, ok := output[1].(time.Time) @@ -68,7 +68,7 @@ func TestValueBinding_loggingZeroKeyvals(t *testing.T) { return now } - logger = log.With(logger, "ts", log.Timestamp(mocktime)) + logger = log.NewContext(logger).With("ts", log.Timestamp(mocktime)) logger.Log() timestamp, ok := output[1].(time.Time) @@ -92,7 +92,7 @@ func TestValueBinding_loggingZeroKeyvals(t *testing.T) { func BenchmarkValueBindingTimestamp(b *testing.B) { logger := log.NewNopLogger() - lc := log.With(logger, "ts", log.DefaultTimestamp) + lc := log.NewContext(logger).With("ts", log.DefaultTimestamp) b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { @@ -102,7 +102,7 @@ func BenchmarkValueBindingTimestamp(b *testing.B) { func BenchmarkValueBindingCaller(b *testing.B) { logger := log.NewNopLogger() - lc := log.With(logger, "caller", log.DefaultCaller) + lc := log.NewContext(logger).With("caller", log.DefaultCaller) b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { diff --git a/vendor/github.com/go-kit/kit/metrics/README.md b/vendor/github.com/go-kit/kit/metrics/README.md index fd3347e..8ffa8fe 100644 --- a/vendor/github.com/go-kit/kit/metrics/README.md +++ b/vendor/github.com/go-kit/kit/metrics/README.md @@ -49,7 +49,7 @@ import ( ) func main() { - var dur metrics.Histogram = prometheus.NewSummaryFrom(stdprometheus.SummaryOpts{ + var dur metrics.Histogram = prometheus.NewSummary(stdprometheus.SummaryOpts{ Namespace: "myservice", Subsystem: "api", Name: "request_duration_seconds", @@ -93,5 +93,3 @@ func exportGoroutines(g metrics.Gauge) { } } ``` - -For more information, see [the package documentation](https://godoc.org/github.com/go-kit/kit/metrics). diff --git a/vendor/github.com/go-kit/kit/metrics/circonus/circonus.go b/vendor/github.com/go-kit/kit/metrics/circonus/circonus.go new file mode 100644 index 0000000..68e00ad --- /dev/null +++ b/vendor/github.com/go-kit/kit/metrics/circonus/circonus.go @@ -0,0 +1,85 @@ +// Package circonus provides a Circonus backend for metrics. +package circonus + +import ( + "github.com/circonus-labs/circonus-gometrics" + + "github.com/go-kit/kit/metrics" +) + +// Circonus wraps a CirconusMetrics object and provides constructors for each of +// the Go kit metrics. The CirconusMetrics object manages aggregation of +// observations and emission to the Circonus server. +type Circonus struct { + m *circonusgometrics.CirconusMetrics +} + +// New creates a new Circonus object wrapping the passed CirconusMetrics, which +// the caller should create and set in motion. The Circonus object can be used +// to construct individual Go kit metrics. +func New(m *circonusgometrics.CirconusMetrics) *Circonus { + return &Circonus{ + m: m, + } +} + +// NewCounter returns a counter metric with the given name. +func (c *Circonus) NewCounter(name string) *Counter { + return &Counter{ + name: name, + m: c.m, + } +} + +// NewGauge returns a gauge metric with the given name. +func (c *Circonus) NewGauge(name string) *Gauge { + return &Gauge{ + name: name, + m: c.m, + } +} + +// NewHistogram returns a histogram metric with the given name. +func (c *Circonus) NewHistogram(name string) *Histogram { + return &Histogram{ + h: c.m.NewHistogram(name), + } +} + +// Counter is a Circonus implementation of a counter metric. +type Counter struct { + name string + m *circonusgometrics.CirconusMetrics +} + +// With implements Counter, but is a no-op, because Circonus metrics have no +// concept of per-observation label values. +func (c *Counter) With(labelValues ...string) metrics.Counter { return c } + +// Add implements Counter. Delta is converted to uint64; precision will be lost. +func (c *Counter) Add(delta float64) { c.m.Add(c.name, uint64(delta)) } + +// Gauge is a Circonus implementation of a gauge metric. +type Gauge struct { + name string + m *circonusgometrics.CirconusMetrics +} + +// With implements Gauge, but is a no-op, because Circonus metrics have no +// concept of per-observation label values. +func (g *Gauge) With(labelValues ...string) metrics.Gauge { return g } + +// Set implements Gauge. +func (g *Gauge) Set(value float64) { g.m.SetGauge(g.name, value) } + +// Histogram is a Circonus implementation of a histogram metric. +type Histogram struct { + h *circonusgometrics.Histogram +} + +// With implements Histogram, but is a no-op, because Circonus metrics have no +// concept of per-observation label values. +func (h *Histogram) With(labelValues ...string) metrics.Histogram { return h } + +// Observe implements Histogram. No precision is lost. +func (h *Histogram) Observe(value float64) { h.h.RecordValue(value) } diff --git a/vendor/github.com/go-kit/kit/metrics/circonus/circonus_test.go b/vendor/github.com/go-kit/kit/metrics/circonus/circonus_test.go new file mode 100644 index 0000000..263c6b6 --- /dev/null +++ b/vendor/github.com/go-kit/kit/metrics/circonus/circonus_test.go @@ -0,0 +1,120 @@ +package circonus + +import ( + "encoding/json" + "net/http" + "net/http/httptest" + "regexp" + "strconv" + "testing" + + "github.com/circonus-labs/circonus-gometrics" + "github.com/circonus-labs/circonus-gometrics/checkmgr" + + "github.com/go-kit/kit/metrics/generic" + "github.com/go-kit/kit/metrics/teststat" +) + +func TestCounter(t *testing.T) { + // The only way to extract values from Circonus is to pose as a Circonus + // server and receive real HTTP writes. + const name = "abc" + var val int64 + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + var res map[string]struct { + Value int64 `json:"_value"` // reverse-engineered :\ + } + json.NewDecoder(r.Body).Decode(&res) + val = res[name].Value + })) + defer s.Close() + + // Set up a Circonus object, submitting to our HTTP server. + m := newCirconusMetrics(s.URL) + counter := New(m).NewCounter(name).With("label values", "not supported") + value := func() float64 { m.Flush(); return float64(val) } + + // Engage. + if err := teststat.TestCounter(counter, value); err != nil { + t.Fatal(err) + } +} + +func TestGauge(t *testing.T) { + const name = "def" + var val float64 + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + var res map[string]struct { + Value string `json:"_value"` + } + json.NewDecoder(r.Body).Decode(&res) + val, _ = strconv.ParseFloat(res[name].Value, 64) + })) + defer s.Close() + + m := newCirconusMetrics(s.URL) + gauge := New(m).NewGauge(name).With("label values", "not supported") + value := func() float64 { m.Flush(); return val } + + if err := teststat.TestGauge(gauge, value); err != nil { + t.Fatal(err) + } +} + +func TestHistogram(t *testing.T) { + const name = "ghi" + + // Circonus just emits bucketed counts. We'll dump them into a generic + // histogram (losing some precision) and take statistics from there. Note + // this does assume that the generic histogram computes statistics properly, + // but we have another test for that :) + re := regexp.MustCompile(`^H\[([0-9\.e\+]+)\]=([0-9]+)$`) // H[1.2e+03]=456 + + var p50, p90, p95, p99 float64 + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + var res map[string]struct { + Values []string `json:"_value"` // reverse-engineered :\ + } + json.NewDecoder(r.Body).Decode(&res) + + h := generic.NewHistogram("dummy", len(res[name].Values)) // match tbe bucket counts + for _, v := range res[name].Values { + match := re.FindStringSubmatch(v) + f, _ := strconv.ParseFloat(match[1], 64) + n, _ := strconv.ParseInt(match[2], 10, 64) + for i := int64(0); i < n; i++ { + h.Observe(f) + } + } + + p50 = h.Quantile(0.50) + p90 = h.Quantile(0.90) + p95 = h.Quantile(0.95) + p99 = h.Quantile(0.99) + })) + defer s.Close() + + m := newCirconusMetrics(s.URL) + histogram := New(m).NewHistogram(name).With("label values", "not supported") + quantiles := func() (float64, float64, float64, float64) { m.Flush(); return p50, p90, p95, p99 } + + // Circonus metrics, because they do their own bucketing, are less precise + // than other systems. So, we bump the tolerance to 5 percent. + if err := teststat.TestHistogram(histogram, quantiles, 0.05); err != nil { + t.Fatal(err) + } +} + +func newCirconusMetrics(url string) *circonusgometrics.CirconusMetrics { + m, err := circonusgometrics.NewCirconusMetrics(&circonusgometrics.Config{ + CheckManager: checkmgr.Config{ + Check: checkmgr.CheckConfig{ + SubmissionURL: url, + }, + }, + }) + if err != nil { + panic(err) + } + return m +} diff --git a/vendor/github.com/go-kit/kit/metrics/discard/discard.go b/vendor/github.com/go-kit/kit/metrics/discard/discard.go index a0d3b14..0bbab8f 100644 --- a/vendor/github.com/go-kit/kit/metrics/discard/discard.go +++ b/vendor/github.com/go-kit/kit/metrics/discard/discard.go @@ -25,9 +25,6 @@ func (g gauge) With(labelValues ...string) metrics.Gauge { return g } // Set implements Gauge. func (g gauge) Set(value float64) {} -// Add implements metrics.Gauge. -func (g gauge) Add(delta float64) {} - type histogram struct{} // NewHistogram returns a new no-op histogram. diff --git a/vendor/github.com/go-kit/kit/metrics/doc.go b/vendor/github.com/go-kit/kit/metrics/doc.go index 3bb7c17..0318ed8 100644 --- a/vendor/github.com/go-kit/kit/metrics/doc.go +++ b/vendor/github.com/go-kit/kit/metrics/doc.go @@ -1,48 +1,17 @@ -// Package metrics provides a framework for application instrumentation. It's -// primarily designed to help you get started with good and robust -// instrumentation, and to help you migrate from a less-capable system like -// Graphite to a more-capable system like Prometheus. If your organization has -// already standardized on an instrumentation system like Prometheus, and has no -// plans to change, it may make sense to use that system's instrumentation -// library directly. +// Package metrics provides a framework for application instrumentation. All +// metrics are safe for concurrent use. Considerable design influence has been +// taken from https://github.com/codahale/metrics and https://prometheus.io. // -// This package provides three core metric abstractions (Counter, Gauge, and -// Histogram) and implementations for almost all common instrumentation -// backends. Each metric has an observation method (Add, Set, or Observe, -// respectively) used to record values, and a With method to "scope" the -// observation by various parameters. For example, you might have a Histogram to -// record request durations, parameterized by the method that's being called. -// -// var requestDuration metrics.Histogram -// // ... -// requestDuration.With("method", "MyMethod").Observe(time.Since(begin)) -// -// This allows a single high-level metrics object (requestDuration) to work with -// many code paths somewhat dynamically. The concept of With is fully supported -// in some backends like Prometheus, and not supported in other backends like -// Graphite. So, With may be a no-op, depending on the concrete implementation -// you choose. Please check the implementation to know for sure. For -// implementations that don't provide With, it's necessary to fully parameterize -// each metric in the metric name, e.g. -// -// // Statsd -// c := statsd.NewCounter("request_duration_MyMethod_200") -// c.Add(1) -// -// // Prometheus -// c := prometheus.NewCounter(stdprometheus.CounterOpts{ -// Name: "request_duration", -// ... -// }, []string{"method", "status_code"}) -// c.With("method", "MyMethod", "status_code", strconv.Itoa(code)).Add(1) +// This package contains the common interfaces. Your code should take these +// interfaces as parameters. Implementations are provided for different +// instrumentation systems in the various subdirectories. // // Usage // -// Metrics are dependencies, and should be passed to the components that need +// Metrics are dependencies and should be passed to the components that need // them in the same way you'd construct and pass a database handle, or reference -// to another component. Metrics should *not* be created in the global scope. -// Instead, instantiate metrics in your func main, using whichever concrete -// implementation is appropriate for your organization. +// to another component. So, create metrics in your func main, using whichever +// concrete implementation is appropriate for your organization. // // latency := prometheus.NewSummaryFrom(stdprometheus.SummaryOpts{ // Namespace: "myteam", @@ -71,14 +40,8 @@ // api := NewAPI(store, logger, latency) // http.ListenAndServe("/", api) // -// Note that metrics are "write-only" interfaces. -// // Implementation details // -// All metrics are safe for concurrent use. Considerable design influence has -// been taken from https://github.com/codahale/metrics and -// https://prometheus.io. -// // Each telemetry system has different semantics for label values, push vs. // pull, support for histograms, etc. These properties influence the design of // their respective packages. This table attempts to summarize the key points of @@ -91,6 +54,7 @@ // expvar 1 atomic atomic synthetic, batch, in-place expose // influx n custom custom custom // prometheus n native native native +// circonus 1 native native native // pcp 1 native native native // package metrics diff --git a/vendor/github.com/go-kit/kit/metrics/dogstatsd/dogstatsd.go b/vendor/github.com/go-kit/kit/metrics/dogstatsd/dogstatsd.go index 13e0b4f..20a77dc 100644 --- a/vendor/github.com/go-kit/kit/metrics/dogstatsd/dogstatsd.go +++ b/vendor/github.com/go-kit/kit/metrics/dogstatsd/dogstatsd.go @@ -72,7 +72,6 @@ func (d *Dogstatsd) NewGauge(name string) *Gauge { return &Gauge{ name: d.prefix + name, obs: d.gauges.Observe, - add: d.gauges.Add, } } @@ -245,7 +244,6 @@ type Gauge struct { name string lvs lv.LabelValues obs observeFunc - add observeFunc } // With implements metrics.Gauge. @@ -254,7 +252,6 @@ func (g *Gauge) With(labelValues ...string) metrics.Gauge { name: g.name, lvs: g.lvs.With(labelValues...), obs: g.obs, - add: g.add, } } @@ -263,11 +260,6 @@ func (g *Gauge) Set(value float64) { g.obs(g.name, g.lvs, value) } -// Add implements metrics.Gauge. -func (g *Gauge) Add(delta float64) { - g.add(g.name, g.lvs, delta) -} - // Timing is a DogStatsD timing, or metrics.Histogram. Observations are // forwarded to a Dogstatsd object, and collected (but not aggregated) per // timeseries. diff --git a/vendor/github.com/go-kit/kit/metrics/expvar/expvar.go b/vendor/github.com/go-kit/kit/metrics/expvar/expvar.go index ce6f3b8..dcb5d62 100644 --- a/vendor/github.com/go-kit/kit/metrics/expvar/expvar.go +++ b/vendor/github.com/go-kit/kit/metrics/expvar/expvar.go @@ -50,9 +50,6 @@ func (g *Gauge) With(labelValues ...string) metrics.Gauge { return g } // Set implements Gauge. func (g *Gauge) Set(value float64) { g.f.Set(value) } -// Add implements metrics.Gauge. -func (g *Gauge) Add(delta float64) { g.f.Add(delta) } - // Histogram implements the histogram metric with a combination of the generic // Histogram object and several expvar Floats, one for each of the 50th, 90th, // 95th, and 99th quantiles of observed values, with the quantile attached to diff --git a/vendor/github.com/go-kit/kit/metrics/generic/generic.go b/vendor/github.com/go-kit/kit/metrics/generic/generic.go index ebde9c8..7e68252 100644 --- a/vendor/github.com/go-kit/kit/metrics/generic/generic.go +++ b/vendor/github.com/go-kit/kit/metrics/generic/generic.go @@ -33,7 +33,6 @@ func NewCounter(name string) *Counter { // With implements Counter. func (c *Counter) With(labelValues ...string) metrics.Counter { return &Counter{ - Name: c.Name, bits: atomic.LoadUint64(&c.bits), lvs: c.lvs.With(labelValues...), } @@ -96,7 +95,6 @@ func NewGauge(name string) *Gauge { // With implements Gauge. func (g *Gauge) With(labelValues ...string) metrics.Gauge { return &Gauge{ - Name: g.Name, bits: atomic.LoadUint64(&g.bits), lvs: g.lvs.With(labelValues...), } @@ -107,20 +105,6 @@ func (g *Gauge) Set(value float64) { atomic.StoreUint64(&g.bits, math.Float64bits(value)) } -// Add implements metrics.Gauge. -func (g *Gauge) Add(delta float64) { - for { - var ( - old = atomic.LoadUint64(&g.bits) - newf = math.Float64frombits(old) + delta - new = math.Float64bits(newf) - ) - if atomic.CompareAndSwapUint64(&g.bits, old, new) { - break - } - } -} - // Value returns the current value of the gauge. func (g *Gauge) Value() float64 { return math.Float64frombits(atomic.LoadUint64(&g.bits)) @@ -137,7 +121,7 @@ func (g *Gauge) LabelValues() []string { type Histogram struct { Name string lvs lv.LabelValues - h *safeHistogram + h gohistogram.Histogram } // NewHistogram returns a numeric histogram based on VividCortex/gohistogram. A @@ -145,30 +129,25 @@ type Histogram struct { func NewHistogram(name string, buckets int) *Histogram { return &Histogram{ Name: name, - h: &safeHistogram{Histogram: gohistogram.NewHistogram(buckets)}, + h: gohistogram.NewHistogram(buckets), } } // With implements Histogram. func (h *Histogram) With(labelValues ...string) metrics.Histogram { return &Histogram{ - Name: h.Name, - lvs: h.lvs.With(labelValues...), - h: h.h, + lvs: h.lvs.With(labelValues...), + h: h.h, } } // Observe implements Histogram. func (h *Histogram) Observe(value float64) { - h.h.Lock() - defer h.h.Unlock() h.h.Add(value) } // Quantile returns the value of the quantile q, 0.0 < q < 1.0. func (h *Histogram) Quantile(q float64) float64 { - h.h.RLock() - defer h.h.RUnlock() return h.h.Quantile(q) } @@ -180,17 +159,9 @@ func (h *Histogram) LabelValues() []string { // Print writes a string representation of the histogram to the passed writer. // Useful for printing to a terminal. func (h *Histogram) Print(w io.Writer) { - h.h.RLock() - defer h.h.RUnlock() fmt.Fprintf(w, h.h.String()) } -// safeHistogram exists as gohistogram.Histogram is not goroutine-safe. -type safeHistogram struct { - sync.RWMutex - gohistogram.Histogram -} - // Bucket is a range in a histogram which aggregates observations. type Bucket struct { From, To, Count int64 @@ -237,7 +208,7 @@ func (h *SimpleHistogram) Observe(value float64) { // ApproximateMovingAverage returns the approximate moving average of observations. func (h *SimpleHistogram) ApproximateMovingAverage() float64 { h.mtx.RLock() - defer h.mtx.RUnlock() + h.mtx.RUnlock() return h.avg } diff --git a/vendor/github.com/go-kit/kit/metrics/generic/generic_test.go b/vendor/github.com/go-kit/kit/metrics/generic/generic_test.go index 56e6a5c..de8940b 100644 --- a/vendor/github.com/go-kit/kit/metrics/generic/generic_test.go +++ b/vendor/github.com/go-kit/kit/metrics/generic/generic_test.go @@ -7,7 +7,6 @@ package generic_test import ( "math" "math/rand" - "sync" "testing" "github.com/go-kit/kit/metrics/generic" @@ -15,11 +14,7 @@ import ( ) func TestCounter(t *testing.T) { - name := "my_counter" - counter := generic.NewCounter(name).With("label", "counter").(*generic.Counter) - if want, have := name, counter.Name; want != have { - t.Errorf("Name: want %q, have %q", want, have) - } + counter := generic.NewCounter("my_counter").With("label", "counter").(*generic.Counter) value := func() float64 { return counter.Value() } if err := teststat.TestCounter(counter, value); err != nil { t.Fatal(err) @@ -40,11 +35,7 @@ func TestValueReset(t *testing.T) { } func TestGauge(t *testing.T) { - name := "my_gauge" - gauge := generic.NewGauge(name).With("label", "gauge").(*generic.Gauge) - if want, have := name, gauge.Name; want != have { - t.Errorf("Name: want %q, have %q", want, have) - } + gauge := generic.NewGauge("my_gauge").With("label", "gauge").(*generic.Gauge) value := func() float64 { return gauge.Value() } if err := teststat.TestGauge(gauge, value); err != nil { t.Fatal(err) @@ -52,11 +43,7 @@ func TestGauge(t *testing.T) { } func TestHistogram(t *testing.T) { - name := "my_histogram" - histogram := generic.NewHistogram(name, 50).With("label", "histogram").(*generic.Histogram) - if want, have := name, histogram.Name; want != have { - t.Errorf("Name: want %q, have %q", want, have) - } + histogram := generic.NewHistogram("my_histogram", 50).With("label", "histogram").(*generic.Histogram) quantiles := func() (float64, float64, float64, float64) { return histogram.Quantile(0.50), histogram.Quantile(0.90), histogram.Quantile(0.95), histogram.Quantile(0.99) } @@ -65,27 +52,6 @@ func TestHistogram(t *testing.T) { } } -func TestIssue424(t *testing.T) { - var ( - histogram = generic.NewHistogram("dont_panic", 50) - concurrency = 100 - operations = 1000 - wg sync.WaitGroup - ) - - wg.Add(concurrency) - for i := 0; i < concurrency; i++ { - go func() { - defer wg.Done() - for j := 0; j < operations; j++ { - histogram.Observe(float64(j)) - histogram.Observe(histogram.Quantile(0.5)) - } - }() - } - wg.Wait() -} - func TestSimpleHistogram(t *testing.T) { histogram := generic.NewSimpleHistogram().With("label", "simple_histogram").(*generic.SimpleHistogram) var ( diff --git a/vendor/github.com/go-kit/kit/metrics/graphite/graphite.go b/vendor/github.com/go-kit/kit/metrics/graphite/graphite.go index 9814e1f..682e147 100644 --- a/vendor/github.com/go-kit/kit/metrics/graphite/graphite.go +++ b/vendor/github.com/go-kit/kit/metrics/graphite/graphite.go @@ -38,7 +38,7 @@ type Graphite struct { logger log.Logger } -// New returns a Graphite object that may be used to create metrics. Prefix is +// New returns a Statsd object that may be used to create metrics. Prefix is // applied to all created metrics. Callers must ensure that regular calls to // WriteTo are performed, either manually or with one of the helper methods. func New(prefix string, logger log.Logger) *Graphite { @@ -182,9 +182,6 @@ func (g *Gauge) With(...string) metrics.Gauge { return g } // Set implements gauge. func (g *Gauge) Set(value float64) { g.g.Set(value) } -// Add implements metrics.Gauge. -func (g *Gauge) Add(delta float64) { g.g.Add(delta) } - // Histogram is a Graphite histogram metric. Observations are bucketed into // per-quantile gauges. type Histogram struct { diff --git a/vendor/github.com/go-kit/kit/metrics/graphite/graphite_test.go b/vendor/github.com/go-kit/kit/metrics/graphite/graphite_test.go index 6474e20..e4bd87f 100644 --- a/vendor/github.com/go-kit/kit/metrics/graphite/graphite_test.go +++ b/vendor/github.com/go-kit/kit/metrics/graphite/graphite_test.go @@ -36,7 +36,7 @@ func TestGauge(t *testing.T) { func TestHistogram(t *testing.T) { // The histogram test is actually like 4 gauge tests. - prefix, name := "graphite.", "histogram_test" + prefix, name := "statsd.", "histogram_test" label, value := "abc", "def" // ignored for Graphite re50 := regexp.MustCompile(prefix + name + `.p50 ([0-9\.]+) [0-9]+`) re90 := regexp.MustCompile(prefix + name + `.p90 ([0-9\.]+) [0-9]+`) diff --git a/vendor/github.com/go-kit/kit/metrics/influx/example_test.go b/vendor/github.com/go-kit/kit/metrics/influx/example_test.go index 7df3f38..1a5105c 100644 --- a/vendor/github.com/go-kit/kit/metrics/influx/example_test.go +++ b/vendor/github.com/go-kit/kit/metrics/influx/example_test.go @@ -44,14 +44,11 @@ func ExampleGauge() { gauge.With("error", "true").Set(1) gauge.With("error", "false").Set(2) gauge.Set(50) - gauge.With("test", "true").Set(1) - gauge.With("test", "true").Add(1) client := &bufWriter{} in.WriteTo(client) expectedLines := []string{ - `(influx_gauge,a=b,test=true value=2) [0-9]{19}`, `(influx_gauge,a=b value=50) [0-9]{19}`, `(influx_gauge,a=b,error=true value=1) [0-9]{19}`, `(influx_gauge,a=b,error=false value=2) [0-9]{19}`, @@ -62,7 +59,6 @@ func ExampleGauge() { } // Output: - // influx_gauge,a=b,test=true value=2 // influx_gauge,a=b value=50 // influx_gauge,a=b,error=true value=1 // influx_gauge,a=b,error=false value=2 diff --git a/vendor/github.com/go-kit/kit/metrics/influx/influx.go b/vendor/github.com/go-kit/kit/metrics/influx/influx.go index 1ea0cc5..0c555e1 100644 --- a/vendor/github.com/go-kit/kit/metrics/influx/influx.go +++ b/vendor/github.com/go-kit/kit/metrics/influx/influx.go @@ -66,7 +66,6 @@ func (in *Influx) NewGauge(name string) *Gauge { return &Gauge{ name: name, obs: in.gauges.Observe, - add: in.gauges.Add, } } @@ -169,14 +168,10 @@ func mergeTags(tags map[string]string, labelValues []string) map[string]string { if len(labelValues)%2 != 0 { panic("mergeTags received a labelValues with an odd number of strings") } - ret := make(map[string]string, len(tags)+len(labelValues)/2) - for k, v := range tags { - ret[k] = v - } for i := 0; i < len(labelValues); i += 2 { - ret[labelValues[i]] = labelValues[i+1] + tags[labelValues[i]] = labelValues[i+1] } - return ret + return tags } func sum(a []float64) float64 { @@ -221,7 +216,6 @@ type Gauge struct { name string lvs lv.LabelValues obs observeFunc - add observeFunc } // With implements metrics.Gauge. @@ -230,7 +224,6 @@ func (g *Gauge) With(labelValues ...string) metrics.Gauge { name: g.name, lvs: g.lvs.With(labelValues...), obs: g.obs, - add: g.add, } } @@ -239,11 +232,6 @@ func (g *Gauge) Set(value float64) { g.obs(g.name, g.lvs, value) } -// Add implements metrics.Gauge. -func (g *Gauge) Add(delta float64) { - g.add(g.name, g.lvs, delta) -} - // Histogram is an Influx histrogram. Observations are aggregated into a // generic.Histogram and emitted as per-quantile gauges to the Influx server. type Histogram struct { diff --git a/vendor/github.com/go-kit/kit/metrics/influx/influx_test.go b/vendor/github.com/go-kit/kit/metrics/influx/influx_test.go index 57950f3..b5d3df4 100644 --- a/vendor/github.com/go-kit/kit/metrics/influx/influx_test.go +++ b/vendor/github.com/go-kit/kit/metrics/influx/influx_test.go @@ -82,37 +82,6 @@ func TestHistogramLabels(t *testing.T) { } } -func TestIssue404(t *testing.T) { - in := New(map[string]string{}, influxdb.BatchPointsConfig{}, log.NewNopLogger()) - - counterOne := in.NewCounter("influx_counter_one").With("a", "b") - counterOne.Add(123) - - counterTwo := in.NewCounter("influx_counter_two").With("c", "d") - counterTwo.Add(456) - - w := &bufWriter{} - in.WriteTo(w) - - lines := strings.Split(strings.TrimSpace(w.buf.String()), "\n") - if want, have := 2, len(lines); want != have { - t.Fatalf("want %d, have %d", want, have) - } - for _, line := range lines { - if strings.HasPrefix(line, "influx_counter_one") { - if !strings.HasPrefix(line, "influx_counter_one,a=b count=123 ") { - t.Errorf("invalid influx_counter_one: %s", line) - } - } else if strings.HasPrefix(line, "influx_counter_two") { - if !strings.HasPrefix(line, "influx_counter_two,c=d count=456 ") { - t.Errorf("invalid influx_counter_two: %s", line) - } - } else { - t.Errorf("unexpected line: %s", line) - } - } -} - type bufWriter struct { buf bytes.Buffer } diff --git a/vendor/github.com/go-kit/kit/metrics/internal/lv/space.go b/vendor/github.com/go-kit/kit/metrics/internal/lv/space.go index 672c900..6807347 100644 --- a/vendor/github.com/go-kit/kit/metrics/internal/lv/space.go +++ b/vendor/github.com/go-kit/kit/metrics/internal/lv/space.go @@ -21,13 +21,6 @@ func (s *Space) Observe(name string, lvs LabelValues, value float64) { s.nodeFor(name).observe(lvs, value) } -// Add locates the time series identified by the name and label values in -// the vector space, and appends the delta to the last value in the list of -// observations. -func (s *Space) Add(name string, lvs LabelValues, delta float64) { - s.nodeFor(name).add(lvs, delta) -} - // Walk traverses the vector space and invokes fn for each non-empty time series // which is encountered. Return false to abort the traversal. func (s *Space) Walk(fn func(name string, lvs LabelValues, observations []float64) bool) { @@ -98,34 +91,6 @@ func (n *node) observe(lvs LabelValues, value float64) { child.observe(tail, value) } -func (n *node) add(lvs LabelValues, delta float64) { - n.mtx.Lock() - defer n.mtx.Unlock() - if len(lvs) == 0 { - var value float64 - if len(n.observations) > 0 { - value = last(n.observations) + delta - } else { - value = delta - } - n.observations = append(n.observations, value) - return - } - if len(lvs) < 2 { - panic("too few LabelValues; programmer error!") - } - head, tail := pair{lvs[0], lvs[1]}, lvs[2:] - if n.children == nil { - n.children = map[pair]*node{} - } - child, ok := n.children[head] - if !ok { - child = &node{} - n.children[head] = child - } - child.add(tail, delta) -} - func (n *node) walk(lvs LabelValues, fn func(LabelValues, []float64) bool) bool { n.mtx.RLock() defer n.mtx.RUnlock() @@ -139,7 +104,3 @@ func (n *node) walk(lvs LabelValues, fn func(LabelValues, []float64) bool) bool } return true } - -func last(a []float64) float64 { - return a[len(a)-1] -} diff --git a/vendor/github.com/go-kit/kit/metrics/metrics.go b/vendor/github.com/go-kit/kit/metrics/metrics.go index a7ba1b1..719c3d8 100644 --- a/vendor/github.com/go-kit/kit/metrics/metrics.go +++ b/vendor/github.com/go-kit/kit/metrics/metrics.go @@ -12,7 +12,6 @@ type Counter interface { type Gauge interface { With(labelValues ...string) Gauge Set(value float64) - Add(delta float64) } // Histogram describes a metric that takes repeated observations of the same diff --git a/vendor/github.com/go-kit/kit/metrics/multi/multi.go b/vendor/github.com/go-kit/kit/metrics/multi/multi.go index 0f4a9e0..971dd17 100644 --- a/vendor/github.com/go-kit/kit/metrics/multi/multi.go +++ b/vendor/github.com/go-kit/kit/metrics/multi/multi.go @@ -54,13 +54,6 @@ func (g Gauge) With(labelValues ...string) metrics.Gauge { return next } -// Add implements metrics.Gauge. -func (g Gauge) Add(delta float64) { - for _, gauge := range g { - gauge.Add(delta) - } -} - // Histogram collects multiple individual histograms and treats them as a unit. type Histogram []metrics.Histogram diff --git a/vendor/github.com/go-kit/kit/metrics/multi/multi_test.go b/vendor/github.com/go-kit/kit/metrics/multi/multi_test.go index bc52f9d..b6f5cfa 100644 --- a/vendor/github.com/go-kit/kit/metrics/multi/multi_test.go +++ b/vendor/github.com/go-kit/kit/metrics/multi/multi_test.go @@ -33,9 +33,8 @@ func TestMultiGauge(t *testing.T) { mg.Set(9) mg.Set(8) mg.Set(7) - mg.Add(3) - want := "[9 8 7 10]" + want := "[9 8 7]" for i, m := range []fmt.Stringer{g1, g2, g3} { if have := m.String(); want != have { t.Errorf("g%d: want %q, have %q", i+1, want, have) @@ -77,15 +76,6 @@ type mockGauge struct { func (g *mockGauge) Set(value float64) { g.obs = append(g.obs, value) } func (g *mockGauge) With(...string) metrics.Gauge { return g } func (g *mockGauge) String() string { return fmt.Sprintf("%v", g.obs) } -func (g *mockGauge) Add(delta float64) { - var value float64 - if len(g.obs) > 0 { - value = g.obs[len(g.obs)-1] + delta - } else { - value = delta - } - g.obs = append(g.obs, value) -} type mockHistogram struct { obs []float64 diff --git a/vendor/github.com/go-kit/kit/metrics/pcp/pcp.go b/vendor/github.com/go-kit/kit/metrics/pcp/pcp.go index e4521c6..a8887a0 100644 --- a/vendor/github.com/go-kit/kit/metrics/pcp/pcp.go +++ b/vendor/github.com/go-kit/kit/metrics/pcp/pcp.go @@ -82,7 +82,7 @@ func (g *Gauge) With(labelValues ...string) metrics.Gauge { return g } func (g *Gauge) Set(value float64) { g.g.Set(value) } // Add adds a value to the gauge. -func (g *Gauge) Add(delta float64) { g.g.Inc(delta) } +func (g *Gauge) Add(value float64) { g.g.Inc(value) } // Histogram wraps a speed Histogram. type Histogram struct { diff --git a/vendor/github.com/go-kit/kit/metrics/provider/circonus.go b/vendor/github.com/go-kit/kit/metrics/provider/circonus.go new file mode 100644 index 0000000..7515f39 --- /dev/null +++ b/vendor/github.com/go-kit/kit/metrics/provider/circonus.go @@ -0,0 +1,36 @@ +package provider + +import ( + "github.com/go-kit/kit/metrics" + "github.com/go-kit/kit/metrics/circonus" +) + +type circonusProvider struct { + c *circonus.Circonus +} + +// NewCirconusProvider takes the given Circonnus object and returns a Provider +// that produces Circonus metrics. +func NewCirconusProvider(c *circonus.Circonus) Provider { + return &circonusProvider{ + c: c, + } +} + +// NewCounter implements Provider. +func (p *circonusProvider) NewCounter(name string) metrics.Counter { + return p.c.NewCounter(name) +} + +// NewGauge implements Provider. +func (p *circonusProvider) NewGauge(name string) metrics.Gauge { + return p.c.NewGauge(name) +} + +// NewHistogram implements Provider. The buckets parameter is ignored. +func (p *circonusProvider) NewHistogram(name string, _ int) metrics.Histogram { + return p.c.NewHistogram(name) +} + +// Stop implements Provider, but is a no-op. +func (p *circonusProvider) Stop() {} diff --git a/vendor/github.com/go-kit/kit/metrics/statsd/statsd.go b/vendor/github.com/go-kit/kit/metrics/statsd/statsd.go index 8dfbf6f..6196105 100644 --- a/vendor/github.com/go-kit/kit/metrics/statsd/statsd.go +++ b/vendor/github.com/go-kit/kit/metrics/statsd/statsd.go @@ -74,7 +74,6 @@ func (s *Statsd) NewGauge(name string) *Gauge { return &Gauge{ name: s.prefix + name, obs: s.gauges.Observe, - add: s.gauges.Add, } } @@ -202,7 +201,6 @@ func (c *Counter) Add(delta float64) { type Gauge struct { name string obs observeFunc - add observeFunc } // With is a no-op. @@ -215,11 +213,6 @@ func (g *Gauge) Set(value float64) { g.obs(g.name, lv.LabelValues{}, value) } -// Add implements metrics.Gauge. -func (g *Gauge) Add(delta float64) { - g.add(g.name, lv.LabelValues{}, delta) -} - // Timing is a StatsD timing, or metrics.Histogram. Observations are // forwarded to a Statsd object, and collected (but not aggregated) per // timeseries. diff --git a/vendor/github.com/go-kit/kit/metrics/teststat/teststat.go b/vendor/github.com/go-kit/kit/metrics/teststat/teststat.go index 5a1885a..991f5c0 100644 --- a/vendor/github.com/go-kit/kit/metrics/teststat/teststat.go +++ b/vendor/github.com/go-kit/kit/metrics/teststat/teststat.go @@ -44,12 +44,6 @@ func TestGauge(gauge metrics.Gauge, value func() float64) error { want = f } - for i := 0; i < n; i++ { - f := float64(a[i]) - gauge.Add(f) - want += f - } - if have := value(); want != have { return fmt.Errorf("want %f, have %f", want, have) } diff --git a/vendor/github.com/go-kit/kit/ratelimit/token_bucket.go b/vendor/github.com/go-kit/kit/ratelimit/token_bucket.go index f6df9d0..48a4f60 100644 --- a/vendor/github.com/go-kit/kit/ratelimit/token_bucket.go +++ b/vendor/github.com/go-kit/kit/ratelimit/token_bucket.go @@ -1,11 +1,11 @@ package ratelimit import ( - "context" "errors" "time" "github.com/juju/ratelimit" + "golang.org/x/net/context" "github.com/go-kit/kit/endpoint" ) diff --git a/vendor/github.com/go-kit/kit/ratelimit/token_bucket_test.go b/vendor/github.com/go-kit/kit/ratelimit/token_bucket_test.go index 54225b8..6f815de 100644 --- a/vendor/github.com/go-kit/kit/ratelimit/token_bucket_test.go +++ b/vendor/github.com/go-kit/kit/ratelimit/token_bucket_test.go @@ -1,12 +1,12 @@ package ratelimit_test import ( - "context" "math" "testing" "time" jujuratelimit "github.com/juju/ratelimit" + "golang.org/x/net/context" "github.com/go-kit/kit/endpoint" "github.com/go-kit/kit/ratelimit" diff --git a/vendor/github.com/go-kit/kit/sd/consul/client.go b/vendor/github.com/go-kit/kit/sd/consul/client.go index fd109aa..4d88ce3 100644 --- a/vendor/github.com/go-kit/kit/sd/consul/client.go +++ b/vendor/github.com/go-kit/kit/sd/consul/client.go @@ -1,8 +1,6 @@ package consul -import ( - consul "github.com/hashicorp/consul/api" -) +import consul "github.com/hashicorp/consul/api" // Client is a wrapper around the Consul API. type Client interface { diff --git a/vendor/github.com/go-kit/kit/sd/consul/client_test.go b/vendor/github.com/go-kit/kit/sd/consul/client_test.go index bc988b3..cf02aea 100644 --- a/vendor/github.com/go-kit/kit/sd/consul/client_test.go +++ b/vendor/github.com/go-kit/kit/sd/consul/client_test.go @@ -1,13 +1,13 @@ package consul import ( - "context" "errors" "io" "reflect" "testing" stdconsul "github.com/hashicorp/consul/api" + "golang.org/x/net/context" "github.com/go-kit/kit/endpoint" ) diff --git a/vendor/github.com/go-kit/kit/sd/consul/integration_test.go b/vendor/github.com/go-kit/kit/sd/consul/integration_test.go index 3b5e79f..3355537 100644 --- a/vendor/github.com/go-kit/kit/sd/consul/integration_test.go +++ b/vendor/github.com/go-kit/kit/sd/consul/integration_test.go @@ -14,9 +14,11 @@ import ( ) func TestIntegration(t *testing.T) { - consulAddr := os.Getenv("CONSUL_ADDR") + // Connect to Consul. + // docker run -p 8500:8500 progrium/consul -server -bootstrap + consulAddr := os.Getenv("CONSUL_ADDRESS") if consulAddr == "" { - t.Fatal("CONSUL_ADDR is not set") + t.Fatal("CONSUL_ADDRESS is not set") } stdClient, err := stdconsul.NewClient(&stdconsul.Config{ Address: consulAddr, @@ -46,7 +48,7 @@ func TestIntegration(t *testing.T) { subscriber := NewSubscriber( client, factory, - log.With(logger, "component", "subscriber"), + log.NewContext(logger).With("component", "subscriber"), r.Name, r.Tags, true, @@ -64,7 +66,7 @@ func TestIntegration(t *testing.T) { } // Build a registrar for r. - registrar := NewRegistrar(client, r, log.With(logger, "component", "registrar")) + registrar := NewRegistrar(client, r, log.NewContext(logger).With("component", "registrar")) registrar.Register() defer registrar.Deregister() diff --git a/vendor/github.com/go-kit/kit/sd/consul/registrar.go b/vendor/github.com/go-kit/kit/sd/consul/registrar.go index bf26bd2..e89fef6 100644 --- a/vendor/github.com/go-kit/kit/sd/consul/registrar.go +++ b/vendor/github.com/go-kit/kit/sd/consul/registrar.go @@ -21,7 +21,7 @@ func NewRegistrar(client Client, r *stdconsul.AgentServiceRegistration, logger l return &Registrar{ client: client, registration: r, - logger: log.With(logger, "service", r.Name, "tags", fmt.Sprint(r.Tags), "address", r.Address), + logger: log.NewContext(logger).With("service", r.Name, "tags", fmt.Sprint(r.Tags), "address", r.Address), } } diff --git a/vendor/github.com/go-kit/kit/sd/consul/subscriber.go b/vendor/github.com/go-kit/kit/sd/consul/subscriber.go index 30922e2..ee3ae34 100644 --- a/vendor/github.com/go-kit/kit/sd/consul/subscriber.go +++ b/vendor/github.com/go-kit/kit/sd/consul/subscriber.go @@ -36,7 +36,7 @@ func NewSubscriber(client Client, factory sd.Factory, logger log.Logger, service s := &Subscriber{ cache: cache.New(factory, logger), client: client, - logger: log.With(logger, "service", service, "tags", fmt.Sprint(tags)), + logger: log.NewContext(logger).With("service", service, "tags", fmt.Sprint(tags)), service: service, tags: tags, passingOnly: passingOnly, diff --git a/vendor/github.com/go-kit/kit/sd/consul/subscriber_test.go b/vendor/github.com/go-kit/kit/sd/consul/subscriber_test.go index da00458..f581216 100644 --- a/vendor/github.com/go-kit/kit/sd/consul/subscriber_test.go +++ b/vendor/github.com/go-kit/kit/sd/consul/subscriber_test.go @@ -1,10 +1,10 @@ package consul import ( - "context" "testing" consul "github.com/hashicorp/consul/api" + "golang.org/x/net/context" "github.com/go-kit/kit/log" ) diff --git a/vendor/github.com/go-kit/kit/sd/etcd/client.go b/vendor/github.com/go-kit/kit/sd/etcd/client.go index d6899a3..0508723 100644 --- a/vendor/github.com/go-kit/kit/sd/etcd/client.go +++ b/vendor/github.com/go-kit/kit/sd/etcd/client.go @@ -1,7 +1,6 @@ package etcd import ( - "context" "crypto/tls" "crypto/x509" "errors" @@ -11,6 +10,7 @@ import ( "time" etcd "github.com/coreos/etcd/client" + "golang.org/x/net/context" ) var ( @@ -156,15 +156,7 @@ func (c *client) Register(s Service) error { if s.Value == "" { return ErrNoValue } - var err error - if s.TTL != nil { - _, err = c.keysAPI.Set(c.ctx, s.Key, s.Value, &etcd.SetOptions{ - PrevExist: etcd.PrevIgnore, - TTL: s.TTL.ttl, - }) - } else { - _, err = c.keysAPI.Create(c.ctx, s.Key, s.Value) - } + _, err := c.keysAPI.Create(c.ctx, s.Key, s.Value) return err } diff --git a/vendor/github.com/go-kit/kit/sd/etcd/client_test.go b/vendor/github.com/go-kit/kit/sd/etcd/client_test.go index 4c8bd91..96dd2e9 100644 --- a/vendor/github.com/go-kit/kit/sd/etcd/client_test.go +++ b/vendor/github.com/go-kit/kit/sd/etcd/client_test.go @@ -6,9 +6,8 @@ import ( "testing" "time" - "golang.org/x/net/context" - etcd "github.com/coreos/etcd/client" + "golang.org/x/net/context" ) func TestNewClient(t *testing.T) { diff --git a/vendor/github.com/go-kit/kit/sd/etcd/example_test.go b/vendor/github.com/go-kit/kit/sd/etcd/example_test.go index 11b0a56..795164c 100644 --- a/vendor/github.com/go-kit/kit/sd/etcd/example_test.go +++ b/vendor/github.com/go-kit/kit/sd/etcd/example_test.go @@ -1,10 +1,11 @@ package etcd import ( - "context" "io" "time" + "golang.org/x/net/context" + "github.com/go-kit/kit/endpoint" "github.com/go-kit/kit/log" "github.com/go-kit/kit/sd/lb" diff --git a/vendor/github.com/go-kit/kit/sd/etcd/integration_test.go b/vendor/github.com/go-kit/kit/sd/etcd/integration_test.go index 86e1a6d..e0fb3a7 100644 --- a/vendor/github.com/go-kit/kit/sd/etcd/integration_test.go +++ b/vendor/github.com/go-kit/kit/sd/etcd/integration_test.go @@ -3,12 +3,13 @@ package etcd import ( - "context" "io" "os" "testing" "time" + "golang.org/x/net/context" + "github.com/go-kit/kit/endpoint" "github.com/go-kit/kit/log" ) @@ -49,7 +50,7 @@ func TestIntegration(t *testing.T) { registrar := NewRegistrar(client, Service{ Key: key, Value: value, - }, log.With(log.NewLogfmtLogger(os.Stderr), "component", "registrar")) + }, log.NewContext(log.NewLogfmtLogger(os.Stderr)).With("component", "registrar")) // Register our instance. registrar.Register() @@ -71,7 +72,7 @@ func TestIntegration(t *testing.T) { client, prefix, func(string) (endpoint.Endpoint, io.Closer, error) { return endpoint.Nop, nil, nil }, - log.With(log.NewLogfmtLogger(os.Stderr), "component", "subscriber"), + log.NewContext(log.NewLogfmtLogger(os.Stderr)).With("component", "subscriber"), ) if err != nil { t.Fatalf("NewSubscriber: %v", err) diff --git a/vendor/github.com/go-kit/kit/sd/etcd/registrar.go b/vendor/github.com/go-kit/kit/sd/etcd/registrar.go index e386430..52b632a 100644 --- a/vendor/github.com/go-kit/kit/sd/etcd/registrar.go +++ b/vendor/github.com/go-kit/kit/sd/etcd/registrar.go @@ -1,24 +1,16 @@ package etcd import ( - "sync" - "time" - etcd "github.com/coreos/etcd/client" "github.com/go-kit/kit/log" ) -const minHeartBeatTime = 500 * time.Millisecond - // Registrar registers service instance liveness information to etcd. type Registrar struct { client Client service Service logger log.Logger - - quitmtx sync.Mutex - quit chan struct{} } // Service holds the instance identifying data you want to publish to etcd. Key @@ -27,43 +19,19 @@ type Registrar struct { type Service struct { Key string // unique key, e.g. "/service/foobar/1.2.3.4:8080" Value string // returned to subscribers, e.g. "http://1.2.3.4:8080" - TTL *TTLOption DeleteOptions *etcd.DeleteOptions } -// TTLOption allow setting a key with a TTL. This option will be used by a loop -// goroutine which regularly refreshes the lease of the key. -type TTLOption struct { - heartbeat time.Duration // e.g. time.Second * 3 - ttl time.Duration // e.g. time.Second * 10 -} - -// NewTTLOption returns a TTLOption that contains proper TTL settings. Heartbeat -// is used to refresh the lease of the key periodically; its value should be at -// least 500ms. TTL defines the lease of the key; its value should be -// significantly greater than heartbeat. -// -// Good default values might be 3s heartbeat, 10s TTL. -func NewTTLOption(heartbeat, ttl time.Duration) *TTLOption { - if heartbeat <= minHeartBeatTime { - heartbeat = minHeartBeatTime - } - if ttl <= heartbeat { - ttl = 3 * heartbeat - } - return &TTLOption{ - heartbeat: heartbeat, - ttl: ttl, - } -} - // NewRegistrar returns a etcd Registrar acting on the provided catalog // registration (service). func NewRegistrar(client Client, service Service, logger log.Logger) *Registrar { return &Registrar{ client: client, service: service, - logger: log.With(logger, "key", service.Key, "value", service.Value), + logger: log.NewContext(logger).With( + "key", service.Key, + "value", service.Value, + ), } } @@ -75,31 +43,6 @@ func (r *Registrar) Register() { } else { r.logger.Log("action", "register") } - if r.service.TTL != nil { - go r.loop() - } -} - -func (r *Registrar) loop() { - r.quitmtx.Lock() - if r.quit != nil { - return // already running - } - r.quit = make(chan struct{}) - r.quitmtx.Unlock() - - tick := time.NewTicker(r.service.TTL.heartbeat) - defer tick.Stop() - for { - select { - case <-tick.C: - if err := r.client.Register(r.service); err != nil { - r.logger.Log("err", err) - } - case <-r.quit: - return - } - } } // Deregister implements the sd.Registrar interface. Call it when you want your @@ -110,11 +53,4 @@ func (r *Registrar) Deregister() { } else { r.logger.Log("action", "deregister") } - - r.quitmtx.Lock() - defer r.quitmtx.Unlock() - if r.quit != nil { - close(r.quit) - r.quit = nil - } } diff --git a/vendor/github.com/go-kit/kit/sd/etcd/registrar_test.go b/vendor/github.com/go-kit/kit/sd/etcd/registrar_test.go index 9426f0b..bea6f91 100644 --- a/vendor/github.com/go-kit/kit/sd/etcd/registrar_test.go +++ b/vendor/github.com/go-kit/kit/sd/etcd/registrar_test.go @@ -30,7 +30,7 @@ func (tc *testClient) Deregister(s Service) error { } // default service used to build registrar in our tests -var testService = Service{"testKey", "testValue", nil, nil} +var testService = Service{"testKey", "testValue", nil} // NewRegistar should return a registar with a logger using the service key and value func TestNewRegistar(t *testing.T) { diff --git a/vendor/github.com/go-kit/kit/sd/lb/random_test.go b/vendor/github.com/go-kit/kit/sd/lb/random_test.go index 8cee33e..c9b0117 100644 --- a/vendor/github.com/go-kit/kit/sd/lb/random_test.go +++ b/vendor/github.com/go-kit/kit/sd/lb/random_test.go @@ -1,12 +1,12 @@ package lb import ( - "context" "math" "testing" "github.com/go-kit/kit/endpoint" "github.com/go-kit/kit/sd" + "golang.org/x/net/context" ) func TestRandom(t *testing.T) { diff --git a/vendor/github.com/go-kit/kit/sd/lb/retry.go b/vendor/github.com/go-kit/kit/sd/lb/retry.go index c551b36..1214a66 100644 --- a/vendor/github.com/go-kit/kit/sd/lb/retry.go +++ b/vendor/github.com/go-kit/kit/sd/lb/retry.go @@ -1,11 +1,12 @@ package lb import ( - "context" "fmt" "strings" "time" + "golang.org/x/net/context" + "github.com/go-kit/kit/endpoint" ) diff --git a/vendor/github.com/go-kit/kit/sd/lb/retry_test.go b/vendor/github.com/go-kit/kit/sd/lb/retry_test.go index 7cdd892..238198a 100644 --- a/vendor/github.com/go-kit/kit/sd/lb/retry_test.go +++ b/vendor/github.com/go-kit/kit/sd/lb/retry_test.go @@ -1,11 +1,12 @@ package lb_test import ( - "context" "errors" "testing" "time" + "golang.org/x/net/context" + "github.com/go-kit/kit/endpoint" "github.com/go-kit/kit/sd" "github.com/go-kit/kit/sd/lb" diff --git a/vendor/github.com/go-kit/kit/sd/lb/round_robin_test.go b/vendor/github.com/go-kit/kit/sd/lb/round_robin_test.go index b10ddbf..64a8baa 100644 --- a/vendor/github.com/go-kit/kit/sd/lb/round_robin_test.go +++ b/vendor/github.com/go-kit/kit/sd/lb/round_robin_test.go @@ -1,13 +1,14 @@ package lb import ( - "context" "reflect" "sync" "sync/atomic" "testing" "time" + "golang.org/x/net/context" + "github.com/go-kit/kit/endpoint" "github.com/go-kit/kit/sd" ) diff --git a/vendor/github.com/go-kit/kit/sd/zk/integration_test.go b/vendor/github.com/go-kit/kit/sd/zk/integration_test.go index 6c60443..6084415 100644 --- a/vendor/github.com/go-kit/kit/sd/zk/integration_test.go +++ b/vendor/github.com/go-kit/kit/sd/zk/integration_test.go @@ -4,7 +4,8 @@ package zk import ( "bytes" - "log" + "flag" + "fmt" "os" "testing" "time" @@ -17,11 +18,21 @@ var ( ) func TestMain(m *testing.M) { - zkAddr := os.Getenv("ZK_ADDR") - if zkAddr == "" { - log.Fatal("ZK_ADDR is not set") + flag.Parse() + + fmt.Println("Starting ZooKeeper server...") + + ts, err := stdzk.StartTestCluster(1, nil, nil) + if err != nil { + fmt.Printf("ZooKeeper server error: %v\n", err) + os.Exit(1) } - host = []string{zkAddr} + + host = []string{fmt.Sprintf("localhost:%d", ts.Servers[0].Port)} + code := m.Run() + + ts.Stop() + os.Exit(code) } func TestCreateParentNodesOnServer(t *testing.T) { diff --git a/vendor/github.com/go-kit/kit/sd/zk/registrar.go b/vendor/github.com/go-kit/kit/sd/zk/registrar.go index 379a4a5..dcfae39 100644 --- a/vendor/github.com/go-kit/kit/sd/zk/registrar.go +++ b/vendor/github.com/go-kit/kit/sd/zk/registrar.go @@ -24,7 +24,7 @@ func NewRegistrar(client Client, service Service, logger log.Logger) *Registrar return &Registrar{ client: client, service: service, - logger: log.With(logger, + logger: log.NewContext(logger).With( "service", service.Name, "path", service.Path, "data", string(service.Data), diff --git a/vendor/github.com/go-kit/kit/sd/zk/util_test.go b/vendor/github.com/go-kit/kit/sd/zk/util_test.go index 91ba966..c77fde9 100644 --- a/vendor/github.com/go-kit/kit/sd/zk/util_test.go +++ b/vendor/github.com/go-kit/kit/sd/zk/util_test.go @@ -1,7 +1,6 @@ package zk import ( - "context" "errors" "fmt" "io" @@ -9,6 +8,7 @@ import ( "time" "github.com/samuel/go-zookeeper/zk" + "golang.org/x/net/context" "github.com/go-kit/kit/endpoint" "github.com/go-kit/kit/log" diff --git a/vendor/github.com/go-kit/kit/tracing/opentracing/endpoint.go b/vendor/github.com/go-kit/kit/tracing/opentracing/endpoint.go index 0482e9c..51934fa 100644 --- a/vendor/github.com/go-kit/kit/tracing/opentracing/endpoint.go +++ b/vendor/github.com/go-kit/kit/tracing/opentracing/endpoint.go @@ -1,10 +1,9 @@ package opentracing import ( - "context" - "github.com/opentracing/opentracing-go" otext "github.com/opentracing/opentracing-go/ext" + "golang.org/x/net/context" "github.com/go-kit/kit/endpoint" ) diff --git a/vendor/github.com/go-kit/kit/tracing/opentracing/endpoint_test.go b/vendor/github.com/go-kit/kit/tracing/opentracing/endpoint_test.go index a26f7ba..f1cc520 100644 --- a/vendor/github.com/go-kit/kit/tracing/opentracing/endpoint_test.go +++ b/vendor/github.com/go-kit/kit/tracing/opentracing/endpoint_test.go @@ -1,11 +1,11 @@ package opentracing_test import ( - "context" "testing" "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/mocktracer" + "golang.org/x/net/context" "github.com/go-kit/kit/endpoint" kitot "github.com/go-kit/kit/tracing/opentracing" diff --git a/vendor/github.com/go-kit/kit/tracing/opentracing/grpc.go b/vendor/github.com/go-kit/kit/tracing/opentracing/grpc.go index fa45440..e0bdbc9 100644 --- a/vendor/github.com/go-kit/kit/tracing/opentracing/grpc.go +++ b/vendor/github.com/go-kit/kit/tracing/opentracing/grpc.go @@ -1,12 +1,12 @@ package opentracing import ( - "context" "encoding/base64" "strings" "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" + "golang.org/x/net/context" "google.golang.org/grpc/metadata" "github.com/go-kit/kit/log" @@ -32,10 +32,10 @@ func ToGRPCRequest(tracer opentracing.Tracer, logger log.Logger) func(ctx contex // `operationName` accordingly. If no trace could be found in `req`, the Span // will be a trace root. The Span is incorporated in the returned Context and // can be retrieved with opentracing.SpanFromContext(ctx). -func FromGRPCRequest(tracer opentracing.Tracer, operationName string, logger log.Logger) func(ctx context.Context, md metadata.MD) context.Context { - return func(ctx context.Context, md metadata.MD) context.Context { +func FromGRPCRequest(tracer opentracing.Tracer, operationName string, logger log.Logger) func(ctx context.Context, md *metadata.MD) context.Context { + return func(ctx context.Context, md *metadata.MD) context.Context { var span opentracing.Span - wireContext, err := tracer.Extract(opentracing.TextMap, metadataReaderWriter{&md}) + wireContext, err := tracer.Extract(opentracing.TextMap, metadataReaderWriter{md}) if err != nil && err != opentracing.ErrSpanContextNotFound { logger.Log("err", err) } diff --git a/vendor/github.com/go-kit/kit/tracing/opentracing/grpc_test.go b/vendor/github.com/go-kit/kit/tracing/opentracing/grpc_test.go index 3d07a14..657817a 100644 --- a/vendor/github.com/go-kit/kit/tracing/opentracing/grpc_test.go +++ b/vendor/github.com/go-kit/kit/tracing/opentracing/grpc_test.go @@ -1,11 +1,11 @@ package opentracing_test import ( - "context" "testing" "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/mocktracer" + "golang.org/x/net/context" "google.golang.org/grpc/metadata" "github.com/go-kit/kit/log" @@ -41,7 +41,7 @@ func TestTraceGRPCRequestRoundtrip(t *testing.T) { // Use FromGRPCRequest to verify that we can join with the trace given MD. fromGRPCFunc := kitot.FromGRPCRequest(tracer, "joined", logger) - joinCtx := fromGRPCFunc(afterCtx, md) + joinCtx := fromGRPCFunc(afterCtx, &md) joinedSpan := opentracing.SpanFromContext(joinCtx).(*mocktracer.MockSpan) joinedContext := joinedSpan.Context().(mocktracer.MockSpanContext) diff --git a/vendor/github.com/go-kit/kit/tracing/opentracing/http.go b/vendor/github.com/go-kit/kit/tracing/opentracing/http.go index 78286cd..9c608f6 100644 --- a/vendor/github.com/go-kit/kit/tracing/opentracing/http.go +++ b/vendor/github.com/go-kit/kit/tracing/opentracing/http.go @@ -1,13 +1,13 @@ package opentracing import ( - "context" "net" "net/http" "strconv" "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" + "golang.org/x/net/context" "github.com/go-kit/kit/log" kithttp "github.com/go-kit/kit/transport/http" diff --git a/vendor/github.com/go-kit/kit/tracing/opentracing/http_test.go b/vendor/github.com/go-kit/kit/tracing/opentracing/http_test.go index 61c1c16..359cba4 100644 --- a/vendor/github.com/go-kit/kit/tracing/opentracing/http_test.go +++ b/vendor/github.com/go-kit/kit/tracing/opentracing/http_test.go @@ -1,7 +1,6 @@ package opentracing_test import ( - "context" "net/http" "reflect" "testing" @@ -9,6 +8,7 @@ import ( "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" "github.com/opentracing/opentracing-go/mocktracer" + "golang.org/x/net/context" "github.com/go-kit/kit/log" kitot "github.com/go-kit/kit/tracing/opentracing" diff --git a/vendor/github.com/go-kit/kit/tracing/zipkin/README.md b/vendor/github.com/go-kit/kit/tracing/zipkin/README.md index 36579b5..248bb0e 100644 --- a/vendor/github.com/go-kit/kit/tracing/zipkin/README.md +++ b/vendor/github.com/go-kit/kit/tracing/zipkin/README.md @@ -155,7 +155,7 @@ func (svc *Service) GetMeSomeExamples(ctx context.Context, ...) ([]Examples, err // this will label the span's service & hostPort (called Endpoint in Zipkin) ext.PeerService.Set(span, serviceName) - ext.PeerHostname.Set(span, serviceHost) + ext.PeerHostname,Set(span, serviceHost) ext.PeerPort.Set(span, servicePort) // a Tag is the equivalent of a Zipkin Binary Annotation (key:value pair) diff --git a/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/client.go b/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/client.go deleted file mode 100644 index 1e0c8a7..0000000 --- a/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/client.go +++ /dev/null @@ -1,50 +0,0 @@ -package test - -import ( - "context" - - "google.golang.org/grpc" - - "github.com/go-kit/kit/endpoint" - grpctransport "github.com/go-kit/kit/transport/grpc" - "github.com/go-kit/kit/transport/grpc/_grpc_test/pb" -) - -type clientBinding struct { - test endpoint.Endpoint -} - -func (c *clientBinding) Test(ctx context.Context, a string, b int64) (context.Context, string, error) { - response, err := c.test(ctx, TestRequest{A: a, B: b}) - if err != nil { - return nil, "", err - } - r := response.(*TestResponse) - return r.Ctx, r.V, nil -} - -func NewClient(cc *grpc.ClientConn) Service { - return &clientBinding{ - test: grpctransport.NewClient( - cc, - "pb.Test", - "Test", - encodeRequest, - decodeResponse, - &pb.TestResponse{}, - grpctransport.ClientBefore( - injectCorrelationID, - ), - grpctransport.ClientBefore( - displayClientRequestHeaders, - ), - grpctransport.ClientAfter( - displayClientResponseHeaders, - displayClientResponseTrailers, - ), - grpctransport.ClientAfter( - extractConsumedCorrelationID, - ), - ).Endpoint(), - } -} diff --git a/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/context_metadata.go b/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/context_metadata.go deleted file mode 100644 index 0769325..0000000 --- a/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/context_metadata.go +++ /dev/null @@ -1,141 +0,0 @@ -package test - -import ( - "context" - "fmt" - - "google.golang.org/grpc/metadata" -) - -type metaContext string - -const ( - correlationID metaContext = "correlation-id" - responseHDR metaContext = "my-response-header" - responseTRLR metaContext = "my-response-trailer" - correlationIDTRLR metaContext = "correlation-id-consumed" -) - -/* client before functions */ - -func injectCorrelationID(ctx context.Context, md *metadata.MD) context.Context { - if hdr, ok := ctx.Value(correlationID).(string); ok { - fmt.Printf("\tClient found correlationID %q in context, set metadata header\n", hdr) - (*md)[string(correlationID)] = append((*md)[string(correlationID)], hdr) - } - return ctx -} - -func displayClientRequestHeaders(ctx context.Context, md *metadata.MD) context.Context { - if len(*md) > 0 { - fmt.Println("\tClient >> Request Headers:") - for key, val := range *md { - fmt.Printf("\t\t%s: %s\n", key, val[len(val)-1]) - } - } - return ctx -} - -/* server before functions */ - -func extractCorrelationID(ctx context.Context, md metadata.MD) context.Context { - if hdr, ok := md[string(correlationID)]; ok { - cID := hdr[len(hdr)-1] - ctx = context.WithValue(ctx, correlationID, cID) - fmt.Printf("\tServer received correlationID %q in metadata header, set context\n", cID) - } - return ctx -} - -func displayServerRequestHeaders(ctx context.Context, md metadata.MD) context.Context { - if len(md) > 0 { - fmt.Println("\tServer << Request Headers:") - for key, val := range md { - fmt.Printf("\t\t%s: %s\n", key, val[len(val)-1]) - } - } - return ctx -} - -/* server after functions */ - -func injectResponseHeader(ctx context.Context, md *metadata.MD, _ *metadata.MD) context.Context { - *md = metadata.Join(*md, metadata.Pairs(string(responseHDR), "has-a-value")) - return ctx -} - -func displayServerResponseHeaders(ctx context.Context, md *metadata.MD, _ *metadata.MD) context.Context { - if len(*md) > 0 { - fmt.Println("\tServer >> Response Headers:") - for key, val := range *md { - fmt.Printf("\t\t%s: %s\n", key, val[len(val)-1]) - } - } - return ctx -} - -func injectResponseTrailer(ctx context.Context, _ *metadata.MD, md *metadata.MD) context.Context { - *md = metadata.Join(*md, metadata.Pairs(string(responseTRLR), "has-a-value-too")) - return ctx -} - -func injectConsumedCorrelationID(ctx context.Context, _ *metadata.MD, md *metadata.MD) context.Context { - if hdr, ok := ctx.Value(correlationID).(string); ok { - fmt.Printf("\tServer found correlationID %q in context, set consumed trailer\n", hdr) - *md = metadata.Join(*md, metadata.Pairs(string(correlationIDTRLR), hdr)) - } - return ctx -} - -func displayServerResponseTrailers(ctx context.Context, _ *metadata.MD, md *metadata.MD) context.Context { - if len(*md) > 0 { - fmt.Println("\tServer >> Response Trailers:") - for key, val := range *md { - fmt.Printf("\t\t%s: %s\n", key, val[len(val)-1]) - } - } - return ctx -} - -/* client after functions */ - -func displayClientResponseHeaders(ctx context.Context, md metadata.MD, _ metadata.MD) context.Context { - if len(md) > 0 { - fmt.Println("\tClient << Response Headers:") - for key, val := range md { - fmt.Printf("\t\t%s: %s\n", key, val[len(val)-1]) - } - } - return ctx -} - -func displayClientResponseTrailers(ctx context.Context, _ metadata.MD, md metadata.MD) context.Context { - if len(md) > 0 { - fmt.Println("\tClient << Response Trailers:") - for key, val := range md { - fmt.Printf("\t\t%s: %s\n", key, val[len(val)-1]) - } - } - return ctx -} - -func extractConsumedCorrelationID(ctx context.Context, _ metadata.MD, md metadata.MD) context.Context { - if hdr, ok := md[string(correlationIDTRLR)]; ok { - fmt.Printf("\tClient received consumed correlationID %q in metadata trailer, set context\n", hdr[len(hdr)-1]) - ctx = context.WithValue(ctx, correlationIDTRLR, hdr[len(hdr)-1]) - } - return ctx -} - -/* CorrelationID context handlers */ - -func SetCorrelationID(ctx context.Context, v string) context.Context { - return context.WithValue(ctx, correlationID, v) -} - -func GetConsumedCorrelationID(ctx context.Context) string { - if trlr, ok := ctx.Value(correlationIDTRLR).(string); ok { - return trlr - } - return "" -} diff --git a/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/pb/generate.go b/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/pb/generate.go deleted file mode 100644 index aa20bb6..0000000 --- a/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/pb/generate.go +++ /dev/null @@ -1,3 +0,0 @@ -package pb - -//go:generate protoc test.proto --go_out=plugins=grpc:. diff --git a/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/pb/test.pb.go b/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/pb/test.pb.go deleted file mode 100644 index 97d29bb..0000000 --- a/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/pb/test.pb.go +++ /dev/null @@ -1,167 +0,0 @@ -// Code generated by protoc-gen-go. -// source: test.proto -// DO NOT EDIT! - -/* -Package pb is a generated protocol buffer package. - -It is generated from these files: - test.proto - -It has these top-level messages: - TestRequest - TestResponse -*/ -package pb - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -import ( - context "golang.org/x/net/context" - grpc "google.golang.org/grpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type TestRequest struct { - A string `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"` - B int64 `protobuf:"varint,2,opt,name=b" json:"b,omitempty"` -} - -func (m *TestRequest) Reset() { *m = TestRequest{} } -func (m *TestRequest) String() string { return proto.CompactTextString(m) } -func (*TestRequest) ProtoMessage() {} -func (*TestRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - -func (m *TestRequest) GetA() string { - if m != nil { - return m.A - } - return "" -} - -func (m *TestRequest) GetB() int64 { - if m != nil { - return m.B - } - return 0 -} - -type TestResponse struct { - V string `protobuf:"bytes,1,opt,name=v" json:"v,omitempty"` -} - -func (m *TestResponse) Reset() { *m = TestResponse{} } -func (m *TestResponse) String() string { return proto.CompactTextString(m) } -func (*TestResponse) ProtoMessage() {} -func (*TestResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } - -func (m *TestResponse) GetV() string { - if m != nil { - return m.V - } - return "" -} - -func init() { - proto.RegisterType((*TestRequest)(nil), "pb.TestRequest") - proto.RegisterType((*TestResponse)(nil), "pb.TestResponse") -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// Client API for Test service - -type TestClient interface { - Test(ctx context.Context, in *TestRequest, opts ...grpc.CallOption) (*TestResponse, error) -} - -type testClient struct { - cc *grpc.ClientConn -} - -func NewTestClient(cc *grpc.ClientConn) TestClient { - return &testClient{cc} -} - -func (c *testClient) Test(ctx context.Context, in *TestRequest, opts ...grpc.CallOption) (*TestResponse, error) { - out := new(TestResponse) - err := grpc.Invoke(ctx, "/pb.Test/Test", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Server API for Test service - -type TestServer interface { - Test(context.Context, *TestRequest) (*TestResponse, error) -} - -func RegisterTestServer(s *grpc.Server, srv TestServer) { - s.RegisterService(&_Test_serviceDesc, srv) -} - -func _Test_Test_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(TestRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TestServer).Test(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.Test/Test", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TestServer).Test(ctx, req.(*TestRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Test_serviceDesc = grpc.ServiceDesc{ - ServiceName: "pb.Test", - HandlerType: (*TestServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Test", - Handler: _Test_Test_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "test.proto", -} - -func init() { proto.RegisterFile("test.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 129 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0x49, 0x2d, 0x2e, - 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2a, 0x48, 0x52, 0xd2, 0xe4, 0xe2, 0x0e, 0x49, - 0x2d, 0x2e, 0x09, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0x11, 0xe2, 0xe1, 0x62, 0x4c, 0x94, 0x60, - 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x62, 0x4c, 0x04, 0xf1, 0x92, 0x24, 0x98, 0x14, 0x18, 0x35, 0x98, - 0x83, 0x18, 0x93, 0x94, 0x64, 0xb8, 0x78, 0x20, 0x4a, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x41, - 0xb2, 0x65, 0x30, 0xb5, 0x65, 0x46, 0xc6, 0x5c, 0x2c, 0x20, 0x59, 0x21, 0x6d, 0x28, 0xcd, 0xaf, - 0x57, 0x90, 0xa4, 0x87, 0x64, 0xb4, 0x94, 0x00, 0x42, 0x00, 0x62, 0x80, 0x12, 0x43, 0x12, 0x1b, - 0xd8, 0x21, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x49, 0xfc, 0xd8, 0xf1, 0x96, 0x00, 0x00, - 0x00, -} diff --git a/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/pb/test.proto b/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/pb/test.proto deleted file mode 100644 index 6a3555e..0000000 --- a/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/pb/test.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; - -package pb; - -service Test { - rpc Test (TestRequest) returns (TestResponse) {} -} - -message TestRequest { - string a = 1; - int64 b = 2; -} - -message TestResponse { - string v = 1; -} diff --git a/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/request_response.go b/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/request_response.go deleted file mode 100644 index 269703d..0000000 --- a/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/request_response.go +++ /dev/null @@ -1,27 +0,0 @@ -package test - -import ( - "context" - - "github.com/go-kit/kit/transport/grpc/_grpc_test/pb" -) - -func encodeRequest(ctx context.Context, req interface{}) (interface{}, error) { - r := req.(TestRequest) - return &pb.TestRequest{A: r.A, B: r.B}, nil -} - -func decodeRequest(ctx context.Context, req interface{}) (interface{}, error) { - r := req.(*pb.TestRequest) - return TestRequest{A: r.A, B: r.B}, nil -} - -func encodeResponse(ctx context.Context, resp interface{}) (interface{}, error) { - r := resp.(*TestResponse) - return &pb.TestResponse{V: r.V}, nil -} - -func decodeResponse(ctx context.Context, resp interface{}) (interface{}, error) { - r := resp.(*pb.TestResponse) - return &TestResponse{V: r.V, Ctx: ctx}, nil -} diff --git a/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/server.go b/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/server.go deleted file mode 100644 index 49e70a9..0000000 --- a/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/server.go +++ /dev/null @@ -1,70 +0,0 @@ -package test - -import ( - "context" - "fmt" - - oldcontext "golang.org/x/net/context" - - "github.com/go-kit/kit/endpoint" - grpctransport "github.com/go-kit/kit/transport/grpc" - "github.com/go-kit/kit/transport/grpc/_grpc_test/pb" -) - -type service struct{} - -func (service) Test(ctx context.Context, a string, b int64) (context.Context, string, error) { - return nil, fmt.Sprintf("%s = %d", a, b), nil -} - -func NewService() Service { - return service{} -} - -func makeTestEndpoint(svc Service) endpoint.Endpoint { - return func(ctx context.Context, request interface{}) (interface{}, error) { - req := request.(TestRequest) - newCtx, v, err := svc.Test(ctx, req.A, req.B) - return &TestResponse{ - V: v, - Ctx: newCtx, - }, err - } -} - -type serverBinding struct { - test grpctransport.Handler -} - -func (b *serverBinding) Test(ctx oldcontext.Context, req *pb.TestRequest) (*pb.TestResponse, error) { - _, response, err := b.test.ServeGRPC(ctx, req) - if err != nil { - return nil, err - } - return response.(*pb.TestResponse), nil -} - -func NewBinding(svc Service) *serverBinding { - return &serverBinding{ - test: grpctransport.NewServer( - makeTestEndpoint(svc), - decodeRequest, - encodeResponse, - grpctransport.ServerBefore( - extractCorrelationID, - ), - grpctransport.ServerBefore( - displayServerRequestHeaders, - ), - grpctransport.ServerAfter( - injectResponseHeader, - injectResponseTrailer, - injectConsumedCorrelationID, - ), - grpctransport.ServerAfter( - displayServerResponseHeaders, - displayServerResponseTrailers, - ), - ), - } -} diff --git a/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/service.go b/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/service.go deleted file mode 100644 index 536b27c..0000000 --- a/vendor/github.com/go-kit/kit/transport/grpc/_grpc_test/service.go +++ /dev/null @@ -1,17 +0,0 @@ -package test - -import "context" - -type Service interface { - Test(ctx context.Context, a string, b int64) (context.Context, string, error) -} - -type TestRequest struct { - A string - B int64 -} - -type TestResponse struct { - Ctx context.Context - V string -} diff --git a/vendor/github.com/go-kit/kit/transport/grpc/client.go b/vendor/github.com/go-kit/kit/transport/grpc/client.go index c0faa2b..2dffb4f 100644 --- a/vendor/github.com/go-kit/kit/transport/grpc/client.go +++ b/vendor/github.com/go-kit/kit/transport/grpc/client.go @@ -1,11 +1,11 @@ package grpc import ( - "context" "fmt" "reflect" "strings" + "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/metadata" @@ -21,8 +21,7 @@ type Client struct { enc EncodeRequestFunc dec DecodeResponseFunc grpcReply reflect.Type - before []ClientRequestFunc - after []ClientResponseFunc + before []RequestFunc } // NewClient constructs a usable Client for a single remote endpoint. @@ -54,8 +53,7 @@ func NewClient( reflect.ValueOf(grpcReply), ).Interface(), ), - before: []ClientRequestFunc{}, - after: []ClientResponseFunc{}, + before: []RequestFunc{}, } for _, option := range options { option(c) @@ -68,15 +66,8 @@ type ClientOption func(*Client) // ClientBefore sets the RequestFuncs that are applied to the outgoing gRPC // request before it's invoked. -func ClientBefore(before ...ClientRequestFunc) ClientOption { - return func(c *Client) { c.before = append(c.before, before...) } -} - -// ClientAfter sets the ClientResponseFuncs that are applied to the incoming -// gRPC response prior to it being decoded. This is useful for obtaining -// response metadata and adding onto the context prior to decoding. -func ClientAfter(after ...ClientResponseFunc) ClientOption { - return func(c *Client) { c.after = append(c.after, after...) } +func ClientBefore(before ...RequestFunc) ClientOption { + return func(c *Client) { c.before = before } } // Endpoint returns a usable endpoint that will invoke the gRPC specified by the @@ -88,7 +79,7 @@ func (c Client) Endpoint() endpoint.Endpoint { req, err := c.enc(ctx, request) if err != nil { - return nil, err + return nil, fmt.Errorf("Encode: %v", err) } md := &metadata.MD{} @@ -97,22 +88,14 @@ func (c Client) Endpoint() endpoint.Endpoint { } ctx = metadata.NewContext(ctx, *md) - var header, trailer metadata.MD grpcReply := reflect.New(c.grpcReply).Interface() - if err = grpc.Invoke( - ctx, c.method, req, grpcReply, c.client, - grpc.Header(&header), grpc.Trailer(&trailer), - ); err != nil { - return nil, err - } - - for _, f := range c.after { - ctx = f(ctx, header, trailer) + if err = grpc.Invoke(ctx, c.method, req, grpcReply, c.client); err != nil { + return nil, fmt.Errorf("Invoke: %v", err) } response, err := c.dec(ctx, grpcReply) if err != nil { - return nil, err + return nil, fmt.Errorf("Decode: %v", err) } return response, nil } diff --git a/vendor/github.com/go-kit/kit/transport/grpc/client_test.go b/vendor/github.com/go-kit/kit/transport/grpc/client_test.go deleted file mode 100644 index e4cac1d..0000000 --- a/vendor/github.com/go-kit/kit/transport/grpc/client_test.go +++ /dev/null @@ -1,59 +0,0 @@ -package grpc_test - -import ( - "context" - "fmt" - "net" - "testing" - - "google.golang.org/grpc" - - test "github.com/go-kit/kit/transport/grpc/_grpc_test" - "github.com/go-kit/kit/transport/grpc/_grpc_test/pb" -) - -const ( - hostPort string = "localhost:8002" -) - -func TestGRPCClient(t *testing.T) { - var ( - server = grpc.NewServer() - service = test.NewService() - ) - - sc, err := net.Listen("tcp", hostPort) - if err != nil { - t.Fatalf("unable to listen: %+v", err) - } - defer server.GracefulStop() - - go func() { - pb.RegisterTestServer(server, test.NewBinding(service)) - _ = server.Serve(sc) - }() - - cc, err := grpc.Dial(hostPort, grpc.WithInsecure()) - if err != nil { - t.Fatalf("unable to Dial: %+v", err) - } - - client := test.NewClient(cc) - - var ( - a = "the answer to life the universe and everything" - b = int64(42) - cID = "request-1" - ctx = test.SetCorrelationID(context.Background(), cID) - ) - - responseCTX, v, err := client.Test(ctx, a, b) - - if want, have := fmt.Sprintf("%s = %d", a, b), v; want != have { - t.Fatalf("want %q, have %q", want, have) - } - - if want, have := cID, test.GetConsumedCorrelationID(responseCTX); want != have { - t.Fatalf("want %q, have %q", want, have) - } -} diff --git a/vendor/github.com/go-kit/kit/transport/grpc/encode_decode.go b/vendor/github.com/go-kit/kit/transport/grpc/encode_decode.go index f2900ed..fb16c99 100644 --- a/vendor/github.com/go-kit/kit/transport/grpc/encode_decode.go +++ b/vendor/github.com/go-kit/kit/transport/grpc/encode_decode.go @@ -1,25 +1,23 @@ package grpc -import ( - "context" -) +import "golang.org/x/net/context" // DecodeRequestFunc extracts a user-domain request object from a gRPC request. // It's designed to be used in gRPC servers, for server-side endpoints. One -// straightforward DecodeRequestFunc could be something that decodes from the -// gRPC request message to the concrete request type. +// straightforward DecodeRequestFunc could be something that +// decodes from the gRPC request message to the concrete request type. type DecodeRequestFunc func(context.Context, interface{}) (request interface{}, err error) // EncodeRequestFunc encodes the passed request object into the gRPC request -// object. It's designed to be used in gRPC clients, for client-side endpoints. -// One straightforward EncodeRequestFunc could something that encodes the object -// directly to the gRPC request message. +// object. It's designed to be used in gRPC clients, for client-side +// endpoints. One straightforward EncodeRequestFunc could something that +// encodes the object directly to the gRPC request message. type EncodeRequestFunc func(context.Context, interface{}) (request interface{}, err error) // EncodeResponseFunc encodes the passed response object to the gRPC response -// message. It's designed to be used in gRPC servers, for server-side endpoints. -// One straightforward EncodeResponseFunc could be something that encodes the -// object directly to the gRPC response message. +// message. It's designed to be used in gRPC servers, for server-side +// endpoints. One straightforward EncodeResponseFunc could be something that +// encodes the object directly to the gRPC response message. type EncodeResponseFunc func(context.Context, interface{}) (response interface{}, err error) // DecodeResponseFunc extracts a user-domain response object from a gRPC diff --git a/vendor/github.com/go-kit/kit/transport/grpc/request_response_funcs.go b/vendor/github.com/go-kit/kit/transport/grpc/request_response_funcs.go index 8d072ed..aceb84f 100644 --- a/vendor/github.com/go-kit/kit/transport/grpc/request_response_funcs.go +++ b/vendor/github.com/go-kit/kit/transport/grpc/request_response_funcs.go @@ -1,10 +1,10 @@ package grpc import ( - "context" "encoding/base64" "strings" + "golang.org/x/net/context" "google.golang.org/grpc/metadata" ) @@ -12,53 +12,30 @@ const ( binHdrSuffix = "-bin" ) -// ClientRequestFunc may take information from context and use it to construct -// metadata headers to be transported to the server. ClientRequestFuncs are -// executed after creating the request but prior to sending the gRPC request to -// the server. -type ClientRequestFunc func(context.Context, *metadata.MD) context.Context +// RequestFunc may take information from an gRPC request and put it into a +// request context. In Servers, BeforeFuncs are executed prior to invoking the +// endpoint. In Clients, BeforeFuncs are executed after creating the request +// but prior to invoking the gRPC client. +type RequestFunc func(context.Context, *metadata.MD) context.Context -// ServerRequestFunc may take information from the received metadata header and -// use it to place items in the request scoped context. ServerRequestFuncs are -// executed prior to invoking the endpoint. -type ServerRequestFunc func(context.Context, metadata.MD) context.Context - -// ServerResponseFunc may take information from a request context and use it to -// manipulate the gRPC response metadata headers and trailers. ResponseFuncs are -// only executed in servers, after invoking the endpoint but prior to writing a -// response. -type ServerResponseFunc func(ctx context.Context, header *metadata.MD, trailer *metadata.MD) context.Context - -// ClientResponseFunc may take information from a gRPC metadata header and/or -// trailer and make the responses available for consumption. ClientResponseFuncs -// are only executed in clients, after a request has been made, but prior to it -// being decoded. -type ClientResponseFunc func(ctx context.Context, header metadata.MD, trailer metadata.MD) context.Context - -// SetRequestHeader returns a ClientRequestFunc that sets the specified metadata -// key-value pair. -func SetRequestHeader(key, val string) ClientRequestFunc { - return func(ctx context.Context, md *metadata.MD) context.Context { - key, val := EncodeKeyValue(key, val) - (*md)[key] = append((*md)[key], val) - return ctx - } -} +// ResponseFunc may take information from a request context and use it to +// manipulate the gRPC metadata header. ResponseFuncs are only executed in +// servers, after invoking the endpoint but prior to writing a response. +type ResponseFunc func(context.Context, *metadata.MD) // SetResponseHeader returns a ResponseFunc that sets the specified metadata // key-value pair. -func SetResponseHeader(key, val string) ServerResponseFunc { - return func(ctx context.Context, md *metadata.MD, _ *metadata.MD) context.Context { +func SetResponseHeader(key, val string) ResponseFunc { + return func(_ context.Context, md *metadata.MD) { key, val := EncodeKeyValue(key, val) (*md)[key] = append((*md)[key], val) - return ctx } } -// SetResponseTrailer returns a ResponseFunc that sets the specified metadata +// SetRequestHeader returns a RequestFunc that sets the specified metadata // key-value pair. -func SetResponseTrailer(key, val string) ServerResponseFunc { - return func(ctx context.Context, _ *metadata.MD, md *metadata.MD) context.Context { +func SetRequestHeader(key, val string) RequestFunc { + return func(ctx context.Context, md *metadata.MD) context.Context { key, val := EncodeKeyValue(key, val) (*md)[key] = append((*md)[key], val) return ctx diff --git a/vendor/github.com/go-kit/kit/transport/grpc/server.go b/vendor/github.com/go-kit/kit/transport/grpc/server.go index b14d7d8..80b41d8 100644 --- a/vendor/github.com/go-kit/kit/transport/grpc/server.go +++ b/vendor/github.com/go-kit/kit/transport/grpc/server.go @@ -1,28 +1,28 @@ package grpc import ( - oldcontext "golang.org/x/net/context" - "google.golang.org/grpc" + "golang.org/x/net/context" "google.golang.org/grpc/metadata" "github.com/go-kit/kit/endpoint" "github.com/go-kit/kit/log" ) -// Handler which should be called from the gRPC binding of the service +// Handler which should be called from the grpc binding of the service // implementation. The incoming request parameter, and returned response // parameter, are both gRPC types, not user-domain. type Handler interface { - ServeGRPC(ctx oldcontext.Context, request interface{}) (oldcontext.Context, interface{}, error) + ServeGRPC(ctx context.Context, request interface{}) (context.Context, interface{}, error) } // Server wraps an endpoint and implements grpc.Handler. type Server struct { + ctx context.Context e endpoint.Endpoint dec DecodeRequestFunc enc EncodeResponseFunc - before []ServerRequestFunc - after []ServerResponseFunc + before []RequestFunc + after []ResponseFunc logger log.Logger } @@ -32,12 +32,14 @@ type Server struct { // definitions to individual handlers. Request and response objects are from the // caller business domain, not gRPC request and reply types. func NewServer( + ctx context.Context, e endpoint.Endpoint, dec DecodeRequestFunc, enc EncodeResponseFunc, options ...ServerOption, ) *Server { s := &Server{ + ctx: ctx, e: e, dec: dec, enc: enc, @@ -54,14 +56,14 @@ type ServerOption func(*Server) // ServerBefore functions are executed on the HTTP request object before the // request is decoded. -func ServerBefore(before ...ServerRequestFunc) ServerOption { - return func(s *Server) { s.before = append(s.before, before...) } +func ServerBefore(before ...RequestFunc) ServerOption { + return func(s *Server) { s.before = before } } // ServerAfter functions are executed on the HTTP response writer after the // endpoint is invoked, but before anything is written to the client. -func ServerAfter(after ...ServerResponseFunc) ServerOption { - return func(s *Server) { s.after = append(s.after, after...) } +func ServerAfter(after ...ResponseFunc) ServerOption { + return func(s *Server) { s.after = after } } // ServerErrorLogger is used to log non-terminal errors. By default, no errors @@ -71,53 +73,56 @@ func ServerErrorLogger(logger log.Logger) ServerOption { } // ServeGRPC implements the Handler interface. -func (s Server) ServeGRPC(ctx oldcontext.Context, req interface{}) (oldcontext.Context, interface{}, error) { +func (s Server) ServeGRPC(grpcCtx context.Context, req interface{}) (context.Context, interface{}, error) { + ctx := s.ctx + // Retrieve gRPC metadata. - md, ok := metadata.FromContext(ctx) + md, ok := metadata.FromContext(grpcCtx) if !ok { md = metadata.MD{} } for _, f := range s.before { - ctx = f(ctx, md) + ctx = f(ctx, &md) } - request, err := s.dec(ctx, req) + // Store potentially updated metadata in the gRPC context. + grpcCtx = metadata.NewContext(grpcCtx, md) + + request, err := s.dec(grpcCtx, req) if err != nil { s.logger.Log("err", err) - return ctx, nil, err + return grpcCtx, nil, BadRequestError{err} } response, err := s.e(ctx, request) if err != nil { s.logger.Log("err", err) - return ctx, nil, err + return grpcCtx, nil, err } - var mdHeader, mdTrailer metadata.MD for _, f := range s.after { - ctx = f(ctx, &mdHeader, &mdTrailer) + f(ctx, &md) } - grpcResp, err := s.enc(ctx, response) + // Store potentially updated metadata in the gRPC context. + grpcCtx = metadata.NewContext(grpcCtx, md) + + grpcResp, err := s.enc(grpcCtx, response) if err != nil { s.logger.Log("err", err) - return ctx, nil, err + return grpcCtx, nil, err } - if len(mdHeader) > 0 { - if err = grpc.SendHeader(ctx, mdHeader); err != nil { - s.logger.Log("err", err) - return ctx, nil, err - } - } - - if len(mdTrailer) > 0 { - if err = grpc.SetTrailer(ctx, mdTrailer); err != nil { - s.logger.Log("err", err) - return ctx, nil, err - } - } - - return ctx, grpcResp, nil + return grpcCtx, grpcResp, nil +} + +// BadRequestError is an error in decoding the request. +type BadRequestError struct { + Err error +} + +// Error implements the error interface. +func (err BadRequestError) Error() string { + return err.Err.Error() } diff --git a/vendor/github.com/go-kit/kit/transport/http/client.go b/vendor/github.com/go-kit/kit/transport/http/client.go index 08f1b88..a8aca26 100644 --- a/vendor/github.com/go-kit/kit/transport/http/client.go +++ b/vendor/github.com/go-kit/kit/transport/http/client.go @@ -1,14 +1,10 @@ package http import ( - "bytes" - "context" - "encoding/json" - "encoding/xml" - "io/ioutil" "net/http" "net/url" + "golang.org/x/net/context" "golang.org/x/net/context/ctxhttp" "github.com/go-kit/kit/endpoint" @@ -62,14 +58,14 @@ func SetClient(client *http.Client) ClientOption { // ClientBefore sets the RequestFuncs that are applied to the outgoing HTTP // request before it's invoked. func ClientBefore(before ...RequestFunc) ClientOption { - return func(c *Client) { c.before = append(c.before, before...) } + return func(c *Client) { c.before = before } } // ClientAfter sets the ClientResponseFuncs applied to the incoming HTTP // request prior to it being decoded. This is useful for obtaining anything off // of the response and adding onto the context prior to decoding. func ClientAfter(after ...ClientResponseFunc) ClientOption { - return func(c *Client) { c.after = append(c.after, after...) } + return func(c *Client) { c.after = after } } // BufferedStream sets whether the Response.Body is left open, allowing it @@ -86,11 +82,11 @@ func (c Client) Endpoint() endpoint.Endpoint { req, err := http.NewRequest(c.method, c.tgt.String(), nil) if err != nil { - return nil, err + return nil, Error{Domain: DomainNewRequest, Err: err} } if err = c.enc(ctx, req, request); err != nil { - return nil, err + return nil, Error{Domain: DomainEncode, Err: err} } for _, f := range c.before { @@ -99,7 +95,7 @@ func (c Client) Endpoint() endpoint.Endpoint { resp, err := ctxhttp.Do(ctx, c.client, req) if err != nil { - return nil, err + return nil, Error{Domain: DomainDo, Err: err} } if !c.bufferedStream { defer resp.Body.Close() @@ -111,40 +107,9 @@ func (c Client) Endpoint() endpoint.Endpoint { response, err := c.dec(ctx, resp) if err != nil { - return nil, err + return nil, Error{Domain: DomainDecode, Err: err} } return response, nil } } - -// EncodeJSONRequest is an EncodeRequestFunc that serializes the request as a -// JSON object to the Request body. Many JSON-over-HTTP services can use it as -// a sensible default. If the request implements Headerer, the provided headers -// will be applied to the request. -func EncodeJSONRequest(c context.Context, r *http.Request, request interface{}) error { - r.Header.Set("Content-Type", "application/json; charset=utf-8") - if headerer, ok := request.(Headerer); ok { - for k := range headerer.Headers() { - r.Header.Set(k, headerer.Headers().Get(k)) - } - } - var b bytes.Buffer - r.Body = ioutil.NopCloser(&b) - return json.NewEncoder(&b).Encode(request) -} - -// EncodeXMLRequest is an EncodeRequestFunc that serializes the request as a -// XML object to the Request body. If the request implements Headerer, -// the provided headers will be applied to the request. -func EncodeXMLRequest(c context.Context, r *http.Request, request interface{}) error { - r.Header.Set("Content-Type", "text/xml; charset=utf-8") - if headerer, ok := request.(Headerer); ok { - for k := range headerer.Headers() { - r.Header.Set(k, headerer.Headers().Get(k)) - } - } - var b bytes.Buffer - r.Body = ioutil.NopCloser(&b) - return xml.NewEncoder(&b).Encode(request) -} diff --git a/vendor/github.com/go-kit/kit/transport/http/client_test.go b/vendor/github.com/go-kit/kit/transport/http/client_test.go index ad366d1..3ec224e 100644 --- a/vendor/github.com/go-kit/kit/transport/http/client_test.go +++ b/vendor/github.com/go-kit/kit/transport/http/client_test.go @@ -1,15 +1,15 @@ package http_test import ( - "context" "io" - "io/ioutil" "net/http" "net/http/httptest" "net/url" "testing" "time" + "golang.org/x/net/context" + httptransport "github.com/go-kit/kit/transport/http" ) @@ -140,68 +140,6 @@ func TestHTTPClientBufferedStream(t *testing.T) { } } -func TestEncodeJSONRequest(t *testing.T) { - var header http.Header - var body string - - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - b, err := ioutil.ReadAll(r.Body) - if err != nil && err != io.EOF { - t.Fatal(err) - } - header = r.Header - body = string(b) - })) - - defer server.Close() - - serverURL, err := url.Parse(server.URL) - - if err != nil { - t.Fatal(err) - } - - client := httptransport.NewClient( - "POST", - serverURL, - httptransport.EncodeJSONRequest, - func(context.Context, *http.Response) (interface{}, error) { return nil, nil }, - ).Endpoint() - - for _, test := range []struct { - value interface{} - body string - }{ - {nil, "null\n"}, - {12, "12\n"}, - {1.2, "1.2\n"}, - {true, "true\n"}, - {"test", "\"test\"\n"}, - {enhancedRequest{Foo: "foo"}, "{\"foo\":\"foo\"}\n"}, - } { - if _, err := client(context.Background(), test.value); err != nil { - t.Error(err) - continue - } - - if body != test.body { - t.Errorf("%v: actual %#v, expected %#v", test.value, body, test.body) - } - } - - if _, err := client(context.Background(), enhancedRequest{Foo: "foo"}); err != nil { - t.Fatal(err) - } - - if _, ok := header["X-Edward"]; !ok { - t.Fatalf("X-Edward value: actual %v, expected %v", nil, []string{"Snowden"}) - } - - if v := header.Get("X-Edward"); v != "Snowden" { - t.Errorf("X-Edward string: actual %v, expected %v", v, "Snowden") - } -} - func mustParse(s string) *url.URL { u, err := url.Parse(s) if err != nil { @@ -209,9 +147,3 @@ func mustParse(s string) *url.URL { } return u } - -type enhancedRequest struct { - Foo string `json:"foo"` -} - -func (e enhancedRequest) Headers() http.Header { return http.Header{"X-Edward": []string{"Snowden"}} } diff --git a/vendor/github.com/go-kit/kit/transport/http/encode_decode.go b/vendor/github.com/go-kit/kit/transport/http/encode_decode.go index 3076e4d..8b8f6d7 100644 --- a/vendor/github.com/go-kit/kit/transport/http/encode_decode.go +++ b/vendor/github.com/go-kit/kit/transport/http/encode_decode.go @@ -1,8 +1,9 @@ package http import ( - "context" "net/http" + + "golang.org/x/net/context" ) // DecodeRequestFunc extracts a user-domain request object from an HTTP diff --git a/vendor/github.com/go-kit/kit/transport/http/err.go b/vendor/github.com/go-kit/kit/transport/http/err.go new file mode 100644 index 0000000..15270c6 --- /dev/null +++ b/vendor/github.com/go-kit/kit/transport/http/err.go @@ -0,0 +1,33 @@ +package http + +import ( + "fmt" +) + +const ( + // DomainNewRequest is an error during request generation. + DomainNewRequest = "NewRequest" + + // DomainEncode is an error during request or response encoding. + DomainEncode = "Encode" + + // DomainDo is an error during the execution phase of the request. + DomainDo = "Do" + + // DomainDecode is an error during request or response decoding. + DomainDecode = "Decode" +) + +// Error is an error that occurred at some phase within the transport. +type Error struct { + // Domain is the phase in which the error was generated. + Domain string + + // Err is the concrete error. + Err error +} + +// Error implements the error interface. +func (e Error) Error() string { + return fmt.Sprintf("%s: %s", e.Domain, e.Err) +} diff --git a/vendor/github.com/go-kit/kit/transport/http/err_test.go b/vendor/github.com/go-kit/kit/transport/http/err_test.go new file mode 100644 index 0000000..b0dd6f7 --- /dev/null +++ b/vendor/github.com/go-kit/kit/transport/http/err_test.go @@ -0,0 +1,56 @@ +package http_test + +import ( + "errors" + "fmt" + "net/http" + "net/url" + "testing" + + "golang.org/x/net/context" + + httptransport "github.com/go-kit/kit/transport/http" +) + +func TestClientEndpointEncodeError(t *testing.T) { + var ( + sampleErr = errors.New("Oh no, an error") + enc = func(context.Context, *http.Request, interface{}) error { return sampleErr } + dec = func(context.Context, *http.Response) (interface{}, error) { return nil, nil } + ) + + u := &url.URL{ + Scheme: "https", + Host: "localhost", + Path: "/does/not/matter", + } + + c := httptransport.NewClient( + "GET", + u, + enc, + dec, + ) + + _, err := c.Endpoint()(context.Background(), nil) + if err == nil { + t.Fatal("err == nil") + } + + e, ok := err.(httptransport.Error) + if !ok { + t.Fatal("err is not of type github.com/go-kit/kit/transport/http.Error") + } + + if want, have := sampleErr, e.Err; want != have { + t.Fatalf("want %v, have %v", want, have) + } +} + +func ExampleErrorOutput() { + sampleErr := errors.New("oh no, an error") + err := httptransport.Error{Domain: httptransport.DomainDo, Err: sampleErr} + fmt.Println(err) + // Output: + // Do: oh no, an error +} diff --git a/vendor/github.com/go-kit/kit/transport/http/example_test.go b/vendor/github.com/go-kit/kit/transport/http/example_test.go deleted file mode 100644 index 3889354..0000000 --- a/vendor/github.com/go-kit/kit/transport/http/example_test.go +++ /dev/null @@ -1,36 +0,0 @@ -package http - -import ( - "context" - "fmt" - "net/http" - "net/http/httptest" -) - -func ExamplePopulateRequestContext() { - handler := NewServer( - func(ctx context.Context, request interface{}) (response interface{}, err error) { - fmt.Println("Method", ctx.Value(ContextKeyRequestMethod).(string)) - fmt.Println("RequestPath", ctx.Value(ContextKeyRequestPath).(string)) - fmt.Println("RequestURI", ctx.Value(ContextKeyRequestURI).(string)) - fmt.Println("X-Request-ID", ctx.Value(ContextKeyRequestXRequestID).(string)) - return struct{}{}, nil - }, - func(context.Context, *http.Request) (interface{}, error) { return struct{}{}, nil }, - func(context.Context, http.ResponseWriter, interface{}) error { return nil }, - ServerBefore(PopulateRequestContext), - ) - - server := httptest.NewServer(handler) - defer server.Close() - - req, _ := http.NewRequest("PATCH", fmt.Sprintf("%s/search?q=sympatico", server.URL), nil) - req.Header.Set("X-Request-Id", "a1b2c3d4e5") - http.DefaultClient.Do(req) - - // Output: - // Method PATCH - // RequestPath /search - // RequestURI /search?q=sympatico - // X-Request-ID a1b2c3d4e5 -} diff --git a/vendor/github.com/go-kit/kit/transport/http/request_response_funcs.go b/vendor/github.com/go-kit/kit/transport/http/request_response_funcs.go index 78ad61e..1a3ef9b 100644 --- a/vendor/github.com/go-kit/kit/transport/http/request_response_funcs.go +++ b/vendor/github.com/go-kit/kit/transport/http/request_response_funcs.go @@ -1,8 +1,9 @@ package http import ( - "context" "net/http" + + "golang.org/x/net/context" ) // RequestFunc may take information from an HTTP request and put it into a @@ -21,13 +22,13 @@ type ServerResponseFunc func(context.Context, http.ResponseWriter) context.Conte // clients, after a request has been made, but prior to it being decoded. type ClientResponseFunc func(context.Context, *http.Response) context.Context -// SetContentType returns a ServerResponseFunc that sets the Content-Type header -// to the provided value. +// SetContentType returns a ResponseFunc that sets the Content-Type header to +// the provided value. func SetContentType(contentType string) ServerResponseFunc { return SetResponseHeader("Content-Type", contentType) } -// SetResponseHeader returns a ServerResponseFunc that sets the given header. +// SetResponseHeader returns a ResponseFunc that sets the specified header. func SetResponseHeader(key, val string) ServerResponseFunc { return func(ctx context.Context, w http.ResponseWriter) context.Context { w.Header().Set(key, val) @@ -35,94 +36,10 @@ func SetResponseHeader(key, val string) ServerResponseFunc { } } -// SetRequestHeader returns a RequestFunc that sets the given header. +// SetRequestHeader returns a RequestFunc that sets the specified header. func SetRequestHeader(key, val string) RequestFunc { return func(ctx context.Context, r *http.Request) context.Context { r.Header.Set(key, val) return ctx } } - -// PopulateRequestContext is a RequestFunc that populates several values into -// the context from the HTTP request. Those values may be extracted using the -// corresponding ContextKey type in this package. -func PopulateRequestContext(ctx context.Context, r *http.Request) context.Context { - for k, v := range map[contextKey]string{ - ContextKeyRequestMethod: r.Method, - ContextKeyRequestURI: r.RequestURI, - ContextKeyRequestPath: r.URL.Path, - ContextKeyRequestProto: r.Proto, - ContextKeyRequestHost: r.Host, - ContextKeyRequestRemoteAddr: r.RemoteAddr, - ContextKeyRequestXForwardedFor: r.Header.Get("X-Forwarded-For"), - ContextKeyRequestXForwardedProto: r.Header.Get("X-Forwarded-Proto"), - ContextKeyRequestAuthorization: r.Header.Get("Authorization"), - ContextKeyRequestReferer: r.Header.Get("Referer"), - ContextKeyRequestUserAgent: r.Header.Get("User-Agent"), - ContextKeyRequestXRequestID: r.Header.Get("X-Request-Id"), - } { - ctx = context.WithValue(ctx, k, v) - } - return ctx -} - -type contextKey int - -const ( - // ContextKeyRequestMethod is populated in the context by - // PopulateRequestContext. Its value is r.Method. - ContextKeyRequestMethod contextKey = iota - - // ContextKeyRequestURI is populated in the context by - // PopulateRequestContext. Its value is r.RequestURI. - ContextKeyRequestURI - - // ContextKeyRequestPath is populated in the context by - // PopulateRequestContext. Its value is r.URL.Path. - ContextKeyRequestPath - - // ContextKeyRequestProto is populated in the context by - // PopulateRequestContext. Its value is r.Proto. - ContextKeyRequestProto - - // ContextKeyRequestHost is populated in the context by - // PopulateRequestContext. Its value is r.Host. - ContextKeyRequestHost - - // ContextKeyRequestRemoteAddr is populated in the context by - // PopulateRequestContext. Its value is r.RemoteAddr. - ContextKeyRequestRemoteAddr - - // ContextKeyRequestXForwardedFor is populated in the context by - // PopulateRequestContext. Its value is r.Header.Get("X-Forwarded-For"). - ContextKeyRequestXForwardedFor - - // ContextKeyRequestXForwardedProto is populated in the context by - // PopulateRequestContext. Its value is r.Header.Get("X-Forwarded-Proto"). - ContextKeyRequestXForwardedProto - - // ContextKeyRequestAuthorization is populated in the context by - // PopulateRequestContext. Its value is r.Header.Get("Authorization"). - ContextKeyRequestAuthorization - - // ContextKeyRequestReferer is populated in the context by - // PopulateRequestContext. Its value is r.Header.Get("Referer"). - ContextKeyRequestReferer - - // ContextKeyRequestUserAgent is populated in the context by - // PopulateRequestContext. Its value is r.Header.Get("User-Agent"). - ContextKeyRequestUserAgent - - // ContextKeyRequestXRequestID is populated in the context by - // PopulateRequestContext. Its value is r.Header.Get("X-Request-Id"). - ContextKeyRequestXRequestID - - // ContextKeyResponseHeaders is populated in the context whenever a - // ServerFinalizerFunc is specified. Its value is of type http.Header, and - // is captured only once the entire response has been written. - ContextKeyResponseHeaders - - // ContextKeyResponseSize is populated in the context whenever a - // ServerFinalizerFunc is specified. Its value is of type int64. - ContextKeyResponseSize -) diff --git a/vendor/github.com/go-kit/kit/transport/http/request_response_funcs_test.go b/vendor/github.com/go-kit/kit/transport/http/request_response_funcs_test.go index e003fc9..4fb87d0 100644 --- a/vendor/github.com/go-kit/kit/transport/http/request_response_funcs_test.go +++ b/vendor/github.com/go-kit/kit/transport/http/request_response_funcs_test.go @@ -1,10 +1,11 @@ package http_test import ( - "context" "net/http/httptest" "testing" + "golang.org/x/net/context" + httptransport "github.com/go-kit/kit/transport/http" ) diff --git a/vendor/github.com/go-kit/kit/transport/http/server.go b/vendor/github.com/go-kit/kit/transport/http/server.go index 0bea793..db528be 100644 --- a/vendor/github.com/go-kit/kit/transport/http/server.go +++ b/vendor/github.com/go-kit/kit/transport/http/server.go @@ -1,39 +1,41 @@ package http import ( - "context" - "encoding/json" "net/http" + "golang.org/x/net/context" + "github.com/go-kit/kit/endpoint" "github.com/go-kit/kit/log" ) // Server wraps an endpoint and implements http.Handler. type Server struct { + ctx context.Context e endpoint.Endpoint dec DecodeRequestFunc enc EncodeResponseFunc before []RequestFunc after []ServerResponseFunc errorEncoder ErrorEncoder - finalizer ServerFinalizerFunc logger log.Logger } // NewServer constructs a new server, which implements http.Server and wraps // the provided endpoint. func NewServer( + ctx context.Context, e endpoint.Endpoint, dec DecodeRequestFunc, enc EncodeResponseFunc, options ...ServerOption, ) *Server { s := &Server{ + ctx: ctx, e: e, dec: dec, enc: enc, - errorEncoder: DefaultErrorEncoder, + errorEncoder: defaultErrorEncoder, logger: log.NewNopLogger(), } for _, option := range options { @@ -48,51 +50,33 @@ type ServerOption func(*Server) // ServerBefore functions are executed on the HTTP request object before the // request is decoded. func ServerBefore(before ...RequestFunc) ServerOption { - return func(s *Server) { s.before = append(s.before, before...) } + return func(s *Server) { s.before = before } } // ServerAfter functions are executed on the HTTP response writer after the // endpoint is invoked, but before anything is written to the client. func ServerAfter(after ...ServerResponseFunc) ServerOption { - return func(s *Server) { s.after = append(s.after, after...) } + return func(s *Server) { s.after = after } } // ServerErrorEncoder is used to encode errors to the http.ResponseWriter // whenever they're encountered in the processing of a request. Clients can // use this to provide custom error formatting and response codes. By default, -// errors will be written with the DefaultErrorEncoder. +// errors will be written as plain text with an appropriate, if generic, +// status code. func ServerErrorEncoder(ee ErrorEncoder) ServerOption { return func(s *Server) { s.errorEncoder = ee } } // ServerErrorLogger is used to log non-terminal errors. By default, no errors -// are logged. This is intended as a diagnostic measure. Finer-grained control -// of error handling, including logging in more detail, should be performed in a -// custom ServerErrorEncoder or ServerFinalizer, both of which have access to -// the context. +// are logged. func ServerErrorLogger(logger log.Logger) ServerOption { return func(s *Server) { s.logger = logger } } -// ServerFinalizer is executed at the end of every HTTP request. -// By default, no finalizer is registered. -func ServerFinalizer(f ServerFinalizerFunc) ServerOption { - return func(s *Server) { s.finalizer = f } -} - // ServeHTTP implements http.Handler. func (s Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { - ctx := r.Context() - - if s.finalizer != nil { - iw := &interceptingWriter{w, http.StatusOK, 0} - defer func() { - ctx = context.WithValue(ctx, ContextKeyResponseHeaders, iw.Header()) - ctx = context.WithValue(ctx, ContextKeyResponseSize, iw.written) - s.finalizer(ctx, iw.code, r) - }() - w = iw - } + ctx := s.ctx for _, f := range s.before { ctx = f(ctx, r) @@ -101,14 +85,14 @@ func (s Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { request, err := s.dec(ctx, r) if err != nil { s.logger.Log("err", err) - s.errorEncoder(ctx, err, w) + s.errorEncoder(ctx, Error{Domain: DomainDecode, Err: err}, w) return } response, err := s.e(ctx, request) if err != nil { s.logger.Log("err", err) - s.errorEncoder(ctx, err, w) + s.errorEncoder(ctx, Error{Domain: DomainDo, Err: err}, w) return } @@ -118,104 +102,32 @@ func (s Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { if err := s.enc(ctx, w, response); err != nil { s.logger.Log("err", err) - s.errorEncoder(ctx, err, w) + s.errorEncoder(ctx, Error{Domain: DomainEncode, Err: err}, w) return } } // ErrorEncoder is responsible for encoding an error to the ResponseWriter. -// Users are encouraged to use custom ErrorEncoders to encode HTTP errors to -// their clients, and will likely want to pass and check for their own error -// types. See the example shipping/handling service. +// +// In the server implementation, only kit/transport/http.Error values are ever +// passed to this function, so you might be tempted to have this function take +// one of those directly. But, users are encouraged to use custom ErrorEncoders +// to encode all HTTP errors to their clients, and so may want to pass and check +// for their own error types. See the example shipping/handling service. type ErrorEncoder func(ctx context.Context, err error, w http.ResponseWriter) -// ServerFinalizerFunc can be used to perform work at the end of an HTTP -// request, after the response has been written to the client. The principal -// intended use is for request logging. In addition to the response code -// provided in the function signature, additional response parameters are -// provided in the context under keys with the ContextKeyResponse prefix. -type ServerFinalizerFunc func(ctx context.Context, code int, r *http.Request) - -// EncodeJSONResponse is a EncodeResponseFunc that serializes the response as a -// JSON object to the ResponseWriter. Many JSON-over-HTTP services can use it as -// a sensible default. If the response implements Headerer, the provided headers -// will be applied to the response. If the response implements StatusCoder, the -// provided StatusCode will be used instead of 200. -func EncodeJSONResponse(_ context.Context, w http.ResponseWriter, response interface{}) error { - w.Header().Set("Content-Type", "application/json; charset=utf-8") - if headerer, ok := response.(Headerer); ok { - for k := range headerer.Headers() { - w.Header().Set(k, headerer.Headers().Get(k)) +func defaultErrorEncoder(_ context.Context, err error, w http.ResponseWriter) { + switch e := err.(type) { + case Error: + switch e.Domain { + case DomainDecode: + http.Error(w, err.Error(), http.StatusBadRequest) + case DomainDo: + http.Error(w, err.Error(), http.StatusServiceUnavailable) // too aggressive? + default: + http.Error(w, err.Error(), http.StatusInternalServerError) } + default: + http.Error(w, err.Error(), http.StatusInternalServerError) } - code := http.StatusOK - if sc, ok := response.(StatusCoder); ok { - code = sc.StatusCode() - } - w.WriteHeader(code) - if code == http.StatusNoContent { - return nil - } - return json.NewEncoder(w).Encode(response) -} - -// DefaultErrorEncoder writes the error to the ResponseWriter, by default a -// content type of text/plain, a body of the plain text of the error, and a -// status code of 500. If the error implements Headerer, the provided headers -// will be applied to the response. If the error implements json.Marshaler, and -// the marshaling succeeds, a content type of application/json and the JSON -// encoded form of the error will be used. If the error implements StatusCoder, -// the provided StatusCode will be used instead of 500. -func DefaultErrorEncoder(_ context.Context, err error, w http.ResponseWriter) { - contentType, body := "text/plain; charset=utf-8", []byte(err.Error()) - if marshaler, ok := err.(json.Marshaler); ok { - if jsonBody, marshalErr := marshaler.MarshalJSON(); marshalErr == nil { - contentType, body = "application/json; charset=utf-8", jsonBody - } - } - w.Header().Set("Content-Type", contentType) - if headerer, ok := err.(Headerer); ok { - for k := range headerer.Headers() { - w.Header().Set(k, headerer.Headers().Get(k)) - } - } - code := http.StatusInternalServerError - if sc, ok := err.(StatusCoder); ok { - code = sc.StatusCode() - } - w.WriteHeader(code) - w.Write(body) -} - -// StatusCoder is checked by DefaultErrorEncoder. If an error value implements -// StatusCoder, the StatusCode will be used when encoding the error. By default, -// StatusInternalServerError (500) is used. -type StatusCoder interface { - StatusCode() int -} - -// Headerer is checked by DefaultErrorEncoder. If an error value implements -// Headerer, the provided headers will be applied to the response writer, after -// the Content-Type is set. -type Headerer interface { - Headers() http.Header -} - -type interceptingWriter struct { - http.ResponseWriter - code int - written int64 -} - -// WriteHeader may not be explicitly called, so care must be taken to -// initialize w.code to its default value of http.StatusOK. -func (w *interceptingWriter) WriteHeader(code int) { - w.code = code - w.ResponseWriter.WriteHeader(code) -} - -func (w *interceptingWriter) Write(p []byte) (int, error) { - n, err := w.ResponseWriter.Write(p) - w.written += int64(n) - return n, err } diff --git a/vendor/github.com/go-kit/kit/transport/http/server_test.go b/vendor/github.com/go-kit/kit/transport/http/server_test.go index ddc40c9..752f010 100644 --- a/vendor/github.com/go-kit/kit/transport/http/server_test.go +++ b/vendor/github.com/go-kit/kit/transport/http/server_test.go @@ -1,21 +1,20 @@ package http_test import ( - "context" "errors" "io/ioutil" "net/http" "net/http/httptest" - "strings" "testing" - "time" - "github.com/go-kit/kit/endpoint" + "golang.org/x/net/context" + httptransport "github.com/go-kit/kit/transport/http" ) func TestServerBadDecode(t *testing.T) { handler := httptransport.NewServer( + context.Background(), func(context.Context, interface{}) (interface{}, error) { return struct{}{}, nil }, func(context.Context, *http.Request) (interface{}, error) { return struct{}{}, errors.New("dang") }, func(context.Context, http.ResponseWriter, interface{}) error { return nil }, @@ -23,13 +22,14 @@ func TestServerBadDecode(t *testing.T) { server := httptest.NewServer(handler) defer server.Close() resp, _ := http.Get(server.URL) - if want, have := http.StatusInternalServerError, resp.StatusCode; want != have { + if want, have := http.StatusBadRequest, resp.StatusCode; want != have { t.Errorf("want %d, have %d", want, have) } } func TestServerBadEndpoint(t *testing.T) { handler := httptransport.NewServer( + context.Background(), func(context.Context, interface{}) (interface{}, error) { return struct{}{}, errors.New("dang") }, func(context.Context, *http.Request) (interface{}, error) { return struct{}{}, nil }, func(context.Context, http.ResponseWriter, interface{}) error { return nil }, @@ -37,13 +37,14 @@ func TestServerBadEndpoint(t *testing.T) { server := httptest.NewServer(handler) defer server.Close() resp, _ := http.Get(server.URL) - if want, have := http.StatusInternalServerError, resp.StatusCode; want != have { + if want, have := http.StatusServiceUnavailable, resp.StatusCode; want != have { t.Errorf("want %d, have %d", want, have) } } func TestServerBadEncode(t *testing.T) { handler := httptransport.NewServer( + context.Background(), func(context.Context, interface{}) (interface{}, error) { return struct{}{}, nil }, func(context.Context, *http.Request) (interface{}, error) { return struct{}{}, nil }, func(context.Context, http.ResponseWriter, interface{}) error { return errors.New("dang") }, @@ -59,12 +60,13 @@ func TestServerBadEncode(t *testing.T) { func TestServerErrorEncoder(t *testing.T) { errTeapot := errors.New("teapot") code := func(err error) int { - if err == errTeapot { + if e, ok := err.(httptransport.Error); ok && e.Err == errTeapot { return http.StatusTeapot } return http.StatusInternalServerError } handler := httptransport.NewServer( + context.Background(), func(context.Context, interface{}) (interface{}, error) { return struct{}{}, errTeapot }, func(context.Context, *http.Request) (interface{}, error) { return struct{}{}, nil }, func(context.Context, http.ResponseWriter, interface{}) error { return nil }, @@ -79,7 +81,7 @@ func TestServerErrorEncoder(t *testing.T) { } func TestServerHappyPath(t *testing.T) { - step, response := testServer(t) + _, step, response := testServer(t) step() resp := <-response defer resp.Body.Close() @@ -89,245 +91,14 @@ func TestServerHappyPath(t *testing.T) { } } -func TestMultipleServerBefore(t *testing.T) { +func testServer(t *testing.T) (cancel, step func(), resp <-chan *http.Response) { var ( - headerKey = "X-Henlo-Lizer" - headerVal = "Helllo you stinky lizard" - statusCode = http.StatusTeapot - responseBody = "go eat a fly ugly\n" - done = make(chan struct{}) - ) - handler := httptransport.NewServer( - endpoint.Nop, - func(context.Context, *http.Request) (interface{}, error) { - return struct{}{}, nil - }, - func(_ context.Context, w http.ResponseWriter, _ interface{}) error { - w.Header().Set(headerKey, headerVal) - w.WriteHeader(statusCode) - w.Write([]byte(responseBody)) - return nil - }, - httptransport.ServerBefore(func(ctx context.Context, r *http.Request) context.Context { - ctx = context.WithValue(ctx, "one", 1) - - return ctx - }), - httptransport.ServerBefore(func(ctx context.Context, r *http.Request) context.Context { - if _, ok := ctx.Value("one").(int); !ok { - t.Error("Value was not set properly when multiple ServerBefores are used") - } - - close(done) - return ctx - }), - ) - - server := httptest.NewServer(handler) - defer server.Close() - go http.Get(server.URL) - - select { - case <-done: - case <-time.After(time.Second): - t.Fatal("timeout waiting for finalizer") - } -} - -func TestMultipleServerAfter(t *testing.T) { - var ( - headerKey = "X-Henlo-Lizer" - headerVal = "Helllo you stinky lizard" - statusCode = http.StatusTeapot - responseBody = "go eat a fly ugly\n" - done = make(chan struct{}) - ) - handler := httptransport.NewServer( - endpoint.Nop, - func(context.Context, *http.Request) (interface{}, error) { - return struct{}{}, nil - }, - func(_ context.Context, w http.ResponseWriter, _ interface{}) error { - w.Header().Set(headerKey, headerVal) - w.WriteHeader(statusCode) - w.Write([]byte(responseBody)) - return nil - }, - httptransport.ServerAfter(func(ctx context.Context, w http.ResponseWriter) context.Context { - ctx = context.WithValue(ctx, "one", 1) - - return ctx - }), - httptransport.ServerAfter(func(ctx context.Context, w http.ResponseWriter) context.Context { - if _, ok := ctx.Value("one").(int); !ok { - t.Error("Value was not set properly when multiple ServerAfters are used") - } - - close(done) - return ctx - }), - ) - - server := httptest.NewServer(handler) - defer server.Close() - go http.Get(server.URL) - - select { - case <-done: - case <-time.After(time.Second): - t.Fatal("timeout waiting for finalizer") - } -} - -func TestServerFinalizer(t *testing.T) { - var ( - headerKey = "X-Henlo-Lizer" - headerVal = "Helllo you stinky lizard" - statusCode = http.StatusTeapot - responseBody = "go eat a fly ugly\n" - done = make(chan struct{}) - ) - handler := httptransport.NewServer( - endpoint.Nop, - func(context.Context, *http.Request) (interface{}, error) { - return struct{}{}, nil - }, - func(_ context.Context, w http.ResponseWriter, _ interface{}) error { - w.Header().Set(headerKey, headerVal) - w.WriteHeader(statusCode) - w.Write([]byte(responseBody)) - return nil - }, - httptransport.ServerFinalizer(func(ctx context.Context, code int, _ *http.Request) { - if want, have := statusCode, code; want != have { - t.Errorf("StatusCode: want %d, have %d", want, have) - } - - responseHeader := ctx.Value(httptransport.ContextKeyResponseHeaders).(http.Header) - if want, have := headerVal, responseHeader.Get(headerKey); want != have { - t.Errorf("%s: want %q, have %q", headerKey, want, have) - } - - responseSize := ctx.Value(httptransport.ContextKeyResponseSize).(int64) - if want, have := int64(len(responseBody)), responseSize; want != have { - t.Errorf("response size: want %d, have %d", want, have) - } - - close(done) - }), - ) - - server := httptest.NewServer(handler) - defer server.Close() - go http.Get(server.URL) - - select { - case <-done: - case <-time.After(time.Second): - t.Fatal("timeout waiting for finalizer") - } -} - -type enhancedResponse struct { - Foo string `json:"foo"` -} - -func (e enhancedResponse) StatusCode() int { return http.StatusPaymentRequired } -func (e enhancedResponse) Headers() http.Header { return http.Header{"X-Edward": []string{"Snowden"}} } - -func TestEncodeJSONResponse(t *testing.T) { - handler := httptransport.NewServer( - func(context.Context, interface{}) (interface{}, error) { return enhancedResponse{Foo: "bar"}, nil }, - func(context.Context, *http.Request) (interface{}, error) { return struct{}{}, nil }, - httptransport.EncodeJSONResponse, - ) - - server := httptest.NewServer(handler) - defer server.Close() - - resp, err := http.Get(server.URL) - if err != nil { - t.Fatal(err) - } - if want, have := http.StatusPaymentRequired, resp.StatusCode; want != have { - t.Errorf("StatusCode: want %d, have %d", want, have) - } - if want, have := "Snowden", resp.Header.Get("X-Edward"); want != have { - t.Errorf("X-Edward: want %q, have %q", want, have) - } - buf, _ := ioutil.ReadAll(resp.Body) - if want, have := `{"foo":"bar"}`, strings.TrimSpace(string(buf)); want != have { - t.Errorf("Body: want %s, have %s", want, have) - } -} - -type noContentResponse struct{} - -func (e noContentResponse) StatusCode() int { return http.StatusNoContent } - -func TestEncodeNoContent(t *testing.T) { - handler := httptransport.NewServer( - func(context.Context, interface{}) (interface{}, error) { return noContentResponse{}, nil }, - func(context.Context, *http.Request) (interface{}, error) { return struct{}{}, nil }, - httptransport.EncodeJSONResponse, - ) - - server := httptest.NewServer(handler) - defer server.Close() - - resp, err := http.Get(server.URL) - if err != nil { - t.Fatal(err) - } - if want, have := http.StatusNoContent, resp.StatusCode; want != have { - t.Errorf("StatusCode: want %d, have %d", want, have) - } - buf, _ := ioutil.ReadAll(resp.Body) - if want, have := 0, len(buf); want != have { - t.Errorf("Body: want no content, have %d bytes", have) - } -} - -type enhancedError struct{} - -func (e enhancedError) Error() string { return "enhanced error" } -func (e enhancedError) StatusCode() int { return http.StatusTeapot } -func (e enhancedError) MarshalJSON() ([]byte, error) { return []byte(`{"err":"enhanced"}`), nil } -func (e enhancedError) Headers() http.Header { return http.Header{"X-Enhanced": []string{"1"}} } - -func TestEnhancedError(t *testing.T) { - handler := httptransport.NewServer( - func(context.Context, interface{}) (interface{}, error) { return nil, enhancedError{} }, - func(context.Context, *http.Request) (interface{}, error) { return struct{}{}, nil }, - func(_ context.Context, w http.ResponseWriter, _ interface{}) error { return nil }, - ) - - server := httptest.NewServer(handler) - defer server.Close() - - resp, err := http.Get(server.URL) - if err != nil { - t.Fatal(err) - } - defer resp.Body.Close() - if want, have := http.StatusTeapot, resp.StatusCode; want != have { - t.Errorf("StatusCode: want %d, have %d", want, have) - } - if want, have := "1", resp.Header.Get("X-Enhanced"); want != have { - t.Errorf("X-Enhanced: want %q, have %q", want, have) - } - buf, _ := ioutil.ReadAll(resp.Body) - if want, have := `{"err":"enhanced"}`, strings.TrimSpace(string(buf)); want != have { - t.Errorf("Body: want %s, have %s", want, have) - } -} - -func testServer(t *testing.T) (step func(), resp <-chan *http.Response) { - var ( - stepch = make(chan bool) - endpoint = func(context.Context, interface{}) (interface{}, error) { <-stepch; return struct{}{}, nil } - response = make(chan *http.Response) - handler = httptransport.NewServer( + ctx, cancelfn = context.WithCancel(context.Background()) + stepch = make(chan bool) + endpoint = func(context.Context, interface{}) (interface{}, error) { <-stepch; return struct{}{}, nil } + response = make(chan *http.Response) + handler = httptransport.NewServer( + ctx, endpoint, func(context.Context, *http.Request) (interface{}, error) { return struct{}{}, nil }, func(context.Context, http.ResponseWriter, interface{}) error { return nil }, @@ -345,5 +116,5 @@ func testServer(t *testing.T) (step func(), resp <-chan *http.Response) { } response <- resp }() - return func() { stepch <- true }, response + return cancelfn, func() { stepch <- true }, response } diff --git a/vendor/github.com/go-kit/kit/transport/httprp/server.go b/vendor/github.com/go-kit/kit/transport/httprp/server.go index b0a1ee3..15b9cd5 100644 --- a/vendor/github.com/go-kit/kit/transport/httprp/server.go +++ b/vendor/github.com/go-kit/kit/transport/httprp/server.go @@ -1,10 +1,11 @@ package httprp import ( - "context" "net/http" "net/http/httputil" "net/url" + + "golang.org/x/net/context" ) // RequestFunc may take information from an HTTP request and put it into a @@ -14,6 +15,7 @@ type RequestFunc func(context.Context, *http.Request) context.Context // Server is a proxying request handler. type Server struct { + ctx context.Context proxy http.Handler before []RequestFunc errorEncoder func(w http.ResponseWriter, err error) @@ -24,10 +26,12 @@ type Server struct { // If the target's path is "/base" and the incoming request was for "/dir", // the target request will be for /base/dir. func NewServer( + ctx context.Context, baseURL *url.URL, options ...ServerOption, ) *Server { s := &Server{ + ctx: ctx, proxy: httputil.NewSingleHostReverseProxy(baseURL), } for _, option := range options { @@ -42,12 +46,12 @@ type ServerOption func(*Server) // ServerBefore functions are executed on the HTTP request object before the // request is decoded. func ServerBefore(before ...RequestFunc) ServerOption { - return func(s *Server) { s.before = append(s.before, before...) } + return func(s *Server) { s.before = before } } // ServeHTTP implements http.Handler. func (s Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { - ctx := r.Context() + ctx := s.ctx for _, f := range s.before { ctx = f(ctx, r) diff --git a/vendor/github.com/go-kit/kit/transport/httprp/server_test.go b/vendor/github.com/go-kit/kit/transport/httprp/server_test.go index fc53576..ec7fb10 100644 --- a/vendor/github.com/go-kit/kit/transport/httprp/server_test.go +++ b/vendor/github.com/go-kit/kit/transport/httprp/server_test.go @@ -1,13 +1,14 @@ package httprp_test import ( - "context" "io/ioutil" "net/http" "net/http/httptest" "net/url" "testing" + "golang.org/x/net/context" + httptransport "github.com/go-kit/kit/transport/httprp" ) @@ -20,6 +21,7 @@ func TestServerHappyPathSingleServer(t *testing.T) { originURL, _ := url.Parse(originServer.URL) handler := httptransport.NewServer( + context.Background(), originURL, ) proxyServer := httptest.NewServer(handler) @@ -54,6 +56,7 @@ func TestServerHappyPathSingleServerWithServerOptions(t *testing.T) { originURL, _ := url.Parse(originServer.URL) handler := httptransport.NewServer( + context.Background(), originURL, httptransport.ServerBefore(func(ctx context.Context, r *http.Request) context.Context { r.Header.Add(headerKey, headerVal) @@ -80,6 +83,7 @@ func TestServerOriginServerNotFoundResponse(t *testing.T) { originURL, _ := url.Parse(originServer.URL) handler := httptransport.NewServer( + context.Background(), originURL, ) proxyServer := httptest.NewServer(handler) @@ -100,6 +104,7 @@ func TestServerOriginServerUnreachable(t *testing.T) { originServer.Close() handler := httptransport.NewServer( + context.Background(), originURL, ) proxyServer := httptest.NewServer(handler) @@ -115,44 +120,3 @@ func TestServerOriginServerUnreachable(t *testing.T) { t.Errorf("want %d or %d, have %d", http.StatusBadGateway, http.StatusInternalServerError, resp.StatusCode) } } - -func TestMultipleServerBefore(t *testing.T) { - const ( - headerKey = "X-TEST-HEADER" - headerVal = "go-kit-proxy" - ) - - originServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if want, have := headerVal, r.Header.Get(headerKey); want != have { - t.Errorf("want %q, have %q", want, have) - } - - w.WriteHeader(http.StatusOK) - w.Write([]byte("hey")) - })) - defer originServer.Close() - originURL, _ := url.Parse(originServer.URL) - - handler := httptransport.NewServer( - originURL, - httptransport.ServerBefore(func(ctx context.Context, r *http.Request) context.Context { - r.Header.Add(headerKey, headerVal) - return ctx - }), - httptransport.ServerBefore(func(ctx context.Context, r *http.Request) context.Context { - return ctx - }), - ) - proxyServer := httptest.NewServer(handler) - defer proxyServer.Close() - - resp, _ := http.Get(proxyServer.URL) - if want, have := http.StatusOK, resp.StatusCode; want != have { - t.Errorf("want %d, have %d", want, have) - } - - responseBody, _ := ioutil.ReadAll(resp.Body) - if want, have := "hey", string(responseBody); want != have { - t.Errorf("want %q, have %q", want, have) - } -} diff --git a/vendor/github.com/go-stack/stack/LICENSE.md b/vendor/github.com/go-stack/stack/LICENSE.md index c8ca66c..2abf98e 100644 --- a/vendor/github.com/go-stack/stack/LICENSE.md +++ b/vendor/github.com/go-stack/stack/LICENSE.md @@ -1,13 +1,21 @@ -Copyright 2014 Chris Hines +The MIT License (MIT) -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at +Copyright (c) 2014 Chris Hines - http://www.apache.org/licenses/LICENSE-2.0 +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/golang/glog/LICENSE b/vendor/github.com/golang/glog/LICENSE new file mode 100644 index 0000000..37ec93a --- /dev/null +++ b/vendor/github.com/golang/glog/LICENSE @@ -0,0 +1,191 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that entity. +For the purposes of this definition, "control" means (i) the power, direct or +indirect, to cause the direction or management of such entity, whether by +contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising +permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + +"Object" form shall mean any form resulting from mechanical transformation or +translation of a Source form, including but not limited to compiled object code, +generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made +available under the License, as indicated by a copyright notice that is included +in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that +is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by +name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative Works +thereof, that is intentionally submitted to Licensor for inclusion in the Work +by the copyright owner or by an individual or Legal Entity authorized to submit +on behalf of the copyright owner. For the purposes of this definition, +"submitted" means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, and +issue tracking systems that are managed by, or on behalf of, the Licensor for +the purpose of discussing and improving the Work, but excluding communication +that is conspicuously marked or otherwise designated in writing by the copyright +owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf +of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the Work and such +Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable (except as stated in this section) patent license to make, have +made, use, offer to sell, sell, import, and otherwise transfer the Work, where +such license applies only to those patent claims licensable by such Contributor +that are necessarily infringed by their Contribution(s) alone or by combination +of their Contribution(s) with the Work to which such Contribution(s) was +submitted. If You institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work or a +Contribution incorporated within the Work constitutes direct or contributory +patent infringement, then any patent licenses granted to You under this License +for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof +in any medium, with or without modifications, and in Source or Object form, +provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of +this License; and +You must cause any modified files to carry prominent notices stating that You +changed the files; and +You must retain, in the Source form of any Derivative Works that You distribute, +all copyright, patent, trademark, and attribution notices from the Source form +of the Work, excluding those notices that do not pertain to any part of the +Derivative Works; and +If the Work includes a "NOTICE" text file as part of its distribution, then any +Derivative Works that You distribute must include a readable copy of the +attribution notices contained within such NOTICE file, excluding those notices +that do not pertain to any part of the Derivative Works, in at least one of the +following places: within a NOTICE text file distributed as part of the +Derivative Works; within the Source form or documentation, if provided along +with the Derivative Works; or, within a display generated by the Derivative +Works, if and wherever such third-party notices normally appear. The contents of +the NOTICE file are for informational purposes only and do not modify the +License. You may add Your own attribution notices within Derivative Works that +You distribute, alongside or as an addendum to the NOTICE text from the Work, +provided that such additional attribution notices cannot be construed as +modifying the License. +You may add Your own copyright statement to Your modifications and may provide +additional or different license terms and conditions for use, reproduction, or +distribution of Your modifications, or for any such Derivative Works as a whole, +provided Your use, reproduction, and distribution of the Work otherwise complies +with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted +for inclusion in the Work by You to the Licensor shall be under the terms and +conditions of this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify the terms of +any separate license agreement you may have executed with Licensor regarding +such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, +service marks, or product names of the Licensor, except as required for +reasonable and customary use in describing the origin of the Work and +reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the +Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, +including, without limitation, any warranties or conditions of TITLE, +NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are +solely responsible for determining the appropriateness of using or +redistributing the Work and assume any risks associated with Your exercise of +permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), +contract, or otherwise, unless required by applicable law (such as deliberate +and grossly negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, incidental, +or consequential damages of any character arising as a result of this License or +out of the use or inability to use the Work (including but not limited to +damages for loss of goodwill, work stoppage, computer failure or malfunction, or +any and all other commercial damages or losses), even if such Contributor has +been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to +offer, and charge a fee for, acceptance of support, warranty, indemnity, or +other liability obligations and/or rights consistent with this License. However, +in accepting such obligations, You may act only on Your own behalf and on Your +sole responsibility, not on behalf of any other Contributor, and only if You +agree to indemnify, defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason of your +accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets "[]" replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also +recommend that a file or class name and description of purpose be included on +the same "printed page" as the copyright notice for easier identification within +third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/golang/glog/README b/vendor/github.com/golang/glog/README new file mode 100644 index 0000000..387b4eb --- /dev/null +++ b/vendor/github.com/golang/glog/README @@ -0,0 +1,44 @@ +glog +==== + +Leveled execution logs for Go. + +This is an efficient pure Go implementation of leveled logs in the +manner of the open source C++ package + https://github.com/google/glog + +By binding methods to booleans it is possible to use the log package +without paying the expense of evaluating the arguments to the log. +Through the -vmodule flag, the package also provides fine-grained +control over logging at the file level. + +The comment from glog.go introduces the ideas: + + Package glog implements logging analogous to the Google-internal + C++ INFO/ERROR/V setup. It provides functions Info, Warning, + Error, Fatal, plus formatting variants such as Infof. It + also provides V-style logging controlled by the -v and + -vmodule=file=2 flags. + + Basic examples: + + glog.Info("Prepare to repel boarders") + + glog.Fatalf("Initialization failed: %s", err) + + See the documentation for the V function for an explanation + of these examples: + + if glog.V(2) { + glog.Info("Starting transaction...") + } + + glog.V(2).Infoln("Processed", nItems, "elements") + + +The repository contains an open source version of the log package +used inside Google. The master copy of the source lives inside +Google, not here. The code in this repo is for export only and is not itself +under development. Feature requests will be ignored. + +Send bug reports to golang-nuts@googlegroups.com. diff --git a/vendor/github.com/golang/glog/glog.go b/vendor/github.com/golang/glog/glog.go new file mode 100644 index 0000000..54bd7af --- /dev/null +++ b/vendor/github.com/golang/glog/glog.go @@ -0,0 +1,1180 @@ +// Go support for leveled logs, analogous to https://code.google.com/p/google-glog/ +// +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package glog implements logging analogous to the Google-internal C++ INFO/ERROR/V setup. +// It provides functions Info, Warning, Error, Fatal, plus formatting variants such as +// Infof. It also provides V-style logging controlled by the -v and -vmodule=file=2 flags. +// +// Basic examples: +// +// glog.Info("Prepare to repel boarders") +// +// glog.Fatalf("Initialization failed: %s", err) +// +// See the documentation for the V function for an explanation of these examples: +// +// if glog.V(2) { +// glog.Info("Starting transaction...") +// } +// +// glog.V(2).Infoln("Processed", nItems, "elements") +// +// Log output is buffered and written periodically using Flush. Programs +// should call Flush before exiting to guarantee all log output is written. +// +// By default, all log statements write to files in a temporary directory. +// This package provides several flags that modify this behavior. +// As a result, flag.Parse must be called before any logging is done. +// +// -logtostderr=false +// Logs are written to standard error instead of to files. +// -alsologtostderr=false +// Logs are written to standard error as well as to files. +// -stderrthreshold=ERROR +// Log events at or above this severity are logged to standard +// error as well as to files. +// -log_dir="" +// Log files will be written to this directory instead of the +// default temporary directory. +// +// Other flags provide aids to debugging. +// +// -log_backtrace_at="" +// When set to a file and line number holding a logging statement, +// such as +// -log_backtrace_at=gopherflakes.go:234 +// a stack trace will be written to the Info log whenever execution +// hits that statement. (Unlike with -vmodule, the ".go" must be +// present.) +// -v=0 +// Enable V-leveled logging at the specified level. +// -vmodule="" +// The syntax of the argument is a comma-separated list of pattern=N, +// where pattern is a literal file name (minus the ".go" suffix) or +// "glob" pattern and N is a V level. For instance, +// -vmodule=gopher*=3 +// sets the V level to 3 in all Go files whose names begin "gopher". +// +package glog + +import ( + "bufio" + "bytes" + "errors" + "flag" + "fmt" + "io" + stdLog "log" + "os" + "path/filepath" + "runtime" + "strconv" + "strings" + "sync" + "sync/atomic" + "time" +) + +// severity identifies the sort of log: info, warning etc. It also implements +// the flag.Value interface. The -stderrthreshold flag is of type severity and +// should be modified only through the flag.Value interface. The values match +// the corresponding constants in C++. +type severity int32 // sync/atomic int32 + +// These constants identify the log levels in order of increasing severity. +// A message written to a high-severity log file is also written to each +// lower-severity log file. +const ( + infoLog severity = iota + warningLog + errorLog + fatalLog + numSeverity = 4 +) + +const severityChar = "IWEF" + +var severityName = []string{ + infoLog: "INFO", + warningLog: "WARNING", + errorLog: "ERROR", + fatalLog: "FATAL", +} + +// get returns the value of the severity. +func (s *severity) get() severity { + return severity(atomic.LoadInt32((*int32)(s))) +} + +// set sets the value of the severity. +func (s *severity) set(val severity) { + atomic.StoreInt32((*int32)(s), int32(val)) +} + +// String is part of the flag.Value interface. +func (s *severity) String() string { + return strconv.FormatInt(int64(*s), 10) +} + +// Get is part of the flag.Value interface. +func (s *severity) Get() interface{} { + return *s +} + +// Set is part of the flag.Value interface. +func (s *severity) Set(value string) error { + var threshold severity + // Is it a known name? + if v, ok := severityByName(value); ok { + threshold = v + } else { + v, err := strconv.Atoi(value) + if err != nil { + return err + } + threshold = severity(v) + } + logging.stderrThreshold.set(threshold) + return nil +} + +func severityByName(s string) (severity, bool) { + s = strings.ToUpper(s) + for i, name := range severityName { + if name == s { + return severity(i), true + } + } + return 0, false +} + +// OutputStats tracks the number of output lines and bytes written. +type OutputStats struct { + lines int64 + bytes int64 +} + +// Lines returns the number of lines written. +func (s *OutputStats) Lines() int64 { + return atomic.LoadInt64(&s.lines) +} + +// Bytes returns the number of bytes written. +func (s *OutputStats) Bytes() int64 { + return atomic.LoadInt64(&s.bytes) +} + +// Stats tracks the number of lines of output and number of bytes +// per severity level. Values must be read with atomic.LoadInt64. +var Stats struct { + Info, Warning, Error OutputStats +} + +var severityStats = [numSeverity]*OutputStats{ + infoLog: &Stats.Info, + warningLog: &Stats.Warning, + errorLog: &Stats.Error, +} + +// Level is exported because it appears in the arguments to V and is +// the type of the v flag, which can be set programmatically. +// It's a distinct type because we want to discriminate it from logType. +// Variables of type level are only changed under logging.mu. +// The -v flag is read only with atomic ops, so the state of the logging +// module is consistent. + +// Level is treated as a sync/atomic int32. + +// Level specifies a level of verbosity for V logs. *Level implements +// flag.Value; the -v flag is of type Level and should be modified +// only through the flag.Value interface. +type Level int32 + +// get returns the value of the Level. +func (l *Level) get() Level { + return Level(atomic.LoadInt32((*int32)(l))) +} + +// set sets the value of the Level. +func (l *Level) set(val Level) { + atomic.StoreInt32((*int32)(l), int32(val)) +} + +// String is part of the flag.Value interface. +func (l *Level) String() string { + return strconv.FormatInt(int64(*l), 10) +} + +// Get is part of the flag.Value interface. +func (l *Level) Get() interface{} { + return *l +} + +// Set is part of the flag.Value interface. +func (l *Level) Set(value string) error { + v, err := strconv.Atoi(value) + if err != nil { + return err + } + logging.mu.Lock() + defer logging.mu.Unlock() + logging.setVState(Level(v), logging.vmodule.filter, false) + return nil +} + +// moduleSpec represents the setting of the -vmodule flag. +type moduleSpec struct { + filter []modulePat +} + +// modulePat contains a filter for the -vmodule flag. +// It holds a verbosity level and a file pattern to match. +type modulePat struct { + pattern string + literal bool // The pattern is a literal string + level Level +} + +// match reports whether the file matches the pattern. It uses a string +// comparison if the pattern contains no metacharacters. +func (m *modulePat) match(file string) bool { + if m.literal { + return file == m.pattern + } + match, _ := filepath.Match(m.pattern, file) + return match +} + +func (m *moduleSpec) String() string { + // Lock because the type is not atomic. TODO: clean this up. + logging.mu.Lock() + defer logging.mu.Unlock() + var b bytes.Buffer + for i, f := range m.filter { + if i > 0 { + b.WriteRune(',') + } + fmt.Fprintf(&b, "%s=%d", f.pattern, f.level) + } + return b.String() +} + +// Get is part of the (Go 1.2) flag.Getter interface. It always returns nil for this flag type since the +// struct is not exported. +func (m *moduleSpec) Get() interface{} { + return nil +} + +var errVmoduleSyntax = errors.New("syntax error: expect comma-separated list of filename=N") + +// Syntax: -vmodule=recordio=2,file=1,gfs*=3 +func (m *moduleSpec) Set(value string) error { + var filter []modulePat + for _, pat := range strings.Split(value, ",") { + if len(pat) == 0 { + // Empty strings such as from a trailing comma can be ignored. + continue + } + patLev := strings.Split(pat, "=") + if len(patLev) != 2 || len(patLev[0]) == 0 || len(patLev[1]) == 0 { + return errVmoduleSyntax + } + pattern := patLev[0] + v, err := strconv.Atoi(patLev[1]) + if err != nil { + return errors.New("syntax error: expect comma-separated list of filename=N") + } + if v < 0 { + return errors.New("negative value for vmodule level") + } + if v == 0 { + continue // Ignore. It's harmless but no point in paying the overhead. + } + // TODO: check syntax of filter? + filter = append(filter, modulePat{pattern, isLiteral(pattern), Level(v)}) + } + logging.mu.Lock() + defer logging.mu.Unlock() + logging.setVState(logging.verbosity, filter, true) + return nil +} + +// isLiteral reports whether the pattern is a literal string, that is, has no metacharacters +// that require filepath.Match to be called to match the pattern. +func isLiteral(pattern string) bool { + return !strings.ContainsAny(pattern, `\*?[]`) +} + +// traceLocation represents the setting of the -log_backtrace_at flag. +type traceLocation struct { + file string + line int +} + +// isSet reports whether the trace location has been specified. +// logging.mu is held. +func (t *traceLocation) isSet() bool { + return t.line > 0 +} + +// match reports whether the specified file and line matches the trace location. +// The argument file name is the full path, not the basename specified in the flag. +// logging.mu is held. +func (t *traceLocation) match(file string, line int) bool { + if t.line != line { + return false + } + if i := strings.LastIndex(file, "/"); i >= 0 { + file = file[i+1:] + } + return t.file == file +} + +func (t *traceLocation) String() string { + // Lock because the type is not atomic. TODO: clean this up. + logging.mu.Lock() + defer logging.mu.Unlock() + return fmt.Sprintf("%s:%d", t.file, t.line) +} + +// Get is part of the (Go 1.2) flag.Getter interface. It always returns nil for this flag type since the +// struct is not exported +func (t *traceLocation) Get() interface{} { + return nil +} + +var errTraceSyntax = errors.New("syntax error: expect file.go:234") + +// Syntax: -log_backtrace_at=gopherflakes.go:234 +// Note that unlike vmodule the file extension is included here. +func (t *traceLocation) Set(value string) error { + if value == "" { + // Unset. + t.line = 0 + t.file = "" + } + fields := strings.Split(value, ":") + if len(fields) != 2 { + return errTraceSyntax + } + file, line := fields[0], fields[1] + if !strings.Contains(file, ".") { + return errTraceSyntax + } + v, err := strconv.Atoi(line) + if err != nil { + return errTraceSyntax + } + if v <= 0 { + return errors.New("negative or zero value for level") + } + logging.mu.Lock() + defer logging.mu.Unlock() + t.line = v + t.file = file + return nil +} + +// flushSyncWriter is the interface satisfied by logging destinations. +type flushSyncWriter interface { + Flush() error + Sync() error + io.Writer +} + +func init() { + flag.BoolVar(&logging.toStderr, "logtostderr", false, "log to standard error instead of files") + flag.BoolVar(&logging.alsoToStderr, "alsologtostderr", false, "log to standard error as well as files") + flag.Var(&logging.verbosity, "v", "log level for V logs") + flag.Var(&logging.stderrThreshold, "stderrthreshold", "logs at or above this threshold go to stderr") + flag.Var(&logging.vmodule, "vmodule", "comma-separated list of pattern=N settings for file-filtered logging") + flag.Var(&logging.traceLocation, "log_backtrace_at", "when logging hits line file:N, emit a stack trace") + + // Default stderrThreshold is ERROR. + logging.stderrThreshold = errorLog + + logging.setVState(0, nil, false) + go logging.flushDaemon() +} + +// Flush flushes all pending log I/O. +func Flush() { + logging.lockAndFlushAll() +} + +// loggingT collects all the global state of the logging setup. +type loggingT struct { + // Boolean flags. Not handled atomically because the flag.Value interface + // does not let us avoid the =true, and that shorthand is necessary for + // compatibility. TODO: does this matter enough to fix? Seems unlikely. + toStderr bool // The -logtostderr flag. + alsoToStderr bool // The -alsologtostderr flag. + + // Level flag. Handled atomically. + stderrThreshold severity // The -stderrthreshold flag. + + // freeList is a list of byte buffers, maintained under freeListMu. + freeList *buffer + // freeListMu maintains the free list. It is separate from the main mutex + // so buffers can be grabbed and printed to without holding the main lock, + // for better parallelization. + freeListMu sync.Mutex + + // mu protects the remaining elements of this structure and is + // used to synchronize logging. + mu sync.Mutex + // file holds writer for each of the log types. + file [numSeverity]flushSyncWriter + // pcs is used in V to avoid an allocation when computing the caller's PC. + pcs [1]uintptr + // vmap is a cache of the V Level for each V() call site, identified by PC. + // It is wiped whenever the vmodule flag changes state. + vmap map[uintptr]Level + // filterLength stores the length of the vmodule filter chain. If greater + // than zero, it means vmodule is enabled. It may be read safely + // using sync.LoadInt32, but is only modified under mu. + filterLength int32 + // traceLocation is the state of the -log_backtrace_at flag. + traceLocation traceLocation + // These flags are modified only under lock, although verbosity may be fetched + // safely using atomic.LoadInt32. + vmodule moduleSpec // The state of the -vmodule flag. + verbosity Level // V logging level, the value of the -v flag/ +} + +// buffer holds a byte Buffer for reuse. The zero value is ready for use. +type buffer struct { + bytes.Buffer + tmp [64]byte // temporary byte array for creating headers. + next *buffer +} + +var logging loggingT + +// setVState sets a consistent state for V logging. +// l.mu is held. +func (l *loggingT) setVState(verbosity Level, filter []modulePat, setFilter bool) { + // Turn verbosity off so V will not fire while we are in transition. + logging.verbosity.set(0) + // Ditto for filter length. + atomic.StoreInt32(&logging.filterLength, 0) + + // Set the new filters and wipe the pc->Level map if the filter has changed. + if setFilter { + logging.vmodule.filter = filter + logging.vmap = make(map[uintptr]Level) + } + + // Things are consistent now, so enable filtering and verbosity. + // They are enabled in order opposite to that in V. + atomic.StoreInt32(&logging.filterLength, int32(len(filter))) + logging.verbosity.set(verbosity) +} + +// getBuffer returns a new, ready-to-use buffer. +func (l *loggingT) getBuffer() *buffer { + l.freeListMu.Lock() + b := l.freeList + if b != nil { + l.freeList = b.next + } + l.freeListMu.Unlock() + if b == nil { + b = new(buffer) + } else { + b.next = nil + b.Reset() + } + return b +} + +// putBuffer returns a buffer to the free list. +func (l *loggingT) putBuffer(b *buffer) { + if b.Len() >= 256 { + // Let big buffers die a natural death. + return + } + l.freeListMu.Lock() + b.next = l.freeList + l.freeList = b + l.freeListMu.Unlock() +} + +var timeNow = time.Now // Stubbed out for testing. + +/* +header formats a log header as defined by the C++ implementation. +It returns a buffer containing the formatted header and the user's file and line number. +The depth specifies how many stack frames above lives the source line to be identified in the log message. + +Log lines have this form: + Lmmdd hh:mm:ss.uuuuuu threadid file:line] msg... +where the fields are defined as follows: + L A single character, representing the log level (eg 'I' for INFO) + mm The month (zero padded; ie May is '05') + dd The day (zero padded) + hh:mm:ss.uuuuuu Time in hours, minutes and fractional seconds + threadid The space-padded thread ID as returned by GetTID() + file The file name + line The line number + msg The user-supplied message +*/ +func (l *loggingT) header(s severity, depth int) (*buffer, string, int) { + _, file, line, ok := runtime.Caller(3 + depth) + if !ok { + file = "???" + line = 1 + } else { + slash := strings.LastIndex(file, "/") + if slash >= 0 { + file = file[slash+1:] + } + } + return l.formatHeader(s, file, line), file, line +} + +// formatHeader formats a log header using the provided file name and line number. +func (l *loggingT) formatHeader(s severity, file string, line int) *buffer { + now := timeNow() + if line < 0 { + line = 0 // not a real line number, but acceptable to someDigits + } + if s > fatalLog { + s = infoLog // for safety. + } + buf := l.getBuffer() + + // Avoid Fprintf, for speed. The format is so simple that we can do it quickly by hand. + // It's worth about 3X. Fprintf is hard. + _, month, day := now.Date() + hour, minute, second := now.Clock() + // Lmmdd hh:mm:ss.uuuuuu threadid file:line] + buf.tmp[0] = severityChar[s] + buf.twoDigits(1, int(month)) + buf.twoDigits(3, day) + buf.tmp[5] = ' ' + buf.twoDigits(6, hour) + buf.tmp[8] = ':' + buf.twoDigits(9, minute) + buf.tmp[11] = ':' + buf.twoDigits(12, second) + buf.tmp[14] = '.' + buf.nDigits(6, 15, now.Nanosecond()/1000, '0') + buf.tmp[21] = ' ' + buf.nDigits(7, 22, pid, ' ') // TODO: should be TID + buf.tmp[29] = ' ' + buf.Write(buf.tmp[:30]) + buf.WriteString(file) + buf.tmp[0] = ':' + n := buf.someDigits(1, line) + buf.tmp[n+1] = ']' + buf.tmp[n+2] = ' ' + buf.Write(buf.tmp[:n+3]) + return buf +} + +// Some custom tiny helper functions to print the log header efficiently. + +const digits = "0123456789" + +// twoDigits formats a zero-prefixed two-digit integer at buf.tmp[i]. +func (buf *buffer) twoDigits(i, d int) { + buf.tmp[i+1] = digits[d%10] + d /= 10 + buf.tmp[i] = digits[d%10] +} + +// nDigits formats an n-digit integer at buf.tmp[i], +// padding with pad on the left. +// It assumes d >= 0. +func (buf *buffer) nDigits(n, i, d int, pad byte) { + j := n - 1 + for ; j >= 0 && d > 0; j-- { + buf.tmp[i+j] = digits[d%10] + d /= 10 + } + for ; j >= 0; j-- { + buf.tmp[i+j] = pad + } +} + +// someDigits formats a zero-prefixed variable-width integer at buf.tmp[i]. +func (buf *buffer) someDigits(i, d int) int { + // Print into the top, then copy down. We know there's space for at least + // a 10-digit number. + j := len(buf.tmp) + for { + j-- + buf.tmp[j] = digits[d%10] + d /= 10 + if d == 0 { + break + } + } + return copy(buf.tmp[i:], buf.tmp[j:]) +} + +func (l *loggingT) println(s severity, args ...interface{}) { + buf, file, line := l.header(s, 0) + fmt.Fprintln(buf, args...) + l.output(s, buf, file, line, false) +} + +func (l *loggingT) print(s severity, args ...interface{}) { + l.printDepth(s, 1, args...) +} + +func (l *loggingT) printDepth(s severity, depth int, args ...interface{}) { + buf, file, line := l.header(s, depth) + fmt.Fprint(buf, args...) + if buf.Bytes()[buf.Len()-1] != '\n' { + buf.WriteByte('\n') + } + l.output(s, buf, file, line, false) +} + +func (l *loggingT) printf(s severity, format string, args ...interface{}) { + buf, file, line := l.header(s, 0) + fmt.Fprintf(buf, format, args...) + if buf.Bytes()[buf.Len()-1] != '\n' { + buf.WriteByte('\n') + } + l.output(s, buf, file, line, false) +} + +// printWithFileLine behaves like print but uses the provided file and line number. If +// alsoLogToStderr is true, the log message always appears on standard error; it +// will also appear in the log file unless --logtostderr is set. +func (l *loggingT) printWithFileLine(s severity, file string, line int, alsoToStderr bool, args ...interface{}) { + buf := l.formatHeader(s, file, line) + fmt.Fprint(buf, args...) + if buf.Bytes()[buf.Len()-1] != '\n' { + buf.WriteByte('\n') + } + l.output(s, buf, file, line, alsoToStderr) +} + +// output writes the data to the log files and releases the buffer. +func (l *loggingT) output(s severity, buf *buffer, file string, line int, alsoToStderr bool) { + l.mu.Lock() + if l.traceLocation.isSet() { + if l.traceLocation.match(file, line) { + buf.Write(stacks(false)) + } + } + data := buf.Bytes() + if !flag.Parsed() { + os.Stderr.Write([]byte("ERROR: logging before flag.Parse: ")) + os.Stderr.Write(data) + } else if l.toStderr { + os.Stderr.Write(data) + } else { + if alsoToStderr || l.alsoToStderr || s >= l.stderrThreshold.get() { + os.Stderr.Write(data) + } + if l.file[s] == nil { + if err := l.createFiles(s); err != nil { + os.Stderr.Write(data) // Make sure the message appears somewhere. + l.exit(err) + } + } + switch s { + case fatalLog: + l.file[fatalLog].Write(data) + fallthrough + case errorLog: + l.file[errorLog].Write(data) + fallthrough + case warningLog: + l.file[warningLog].Write(data) + fallthrough + case infoLog: + l.file[infoLog].Write(data) + } + } + if s == fatalLog { + // If we got here via Exit rather than Fatal, print no stacks. + if atomic.LoadUint32(&fatalNoStacks) > 0 { + l.mu.Unlock() + timeoutFlush(10 * time.Second) + os.Exit(1) + } + // Dump all goroutine stacks before exiting. + // First, make sure we see the trace for the current goroutine on standard error. + // If -logtostderr has been specified, the loop below will do that anyway + // as the first stack in the full dump. + if !l.toStderr { + os.Stderr.Write(stacks(false)) + } + // Write the stack trace for all goroutines to the files. + trace := stacks(true) + logExitFunc = func(error) {} // If we get a write error, we'll still exit below. + for log := fatalLog; log >= infoLog; log-- { + if f := l.file[log]; f != nil { // Can be nil if -logtostderr is set. + f.Write(trace) + } + } + l.mu.Unlock() + timeoutFlush(10 * time.Second) + os.Exit(255) // C++ uses -1, which is silly because it's anded with 255 anyway. + } + l.putBuffer(buf) + l.mu.Unlock() + if stats := severityStats[s]; stats != nil { + atomic.AddInt64(&stats.lines, 1) + atomic.AddInt64(&stats.bytes, int64(len(data))) + } +} + +// timeoutFlush calls Flush and returns when it completes or after timeout +// elapses, whichever happens first. This is needed because the hooks invoked +// by Flush may deadlock when glog.Fatal is called from a hook that holds +// a lock. +func timeoutFlush(timeout time.Duration) { + done := make(chan bool, 1) + go func() { + Flush() // calls logging.lockAndFlushAll() + done <- true + }() + select { + case <-done: + case <-time.After(timeout): + fmt.Fprintln(os.Stderr, "glog: Flush took longer than", timeout) + } +} + +// stacks is a wrapper for runtime.Stack that attempts to recover the data for all goroutines. +func stacks(all bool) []byte { + // We don't know how big the traces are, so grow a few times if they don't fit. Start large, though. + n := 10000 + if all { + n = 100000 + } + var trace []byte + for i := 0; i < 5; i++ { + trace = make([]byte, n) + nbytes := runtime.Stack(trace, all) + if nbytes < len(trace) { + return trace[:nbytes] + } + n *= 2 + } + return trace +} + +// logExitFunc provides a simple mechanism to override the default behavior +// of exiting on error. Used in testing and to guarantee we reach a required exit +// for fatal logs. Instead, exit could be a function rather than a method but that +// would make its use clumsier. +var logExitFunc func(error) + +// exit is called if there is trouble creating or writing log files. +// It flushes the logs and exits the program; there's no point in hanging around. +// l.mu is held. +func (l *loggingT) exit(err error) { + fmt.Fprintf(os.Stderr, "log: exiting because of error: %s\n", err) + // If logExitFunc is set, we do that instead of exiting. + if logExitFunc != nil { + logExitFunc(err) + return + } + l.flushAll() + os.Exit(2) +} + +// syncBuffer joins a bufio.Writer to its underlying file, providing access to the +// file's Sync method and providing a wrapper for the Write method that provides log +// file rotation. There are conflicting methods, so the file cannot be embedded. +// l.mu is held for all its methods. +type syncBuffer struct { + logger *loggingT + *bufio.Writer + file *os.File + sev severity + nbytes uint64 // The number of bytes written to this file +} + +func (sb *syncBuffer) Sync() error { + return sb.file.Sync() +} + +func (sb *syncBuffer) Write(p []byte) (n int, err error) { + if sb.nbytes+uint64(len(p)) >= MaxSize { + if err := sb.rotateFile(time.Now()); err != nil { + sb.logger.exit(err) + } + } + n, err = sb.Writer.Write(p) + sb.nbytes += uint64(n) + if err != nil { + sb.logger.exit(err) + } + return +} + +// rotateFile closes the syncBuffer's file and starts a new one. +func (sb *syncBuffer) rotateFile(now time.Time) error { + if sb.file != nil { + sb.Flush() + sb.file.Close() + } + var err error + sb.file, _, err = create(severityName[sb.sev], now) + sb.nbytes = 0 + if err != nil { + return err + } + + sb.Writer = bufio.NewWriterSize(sb.file, bufferSize) + + // Write header. + var buf bytes.Buffer + fmt.Fprintf(&buf, "Log file created at: %s\n", now.Format("2006/01/02 15:04:05")) + fmt.Fprintf(&buf, "Running on machine: %s\n", host) + fmt.Fprintf(&buf, "Binary: Built with %s %s for %s/%s\n", runtime.Compiler, runtime.Version(), runtime.GOOS, runtime.GOARCH) + fmt.Fprintf(&buf, "Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg\n") + n, err := sb.file.Write(buf.Bytes()) + sb.nbytes += uint64(n) + return err +} + +// bufferSize sizes the buffer associated with each log file. It's large +// so that log records can accumulate without the logging thread blocking +// on disk I/O. The flushDaemon will block instead. +const bufferSize = 256 * 1024 + +// createFiles creates all the log files for severity from sev down to infoLog. +// l.mu is held. +func (l *loggingT) createFiles(sev severity) error { + now := time.Now() + // Files are created in decreasing severity order, so as soon as we find one + // has already been created, we can stop. + for s := sev; s >= infoLog && l.file[s] == nil; s-- { + sb := &syncBuffer{ + logger: l, + sev: s, + } + if err := sb.rotateFile(now); err != nil { + return err + } + l.file[s] = sb + } + return nil +} + +const flushInterval = 30 * time.Second + +// flushDaemon periodically flushes the log file buffers. +func (l *loggingT) flushDaemon() { + for _ = range time.NewTicker(flushInterval).C { + l.lockAndFlushAll() + } +} + +// lockAndFlushAll is like flushAll but locks l.mu first. +func (l *loggingT) lockAndFlushAll() { + l.mu.Lock() + l.flushAll() + l.mu.Unlock() +} + +// flushAll flushes all the logs and attempts to "sync" their data to disk. +// l.mu is held. +func (l *loggingT) flushAll() { + // Flush from fatal down, in case there's trouble flushing. + for s := fatalLog; s >= infoLog; s-- { + file := l.file[s] + if file != nil { + file.Flush() // ignore error + file.Sync() // ignore error + } + } +} + +// CopyStandardLogTo arranges for messages written to the Go "log" package's +// default logs to also appear in the Google logs for the named and lower +// severities. Subsequent changes to the standard log's default output location +// or format may break this behavior. +// +// Valid names are "INFO", "WARNING", "ERROR", and "FATAL". If the name is not +// recognized, CopyStandardLogTo panics. +func CopyStandardLogTo(name string) { + sev, ok := severityByName(name) + if !ok { + panic(fmt.Sprintf("log.CopyStandardLogTo(%q): unrecognized severity name", name)) + } + // Set a log format that captures the user's file and line: + // d.go:23: message + stdLog.SetFlags(stdLog.Lshortfile) + stdLog.SetOutput(logBridge(sev)) +} + +// logBridge provides the Write method that enables CopyStandardLogTo to connect +// Go's standard logs to the logs provided by this package. +type logBridge severity + +// Write parses the standard logging line and passes its components to the +// logger for severity(lb). +func (lb logBridge) Write(b []byte) (n int, err error) { + var ( + file = "???" + line = 1 + text string + ) + // Split "d.go:23: message" into "d.go", "23", and "message". + if parts := bytes.SplitN(b, []byte{':'}, 3); len(parts) != 3 || len(parts[0]) < 1 || len(parts[2]) < 1 { + text = fmt.Sprintf("bad log format: %s", b) + } else { + file = string(parts[0]) + text = string(parts[2][1:]) // skip leading space + line, err = strconv.Atoi(string(parts[1])) + if err != nil { + text = fmt.Sprintf("bad line number: %s", b) + line = 1 + } + } + // printWithFileLine with alsoToStderr=true, so standard log messages + // always appear on standard error. + logging.printWithFileLine(severity(lb), file, line, true, text) + return len(b), nil +} + +// setV computes and remembers the V level for a given PC +// when vmodule is enabled. +// File pattern matching takes the basename of the file, stripped +// of its .go suffix, and uses filepath.Match, which is a little more +// general than the *? matching used in C++. +// l.mu is held. +func (l *loggingT) setV(pc uintptr) Level { + fn := runtime.FuncForPC(pc) + file, _ := fn.FileLine(pc) + // The file is something like /a/b/c/d.go. We want just the d. + if strings.HasSuffix(file, ".go") { + file = file[:len(file)-3] + } + if slash := strings.LastIndex(file, "/"); slash >= 0 { + file = file[slash+1:] + } + for _, filter := range l.vmodule.filter { + if filter.match(file) { + l.vmap[pc] = filter.level + return filter.level + } + } + l.vmap[pc] = 0 + return 0 +} + +// Verbose is a boolean type that implements Infof (like Printf) etc. +// See the documentation of V for more information. +type Verbose bool + +// V reports whether verbosity at the call site is at least the requested level. +// The returned value is a boolean of type Verbose, which implements Info, Infoln +// and Infof. These methods will write to the Info log if called. +// Thus, one may write either +// if glog.V(2) { glog.Info("log this") } +// or +// glog.V(2).Info("log this") +// The second form is shorter but the first is cheaper if logging is off because it does +// not evaluate its arguments. +// +// Whether an individual call to V generates a log record depends on the setting of +// the -v and --vmodule flags; both are off by default. If the level in the call to +// V is at least the value of -v, or of -vmodule for the source file containing the +// call, the V call will log. +func V(level Level) Verbose { + // This function tries hard to be cheap unless there's work to do. + // The fast path is two atomic loads and compares. + + // Here is a cheap but safe test to see if V logging is enabled globally. + if logging.verbosity.get() >= level { + return Verbose(true) + } + + // It's off globally but it vmodule may still be set. + // Here is another cheap but safe test to see if vmodule is enabled. + if atomic.LoadInt32(&logging.filterLength) > 0 { + // Now we need a proper lock to use the logging structure. The pcs field + // is shared so we must lock before accessing it. This is fairly expensive, + // but if V logging is enabled we're slow anyway. + logging.mu.Lock() + defer logging.mu.Unlock() + if runtime.Callers(2, logging.pcs[:]) == 0 { + return Verbose(false) + } + v, ok := logging.vmap[logging.pcs[0]] + if !ok { + v = logging.setV(logging.pcs[0]) + } + return Verbose(v >= level) + } + return Verbose(false) +} + +// Info is equivalent to the global Info function, guarded by the value of v. +// See the documentation of V for usage. +func (v Verbose) Info(args ...interface{}) { + if v { + logging.print(infoLog, args...) + } +} + +// Infoln is equivalent to the global Infoln function, guarded by the value of v. +// See the documentation of V for usage. +func (v Verbose) Infoln(args ...interface{}) { + if v { + logging.println(infoLog, args...) + } +} + +// Infof is equivalent to the global Infof function, guarded by the value of v. +// See the documentation of V for usage. +func (v Verbose) Infof(format string, args ...interface{}) { + if v { + logging.printf(infoLog, format, args...) + } +} + +// Info logs to the INFO log. +// Arguments are handled in the manner of fmt.Print; a newline is appended if missing. +func Info(args ...interface{}) { + logging.print(infoLog, args...) +} + +// InfoDepth acts as Info but uses depth to determine which call frame to log. +// InfoDepth(0, "msg") is the same as Info("msg"). +func InfoDepth(depth int, args ...interface{}) { + logging.printDepth(infoLog, depth, args...) +} + +// Infoln logs to the INFO log. +// Arguments are handled in the manner of fmt.Println; a newline is appended if missing. +func Infoln(args ...interface{}) { + logging.println(infoLog, args...) +} + +// Infof logs to the INFO log. +// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing. +func Infof(format string, args ...interface{}) { + logging.printf(infoLog, format, args...) +} + +// Warning logs to the WARNING and INFO logs. +// Arguments are handled in the manner of fmt.Print; a newline is appended if missing. +func Warning(args ...interface{}) { + logging.print(warningLog, args...) +} + +// WarningDepth acts as Warning but uses depth to determine which call frame to log. +// WarningDepth(0, "msg") is the same as Warning("msg"). +func WarningDepth(depth int, args ...interface{}) { + logging.printDepth(warningLog, depth, args...) +} + +// Warningln logs to the WARNING and INFO logs. +// Arguments are handled in the manner of fmt.Println; a newline is appended if missing. +func Warningln(args ...interface{}) { + logging.println(warningLog, args...) +} + +// Warningf logs to the WARNING and INFO logs. +// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing. +func Warningf(format string, args ...interface{}) { + logging.printf(warningLog, format, args...) +} + +// Error logs to the ERROR, WARNING, and INFO logs. +// Arguments are handled in the manner of fmt.Print; a newline is appended if missing. +func Error(args ...interface{}) { + logging.print(errorLog, args...) +} + +// ErrorDepth acts as Error but uses depth to determine which call frame to log. +// ErrorDepth(0, "msg") is the same as Error("msg"). +func ErrorDepth(depth int, args ...interface{}) { + logging.printDepth(errorLog, depth, args...) +} + +// Errorln logs to the ERROR, WARNING, and INFO logs. +// Arguments are handled in the manner of fmt.Println; a newline is appended if missing. +func Errorln(args ...interface{}) { + logging.println(errorLog, args...) +} + +// Errorf logs to the ERROR, WARNING, and INFO logs. +// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing. +func Errorf(format string, args ...interface{}) { + logging.printf(errorLog, format, args...) +} + +// Fatal logs to the FATAL, ERROR, WARNING, and INFO logs, +// including a stack trace of all running goroutines, then calls os.Exit(255). +// Arguments are handled in the manner of fmt.Print; a newline is appended if missing. +func Fatal(args ...interface{}) { + logging.print(fatalLog, args...) +} + +// FatalDepth acts as Fatal but uses depth to determine which call frame to log. +// FatalDepth(0, "msg") is the same as Fatal("msg"). +func FatalDepth(depth int, args ...interface{}) { + logging.printDepth(fatalLog, depth, args...) +} + +// Fatalln logs to the FATAL, ERROR, WARNING, and INFO logs, +// including a stack trace of all running goroutines, then calls os.Exit(255). +// Arguments are handled in the manner of fmt.Println; a newline is appended if missing. +func Fatalln(args ...interface{}) { + logging.println(fatalLog, args...) +} + +// Fatalf logs to the FATAL, ERROR, WARNING, and INFO logs, +// including a stack trace of all running goroutines, then calls os.Exit(255). +// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing. +func Fatalf(format string, args ...interface{}) { + logging.printf(fatalLog, format, args...) +} + +// fatalNoStacks is non-zero if we are to exit without dumping goroutine stacks. +// It allows Exit and relatives to use the Fatal logs. +var fatalNoStacks uint32 + +// Exit logs to the FATAL, ERROR, WARNING, and INFO logs, then calls os.Exit(1). +// Arguments are handled in the manner of fmt.Print; a newline is appended if missing. +func Exit(args ...interface{}) { + atomic.StoreUint32(&fatalNoStacks, 1) + logging.print(fatalLog, args...) +} + +// ExitDepth acts as Exit but uses depth to determine which call frame to log. +// ExitDepth(0, "msg") is the same as Exit("msg"). +func ExitDepth(depth int, args ...interface{}) { + atomic.StoreUint32(&fatalNoStacks, 1) + logging.printDepth(fatalLog, depth, args...) +} + +// Exitln logs to the FATAL, ERROR, WARNING, and INFO logs, then calls os.Exit(1). +func Exitln(args ...interface{}) { + atomic.StoreUint32(&fatalNoStacks, 1) + logging.println(fatalLog, args...) +} + +// Exitf logs to the FATAL, ERROR, WARNING, and INFO logs, then calls os.Exit(1). +// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing. +func Exitf(format string, args ...interface{}) { + atomic.StoreUint32(&fatalNoStacks, 1) + logging.printf(fatalLog, format, args...) +} diff --git a/vendor/github.com/golang/glog/glog_file.go b/vendor/github.com/golang/glog/glog_file.go new file mode 100644 index 0000000..65075d2 --- /dev/null +++ b/vendor/github.com/golang/glog/glog_file.go @@ -0,0 +1,124 @@ +// Go support for leveled logs, analogous to https://code.google.com/p/google-glog/ +// +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// File I/O for logs. + +package glog + +import ( + "errors" + "flag" + "fmt" + "os" + "os/user" + "path/filepath" + "strings" + "sync" + "time" +) + +// MaxSize is the maximum size of a log file in bytes. +var MaxSize uint64 = 1024 * 1024 * 1800 + +// logDirs lists the candidate directories for new log files. +var logDirs []string + +// If non-empty, overrides the choice of directory in which to write logs. +// See createLogDirs for the full list of possible destinations. +var logDir = flag.String("log_dir", "", "If non-empty, write log files in this directory") + +func createLogDirs() { + if *logDir != "" { + logDirs = append(logDirs, *logDir) + } + logDirs = append(logDirs, os.TempDir()) +} + +var ( + pid = os.Getpid() + program = filepath.Base(os.Args[0]) + host = "unknownhost" + userName = "unknownuser" +) + +func init() { + h, err := os.Hostname() + if err == nil { + host = shortHostname(h) + } + + current, err := user.Current() + if err == nil { + userName = current.Username + } + + // Sanitize userName since it may contain filepath separators on Windows. + userName = strings.Replace(userName, `\`, "_", -1) +} + +// shortHostname returns its argument, truncating at the first period. +// For instance, given "www.google.com" it returns "www". +func shortHostname(hostname string) string { + if i := strings.Index(hostname, "."); i >= 0 { + return hostname[:i] + } + return hostname +} + +// logName returns a new log file name containing tag, with start time t, and +// the name for the symlink for tag. +func logName(tag string, t time.Time) (name, link string) { + name = fmt.Sprintf("%s.%s.%s.log.%s.%04d%02d%02d-%02d%02d%02d.%d", + program, + host, + userName, + tag, + t.Year(), + t.Month(), + t.Day(), + t.Hour(), + t.Minute(), + t.Second(), + pid) + return name, program + "." + tag +} + +var onceLogDirs sync.Once + +// create creates a new log file and returns the file and its filename, which +// contains tag ("INFO", "FATAL", etc.) and t. If the file is created +// successfully, create also attempts to update the symlink for that tag, ignoring +// errors. +func create(tag string, t time.Time) (f *os.File, filename string, err error) { + onceLogDirs.Do(createLogDirs) + if len(logDirs) == 0 { + return nil, "", errors.New("log: no log dirs") + } + name, link := logName(tag, t) + var lastErr error + for _, dir := range logDirs { + fname := filepath.Join(dir, name) + f, err := os.Create(fname) + if err == nil { + symlink := filepath.Join(dir, link) + os.Remove(symlink) // ignore err + os.Symlink(name, symlink) // ignore err + return f, fname, nil + } + lastErr = err + } + return nil, "", fmt.Errorf("log: cannot create log: %v", lastErr) +} diff --git a/vendor/github.com/golang/glog/glog_test.go b/vendor/github.com/golang/glog/glog_test.go new file mode 100644 index 0000000..0fb376e --- /dev/null +++ b/vendor/github.com/golang/glog/glog_test.go @@ -0,0 +1,415 @@ +// Go support for leveled logs, analogous to https://code.google.com/p/google-glog/ +// +// Copyright 2013 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package glog + +import ( + "bytes" + "fmt" + stdLog "log" + "path/filepath" + "runtime" + "strconv" + "strings" + "testing" + "time" +) + +// Test that shortHostname works as advertised. +func TestShortHostname(t *testing.T) { + for hostname, expect := range map[string]string{ + "": "", + "host": "host", + "host.google.com": "host", + } { + if got := shortHostname(hostname); expect != got { + t.Errorf("shortHostname(%q): expected %q, got %q", hostname, expect, got) + } + } +} + +// flushBuffer wraps a bytes.Buffer to satisfy flushSyncWriter. +type flushBuffer struct { + bytes.Buffer +} + +func (f *flushBuffer) Flush() error { + return nil +} + +func (f *flushBuffer) Sync() error { + return nil +} + +// swap sets the log writers and returns the old array. +func (l *loggingT) swap(writers [numSeverity]flushSyncWriter) (old [numSeverity]flushSyncWriter) { + l.mu.Lock() + defer l.mu.Unlock() + old = l.file + for i, w := range writers { + logging.file[i] = w + } + return +} + +// newBuffers sets the log writers to all new byte buffers and returns the old array. +func (l *loggingT) newBuffers() [numSeverity]flushSyncWriter { + return l.swap([numSeverity]flushSyncWriter{new(flushBuffer), new(flushBuffer), new(flushBuffer), new(flushBuffer)}) +} + +// contents returns the specified log value as a string. +func contents(s severity) string { + return logging.file[s].(*flushBuffer).String() +} + +// contains reports whether the string is contained in the log. +func contains(s severity, str string, t *testing.T) bool { + return strings.Contains(contents(s), str) +} + +// setFlags configures the logging flags how the test expects them. +func setFlags() { + logging.toStderr = false +} + +// Test that Info works as advertised. +func TestInfo(t *testing.T) { + setFlags() + defer logging.swap(logging.newBuffers()) + Info("test") + if !contains(infoLog, "I", t) { + t.Errorf("Info has wrong character: %q", contents(infoLog)) + } + if !contains(infoLog, "test", t) { + t.Error("Info failed") + } +} + +func TestInfoDepth(t *testing.T) { + setFlags() + defer logging.swap(logging.newBuffers()) + + f := func() { InfoDepth(1, "depth-test1") } + + // The next three lines must stay together + _, _, wantLine, _ := runtime.Caller(0) + InfoDepth(0, "depth-test0") + f() + + msgs := strings.Split(strings.TrimSuffix(contents(infoLog), "\n"), "\n") + if len(msgs) != 2 { + t.Fatalf("Got %d lines, expected 2", len(msgs)) + } + + for i, m := range msgs { + if !strings.HasPrefix(m, "I") { + t.Errorf("InfoDepth[%d] has wrong character: %q", i, m) + } + w := fmt.Sprintf("depth-test%d", i) + if !strings.Contains(m, w) { + t.Errorf("InfoDepth[%d] missing %q: %q", i, w, m) + } + + // pull out the line number (between : and ]) + msg := m[strings.LastIndex(m, ":")+1:] + x := strings.Index(msg, "]") + if x < 0 { + t.Errorf("InfoDepth[%d]: missing ']': %q", i, m) + continue + } + line, err := strconv.Atoi(msg[:x]) + if err != nil { + t.Errorf("InfoDepth[%d]: bad line number: %q", i, m) + continue + } + wantLine++ + if wantLine != line { + t.Errorf("InfoDepth[%d]: got line %d, want %d", i, line, wantLine) + } + } +} + +func init() { + CopyStandardLogTo("INFO") +} + +// Test that CopyStandardLogTo panics on bad input. +func TestCopyStandardLogToPanic(t *testing.T) { + defer func() { + if s, ok := recover().(string); !ok || !strings.Contains(s, "LOG") { + t.Errorf(`CopyStandardLogTo("LOG") should have panicked: %v`, s) + } + }() + CopyStandardLogTo("LOG") +} + +// Test that using the standard log package logs to INFO. +func TestStandardLog(t *testing.T) { + setFlags() + defer logging.swap(logging.newBuffers()) + stdLog.Print("test") + if !contains(infoLog, "I", t) { + t.Errorf("Info has wrong character: %q", contents(infoLog)) + } + if !contains(infoLog, "test", t) { + t.Error("Info failed") + } +} + +// Test that the header has the correct format. +func TestHeader(t *testing.T) { + setFlags() + defer logging.swap(logging.newBuffers()) + defer func(previous func() time.Time) { timeNow = previous }(timeNow) + timeNow = func() time.Time { + return time.Date(2006, 1, 2, 15, 4, 5, .067890e9, time.Local) + } + pid = 1234 + Info("test") + var line int + format := "I0102 15:04:05.067890 1234 glog_test.go:%d] test\n" + n, err := fmt.Sscanf(contents(infoLog), format, &line) + if n != 1 || err != nil { + t.Errorf("log format error: %d elements, error %s:\n%s", n, err, contents(infoLog)) + } + // Scanf treats multiple spaces as equivalent to a single space, + // so check for correct space-padding also. + want := fmt.Sprintf(format, line) + if contents(infoLog) != want { + t.Errorf("log format error: got:\n\t%q\nwant:\t%q", contents(infoLog), want) + } +} + +// Test that an Error log goes to Warning and Info. +// Even in the Info log, the source character will be E, so the data should +// all be identical. +func TestError(t *testing.T) { + setFlags() + defer logging.swap(logging.newBuffers()) + Error("test") + if !contains(errorLog, "E", t) { + t.Errorf("Error has wrong character: %q", contents(errorLog)) + } + if !contains(errorLog, "test", t) { + t.Error("Error failed") + } + str := contents(errorLog) + if !contains(warningLog, str, t) { + t.Error("Warning failed") + } + if !contains(infoLog, str, t) { + t.Error("Info failed") + } +} + +// Test that a Warning log goes to Info. +// Even in the Info log, the source character will be W, so the data should +// all be identical. +func TestWarning(t *testing.T) { + setFlags() + defer logging.swap(logging.newBuffers()) + Warning("test") + if !contains(warningLog, "W", t) { + t.Errorf("Warning has wrong character: %q", contents(warningLog)) + } + if !contains(warningLog, "test", t) { + t.Error("Warning failed") + } + str := contents(warningLog) + if !contains(infoLog, str, t) { + t.Error("Info failed") + } +} + +// Test that a V log goes to Info. +func TestV(t *testing.T) { + setFlags() + defer logging.swap(logging.newBuffers()) + logging.verbosity.Set("2") + defer logging.verbosity.Set("0") + V(2).Info("test") + if !contains(infoLog, "I", t) { + t.Errorf("Info has wrong character: %q", contents(infoLog)) + } + if !contains(infoLog, "test", t) { + t.Error("Info failed") + } +} + +// Test that a vmodule enables a log in this file. +func TestVmoduleOn(t *testing.T) { + setFlags() + defer logging.swap(logging.newBuffers()) + logging.vmodule.Set("glog_test=2") + defer logging.vmodule.Set("") + if !V(1) { + t.Error("V not enabled for 1") + } + if !V(2) { + t.Error("V not enabled for 2") + } + if V(3) { + t.Error("V enabled for 3") + } + V(2).Info("test") + if !contains(infoLog, "I", t) { + t.Errorf("Info has wrong character: %q", contents(infoLog)) + } + if !contains(infoLog, "test", t) { + t.Error("Info failed") + } +} + +// Test that a vmodule of another file does not enable a log in this file. +func TestVmoduleOff(t *testing.T) { + setFlags() + defer logging.swap(logging.newBuffers()) + logging.vmodule.Set("notthisfile=2") + defer logging.vmodule.Set("") + for i := 1; i <= 3; i++ { + if V(Level(i)) { + t.Errorf("V enabled for %d", i) + } + } + V(2).Info("test") + if contents(infoLog) != "" { + t.Error("V logged incorrectly") + } +} + +// vGlobs are patterns that match/don't match this file at V=2. +var vGlobs = map[string]bool{ + // Easy to test the numeric match here. + "glog_test=1": false, // If -vmodule sets V to 1, V(2) will fail. + "glog_test=2": true, + "glog_test=3": true, // If -vmodule sets V to 1, V(3) will succeed. + // These all use 2 and check the patterns. All are true. + "*=2": true, + "?l*=2": true, + "????_*=2": true, + "??[mno]?_*t=2": true, + // These all use 2 and check the patterns. All are false. + "*x=2": false, + "m*=2": false, + "??_*=2": false, + "?[abc]?_*t=2": false, +} + +// Test that vmodule globbing works as advertised. +func testVmoduleGlob(pat string, match bool, t *testing.T) { + setFlags() + defer logging.swap(logging.newBuffers()) + defer logging.vmodule.Set("") + logging.vmodule.Set(pat) + if V(2) != Verbose(match) { + t.Errorf("incorrect match for %q: got %t expected %t", pat, V(2), match) + } +} + +// Test that a vmodule globbing works as advertised. +func TestVmoduleGlob(t *testing.T) { + for glob, match := range vGlobs { + testVmoduleGlob(glob, match, t) + } +} + +func TestRollover(t *testing.T) { + setFlags() + var err error + defer func(previous func(error)) { logExitFunc = previous }(logExitFunc) + logExitFunc = func(e error) { + err = e + } + defer func(previous uint64) { MaxSize = previous }(MaxSize) + MaxSize = 512 + + Info("x") // Be sure we have a file. + info, ok := logging.file[infoLog].(*syncBuffer) + if !ok { + t.Fatal("info wasn't created") + } + if err != nil { + t.Fatalf("info has initial error: %v", err) + } + fname0 := info.file.Name() + Info(strings.Repeat("x", int(MaxSize))) // force a rollover + if err != nil { + t.Fatalf("info has error after big write: %v", err) + } + + // Make sure the next log file gets a file name with a different + // time stamp. + // + // TODO: determine whether we need to support subsecond log + // rotation. C++ does not appear to handle this case (nor does it + // handle Daylight Savings Time properly). + time.Sleep(1 * time.Second) + + Info("x") // create a new file + if err != nil { + t.Fatalf("error after rotation: %v", err) + } + fname1 := info.file.Name() + if fname0 == fname1 { + t.Errorf("info.f.Name did not change: %v", fname0) + } + if info.nbytes >= MaxSize { + t.Errorf("file size was not reset: %d", info.nbytes) + } +} + +func TestLogBacktraceAt(t *testing.T) { + setFlags() + defer logging.swap(logging.newBuffers()) + // The peculiar style of this code simplifies line counting and maintenance of the + // tracing block below. + var infoLine string + setTraceLocation := func(file string, line int, ok bool, delta int) { + if !ok { + t.Fatal("could not get file:line") + } + _, file = filepath.Split(file) + infoLine = fmt.Sprintf("%s:%d", file, line+delta) + err := logging.traceLocation.Set(infoLine) + if err != nil { + t.Fatal("error setting log_backtrace_at: ", err) + } + } + { + // Start of tracing block. These lines know about each other's relative position. + _, file, line, ok := runtime.Caller(0) + setTraceLocation(file, line, ok, +2) // Two lines between Caller and Info calls. + Info("we want a stack trace here") + } + numAppearances := strings.Count(contents(infoLog), infoLine) + if numAppearances < 2 { + // Need 2 appearances, one in the log header and one in the trace: + // log_test.go:281: I0511 16:36:06.952398 02238 log_test.go:280] we want a stack trace here + // ... + // github.com/glog/glog_test.go:280 (0x41ba91) + // ... + // We could be more precise but that would require knowing the details + // of the traceback format, which may not be dependable. + t.Fatal("got no trace back; log is ", contents(infoLog)) + } +} + +func BenchmarkHeader(b *testing.B) { + for i := 0; i < b.N; i++ { + buf, _, _ := logging.header(infoLog, 0) + logging.putBuffer(buf) + } +} diff --git a/vendor/github.com/golang/protobuf/descriptor/descriptor.go b/vendor/github.com/golang/protobuf/descriptor/descriptor.go index ac7e51b..83607ff 100644 --- a/vendor/github.com/golang/protobuf/descriptor/descriptor.go +++ b/vendor/github.com/golang/protobuf/descriptor/descriptor.go @@ -43,7 +43,7 @@ import ( "io/ioutil" "github.com/golang/protobuf/proto" - protobuf "github.com/golang/protobuf/protoc-gen-go/descriptor" + protobuf "google.golang.org/genproto/protobuf" ) // extractFile extracts a FileDescriptorProto from a gzip'd buffer. diff --git a/vendor/github.com/golang/protobuf/descriptor/descriptor_test.go b/vendor/github.com/golang/protobuf/descriptor/descriptor_test.go index 27b0729..282a1e3 100644 --- a/vendor/github.com/golang/protobuf/descriptor/descriptor_test.go +++ b/vendor/github.com/golang/protobuf/descriptor/descriptor_test.go @@ -6,7 +6,7 @@ import ( "github.com/golang/protobuf/descriptor" tpb "github.com/golang/protobuf/proto/testdata" - protobuf "github.com/golang/protobuf/protoc-gen-go/descriptor" + protobuf "google.golang.org/genproto/protobuf" ) func TestMessage(t *testing.T) { diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/Makefile b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/Makefile index a0bf9fe..b1ac45c 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/Makefile +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/Makefile @@ -45,9 +45,9 @@ my_test/test.pb.go: my_test/test.proto golden: make -B my_test/test.pb.go - sed -i -e '/return.*fileDescriptor/d' my_test/test.pb.go - sed -i -e '/^var fileDescriptor/,/^}/d' my_test/test.pb.go - sed -i -e '/proto.RegisterFile.*fileDescriptor/d' my_test/test.pb.go + sed -i '/return.*fileDescriptor/d' my_test/test.pb.go + sed -i '/^var fileDescriptor/,/^}/d' my_test/test.pb.go + sed -i '/proto.RegisterFile.*fileDescriptor/d' my_test/test.pb.go gofmt -w my_test/test.pb.go diff -w my_test/test.pb.go my_test/test.pb.go.golden diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go index d8717d5..9ec3e12 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go @@ -319,7 +319,7 @@ func (m *Reply) GetCompactKeys() []int32 { type Reply_Entry struct { KeyThatNeeds_1234Camel_CasIng *int64 `protobuf:"varint,1,req,name=key_that_needs_1234camel_CasIng,json=keyThatNeeds1234camelCasIng" json:"key_that_needs_1234camel_CasIng,omitempty"` Value *int64 `protobuf:"varint,2,opt,name=value,def=7" json:"value,omitempty"` - XMyFieldName_2 *int64 `protobuf:"varint,3,opt,name=_my_field_name_2,json=MyFieldName2" json:"_my_field_name_2,omitempty"` + XMyFieldName_2 *int64 `protobuf:"varint,3,opt,name=_my_field_name_2,json=myFieldName2" json:"_my_field_name_2,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -389,7 +389,6 @@ var E_ReplyExtensions_Time = &proto.ExtensionDesc{ Field: 101, Name: "my.test.ReplyExtensions.time", Tag: "fixed64,101,opt,name=time", - Filename: "my_test/test.proto", } var E_ReplyExtensions_Carrot = &proto.ExtensionDesc{ @@ -398,7 +397,6 @@ var E_ReplyExtensions_Carrot = &proto.ExtensionDesc{ Field: 105, Name: "my.test.ReplyExtensions.carrot", Tag: "bytes,105,opt,name=carrot", - Filename: "my_test/test.proto", } var E_ReplyExtensions_Donut = &proto.ExtensionDesc{ @@ -407,7 +405,6 @@ var E_ReplyExtensions_Donut = &proto.ExtensionDesc{ Field: 101, Name: "my.test.ReplyExtensions.donut", Tag: "bytes,101,opt,name=donut", - Filename: "my_test/test.proto", } type OtherReplyExtensions struct { @@ -835,7 +832,6 @@ var E_Tag = &proto.ExtensionDesc{ Field: 103, Name: "my.test.tag", Tag: "bytes,103,opt,name=tag", - Filename: "my_test/test.proto", } var E_Donut = &proto.ExtensionDesc{ @@ -844,7 +840,6 @@ var E_Donut = &proto.ExtensionDesc{ Field: 106, Name: "my.test.donut", Tag: "bytes,106,opt,name=donut", - Filename: "my_test/test.proto", } func init() { diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go.golden b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go.golden index d8717d5..9ec3e12 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go.golden +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go.golden @@ -319,7 +319,7 @@ func (m *Reply) GetCompactKeys() []int32 { type Reply_Entry struct { KeyThatNeeds_1234Camel_CasIng *int64 `protobuf:"varint,1,req,name=key_that_needs_1234camel_CasIng,json=keyThatNeeds1234camelCasIng" json:"key_that_needs_1234camel_CasIng,omitempty"` Value *int64 `protobuf:"varint,2,opt,name=value,def=7" json:"value,omitempty"` - XMyFieldName_2 *int64 `protobuf:"varint,3,opt,name=_my_field_name_2,json=MyFieldName2" json:"_my_field_name_2,omitempty"` + XMyFieldName_2 *int64 `protobuf:"varint,3,opt,name=_my_field_name_2,json=myFieldName2" json:"_my_field_name_2,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -389,7 +389,6 @@ var E_ReplyExtensions_Time = &proto.ExtensionDesc{ Field: 101, Name: "my.test.ReplyExtensions.time", Tag: "fixed64,101,opt,name=time", - Filename: "my_test/test.proto", } var E_ReplyExtensions_Carrot = &proto.ExtensionDesc{ @@ -398,7 +397,6 @@ var E_ReplyExtensions_Carrot = &proto.ExtensionDesc{ Field: 105, Name: "my.test.ReplyExtensions.carrot", Tag: "bytes,105,opt,name=carrot", - Filename: "my_test/test.proto", } var E_ReplyExtensions_Donut = &proto.ExtensionDesc{ @@ -407,7 +405,6 @@ var E_ReplyExtensions_Donut = &proto.ExtensionDesc{ Field: 101, Name: "my.test.ReplyExtensions.donut", Tag: "bytes,101,opt,name=donut", - Filename: "my_test/test.proto", } type OtherReplyExtensions struct { @@ -835,7 +832,6 @@ var E_Tag = &proto.ExtensionDesc{ Field: 103, Name: "my.test.tag", Tag: "bytes,103,opt,name=tag", - Filename: "my_test/test.proto", } var E_Donut = &proto.ExtensionDesc{ @@ -844,7 +840,6 @@ var E_Donut = &proto.ExtensionDesc{ Field: 106, Name: "my.test.donut", Tag: "bytes,106,opt,name=donut", - Filename: "my_test/test.proto", } func init() { diff --git a/vendor/github.com/gorilla/handlers/README.md b/vendor/github.com/gorilla/handlers/README.md index 4a6895d..a782c41 100644 --- a/vendor/github.com/gorilla/handlers/README.md +++ b/vendor/github.com/gorilla/handlers/README.md @@ -1,8 +1,6 @@ gorilla/handlers ================ [![GoDoc](https://godoc.org/github.com/gorilla/handlers?status.svg)](https://godoc.org/github.com/gorilla/handlers) [![Build Status](https://travis-ci.org/gorilla/handlers.svg?branch=master)](https://travis-ci.org/gorilla/handlers) -[![Sourcegraph](https://sourcegraph.com/github.com/gorilla/handlers/-/badge.svg)](https://sourcegraph.com/github.com/gorilla/handlers?badge) - Package handlers is a collection of handlers (aka "HTTP middleware") for use with Go's `net/http` package (or any framework supporting `http.Handler`), including: diff --git a/vendor/github.com/gorilla/handlers/handlers.go b/vendor/github.com/gorilla/handlers/handlers.go index 551f8ff..9544d2f 100644 --- a/vendor/github.com/gorilla/handlers/handlers.go +++ b/vendor/github.com/gorilla/handlers/handlers.go @@ -94,7 +94,7 @@ func makeLogger(w http.ResponseWriter) loggingResponseWriter { return logger } -type commonLoggingResponseWriter interface { +type loggingResponseWriter interface { http.ResponseWriter http.Flusher Status() int diff --git a/vendor/github.com/gorilla/handlers/handlers_go18.go b/vendor/github.com/gorilla/handlers/handlers_go18.go deleted file mode 100644 index 35eb8d4..0000000 --- a/vendor/github.com/gorilla/handlers/handlers_go18.go +++ /dev/null @@ -1,21 +0,0 @@ -// +build go1.8 - -package handlers - -import ( - "fmt" - "net/http" -) - -type loggingResponseWriter interface { - commonLoggingResponseWriter - http.Pusher -} - -func (l *responseLogger) Push(target string, opts *http.PushOptions) error { - p, ok := l.w.(http.Pusher) - if !ok { - return fmt.Errorf("responseLogger does not implement http.Pusher") - } - return p.Push(target, opts) -} diff --git a/vendor/github.com/gorilla/handlers/handlers_go18_test.go b/vendor/github.com/gorilla/handlers/handlers_go18_test.go deleted file mode 100644 index c8cfa72..0000000 --- a/vendor/github.com/gorilla/handlers/handlers_go18_test.go +++ /dev/null @@ -1,34 +0,0 @@ -// +build go1.8 - -package handlers - -import ( - "io/ioutil" - "net/http" - "net/http/httptest" - "testing" -) - -func TestLoggingHandlerWithPush(t *testing.T) { - handler := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - if _, ok := w.(http.Pusher); !ok { - t.Fatalf("%T from LoggingHandler does not satisfy http.Pusher interface when built with Go >=1.8", w) - } - w.WriteHeader(200) - }) - - logger := LoggingHandler(ioutil.Discard, handler) - logger.ServeHTTP(httptest.NewRecorder(), newRequest("GET", "/")) -} - -func TestCombinedLoggingHandlerWithPush(t *testing.T) { - handler := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - if _, ok := w.(http.Pusher); !ok { - t.Fatalf("%T from CombinedLoggingHandler does not satisfy http.Pusher interface when built with Go >=1.8", w) - } - w.WriteHeader(200) - }) - - logger := CombinedLoggingHandler(ioutil.Discard, handler) - logger.ServeHTTP(httptest.NewRecorder(), newRequest("GET", "/")) -} diff --git a/vendor/github.com/gorilla/handlers/handlers_pre18.go b/vendor/github.com/gorilla/handlers/handlers_pre18.go deleted file mode 100644 index 197836a..0000000 --- a/vendor/github.com/gorilla/handlers/handlers_pre18.go +++ /dev/null @@ -1,7 +0,0 @@ -// +build !go1.8 - -package handlers - -type loggingResponseWriter interface { - commonLoggingResponseWriter -} diff --git a/vendor/github.com/gorilla/handlers/recovery.go b/vendor/github.com/gorilla/handlers/recovery.go index b1be9dc..65b7de5 100644 --- a/vendor/github.com/gorilla/handlers/recovery.go +++ b/vendor/github.com/gorilla/handlers/recovery.go @@ -6,14 +6,9 @@ import ( "runtime/debug" ) -// RecoveryHandlerLogger is an interface used by the recovering handler to print logs. -type RecoveryHandlerLogger interface { - Println(...interface{}) -} - type recoveryHandler struct { handler http.Handler - logger RecoveryHandlerLogger + logger *log.Logger printStack bool } @@ -51,7 +46,7 @@ func RecoveryHandler(opts ...RecoveryOption) func(h http.Handler) http.Handler { // RecoveryLogger is a functional option to override // the default logger -func RecoveryLogger(logger RecoveryHandlerLogger) RecoveryOption { +func RecoveryLogger(logger *log.Logger) RecoveryOption { return func(h http.Handler) { r := h.(*recoveryHandler) r.logger = logger @@ -78,11 +73,11 @@ func (h recoveryHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { h.handler.ServeHTTP(w, req) } -func (h recoveryHandler) log(v ...interface{}) { +func (h recoveryHandler) log(message interface{}) { if h.logger != nil { - h.logger.Println(v...) + h.logger.Println(message) } else { - log.Println(v...) + log.Println(message) } if h.printStack { diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/.gitignore b/vendor/github.com/grpc-ecosystem/grpc-gateway/.gitignore new file mode 100644 index 0000000..88ddcdf --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/.gitignore @@ -0,0 +1 @@ +_output/ diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/.travis.yml b/vendor/github.com/grpc-ecosystem/grpc-gateway/.travis.yml new file mode 100644 index 0000000..c1113a5 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/.travis.yml @@ -0,0 +1,36 @@ +language: go +sudo: false +go: +- 1.8.x +- 1.7.x +- tip +go_import_path: github.com/grpc-ecosystem/grpc-gateway +cache: + directories: + - $HOME/local + - ${TRAVIS_BUILD_DIR}/examples/browser/node_modules +before_install: +- ./.travis/install-protoc.sh 3.1.0 +- ./.travis/install-swagger-codegen.sh 2.1.6 +- nvm install v6.1 && nvm use v6.1 && node --version +- go get github.com/golang/lint/golint +- go get github.com/dghubble/sling +install: +- go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway +- go get github.com/grpc-ecosystem/grpc-gateway/runtime +- go get github.com/grpc-ecosystem/grpc-gateway/examples +- go get github.com/grpc-ecosystem/grpc-gateway/examples/server +before_script: +- sh -c 'cd examples/browser && npm install' +script: +- make realclean && make examples SWAGGER_CODEGEN="java -jar $HOME/local/swagger-codegen-cli.jar" +- if (go version | grep -q 1.8) && [ -z "${GATEWAY_PLUGIN_FLAGS}" ]; then test -z "$(git status --porcelain)" || (git status; git diff; exit 1); fi +- env GLOG_logtostderr=1 go test -race -v github.com/grpc-ecosystem/grpc-gateway/... +- make lint +- sh -c 'cd examples/browser && gulp' +env: + global: + - "PATH=$PATH:$HOME/local/bin" + matrix: + - GATEWAY_PLUGIN_FLAGS= + - GATEWAY_PLUGIN_FLAGS=request_context=true diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/.travis/install-protoc.sh b/vendor/github.com/grpc-ecosystem/grpc-gateway/.travis/install-protoc.sh new file mode 100755 index 0000000..d96c259 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/.travis/install-protoc.sh @@ -0,0 +1,19 @@ +#!/bin/sh -eu +protoc_version=$1 +if test -z "${protoc_version}"; then + echo "Usage: .travis/install-protoc.sh protoc-version" + exit 1 +fi +if [ "`$HOME/local/bin/protoc-${protoc_version} --version 2>/dev/null | cut -d' ' -f 2`" != ${protoc_version} ]; then + rm -rf $HOME/local/bin $HOME/local/include + + mkdir -p $HOME/tmp $HOME/local + cd $HOME/tmp + wget https://github.com/google/protobuf/releases/download/v${protoc_version}/protoc-${protoc_version}-linux-x86_64.zip + unzip protoc-${protoc_version}-linux-x86_64.zip + mv bin $HOME/local/bin + mv include $HOME/local/include +fi + +echo \$ $HOME/local/bin/protoc --version +$HOME/local/bin/protoc --version diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/.travis/install-swagger-codegen.sh b/vendor/github.com/grpc-ecosystem/grpc-gateway/.travis/install-swagger-codegen.sh new file mode 100755 index 0000000..ad4c8b5 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/.travis/install-swagger-codegen.sh @@ -0,0 +1,9 @@ +#!/bin/sh -eu +codegen_version=$1 +if test -z "${codegen_version}"; then + echo "Usage: .travis/install-swagger-codegen.sh codegen-version" + exit 1 +fi + +wget http://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/${codegen_version}/swagger-codegen-cli-${codegen_version}.jar \ + -O $HOME/local/swagger-codegen-cli.jar diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/CHANGELOG.md b/vendor/github.com/grpc-ecosystem/grpc-gateway/CHANGELOG.md new file mode 100644 index 0000000..3d613fe --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/CHANGELOG.md @@ -0,0 +1,169 @@ +# Change Log + +## [v1.2.2](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.2.2) (2017-04-17) +**Merged pull requests:** + +- metadata: fix properly and change to Outgoing [\#361](https://github.com/grpc-ecosystem/grpc-gateway/pull/361) + +## [v1.2.1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.2.1) (2017-04-17) +**Merged pull requests:** + +- Add changelog for 1.2.1 [\#360](https://github.com/grpc-ecosystem/grpc-gateway/pull/360) +- bugfix: reflect upstream api change. [\#359](https://github.com/grpc-ecosystem/grpc-gateway/pull/359) + +## [v1.2.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.2.0) (2017-03-31) +**Merged pull requests:** + +- Add changelog for 1.2.0 [\#342](https://github.com/grpc-ecosystem/grpc-gateway/pull/342) + +## [v1.2.0.rc1](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.2.0.rc1) (2017-03-24) +**Merged pull requests:** + +- Update go\_out parameter to remove comma [\#333](https://github.com/grpc-ecosystem/grpc-gateway/pull/333) +- Update stale path in README [\#332](https://github.com/grpc-ecosystem/grpc-gateway/pull/332) +- improve documentation regarding external dependencies [\#330](https://github.com/grpc-ecosystem/grpc-gateway/pull/330) +- Return an error on invalid nested query parameters. [\#329](https://github.com/grpc-ecosystem/grpc-gateway/pull/329) +- Update upstream proto files and add google.golang.org/genproto support. [\#325](https://github.com/grpc-ecosystem/grpc-gateway/pull/325) +- Support oneof fields in query params [\#321](https://github.com/grpc-ecosystem/grpc-gateway/pull/321) +- Do not ignore the error coming from http.ListenAndServe in examples [\#319](https://github.com/grpc-ecosystem/grpc-gateway/pull/319) +- Look up enum value maps by their proto name [\#315](https://github.com/grpc-ecosystem/grpc-gateway/pull/315) +- enable parsing enums from query parameters [\#314](https://github.com/grpc-ecosystem/grpc-gateway/pull/314) +- Do not add imports from methods with no bindings. [\#312](https://github.com/grpc-ecosystem/grpc-gateway/pull/312) +- Convert the first letter of method name to upper [\#300](https://github.com/grpc-ecosystem/grpc-gateway/pull/300) +- write query parameters to swagger definition [\#297](https://github.com/grpc-ecosystem/grpc-gateway/pull/297) +- Bump swagger-client to 2.1.28 for examples/browser [\#290](https://github.com/grpc-ecosystem/grpc-gateway/pull/290) +- pin to version before es6ism [\#289](https://github.com/grpc-ecosystem/grpc-gateway/pull/289) +- Prevent lack of http bindings from generating non-building output [\#286](https://github.com/grpc-ecosystem/grpc-gateway/pull/286) +- Added support for Timestamp in URL. [\#281](https://github.com/grpc-ecosystem/grpc-gateway/pull/281) +- add plugin param 'allow\_delete\_body' [\#280](https://github.com/grpc-ecosystem/grpc-gateway/pull/280) +- Fix ruby gen command [\#275](https://github.com/grpc-ecosystem/grpc-gateway/pull/275) +- Make grpc-gateway support enum fields in path parameter [\#273](https://github.com/grpc-ecosystem/grpc-gateway/pull/273) +- remove unnecessary make\(\) [\#271](https://github.com/grpc-ecosystem/grpc-gateway/pull/271) +- preserve field order in swagger spec [\#270](https://github.com/grpc-ecosystem/grpc-gateway/pull/270) +- Merge \#228 [\#268](https://github.com/grpc-ecosystem/grpc-gateway/pull/268) +- Handle methods with no bindings more carefully [\#267](https://github.com/grpc-ecosystem/grpc-gateway/pull/267) +- describe default marshaler in README.md [\#266](https://github.com/grpc-ecosystem/grpc-gateway/pull/266) +- Add request\_context flag to utilize \(\*http.Request\).Context\(\) in handlers [\#265](https://github.com/grpc-ecosystem/grpc-gateway/pull/265) +- Regenerate examples [\#264](https://github.com/grpc-ecosystem/grpc-gateway/pull/264) +- Correct runtime.errorBody protobuf field tag [\#256](https://github.com/grpc-ecosystem/grpc-gateway/pull/256) +- Pass permanent HTTP request headers [\#252](https://github.com/grpc-ecosystem/grpc-gateway/pull/252) +- regenerate examples, fix tests for go tip [\#248](https://github.com/grpc-ecosystem/grpc-gateway/pull/248) +- Render the swagger request body properly [\#247](https://github.com/grpc-ecosystem/grpc-gateway/pull/247) +- Error output should have lowercase attribute names [\#244](https://github.com/grpc-ecosystem/grpc-gateway/pull/244) +- runtime - export prefix constants [\#236](https://github.com/grpc-ecosystem/grpc-gateway/pull/236) +- README - Add CoreOS example [\#231](https://github.com/grpc-ecosystem/grpc-gateway/pull/231) +- Docs - Add section about how HTTP maps to gRPC [\#227](https://github.com/grpc-ecosystem/grpc-gateway/pull/227) +- readme: added links to additional documentation [\#222](https://github.com/grpc-ecosystem/grpc-gateway/pull/222) +- Use a released version of protoc [\#216](https://github.com/grpc-ecosystem/grpc-gateway/pull/216) +- Add contribution guideline [\#210](https://github.com/grpc-ecosystem/grpc-gateway/pull/210) +- improve\(genswagger:template\):added support for google.protobuf.Timestamp [\#209](https://github.com/grpc-ecosystem/grpc-gateway/pull/209) +- Allowing unknown fields to be dropped instead of returning error from… [\#208](https://github.com/grpc-ecosystem/grpc-gateway/pull/208) +- Avoid Internal Server Error on zero-length input for bidi streaming [\#200](https://github.com/grpc-ecosystem/grpc-gateway/pull/200) + +## [v1.1.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.1.0) (2016-07-23) +**Merged pull requests:** + +- Rename packages to follow the repository transfer [\#192](https://github.com/grpc-ecosystem/grpc-gateway/pull/192) +- return err early if EOF to prevent logging in normal conditions [\#191](https://github.com/grpc-ecosystem/grpc-gateway/pull/191) +- send Trailer header on error [\#188](https://github.com/grpc-ecosystem/grpc-gateway/pull/188) +- generate swagger output for streaming endpoints with a basic note [\#183](https://github.com/grpc-ecosystem/grpc-gateway/pull/183) + +## [v1.0.0](https://github.com/grpc-ecosystem/grpc-gateway/tree/v1.0.0) (2016-06-15) +**Merged pull requests:** + +- Regenerate files with the latest protoc-gen-go [\#185](https://github.com/grpc-ecosystem/grpc-gateway/pull/185) +- Add browser examples [\#184](https://github.com/grpc-ecosystem/grpc-gateway/pull/184) +- Fix golint and go vet errors [\#182](https://github.com/grpc-ecosystem/grpc-gateway/pull/182) +- Add integration with clients generated by swagger-codegen [\#181](https://github.com/grpc-ecosystem/grpc-gateway/pull/181) +- Simplify example services [\#180](https://github.com/grpc-ecosystem/grpc-gateway/pull/180) +- Avoid errors when req.RemoteAddr is empty [\#178](https://github.com/grpc-ecosystem/grpc-gateway/pull/178) +- Feature/headers [\#176](https://github.com/grpc-ecosystem/grpc-gateway/pull/176) +- Include HTTP req.remoteAddr in gRPC ctx [\#174](https://github.com/grpc-ecosystem/grpc-gateway/pull/174) +- Update dependencies [\#171](https://github.com/grpc-ecosystem/grpc-gateway/pull/171) +- Add bidirectional streaming support by running Send\(\) and Recv\(\) concurrently [\#170](https://github.com/grpc-ecosystem/grpc-gateway/pull/170) +- make Authorization header check case-insensitive to comply with RFC 2616 4.2 [\#164](https://github.com/grpc-ecosystem/grpc-gateway/pull/164) +- jsonpb: avoid duplicating upstream's struct [\#158](https://github.com/grpc-ecosystem/grpc-gateway/pull/158) +- Generate Swagger description for service methods using proto comments. [\#156](https://github.com/grpc-ecosystem/grpc-gateway/pull/156) +- Implement gRPC timeout support for inbound HTTP headers [\#155](https://github.com/grpc-ecosystem/grpc-gateway/pull/155) +- Add more examples to marshalers [\#154](https://github.com/grpc-ecosystem/grpc-gateway/pull/154) +- custom marshaler: handle `Accept` headers correctly [\#152](https://github.com/grpc-ecosystem/grpc-gateway/pull/152) +- Simplify custom marshaler API [\#151](https://github.com/grpc-ecosystem/grpc-gateway/pull/151) +- Fix camel case path parameter handling in swagger [\#149](https://github.com/grpc-ecosystem/grpc-gateway/pull/149) +- Swagger dot in path template [\#148](https://github.com/grpc-ecosystem/grpc-gateway/pull/148) +- Support map types in swagger generator [\#147](https://github.com/grpc-ecosystem/grpc-gateway/pull/147) +- Cleanup custom marshaler [\#146](https://github.com/grpc-ecosystem/grpc-gateway/pull/146) +- Implement custom Marshaler support, add jsonpb implemention. [\#144](https://github.com/grpc-ecosystem/grpc-gateway/pull/144) +- Allow period in path URL templates when generating Swagger templates. [\#143](https://github.com/grpc-ecosystem/grpc-gateway/pull/143) +- Link to LICENSE.txt [\#142](https://github.com/grpc-ecosystem/grpc-gateway/pull/142) +- Support map types in swagger generator [\#141](https://github.com/grpc-ecosystem/grpc-gateway/pull/141) +- Conditionally stops checking if generated file are up-to-date [\#136](https://github.com/grpc-ecosystem/grpc-gateway/pull/136) +- Generate Swagger description for service methods using proto comments. [\#134](https://github.com/grpc-ecosystem/grpc-gateway/pull/134) +- Swagger definitions now have `type` set to `object`. [\#133](https://github.com/grpc-ecosystem/grpc-gateway/pull/133) +- go\_package option as go import path [\#129](https://github.com/grpc-ecosystem/grpc-gateway/pull/129) +- Fix govet errors [\#126](https://github.com/grpc-ecosystem/grpc-gateway/pull/126) +- Fix data-race in generated codes [\#125](https://github.com/grpc-ecosystem/grpc-gateway/pull/125) +- Fix \#119 - CloseNotify race with ServeHTTP [\#120](https://github.com/grpc-ecosystem/grpc-gateway/pull/120) +- Replace glog with grpclog [\#118](https://github.com/grpc-ecosystem/grpc-gateway/pull/118) +- Fix a goroutine-leak in HTTP keep-alive [\#116](https://github.com/grpc-ecosystem/grpc-gateway/pull/116) +- Fix camel case path parameter handling in swagger [\#114](https://github.com/grpc-ecosystem/grpc-gateway/pull/114) +- gofmt -s [\#112](https://github.com/grpc-ecosystem/grpc-gateway/pull/112) +- fix typo [\#111](https://github.com/grpc-ecosystem/grpc-gateway/pull/111) +- fix typo [\#110](https://github.com/grpc-ecosystem/grpc-gateway/pull/110) +- fixes missing swagger operation objects [\#109](https://github.com/grpc-ecosystem/grpc-gateway/pull/109) +- Add parser and swagger support for enum, no gengateway yet [\#108](https://github.com/grpc-ecosystem/grpc-gateway/pull/108) +- README: add protoc-gen-swagger too [\#105](https://github.com/grpc-ecosystem/grpc-gateway/pull/105) +- README: Suggest go get -u by default. [\#104](https://github.com/grpc-ecosystem/grpc-gateway/pull/104) +- Cancel context when HTTP connection is closed [\#102](https://github.com/grpc-ecosystem/grpc-gateway/pull/102) +- wait test server up [\#100](https://github.com/grpc-ecosystem/grpc-gateway/pull/100) +- Fix the swagger section of the README.md [\#98](https://github.com/grpc-ecosystem/grpc-gateway/pull/98) +- Add documentation for using Swagger [\#97](https://github.com/grpc-ecosystem/grpc-gateway/pull/97) +- Better compatibility to field names generated by protoc-gen-go [\#96](https://github.com/grpc-ecosystem/grpc-gateway/pull/96) +- Update protoc from 3.0.0-beta1 to 3.0.0-beta2 [\#95](https://github.com/grpc-ecosystem/grpc-gateway/pull/95) +- Better grpc error strings [\#94](https://github.com/grpc-ecosystem/grpc-gateway/pull/94) +- make available header and trailer metadata [\#93](https://github.com/grpc-ecosystem/grpc-gateway/pull/93) +- make grpc.DialOption configurable [\#89](https://github.com/grpc-ecosystem/grpc-gateway/pull/89) +- Add request in error handlers [\#88](https://github.com/grpc-ecosystem/grpc-gateway/pull/88) +- Improve PascalFromSnake behavior [\#85](https://github.com/grpc-ecosystem/grpc-gateway/pull/85) +- Typo grcp -\> grpc [\#81](https://github.com/grpc-ecosystem/grpc-gateway/pull/81) +- Add abstraction of code generator implementation [\#78](https://github.com/grpc-ecosystem/grpc-gateway/pull/78) +- Support multivalue of metadata [\#77](https://github.com/grpc-ecosystem/grpc-gateway/pull/77) +- Fix broken test [\#76](https://github.com/grpc-ecosystem/grpc-gateway/pull/76) +- Added missing instruction line in README [\#75](https://github.com/grpc-ecosystem/grpc-gateway/pull/75) +- Fix a complie error in generated go files [\#71](https://github.com/grpc-ecosystem/grpc-gateway/pull/71) +- Update generated .pb.go files in third\_party [\#69](https://github.com/grpc-ecosystem/grpc-gateway/pull/69) +- Add swagger support [\#68](https://github.com/grpc-ecosystem/grpc-gateway/pull/68) +- Bugfix/handling headers for `Authorization` and `Host` [\#65](https://github.com/grpc-ecosystem/grpc-gateway/pull/65) +- Fix `error` field always in chunk response [\#64](https://github.com/grpc-ecosystem/grpc-gateway/pull/64) +- Update .pb.go to latest version. [\#63](https://github.com/grpc-ecosystem/grpc-gateway/pull/63) +- Run more tests in Travis CI [\#60](https://github.com/grpc-ecosystem/grpc-gateway/pull/60) +- Added http error code and error status for responseStreamChunk error [\#59](https://github.com/grpc-ecosystem/grpc-gateway/pull/59) +- Fix parsing of verb and final path component. [\#55](https://github.com/grpc-ecosystem/grpc-gateway/pull/55) +- Add runtime.WithForwardResponseOption [\#53](https://github.com/grpc-ecosystem/grpc-gateway/pull/53) +- add grpc.WithInsecure\(\) as option for grpc.Dial call in template [\#52](https://github.com/grpc-ecosystem/grpc-gateway/pull/52) +- update .pb.go files for latest golang proto generation [\#51](https://github.com/grpc-ecosystem/grpc-gateway/pull/51) +- Fix a build error with the latest protoc-gen-go [\#50](https://github.com/grpc-ecosystem/grpc-gateway/pull/50) +- Configure Travis CI [\#49](https://github.com/grpc-ecosystem/grpc-gateway/pull/49) +- Follow a change of go package name convention in protoc-gen-go [\#48](https://github.com/grpc-ecosystem/grpc-gateway/pull/48) +- Consider tail segments after deep wildcard [\#47](https://github.com/grpc-ecosystem/grpc-gateway/pull/47) +- Fix typo in README [\#45](https://github.com/grpc-ecosystem/grpc-gateway/pull/45) +- Fix undefined variable error in generated codes [\#42](https://github.com/grpc-ecosystem/grpc-gateway/pull/42) +- Follow changes in protoc-gen-go and grpc-go [\#41](https://github.com/grpc-ecosystem/grpc-gateway/pull/41) +- Fixes \#4 [\#40](https://github.com/grpc-ecosystem/grpc-gateway/pull/40) +- fix examples to work with go1.5 [\#39](https://github.com/grpc-ecosystem/grpc-gateway/pull/39) +- rename internal to utilties for 1.5 compatibility [\#38](https://github.com/grpc-ecosystem/grpc-gateway/pull/38) +- Reflection fix of proto3 nested messages. [\#34](https://github.com/grpc-ecosystem/grpc-gateway/pull/34) +- \[Experimental\] Make the response forwarder function customizable [\#31](https://github.com/grpc-ecosystem/grpc-gateway/pull/31) +- Add f.Flush\(\) to runtime.ForwardResponseStream [\#30](https://github.com/grpc-ecosystem/grpc-gateway/pull/30) +- Format error message in JSON [\#29](https://github.com/grpc-ecosystem/grpc-gateway/pull/29) +- Update examples with HTTP header context annotation [\#28](https://github.com/grpc-ecosystem/grpc-gateway/pull/28) +- Report semantic errors in the source to protoc [\#27](https://github.com/grpc-ecosystem/grpc-gateway/pull/27) +- Add support for non-nullable nested messages. [\#21](https://github.com/grpc-ecosystem/grpc-gateway/pull/21) +- Receive GRPC metadata from HTTP headers. [\#18](https://github.com/grpc-ecosystem/grpc-gateway/pull/18) +- Implement detailed specs of google.api.http [\#14](https://github.com/grpc-ecosystem/grpc-gateway/pull/14) +- Configure travis CI [\#13](https://github.com/grpc-ecosystem/grpc-gateway/pull/13) +- Replace our own custom option with the one defined by Google [\#12](https://github.com/grpc-ecosystem/grpc-gateway/pull/12) +- Remove useless context setup [\#11](https://github.com/grpc-ecosystem/grpc-gateway/pull/11) +- Fix typo, path, missing semicolon. [\#10](https://github.com/grpc-ecosystem/grpc-gateway/pull/10) +- Use a globally unique id for the custom option [\#3](https://github.com/grpc-ecosystem/grpc-gateway/pull/3) +- implement ABitOfEverythingService [\#2](https://github.com/grpc-ecosystem/grpc-gateway/pull/2) +- support streaming API calls [\#1](https://github.com/grpc-ecosystem/grpc-gateway/pull/1) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/CONTRIBUTING.md b/vendor/github.com/grpc-ecosystem/grpc-gateway/CONTRIBUTING.md new file mode 100644 index 0000000..94983bc --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/CONTRIBUTING.md @@ -0,0 +1,20 @@ +# How to contribute + +Thank you for your contribution to grpc-gateway. +Here's the recommended process of contribution. + +1. `go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway` +2. `cd $GOPATH/src/github.com/grpc-ecosystem/grpc-gateway` +3. hack, hack, hack... +4. Make sure that your change follows best practices in Go + * [Effective Go](https://golang.org/doc/effective_go.html) + * [Go Code Review Comments](https://golang.org/wiki/CodeReviewComments) +5. Make sure that `make test` passes. (use swagger-codegen 2.1.6, not newer versions) +6. Sign [a Contributor License Agreement](https://cla.developers.google.com/clas) +7. Open a pull request in Github + +When you work on a larger contribution, it is also recommended that you get in touch +with us through the issue tracker. + +### Code reviews +All submissions, including submissions by project members, require review. diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/LICENSE.txt b/vendor/github.com/grpc-ecosystem/grpc-gateway/LICENSE.txt new file mode 100644 index 0000000..3645162 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/LICENSE.txt @@ -0,0 +1,27 @@ +Copyright (c) 2015, Gengo, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Gengo, Inc. nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/Makefile b/vendor/github.com/grpc-ecosystem/grpc-gateway/Makefile new file mode 100644 index 0000000..accde98 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/Makefile @@ -0,0 +1,143 @@ +# This is a Makefile which maintains files automatically generated but to be +# shipped together with other files. +# You don't have to rebuild these targets by yourself unless you develop +# grpc-gateway itself. + +PKG=github.com/grpc-ecosystem/grpc-gateway +GO_PLUGIN=bin/protoc-gen-go +GO_PLUGIN_PKG=github.com/golang/protobuf/protoc-gen-go +SWAGGER_PLUGIN=bin/protoc-gen-swagger +SWAGGER_PLUGIN_SRC= utilities/doc.go \ + utilities/pattern.go \ + utilities/trie.go \ + protoc-gen-swagger/genswagger/generator.go \ + protoc-gen-swagger/genswagger/template.go \ + protoc-gen-swagger/main.go +SWAGGER_PLUGIN_PKG=$(PKG)/protoc-gen-swagger +GATEWAY_PLUGIN=bin/protoc-gen-grpc-gateway +GATEWAY_PLUGIN_PKG=$(PKG)/protoc-gen-grpc-gateway +GATEWAY_PLUGIN_SRC= utilities/doc.go \ + utilities/pattern.go \ + utilities/trie.go \ + protoc-gen-grpc-gateway \ + protoc-gen-grpc-gateway/descriptor \ + protoc-gen-grpc-gateway/descriptor/registry.go \ + protoc-gen-grpc-gateway/descriptor/services.go \ + protoc-gen-grpc-gateway/descriptor/types.go \ + protoc-gen-grpc-gateway/generator \ + protoc-gen-grpc-gateway/generator/generator.go \ + protoc-gen-grpc-gateway/gengateway \ + protoc-gen-grpc-gateway/gengateway/doc.go \ + protoc-gen-grpc-gateway/gengateway/generator.go \ + protoc-gen-grpc-gateway/gengateway/template.go \ + protoc-gen-grpc-gateway/httprule \ + protoc-gen-grpc-gateway/httprule/compile.go \ + protoc-gen-grpc-gateway/httprule/parse.go \ + protoc-gen-grpc-gateway/httprule/types.go \ + protoc-gen-grpc-gateway/main.go +GATEWAY_PLUGIN_FLAGS?= + +GOOGLEAPIS_DIR=third_party/googleapis +OUTPUT_DIR=_output + +RUNTIME_PROTO=runtime/internal/stream_chunk.proto +RUNTIME_GO=$(RUNTIME_PROTO:.proto=.pb.go) + +PKGMAP=Mgoogle/protobuf/descriptor.proto=$(GO_PLUGIN_PKG)/descriptor,Mexamples/sub/message.proto=$(PKG)/examples/sub +ADDITIONAL_FLAGS= +ifneq "$(GATEWAY_PLUGIN_FLAGS)" "" + ADDITIONAL_FLAGS=,$(GATEWAY_PLUGIN_FLAGS) +endif +SWAGGER_EXAMPLES=examples/examplepb/echo_service.proto \ + examples/examplepb/a_bit_of_everything.proto +EXAMPLES=examples/examplepb/echo_service.proto \ + examples/examplepb/a_bit_of_everything.proto \ + examples/examplepb/stream.proto \ + examples/examplepb/flow_combination.proto +EXAMPLE_SVCSRCS=$(EXAMPLES:.proto=.pb.go) +EXAMPLE_GWSRCS=$(EXAMPLES:.proto=.pb.gw.go) +EXAMPLE_SWAGGERSRCS=$(EXAMPLES:.proto=.swagger.json) +EXAMPLE_DEPS=examples/sub/message.proto examples/sub2/message.proto +EXAMPLE_DEPSRCS=$(EXAMPLE_DEPS:.proto=.pb.go) + +EXAMPLE_CLIENT_DIR=examples/clients +ECHO_EXAMPLE_SPEC=examples/examplepb/echo_service.swagger.json +ECHO_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/echo/EchoServiceApi.go \ + $(EXAMPLE_CLIENT_DIR)/echo/ExamplepbSimpleMessage.go +ABE_EXAMPLE_SPEC=examples/examplepb/a_bit_of_everything.swagger.json +ABE_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/abe/ABitOfEverythingServiceApi.go \ + $(EXAMPLE_CLIENT_DIR)/abe/ABitOfEverythingNested.go \ + $(EXAMPLE_CLIENT_DIR)/abe/ExamplepbABitOfEverything.go \ + $(EXAMPLE_CLIENT_DIR)/abe/ExamplepbNumericEnum.go \ + $(EXAMPLE_CLIENT_DIR)/abe/ExamplepbIdMessage.go \ + $(EXAMPLE_CLIENT_DIR)/abe/NestedDeepEnum.go \ + $(EXAMPLE_CLIENT_DIR)/abe/ProtobufEmpty.go \ + $(EXAMPLE_CLIENT_DIR)/abe/Sub2IdMessage.go \ + $(EXAMPLE_CLIENT_DIR)/abe/SubStringMessage.go +EXAMPLE_CLIENT_SRCS=$(ECHO_EXAMPLE_SRCS) $(ABE_EXAMPLE_SRCS) +SWAGGER_CODEGEN=swagger-codegen + +PROTOC_INC_PATH=$(dir $(shell which protoc))/../include + +generate: $(RUNTIME_GO) + +.SUFFIXES: .go .proto + +$(GO_PLUGIN): + go get $(GO_PLUGIN_PKG) + go build -o $@ $(GO_PLUGIN_PKG) + +$(RUNTIME_GO): $(RUNTIME_PROTO) $(GO_PLUGIN) + protoc -I $(PROTOC_INC_PATH) --plugin=$(GO_PLUGIN) -I. --go_out=$(PKGMAP):. $(RUNTIME_PROTO) + +$(GATEWAY_PLUGIN): $(RUNTIME_GO) $(GATEWAY_PLUGIN_SRC) + go build -o $@ $(GATEWAY_PLUGIN_PKG) + +$(SWAGGER_PLUGIN): $(SWAGGER_PLUGIN_SRC) + go build -o $@ $(SWAGGER_PLUGIN_PKG) + +$(EXAMPLE_SVCSRCS): $(GO_PLUGIN) $(EXAMPLES) + protoc -I $(PROTOC_INC_PATH) -I. -I$(GOOGLEAPIS_DIR) --plugin=$(GO_PLUGIN) --go_out=$(PKGMAP),plugins=grpc:. $(EXAMPLES) +$(EXAMPLE_DEPSRCS): $(GO_PLUGIN) $(EXAMPLE_DEPS) + mkdir -p $(OUTPUT_DIR) + protoc -I $(PROTOC_INC_PATH) -I. --plugin=$(GO_PLUGIN) --go_out=$(PKGMAP),plugins=grpc:$(OUTPUT_DIR) $(@:.pb.go=.proto) + cp $(OUTPUT_DIR)/$(PKG)/$@ $@ || cp $(OUTPUT_DIR)/$@ $@ +$(EXAMPLE_GWSRCS): $(GATEWAY_PLUGIN) $(EXAMPLES) + protoc -I $(PROTOC_INC_PATH) -I. -I$(GOOGLEAPIS_DIR) --plugin=$(GATEWAY_PLUGIN) --grpc-gateway_out=logtostderr=true,$(PKGMAP)$(ADDITIONAL_FLAGS):. $(EXAMPLES) +$(EXAMPLE_SWAGGERSRCS): $(SWAGGER_PLUGIN) $(SWAGGER_EXAMPLES) + protoc -I $(PROTOC_INC_PATH) -I. -I$(GOOGLEAPIS_DIR) --plugin=$(SWAGGER_PLUGIN) --swagger_out=logtostderr=true,$(PKGMAP):. $(SWAGGER_EXAMPLES) + +$(ECHO_EXAMPLE_SRCS): $(ECHO_EXAMPLE_SPEC) + $(SWAGGER_CODEGEN) generate -i $(ECHO_EXAMPLE_SPEC) \ + -l go -o examples/clients --additional-properties packageName=echo + @rm -f $(EXAMPLE_CLIENT_DIR)/README.md $(EXAMPLE_CLIENT_DIR)/git_push.sh $(EXAMPLE_CLIENT_DIR)/.gitignore +$(ABE_EXAMPLE_SRCS): $(ABE_EXAMPLE_SPEC) + $(SWAGGER_CODEGEN) generate -i $(ABE_EXAMPLE_SPEC) \ + -l go -o examples/clients --additional-properties packageName=abe + @rm -f $(EXAMPLE_CLIENT_DIR)/README.md $(EXAMPLE_CLIENT_DIR)/git_push.sh $(EXAMPLE_CLIENT_DIR)/.gitignore + +examples: $(EXAMPLE_SVCSRCS) $(EXAMPLE_GWSRCS) $(EXAMPLE_DEPSRCS) $(EXAMPLE_SWAGGERSRCS) $(EXAMPLE_CLIENT_SRCS) +test: examples + go test -race $(PKG)/... + +lint: + golint --set_exit_status $(PKG)/runtime + golint --set_exit_status $(PKG)/utilities/... + golint --set_exit_status $(PKG)/protoc-gen-grpc-gateway/... + golint --set_exit_status $(PKG)/protoc-gen-swagger/... + go vet $(PKG)/runtime || true + go vet $(PKG)/utilities/... + go vet $(PKG)/protoc-gen-grpc-gateway/... + go vet $(PKG)/protoc-gen-swagger/... + +clean distclean: + rm -f $(GATEWAY_PLUGIN) +realclean: distclean + rm -f $(EXAMPLE_SVCSRCS) $(EXAMPLE_DEPSRCS) + rm -f $(EXAMPLE_GWSRCS) + rm -f $(EXAMPLE_SWAGGERSRCS) + rm -f $(GO_PLUGIN) + rm -f $(SWAGGER_PLUGIN) + rm -f $(EXAMPLE_CLIENT_SRCS) + +.PHONY: generate examples test lint clean distclean realclean diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/README.md b/vendor/github.com/grpc-ecosystem/grpc-gateway/README.md new file mode 100644 index 0000000..c7396cc --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/README.md @@ -0,0 +1,245 @@ +# grpc-gateway + +[![Build Status](https://travis-ci.org/grpc-ecosystem/grpc-gateway.svg?branch=master)](https://travis-ci.org/grpc-ecosystem/grpc-gateway) + +grpc-gateway is a plugin of [protoc](http://github.com/google/protobuf). +It reads [gRPC](http://github.com/grpc/grpc-common) service definition, +and generates a reverse-proxy server which translates a RESTful JSON API into gRPC. +This server is generated according to [custom options](https://cloud.google.com/service-management/reference/rpc/google.api#http) in your gRPC definition. + +It helps you to provide your APIs in both gRPC and RESTful style at the same time. + +![architecture introduction diagram](https://docs.google.com/drawings/d/12hp4CPqrNPFhattL_cIoJptFvlAqm5wLQ0ggqI5mkCg/pub?w=749&h=370) + +## Background +gRPC is great -- it generates API clients and server stubs in many programming languages, it is fast, easy-to-use, bandwidth-efficient and its design is combat-proven by Google. +However, you might still want to provide a traditional RESTful API as well. Reasons can range from maintaining backwards-compatibility, supporting languages or clients not well supported by gRPC to simply maintaining the aesthetics and tooling involved with a RESTful architecture. + +This project aims to provide that HTTP+JSON interface to your gRPC service. A small amount of configuration in your service to attach HTTP semantics is all that's needed to generate a reverse-proxy with this library. + +## Installation +First you need to install ProtocolBuffers 3.0.0-beta-3 or later. + +```sh +mkdir tmp +cd tmp +git clone https://github.com/google/protobuf +cd protobuf +./autogen.sh +./configure +make +make check +sudo make install +``` + +Then, `go get -u` as usual the following packages: + +```sh +go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway +go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger +go get -u github.com/golang/protobuf/protoc-gen-go +``` + +## Usage +Make sure that your `$GOPATH/bin` is in your `$PATH`. + +1. Define your service in gRPC + + your_service.proto: + ```protobuf + syntax = "proto3"; + package example; + message StringMessage { + string value = 1; + } + + service YourService { + rpc Echo(StringMessage) returns (StringMessage) {} + } + ``` +2. Add a [custom option](https://cloud.google.com/service-management/reference/rpc/google.api#http) to the .proto file + + your_service.proto: + ```diff + syntax = "proto3"; + package example; + + + +import "google/api/annotations.proto"; + + + message StringMessage { + string value = 1; + } + + service YourService { + - rpc Echo(StringMessage) returns (StringMessage) {} + + rpc Echo(StringMessage) returns (StringMessage) { + + option (google.api.http) = { + + post: "/v1/example/echo" + + body: "*" + + }; + + } + } + ``` +3. Generate gRPC stub + + ```sh + protoc -I/usr/local/include -I. \ + -I$GOPATH/src \ + -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ + --go_out=plugins=grpc:. \ + path/to/your_service.proto + ``` + + It will generate a stub file `path/to/your_service.pb.go`. +4. Implement your service in gRPC as usual + 1. (Optional) Generate gRPC stub in the language you want. + + e.g. + ```sh + protoc -I/usr/local/include -I. \ + -I$GOPATH/src \ + -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ + --ruby_out=. \ + path/to/your/service_proto + + protoc -I/usr/local/include -I. \ + -I$GOPATH/src \ + -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ + --plugin=protoc-gen-grpc=grpc_ruby_plugin \ + --grpc-ruby_out=. \ + path/to/your/service.proto + ``` + 2. Add the googleapis-common-protos gem (or your language equivalent) as a dependency to your project. + 3. Implement your service + +5. Generate reverse-proxy + + ```sh + protoc -I/usr/local/include -I. \ + -I$GOPATH/src \ + -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ + --grpc-gateway_out=logtostderr=true:. \ + path/to/your_service.proto + ``` + + It will generate a reverse proxy `path/to/your_service.pb.gw.go`. + + Note: After generating the code for each of the stubs, in order to build the code, you will want to run ```go get .``` from the directory containing the stubs. + +6. Write an entrypoint + + Now you need to write an entrypoint of the proxy server. + ```go + package main + + import ( + "flag" + "net/http" + + "github.com/golang/glog" + "golang.org/x/net/context" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "google.golang.org/grpc" + + gw "path/to/your_service_package" + ) + + var ( + echoEndpoint = flag.String("echo_endpoint", "localhost:9090", "endpoint of YourService") + ) + + func run() error { + ctx := context.Background() + ctx, cancel := context.WithCancel(ctx) + defer cancel() + + mux := runtime.NewServeMux() + opts := []grpc.DialOption{grpc.WithInsecure()} + err := gw.RegisterYourServiceHandlerFromEndpoint(ctx, mux, *echoEndpoint, opts) + if err != nil { + return err + } + + return http.ListenAndServe(":8080", mux) + } + + func main() { + flag.Parse() + defer glog.Flush() + + if err := run(); err != nil { + glog.Fatal(err) + } + } + ``` + +7. (Optional) Generate swagger definitions + + ```sh + protoc -I/usr/local/include -I. \ + -I$GOPATH/src \ + -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ + --swagger_out=logtostderr=true:. \ + path/to/your_service.proto + ``` + +## Parameters and flags +`protoc-gen-grpc-gateway` supports custom mapping from Protobuf `import` to Golang import path. +They are compatible to [the parameters with same names in `protoc-gen-go`](https://github.com/golang/protobuf#parameters). + +In addition we also support the `request_context` parameter in order to use the `http.Request`'s Context (only for Go 1.7 and above). +This parameter can be useful to pass request scoped context between the gateway and the gRPC service. + +`protoc-gen-grpc-gateway` also supports some more command line flags to control logging. You can give these flags together with parameters above. Run `protoc-gen-grpc-gateway --help` for more details about the flags. + +## More Examples +More examples are available under `examples` directory. +* `examplepb/echo_service.proto`, `examplepb/a_bit_of_everything.proto`: service definition + * `examplepb/echo_service.pb.go`, `examplepb/a_bit_of_everything.pb.go`: [generated] stub of the service + * `examplepb/echo_service.pb.gw.go`, `examplepb/a_bit_of_everything.pb.gw.go`: [generated] reverse proxy for the service +* `server/main.go`: service implementation +* `main.go`: entrypoint of the generated reverse proxy + +To use the same port for custom HTTP handlers (e.g. serving `swagger.json`), gRPC-gateway, and a gRPC server, see [this code example by CoreOS](https://github.com/philips/grpc-gateway-example/blob/master/cmd/serve.go) (and its accompanying [blog post](https://coreos.com/blog/gRPC-protobufs-swagger.html)) + +## Features +### Supported +* Generating JSON API handlers +* Method parameters in request body +* Method parameters in request path +* Method parameters in query string +* Enum fields in path parameter (including repeated enum fields). +* Mapping streaming APIs to newline-delimited JSON streams +* Mapping HTTP headers with `Grpc-Metadata-` prefix to gRPC metadata (prefixed with `grpcgateway-`) +* Optionally emitting API definition for [Swagger](http://swagger.io). +* Setting [gRPC timeouts](http://www.grpc.io/docs/guides/wire.html) through inbound HTTP `Grpc-Timeout` header. + +### Want to support +But not yet. +* bytes fields in path parameter. #5 +* Optionally generating the entrypoint. #8 +* `import_path` parameter + +### No plan to support +But patch is welcome. +* Method parameters in HTTP headers +* Handling trailer metadata +* Encoding request/response body in XML +* True bi-directional streaming. (Probably impossible?) + +# Mapping gRPC to HTTP + +* [How gRPC error codes map to HTTP status codes in the response](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/runtime/errors.go#L15) +* HTTP request source IP is added as `X-Forwarded-For` gRPC request header +* HTTP request host is added as `X-Forwarded-Host` gRPC request header +* HTTP `Authorization` header is added as `authorization` gRPC request header +* Remaining Permanent HTTP header keys (as specified by the IANA [here](http://www.iana.org/assignments/message-headers/message-headers.xhtml) are prefixed with `grpcgateway-` and added with their values to gRPC request header +* HTTP headers that start with 'Grpc-Metadata-' are mapped to gRPC metadata (prefixed with `grpcgateway-`) +* While configurable, the default {un,}marshaling uses [jsonpb](https://godoc.org/github.com/golang/protobuf/jsonpb) with `OrigName: true`. + +# Contribution +See [CONTRIBUTING.md](http://github.com/grpc-ecosystem/grpc-gateway/blob/master/CONTRIBUTING.md). + +# License +grpc-gateway is licensed under the BSD 3-Clause License. +See [LICENSE.txt](https://github.com/grpc-ecosystem/grpc-gateway/blob/master/LICENSE.txt) for more details. diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/bin/.gitignore b/vendor/github.com/grpc-ecosystem/grpc-gateway/bin/.gitignore new file mode 100644 index 0000000..f20d08c --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/bin/.gitignore @@ -0,0 +1,3 @@ +/protoc-gen-go +/protoc-gen-grpc-gateway +/protoc-gen-swagger diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/.gitignore b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/.gitignore new file mode 100644 index 0000000..75ce18e --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/.gitignore @@ -0,0 +1,2 @@ +/bower_components +/node_modules diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/README.md b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/README.md new file mode 100644 index 0000000..be4fbd3 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/README.md @@ -0,0 +1,31 @@ +# Browser example + +This directory contains an example use of grpc-gateway with web browsers. +The following commands automatically runs integration tests with phantomjs. + +```shell-session +$ npm install -g gulp-cli +$ npm install +$ gulp +``` + +## Other examples + +### Very simple example +Run +```shell-session +$ gulp bower +$ gulp backends +``` + +then, open `index.html`. + + +### Integration test with your browser + +Run +```shell-session +$ gulp serve +``` + +then, open `http://localhost:8000` with your browser. diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/a_bit_of_everything_service.spec.js b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/a_bit_of_everything_service.spec.js new file mode 100644 index 0000000..edcbebe --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/a_bit_of_everything_service.spec.js @@ -0,0 +1,185 @@ +'use strict'; + +var SwaggerClient = require('swagger-client'); + +describe('ABitOfEverythingService', function() { + var client; + + beforeEach(function(done) { + new SwaggerClient({ + url: "http://localhost:8080/swagger/a_bit_of_everything.swagger.json", + usePromise: true, + }).then(function(c) { + client = c; + }).catch(function(err) { + done.fail(err); + }).then(done); + }); + + describe('Create', function() { + var created; + var expected = { + float_value: 1.5, + double_value: 2.5, + int64_value: "4294967296", + uint64_value: "9223372036854775807", + int32_value: -2147483648, + fixed64_value: "9223372036854775807", + fixed32_value: 4294967295, + bool_value: true, + string_value: "strprefix/foo", + uint32_value: 4294967295, + sfixed32_value: 2147483647, + sfixed64_value: "-4611686018427387904", + sint32_value: 2147483647, + sint64_value: "4611686018427387903", + nonConventionalNameValue: "camelCase", + }; + + beforeEach(function(done) { + client.ABitOfEverythingService.Create(expected).then(function(resp) { + created = resp.obj; + }).catch(function(err) { + done.fail(err); + }).then(done); + }); + + it('should assign id', function() { + expect(created.uuid).not.toBe(""); + }); + + it('should echo the request back', function() { + delete created.uuid; + expect(created).toEqual(expected); + }); + }); + + describe('CreateBody', function() { + var created; + var expected = { + float_value: 1.5, + double_value: 2.5, + int64_value: "4294967296", + uint64_value: "9223372036854775807", + int32_value: -2147483648, + fixed64_value: "9223372036854775807", + fixed32_value: 4294967295, + bool_value: true, + string_value: "strprefix/foo", + uint32_value: 4294967295, + sfixed32_value: 2147483647, + sfixed64_value: "-4611686018427387904", + sint32_value: 2147483647, + sint64_value: "4611686018427387903", + nonConventionalNameValue: "camelCase", + + nested: [ + { name: "bar", amount: 10 }, + { name: "baz", amount: 20 }, + ], + repeated_string_value: ["a", "b", "c"], + oneof_string: "x", + // TODO(yugui) Support enum by name + map_value: { a: 1, b: 2 }, + mapped_string_value: { a: "x", b: "y" }, + mapped_nested_value: { + a: { name: "x", amount: 1 }, + b: { name: "y", amount: 2 }, + }, + }; + + beforeEach(function(done) { + client.ABitOfEverythingService.CreateBody({ + body: expected, + }).then(function(resp) { + created = resp.obj; + }).catch(function(err) { + done.fail(err); + }).then(done); + }); + + it('should assign id', function() { + expect(created.uuid).not.toBe(""); + }); + + it('should echo the request back', function() { + delete created.uuid; + expect(created).toEqual(expected); + }); + }); + + describe('lookup', function() { + var created; + var expected = { + bool_value: true, + string_value: "strprefix/foo", + }; + + beforeEach(function(done) { + client.ABitOfEverythingService.CreateBody({ + body: expected, + }).then(function(resp) { + created = resp.obj; + }).catch(function(err) { + fail(err); + }).finally(done); + }); + + it('should look up an object by uuid', function(done) { + client.ABitOfEverythingService.Lookup({ + uuid: created.uuid + }).then(function(resp) { + expect(resp.obj).toEqual(created); + }).catch(function(err) { + fail(err.errObj); + }).finally(done); + }); + + it('should fail if no such object', function(done) { + client.ABitOfEverythingService.Lookup({ + uuid: 'not_exist', + }).then(function(resp) { + fail('expected failure but succeeded'); + }).catch(function(err) { + expect(err.status).toBe(404); + }).finally(done); + }); + }); + + describe('Delete', function() { + var created; + var expected = { + bool_value: true, + string_value: "strprefix/foo", + }; + + beforeEach(function(done) { + client.ABitOfEverythingService.CreateBody({ + body: expected, + }).then(function(resp) { + created = resp.obj; + }).catch(function(err) { + fail(err); + }).finally(done); + }); + + it('should delete an object by id', function(done) { + client.ABitOfEverythingService.Delete({ + uuid: created.uuid + }).then(function(resp) { + expect(resp.obj).toEqual({}); + }).catch(function(err) { + fail(err.errObj); + }).then(function() { + return client.ABitOfEverythingService.Lookup({ + uuid: created.uuid + }); + }).then(function(resp) { + fail('expected failure but succeeded'); + }). catch(function(err) { + expect(err.status).toBe(404); + }).finally(done); + }); + }); +}); + diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/bin/.gitignore b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/bin/.gitignore new file mode 100644 index 0000000..a68d087 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/bin/.gitignore @@ -0,0 +1,2 @@ +/* +!/.gitignore diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/bower.json b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/bower.json new file mode 100644 index 0000000..2454691 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/bower.json @@ -0,0 +1,21 @@ +{ + "name": "grpc-gateway-example-browser", + "description": "Example use of grpc-gateway from browser", + "main": "index.js", + "authors": [ + "Yuki Yugui Sonoda " + ], + "license": "SEE LICENSE IN LICENSE file", + "homepage": "https://github.com/grpc-ecosystem/grpc-gateway", + "private": true, + "dependencies": { + "swagger-js": "~> 2.1" + }, + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/echo_service.spec.js b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/echo_service.spec.js new file mode 100644 index 0000000..97888c3 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/echo_service.spec.js @@ -0,0 +1,43 @@ +'use strict'; + +var SwaggerClient = require('swagger-client'); + +describe('EchoService', function() { + var client; + + beforeEach(function(done) { + new SwaggerClient({ + url: "http://localhost:8080/swagger/echo_service.swagger.json", + usePromise: true, + }).then(function(c) { + client = c; + done(); + }); + }); + + describe('Echo', function() { + it('should echo the request back', function(done) { + client.EchoService.Echo( + {id: "foo"}, + {responseContentType: "application/json"} + ).then(function(resp) { + expect(resp.obj).toEqual({id: "foo"}); + }).catch(function(err) { + done.fail(err); + }).then(done); + }); + }); + + describe('EchoBody', function() { + it('should echo the request back', function(done) { + client.EchoService.EchoBody( + {body: {id: "foo"}}, + {responseContentType: "application/json"} + ).then(function(resp) { + expect(resp.obj).toEqual({id: "foo"}); + }).catch(function(err) { + done.fail(err); + }).then(done); + }); + }); +}); diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/gulpfile.js b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/gulpfile.js new file mode 100644 index 0000000..3964888 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/gulpfile.js @@ -0,0 +1,81 @@ +"use strict"; + +var gulp = require('gulp'); + +var path = require('path'); + +var bower = require('gulp-bower'); +var exit = require('gulp-exit'); +var gprocess = require('gulp-process'); +var shell = require('gulp-shell'); +var jasmineBrowser = require('gulp-jasmine-browser'); +var webpack = require('webpack-stream'); + +gulp.task('bower', function(){ + return bower(); +}); + +gulp.task('server', shell.task([ + 'go build -o bin/example-server github.com/grpc-ecosystem/grpc-gateway/examples/server/cmd/example-server', +])); + +gulp.task('gateway', shell.task([ + 'go build -o bin/example-gw github.com/grpc-ecosystem/grpc-gateway/examples', +])); + +gulp.task('serve-server', ['server'], function(){ + gprocess.start('server-server', 'bin/example-server', [ + '--logtostderr', + ]); + gulp.watch('bin/example-server', ['serve-server']); +}); + +gulp.task('serve-gateway', ['gateway', 'serve-server'], function(){ + gprocess.start('gateway-server', 'bin/example-gw', [ + '--logtostderr', '--swagger_dir', path.join(__dirname, "../examplepb"), + ]); + gulp.watch('bin/example-gateway', ['serve-gateway']); +}); + +gulp.task('backends', ['serve-gateway', 'serve-server']); + +var specFiles = ['*.spec.js']; +gulp.task('test', ['backends'], function(done) { + return gulp.src(specFiles) + .pipe(webpack({output: {filename: 'spec.js'}})) + .pipe(jasmineBrowser.specRunner({ + console: true, + sourceMappedStacktrace: true, + })) + .pipe(jasmineBrowser.headless({ + findOpenPort: true, + catch: true, + throwFailures: true, + })) + .on('error', function(err) { + done(err); + process.exit(1); + }) + .pipe(exit()); +}); + +gulp.task('serve', ['backends'], function(done) { + var JasminePlugin = require('gulp-jasmine-browser/webpack/jasmine-plugin'); + var plugin = new JasminePlugin(); + + return gulp.src(specFiles) + .pipe(webpack({ + output: {filename: 'spec.js'}, + watch: true, + plugins: [plugin], + })) + .pipe(jasmineBrowser.specRunner({ + sourceMappedStacktrace: true, + })) + .pipe(jasmineBrowser.server({ + port: 8000, + whenReady: plugin.whenReady, + })); +}); + +gulp.task('default', ['test']); diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/index.html b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/index.html new file mode 100644 index 0000000..7817451 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/index.html @@ -0,0 +1,22 @@ + + + + + + + +
+ + diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/package.json b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/package.json new file mode 100644 index 0000000..963f4cd --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/package.json @@ -0,0 +1,23 @@ +{ + "name": "grpc-gateway-example", + "version": "1.0.0", + "description": "Example use of grpc-gateway from browser", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "SEE LICENSE IN LICENSE.txt", + "devDependencies": { + "bower": "^1.7.9", + "gulp": "^3.9.1", + "gulp-bower": "0.0.13", + "gulp-exit": "0.0.2", + "gulp-jasmine-browser": "^1.3.2", + "gulp-process": "^0.1.2", + "gulp-shell": "^0.5.2", + "jasmine": "^2.4.1", + "phantomjs": "^2.1.7", + "swagger-client": "^2.1.28", + "webpack-stream": "^3.2.0" + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/client_test.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/client_test.go new file mode 100644 index 0000000..0574d9f --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/client_test.go @@ -0,0 +1,162 @@ +package main + +import ( + "reflect" + "testing" + + "github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe" + "github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo" +) + +func TestClientIntegration(t *testing.T) { +} + +func TestEchoClient(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + + cl := echo.NewEchoServiceApiWithBasePath("http://localhost:8080") + resp, err := cl.Echo("foo") + if err != nil { + t.Errorf(`cl.Echo("foo") failed with %v; want success`, err) + } + if got, want := resp.Id, "foo"; got != want { + t.Errorf("resp.Id = %q; want %q", got, want) + } +} + +func TestEchoBodyClient(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + + cl := echo.NewEchoServiceApiWithBasePath("http://localhost:8080") + req := echo.ExamplepbSimpleMessage{Id: "foo"} + resp, err := cl.EchoBody(req) + if err != nil { + t.Errorf("cl.EchoBody(%#v) failed with %v; want success", req, err) + } + if got, want := resp.Id, "foo"; got != want { + t.Errorf("resp.Id = %q; want %q", got, want) + } +} + +func TestAbitOfEverythingClient(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + + cl := abe.NewABitOfEverythingServiceApiWithBasePath("http://localhost:8080") + testABEClientCreate(t, cl) + testABEClientCreateBody(t, cl) +} + +func testABEClientCreate(t *testing.T, cl *abe.ABitOfEverythingServiceApi) { + want := abe.ExamplepbABitOfEverything{ + FloatValue: 1.5, + DoubleValue: 2.5, + Int64Value: "4294967296", + Uint64Value: "9223372036854775807", + Int32Value: -2147483648, + Fixed64Value: "9223372036854775807", + Fixed32Value: 4294967295, + BoolValue: true, + StringValue: "strprefix/foo", + Uint32Value: 4294967295, + Sfixed32Value: 2147483647, + Sfixed64Value: "-4611686018427387904", + Sint32Value: 2147483647, + Sint64Value: "4611686018427387903", + NonConventionalNameValue: "camelCase", + } + resp, err := cl.Create( + want.FloatValue, + want.DoubleValue, + want.Int64Value, + want.Uint64Value, + want.Int32Value, + want.Fixed64Value, + want.Fixed32Value, + want.BoolValue, + want.StringValue, + want.Uint32Value, + want.Sfixed32Value, + want.Sfixed64Value, + want.Sint32Value, + want.Sint64Value, + want.NonConventionalNameValue, + ) + if err != nil { + t.Errorf("cl.Create(%#v) failed with %v; want success", want, err) + } + if resp.Uuid == "" { + t.Errorf("resp.Uuid is empty; want not empty") + } + resp.Uuid = "" + if got := resp; !reflect.DeepEqual(got, want) { + t.Errorf("resp = %#v; want %#v", got, want) + } +} + +func testABEClientCreateBody(t *testing.T, cl *abe.ABitOfEverythingServiceApi) { + t.Log("TODO: support enum") + return + + want := abe.ExamplepbABitOfEverything{ + FloatValue: 1.5, + DoubleValue: 2.5, + Int64Value: "4294967296", + Uint64Value: "9223372036854775807", + Int32Value: -2147483648, + Fixed64Value: "9223372036854775807", + Fixed32Value: 4294967295, + BoolValue: true, + StringValue: "strprefix/foo", + Uint32Value: 4294967295, + Sfixed32Value: 2147483647, + Sfixed64Value: "-4611686018427387904", + Sint32Value: 2147483647, + Sint64Value: "4611686018427387903", + NonConventionalNameValue: "camelCase", + + Nested: []abe.ABitOfEverythingNested{ + { + Name: "bar", + Amount: 10, + }, + { + Name: "baz", + Amount: 20, + }, + }, + RepeatedStringValue: []string{"a", "b", "c"}, + OneofString: "x", + MapValue: map[string]abe.ExamplepbNumericEnum{ + // "a": abe.ExamplepbNumericEnum_ONE, + // "b": abe.ExamplepbNumericEnum_ZERO, + }, + MappedStringValue: map[string]string{ + "a": "x", + "b": "y", + }, + MappedNestedValue: map[string]abe.ABitOfEverythingNested{ + "a": {Name: "x", Amount: 1}, + "b": {Name: "y", Amount: 2}, + }, + } + resp, err := cl.CreateBody(want) + if err != nil { + t.Errorf("cl.CreateBody(%#v) failed with %v; want success", want, err) + } + if resp.Uuid == "" { + t.Errorf("resp.Uuid is empty; want not empty") + } + resp.Uuid = "" + if got := resp; !reflect.DeepEqual(got, want) { + t.Errorf("resp = %#v; want %#v", got, want) + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ABitOfEverythingNested.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ABitOfEverythingNested.go new file mode 100644 index 0000000..7e5488e --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ABitOfEverythingNested.go @@ -0,0 +1,11 @@ +package abe + +import ( +) + +type ABitOfEverythingNested struct { + Name string `json:"name,omitempty"` + Amount int64 `json:"amount,omitempty"` + Ok NestedDeepEnum `json:"ok,omitempty"` + +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ABitOfEverythingServiceApi.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ABitOfEverythingServiceApi.go new file mode 100644 index 0000000..fcc6076 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ABitOfEverythingServiceApi.go @@ -0,0 +1,764 @@ +package abe + +import ( + "strings" + "fmt" + "encoding/json" + "errors" + "github.com/dghubble/sling" + "time" +) + +type ABitOfEverythingServiceApi struct { + basePath string +} + +func NewABitOfEverythingServiceApi() *ABitOfEverythingServiceApi{ + return &ABitOfEverythingServiceApi { + basePath: "http://localhost", + } +} + +func NewABitOfEverythingServiceApiWithBasePath(basePath string) *ABitOfEverythingServiceApi{ + return &ABitOfEverythingServiceApi { + basePath: basePath, + } +} + +/** + * + * + * @param floatValue + * @param doubleValue + * @param int64Value + * @param uint64Value + * @param int32Value + * @param fixed64Value + * @param fixed32Value + * @param boolValue + * @param stringValue + * @param uint32Value + * @param sfixed32Value + * @param sfixed64Value + * @param sint32Value + * @param sint64Value + * @param nonConventionalNameValue + * @return ExamplepbABitOfEverything + */ +//func (a ABitOfEverythingServiceApi) Create (floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string) (ExamplepbABitOfEverything, error) { +func (a ABitOfEverythingServiceApi) Create (floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string) (ExamplepbABitOfEverything, error) { + + _sling := sling.New().Post(a.basePath) + + // create path and map variables + path := "/v1/example/a_bit_of_everything/{float_value}/{double_value}/{int64_value}/separator/{uint64_value}/{int32_value}/{fixed64_value}/{fixed32_value}/{bool_value}/{string_value}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}" + path = strings.Replace(path, "{" + "float_value" + "}", fmt.Sprintf("%v", floatValue), -1) + path = strings.Replace(path, "{" + "double_value" + "}", fmt.Sprintf("%v", doubleValue), -1) + path = strings.Replace(path, "{" + "int64_value" + "}", fmt.Sprintf("%v", int64Value), -1) + path = strings.Replace(path, "{" + "uint64_value" + "}", fmt.Sprintf("%v", uint64Value), -1) + path = strings.Replace(path, "{" + "int32_value" + "}", fmt.Sprintf("%v", int32Value), -1) + path = strings.Replace(path, "{" + "fixed64_value" + "}", fmt.Sprintf("%v", fixed64Value), -1) + path = strings.Replace(path, "{" + "fixed32_value" + "}", fmt.Sprintf("%v", fixed32Value), -1) + path = strings.Replace(path, "{" + "bool_value" + "}", fmt.Sprintf("%v", boolValue), -1) + path = strings.Replace(path, "{" + "string_value" + "}", fmt.Sprintf("%v", stringValue), -1) + path = strings.Replace(path, "{" + "uint32_value" + "}", fmt.Sprintf("%v", uint32Value), -1) + path = strings.Replace(path, "{" + "sfixed32_value" + "}", fmt.Sprintf("%v", sfixed32Value), -1) + path = strings.Replace(path, "{" + "sfixed64_value" + "}", fmt.Sprintf("%v", sfixed64Value), -1) + path = strings.Replace(path, "{" + "sint32_value" + "}", fmt.Sprintf("%v", sint32Value), -1) + path = strings.Replace(path, "{" + "sint64_value" + "}", fmt.Sprintf("%v", sint64Value), -1) + path = strings.Replace(path, "{" + "nonConventionalNameValue" + "}", fmt.Sprintf("%v", nonConventionalNameValue), -1) + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + + + var successPayload = new(ExamplepbABitOfEverything) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} +/** + * + * + * @param body + * @return ExamplepbABitOfEverything + */ +//func (a ABitOfEverythingServiceApi) CreateBody (body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, error) { +func (a ABitOfEverythingServiceApi) CreateBody (body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, error) { + + _sling := sling.New().Post(a.basePath) + + // create path and map variables + path := "/v1/example/a_bit_of_everything" + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + +// body params + _sling = _sling.BodyJSON(body) + + var successPayload = new(ExamplepbABitOfEverything) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} +/** + * + * + * @param singleNestedName + * @param body + * @return ExamplepbABitOfEverything + */ +//func (a ABitOfEverythingServiceApi) DeepPathEcho (singleNestedName string, body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, error) { +func (a ABitOfEverythingServiceApi) DeepPathEcho (singleNestedName string, body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, error) { + + _sling := sling.New().Post(a.basePath) + + // create path and map variables + path := "/v1/example/a_bit_of_everything/{single_nested.name}" + path = strings.Replace(path, "{" + "single_nested.name" + "}", fmt.Sprintf("%v", singleNestedName), -1) + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + +// body params + _sling = _sling.BodyJSON(body) + + var successPayload = new(ExamplepbABitOfEverything) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} +/** + * + * + * @param uuid + * @return ProtobufEmpty + */ +//func (a ABitOfEverythingServiceApi) Delete (uuid string) (ProtobufEmpty, error) { +func (a ABitOfEverythingServiceApi) Delete (uuid string) (ProtobufEmpty, error) { + + _sling := sling.New().Delete(a.basePath) + + // create path and map variables + path := "/v1/example/a_bit_of_everything/{uuid}" + path = strings.Replace(path, "{" + "uuid" + "}", fmt.Sprintf("%v", uuid), -1) + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + + + var successPayload = new(ProtobufEmpty) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} +/** + * + * + * @param value + * @return SubStringMessage + */ +//func (a ABitOfEverythingServiceApi) Echo (value string) (SubStringMessage, error) { +func (a ABitOfEverythingServiceApi) Echo (value string) (SubStringMessage, error) { + + _sling := sling.New().Get(a.basePath) + + // create path and map variables + path := "/v1/example/a_bit_of_everything/echo/{value}" + path = strings.Replace(path, "{" + "value" + "}", fmt.Sprintf("%v", value), -1) + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + + + var successPayload = new(SubStringMessage) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} +/** + * + * + * @param value + * @return SubStringMessage + */ +//func (a ABitOfEverythingServiceApi) Echo_1 (value string) (SubStringMessage, error) { +func (a ABitOfEverythingServiceApi) Echo_1 (value string) (SubStringMessage, error) { + + _sling := sling.New().Get(a.basePath) + + // create path and map variables + path := "/v2/example/echo" + + _sling = _sling.Path(path) + + type QueryParams struct { + value string `url:"value,omitempty"` + +} + _sling = _sling.QueryStruct(&QueryParams{ value: value }) + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + + + var successPayload = new(SubStringMessage) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} +/** + * + * + * @param body + * @return SubStringMessage + */ +//func (a ABitOfEverythingServiceApi) Echo_2 (body string) (SubStringMessage, error) { +func (a ABitOfEverythingServiceApi) Echo_2 (body string) (SubStringMessage, error) { + + _sling := sling.New().Post(a.basePath) + + // create path and map variables + path := "/v2/example/echo" + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + +// body params + _sling = _sling.BodyJSON(body) + + var successPayload = new(SubStringMessage) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} +/** + * + * + * @param uuid + * @param singleNestedName name is nested field. + * @param singleNestedAmount + * @param singleNestedOk - FALSE: FALSE is false.\n - TRUE: TRUE is true. + * @param floatValue + * @param doubleValue + * @param int64Value + * @param uint64Value + * @param int32Value + * @param fixed64Value + * @param fixed32Value + * @param boolValue + * @param stringValue + * @param uint32Value TODO(yugui) add bytes_value. + * @param enumValue - ZERO: ZERO means 0\n - ONE: ONE means 1 + * @param sfixed32Value + * @param sfixed64Value + * @param sint32Value + * @param sint64Value + * @param repeatedStringValue + * @param oneofString + * @param nonConventionalNameValue + * @param timestampValue + * @param repeatedEnumValue repeated enum value. it is comma-separated in query.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1 + * @return ProtobufEmpty + */ +//func (a ABitOfEverythingServiceApi) GetQuery (uuid string, singleNestedName string, singleNestedAmount int64, singleNestedOk string, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, enumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string) (ProtobufEmpty, error) { +func (a ABitOfEverythingServiceApi) GetQuery (uuid string, singleNestedName string, singleNestedAmount int64, singleNestedOk string, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, enumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string) (ProtobufEmpty, error) { + + _sling := sling.New().Get(a.basePath) + + // create path and map variables + path := "/v1/example/a_bit_of_everything/query/{uuid}" + path = strings.Replace(path, "{" + "uuid" + "}", fmt.Sprintf("%v", uuid), -1) + + _sling = _sling.Path(path) + + type QueryParams struct { + singleNestedName string `url:"single_nested.name,omitempty"` + singleNestedAmount int64 `url:"single_nested.amount,omitempty"` + singleNestedOk string `url:"single_nested.ok,omitempty"` + floatValue float32 `url:"float_value,omitempty"` + doubleValue float64 `url:"double_value,omitempty"` + int64Value string `url:"int64_value,omitempty"` + uint64Value string `url:"uint64_value,omitempty"` + int32Value int32 `url:"int32_value,omitempty"` + fixed64Value string `url:"fixed64_value,omitempty"` + fixed32Value int64 `url:"fixed32_value,omitempty"` + boolValue bool `url:"bool_value,omitempty"` + stringValue string `url:"string_value,omitempty"` + uint32Value int64 `url:"uint32_value,omitempty"` + enumValue string `url:"enum_value,omitempty"` + sfixed32Value int32 `url:"sfixed32_value,omitempty"` + sfixed64Value string `url:"sfixed64_value,omitempty"` + sint32Value int32 `url:"sint32_value,omitempty"` + sint64Value string `url:"sint64_value,omitempty"` + repeatedStringValue []string `url:"repeated_string_value,omitempty"` + oneofString string `url:"oneof_string,omitempty"` + nonConventionalNameValue string `url:"nonConventionalNameValue,omitempty"` + timestampValue time.Time `url:"timestamp_value,omitempty"` + repeatedEnumValue []string `url:"repeated_enum_value,omitempty"` + +} + _sling = _sling.QueryStruct(&QueryParams{ singleNestedName: singleNestedName,singleNestedAmount: singleNestedAmount,singleNestedOk: singleNestedOk,floatValue: floatValue,doubleValue: doubleValue,int64Value: int64Value,uint64Value: uint64Value,int32Value: int32Value,fixed64Value: fixed64Value,fixed32Value: fixed32Value,boolValue: boolValue,stringValue: stringValue,uint32Value: uint32Value,enumValue: enumValue,sfixed32Value: sfixed32Value,sfixed64Value: sfixed64Value,sint32Value: sint32Value,sint64Value: sint64Value,repeatedStringValue: repeatedStringValue,oneofString: oneofString,nonConventionalNameValue: nonConventionalNameValue,timestampValue: timestampValue,repeatedEnumValue: repeatedEnumValue }) + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + + + var successPayload = new(ProtobufEmpty) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} +/** + * + * + * @param uuid + * @return ExamplepbABitOfEverything + */ +//func (a ABitOfEverythingServiceApi) Lookup (uuid string) (ExamplepbABitOfEverything, error) { +func (a ABitOfEverythingServiceApi) Lookup (uuid string) (ExamplepbABitOfEverything, error) { + + _sling := sling.New().Get(a.basePath) + + // create path and map variables + path := "/v1/example/a_bit_of_everything/{uuid}" + path = strings.Replace(path, "{" + "uuid" + "}", fmt.Sprintf("%v", uuid), -1) + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + + + var successPayload = new(ExamplepbABitOfEverything) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} +/** + * + * + * @return ProtobufEmpty + */ +//func (a ABitOfEverythingServiceApi) Timeout () (ProtobufEmpty, error) { +func (a ABitOfEverythingServiceApi) Timeout () (ProtobufEmpty, error) { + + _sling := sling.New().Get(a.basePath) + + // create path and map variables + path := "/v2/example/timeout" + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + + + var successPayload = new(ProtobufEmpty) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} +/** + * + * + * @param uuid + * @param body + * @return ProtobufEmpty + */ +//func (a ABitOfEverythingServiceApi) Update (uuid string, body ExamplepbABitOfEverything) (ProtobufEmpty, error) { +func (a ABitOfEverythingServiceApi) Update (uuid string, body ExamplepbABitOfEverything) (ProtobufEmpty, error) { + + _sling := sling.New().Put(a.basePath) + + // create path and map variables + path := "/v1/example/a_bit_of_everything/{uuid}" + path = strings.Replace(path, "{" + "uuid" + "}", fmt.Sprintf("%v", uuid), -1) + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + +// body params + _sling = _sling.BodyJSON(body) + + var successPayload = new(ProtobufEmpty) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ExamplepbABitOfEverything.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ExamplepbABitOfEverything.go new file mode 100644 index 0000000..2892eb6 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ExamplepbABitOfEverything.go @@ -0,0 +1,36 @@ +package abe + +import ( + "time" +) + +type ExamplepbABitOfEverything struct { + SingleNested ABitOfEverythingNested `json:"single_nested,omitempty"` + Uuid string `json:"uuid,omitempty"` + Nested []ABitOfEverythingNested `json:"nested,omitempty"` + FloatValue float32 `json:"float_value,omitempty"` + DoubleValue float64 `json:"double_value,omitempty"` + Int64Value string `json:"int64_value,omitempty"` + Uint64Value string `json:"uint64_value,omitempty"` + Int32Value int32 `json:"int32_value,omitempty"` + Fixed64Value string `json:"fixed64_value,omitempty"` + Fixed32Value int64 `json:"fixed32_value,omitempty"` + BoolValue bool `json:"bool_value,omitempty"` + StringValue string `json:"string_value,omitempty"` + Uint32Value int64 `json:"uint32_value,omitempty"` + EnumValue ExamplepbNumericEnum `json:"enum_value,omitempty"` + Sfixed32Value int32 `json:"sfixed32_value,omitempty"` + Sfixed64Value string `json:"sfixed64_value,omitempty"` + Sint32Value int32 `json:"sint32_value,omitempty"` + Sint64Value string `json:"sint64_value,omitempty"` + RepeatedStringValue []string `json:"repeated_string_value,omitempty"` + OneofEmpty ProtobufEmpty `json:"oneof_empty,omitempty"` + OneofString string `json:"oneof_string,omitempty"` + MapValue map[string]ExamplepbNumericEnum `json:"map_value,omitempty"` + MappedStringValue map[string]string `json:"mapped_string_value,omitempty"` + MappedNestedValue map[string]ABitOfEverythingNested `json:"mapped_nested_value,omitempty"` + NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` + TimestampValue time.Time `json:"timestamp_value,omitempty"` + RepeatedEnumValue []ExamplepbNumericEnum `json:"repeated_enum_value,omitempty"` + +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ExamplepbNumericEnum.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ExamplepbNumericEnum.go new file mode 100644 index 0000000..51cffc7 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ExamplepbNumericEnum.go @@ -0,0 +1,8 @@ +package abe + +import ( +) + +type ExamplepbNumericEnum struct { + +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/NestedDeepEnum.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/NestedDeepEnum.go new file mode 100644 index 0000000..b48e231 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/NestedDeepEnum.go @@ -0,0 +1,8 @@ +package abe + +import ( +) + +type NestedDeepEnum struct { + +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ProtobufDuration.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ProtobufDuration.go new file mode 100644 index 0000000..837f298 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ProtobufDuration.go @@ -0,0 +1,10 @@ +package abe + +import ( +) + +type ProtobufDuration struct { + Seconds string `json:"seconds,omitempty"` + Nanos int32 `json:"nanos,omitempty"` + +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ProtobufEmpty.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ProtobufEmpty.go new file mode 100644 index 0000000..ac37afe --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ProtobufEmpty.go @@ -0,0 +1,8 @@ +package abe + +import ( +) + +type ProtobufEmpty struct { + +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/Sub2IdMessage.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/Sub2IdMessage.go new file mode 100644 index 0000000..77ebe15 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/Sub2IdMessage.go @@ -0,0 +1,9 @@ +package abe + +import ( +) + +type Sub2IdMessage struct { + Uuid string `json:"uuid,omitempty"` + +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/SubStringMessage.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/SubStringMessage.go new file mode 100644 index 0000000..f278dbf --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/SubStringMessage.go @@ -0,0 +1,9 @@ +package abe + +import ( +) + +type SubStringMessage struct { + Value string `json:"value,omitempty"` + +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo/EchoServiceApi.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo/EchoServiceApi.go new file mode 100644 index 0000000..0cf5b58 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo/EchoServiceApi.go @@ -0,0 +1,145 @@ +package echo + +import ( + "strings" + "fmt" + "encoding/json" + "errors" + "github.com/dghubble/sling" +) + +type EchoServiceApi struct { + basePath string +} + +func NewEchoServiceApi() *EchoServiceApi{ + return &EchoServiceApi { + basePath: "http://localhost", + } +} + +func NewEchoServiceApiWithBasePath(basePath string) *EchoServiceApi{ + return &EchoServiceApi { + basePath: basePath, + } +} + +/** + * Echo method receives a simple message and returns it. + * The message posted as the id parameter will also be\nreturned. + * @param id + * @return ExamplepbSimpleMessage + */ +//func (a EchoServiceApi) Echo (id string) (ExamplepbSimpleMessage, error) { +func (a EchoServiceApi) Echo (id string) (ExamplepbSimpleMessage, error) { + + _sling := sling.New().Post(a.basePath) + + // create path and map variables + path := "/v1/example/echo/{id}" + path = strings.Replace(path, "{" + "id" + "}", fmt.Sprintf("%v", id), -1) + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + + + var successPayload = new(ExamplepbSimpleMessage) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} +/** + * EchoBody method receives a simple message and returns it. + * + * @param body + * @return ExamplepbSimpleMessage + */ +//func (a EchoServiceApi) EchoBody (body ExamplepbSimpleMessage) (ExamplepbSimpleMessage, error) { +func (a EchoServiceApi) EchoBody (body ExamplepbSimpleMessage) (ExamplepbSimpleMessage, error) { + + _sling := sling.New().Post(a.basePath) + + // create path and map variables + path := "/v1/example/echo_body" + + _sling = _sling.Path(path) + + // accept header + accepts := []string { "application/json" } + for key := range accepts { + _sling = _sling.Set("Accept", accepts[key]) + break // only use the first Accept + } + +// body params + _sling = _sling.BodyJSON(body) + + var successPayload = new(ExamplepbSimpleMessage) + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive(successPayload, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return *successPayload, err +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo/ExamplepbSimpleMessage.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo/ExamplepbSimpleMessage.go new file mode 100644 index 0000000..ed9ada3 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo/ExamplepbSimpleMessage.go @@ -0,0 +1,9 @@ +package echo + +import ( +) + +type ExamplepbSimpleMessage struct { + Id string `json:"id,omitempty"` + +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.pb.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.pb.go new file mode 100644 index 0000000..0d8f320 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.pb.go @@ -0,0 +1,958 @@ +// Code generated by protoc-gen-go. +// source: examples/examplepb/a_bit_of_everything.proto +// DO NOT EDIT! + +package examplepb + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "google.golang.org/genproto/googleapis/api/annotations" +import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" +import google_protobuf2 "github.com/golang/protobuf/ptypes/duration" +import grpc_gateway_examples_sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" +import sub2 "github.com/grpc-ecosystem/grpc-gateway/examples/sub2" +import google_protobuf3 "github.com/golang/protobuf/ptypes/timestamp" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// NumericEnum is one or zero. +type NumericEnum int32 + +const ( + // ZERO means 0 + NumericEnum_ZERO NumericEnum = 0 + // ONE means 1 + NumericEnum_ONE NumericEnum = 1 +) + +var NumericEnum_name = map[int32]string{ + 0: "ZERO", + 1: "ONE", +} +var NumericEnum_value = map[string]int32{ + "ZERO": 0, + "ONE": 1, +} + +func (x NumericEnum) String() string { + return proto.EnumName(NumericEnum_name, int32(x)) +} +func (NumericEnum) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } + +// DeepEnum is one or zero. +type ABitOfEverything_Nested_DeepEnum int32 + +const ( + // FALSE is false. + ABitOfEverything_Nested_FALSE ABitOfEverything_Nested_DeepEnum = 0 + // TRUE is true. + ABitOfEverything_Nested_TRUE ABitOfEverything_Nested_DeepEnum = 1 +) + +var ABitOfEverything_Nested_DeepEnum_name = map[int32]string{ + 0: "FALSE", + 1: "TRUE", +} +var ABitOfEverything_Nested_DeepEnum_value = map[string]int32{ + "FALSE": 0, + "TRUE": 1, +} + +func (x ABitOfEverything_Nested_DeepEnum) String() string { + return proto.EnumName(ABitOfEverything_Nested_DeepEnum_name, int32(x)) +} +func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) { + return fileDescriptor1, []int{0, 0, 0} +} + +// Intentionaly complicated message type to cover much features of Protobuf. +// NEXT ID: 27 +type ABitOfEverything struct { + SingleNested *ABitOfEverything_Nested `protobuf:"bytes,25,opt,name=single_nested,json=singleNested" json:"single_nested,omitempty"` + Uuid string `protobuf:"bytes,1,opt,name=uuid" json:"uuid,omitempty"` + Nested []*ABitOfEverything_Nested `protobuf:"bytes,2,rep,name=nested" json:"nested,omitempty"` + FloatValue float32 `protobuf:"fixed32,3,opt,name=float_value,json=floatValue" json:"float_value,omitempty"` + DoubleValue float64 `protobuf:"fixed64,4,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` + Int64Value int64 `protobuf:"varint,5,opt,name=int64_value,json=int64Value" json:"int64_value,omitempty"` + Uint64Value uint64 `protobuf:"varint,6,opt,name=uint64_value,json=uint64Value" json:"uint64_value,omitempty"` + Int32Value int32 `protobuf:"varint,7,opt,name=int32_value,json=int32Value" json:"int32_value,omitempty"` + Fixed64Value uint64 `protobuf:"fixed64,8,opt,name=fixed64_value,json=fixed64Value" json:"fixed64_value,omitempty"` + Fixed32Value uint32 `protobuf:"fixed32,9,opt,name=fixed32_value,json=fixed32Value" json:"fixed32_value,omitempty"` + BoolValue bool `protobuf:"varint,10,opt,name=bool_value,json=boolValue" json:"bool_value,omitempty"` + StringValue string `protobuf:"bytes,11,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` + // TODO(yugui) add bytes_value + Uint32Value uint32 `protobuf:"varint,13,opt,name=uint32_value,json=uint32Value" json:"uint32_value,omitempty"` + EnumValue NumericEnum `protobuf:"varint,14,opt,name=enum_value,json=enumValue,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"enum_value,omitempty"` + Sfixed32Value int32 `protobuf:"fixed32,15,opt,name=sfixed32_value,json=sfixed32Value" json:"sfixed32_value,omitempty"` + Sfixed64Value int64 `protobuf:"fixed64,16,opt,name=sfixed64_value,json=sfixed64Value" json:"sfixed64_value,omitempty"` + Sint32Value int32 `protobuf:"zigzag32,17,opt,name=sint32_value,json=sint32Value" json:"sint32_value,omitempty"` + Sint64Value int64 `protobuf:"zigzag64,18,opt,name=sint64_value,json=sint64Value" json:"sint64_value,omitempty"` + RepeatedStringValue []string `protobuf:"bytes,19,rep,name=repeated_string_value,json=repeatedStringValue" json:"repeated_string_value,omitempty"` + // Types that are valid to be assigned to OneofValue: + // *ABitOfEverything_OneofEmpty + // *ABitOfEverything_OneofString + OneofValue isABitOfEverything_OneofValue `protobuf_oneof:"oneof_value"` + MapValue map[string]NumericEnum `protobuf:"bytes,22,rep,name=map_value,json=mapValue" json:"map_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value,enum=grpc.gateway.examples.examplepb.NumericEnum"` + MappedStringValue map[string]string `protobuf:"bytes,23,rep,name=mapped_string_value,json=mappedStringValue" json:"mapped_string_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + MappedNestedValue map[string]*ABitOfEverything_Nested `protobuf:"bytes,24,rep,name=mapped_nested_value,json=mappedNestedValue" json:"mapped_nested_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + NonConventionalNameValue string `protobuf:"bytes,26,opt,name=nonConventionalNameValue" json:"nonConventionalNameValue,omitempty"` + TimestampValue *google_protobuf3.Timestamp `protobuf:"bytes,27,opt,name=timestamp_value,json=timestampValue" json:"timestamp_value,omitempty"` + // repeated enum value. it is comma-separated in query + RepeatedEnumValue []NumericEnum `protobuf:"varint,28,rep,packed,name=repeated_enum_value,json=repeatedEnumValue,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"repeated_enum_value,omitempty"` +} + +func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} } +func (m *ABitOfEverything) String() string { return proto.CompactTextString(m) } +func (*ABitOfEverything) ProtoMessage() {} +func (*ABitOfEverything) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } + +type isABitOfEverything_OneofValue interface { + isABitOfEverything_OneofValue() +} + +type ABitOfEverything_OneofEmpty struct { + OneofEmpty *google_protobuf1.Empty `protobuf:"bytes,20,opt,name=oneof_empty,json=oneofEmpty,oneof"` +} +type ABitOfEverything_OneofString struct { + OneofString string `protobuf:"bytes,21,opt,name=oneof_string,json=oneofString,oneof"` +} + +func (*ABitOfEverything_OneofEmpty) isABitOfEverything_OneofValue() {} +func (*ABitOfEverything_OneofString) isABitOfEverything_OneofValue() {} + +func (m *ABitOfEverything) GetOneofValue() isABitOfEverything_OneofValue { + if m != nil { + return m.OneofValue + } + return nil +} + +func (m *ABitOfEverything) GetSingleNested() *ABitOfEverything_Nested { + if m != nil { + return m.SingleNested + } + return nil +} + +func (m *ABitOfEverything) GetUuid() string { + if m != nil { + return m.Uuid + } + return "" +} + +func (m *ABitOfEverything) GetNested() []*ABitOfEverything_Nested { + if m != nil { + return m.Nested + } + return nil +} + +func (m *ABitOfEverything) GetFloatValue() float32 { + if m != nil { + return m.FloatValue + } + return 0 +} + +func (m *ABitOfEverything) GetDoubleValue() float64 { + if m != nil { + return m.DoubleValue + } + return 0 +} + +func (m *ABitOfEverything) GetInt64Value() int64 { + if m != nil { + return m.Int64Value + } + return 0 +} + +func (m *ABitOfEverything) GetUint64Value() uint64 { + if m != nil { + return m.Uint64Value + } + return 0 +} + +func (m *ABitOfEverything) GetInt32Value() int32 { + if m != nil { + return m.Int32Value + } + return 0 +} + +func (m *ABitOfEverything) GetFixed64Value() uint64 { + if m != nil { + return m.Fixed64Value + } + return 0 +} + +func (m *ABitOfEverything) GetFixed32Value() uint32 { + if m != nil { + return m.Fixed32Value + } + return 0 +} + +func (m *ABitOfEverything) GetBoolValue() bool { + if m != nil { + return m.BoolValue + } + return false +} + +func (m *ABitOfEverything) GetStringValue() string { + if m != nil { + return m.StringValue + } + return "" +} + +func (m *ABitOfEverything) GetUint32Value() uint32 { + if m != nil { + return m.Uint32Value + } + return 0 +} + +func (m *ABitOfEverything) GetEnumValue() NumericEnum { + if m != nil { + return m.EnumValue + } + return NumericEnum_ZERO +} + +func (m *ABitOfEverything) GetSfixed32Value() int32 { + if m != nil { + return m.Sfixed32Value + } + return 0 +} + +func (m *ABitOfEverything) GetSfixed64Value() int64 { + if m != nil { + return m.Sfixed64Value + } + return 0 +} + +func (m *ABitOfEverything) GetSint32Value() int32 { + if m != nil { + return m.Sint32Value + } + return 0 +} + +func (m *ABitOfEverything) GetSint64Value() int64 { + if m != nil { + return m.Sint64Value + } + return 0 +} + +func (m *ABitOfEverything) GetRepeatedStringValue() []string { + if m != nil { + return m.RepeatedStringValue + } + return nil +} + +func (m *ABitOfEverything) GetOneofEmpty() *google_protobuf1.Empty { + if x, ok := m.GetOneofValue().(*ABitOfEverything_OneofEmpty); ok { + return x.OneofEmpty + } + return nil +} + +func (m *ABitOfEverything) GetOneofString() string { + if x, ok := m.GetOneofValue().(*ABitOfEverything_OneofString); ok { + return x.OneofString + } + return "" +} + +func (m *ABitOfEverything) GetMapValue() map[string]NumericEnum { + if m != nil { + return m.MapValue + } + return nil +} + +func (m *ABitOfEverything) GetMappedStringValue() map[string]string { + if m != nil { + return m.MappedStringValue + } + return nil +} + +func (m *ABitOfEverything) GetMappedNestedValue() map[string]*ABitOfEverything_Nested { + if m != nil { + return m.MappedNestedValue + } + return nil +} + +func (m *ABitOfEverything) GetNonConventionalNameValue() string { + if m != nil { + return m.NonConventionalNameValue + } + return "" +} + +func (m *ABitOfEverything) GetTimestampValue() *google_protobuf3.Timestamp { + if m != nil { + return m.TimestampValue + } + return nil +} + +func (m *ABitOfEverything) GetRepeatedEnumValue() []NumericEnum { + if m != nil { + return m.RepeatedEnumValue + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*ABitOfEverything) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _ABitOfEverything_OneofMarshaler, _ABitOfEverything_OneofUnmarshaler, _ABitOfEverything_OneofSizer, []interface{}{ + (*ABitOfEverything_OneofEmpty)(nil), + (*ABitOfEverything_OneofString)(nil), + } +} + +func _ABitOfEverything_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*ABitOfEverything) + // oneof_value + switch x := m.OneofValue.(type) { + case *ABitOfEverything_OneofEmpty: + b.EncodeVarint(20<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.OneofEmpty); err != nil { + return err + } + case *ABitOfEverything_OneofString: + b.EncodeVarint(21<<3 | proto.WireBytes) + b.EncodeStringBytes(x.OneofString) + case nil: + default: + return fmt.Errorf("ABitOfEverything.OneofValue has unexpected type %T", x) + } + return nil +} + +func _ABitOfEverything_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*ABitOfEverything) + switch tag { + case 20: // oneof_value.oneof_empty + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(google_protobuf1.Empty) + err := b.DecodeMessage(msg) + m.OneofValue = &ABitOfEverything_OneofEmpty{msg} + return true, err + case 21: // oneof_value.oneof_string + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.OneofValue = &ABitOfEverything_OneofString{x} + return true, err + default: + return false, nil + } +} + +func _ABitOfEverything_OneofSizer(msg proto.Message) (n int) { + m := msg.(*ABitOfEverything) + // oneof_value + switch x := m.OneofValue.(type) { + case *ABitOfEverything_OneofEmpty: + s := proto.Size(x.OneofEmpty) + n += proto.SizeVarint(20<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *ABitOfEverything_OneofString: + n += proto.SizeVarint(21<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.OneofString))) + n += len(x.OneofString) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// Nested is nested type. +type ABitOfEverything_Nested struct { + // name is nested field. + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Amount uint32 `protobuf:"varint,2,opt,name=amount" json:"amount,omitempty"` + Ok ABitOfEverything_Nested_DeepEnum `protobuf:"varint,3,opt,name=ok,enum=grpc.gateway.examples.examplepb.ABitOfEverything_Nested_DeepEnum" json:"ok,omitempty"` +} + +func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested{} } +func (m *ABitOfEverything_Nested) String() string { return proto.CompactTextString(m) } +func (*ABitOfEverything_Nested) ProtoMessage() {} +func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0, 0} } + +func (m *ABitOfEverything_Nested) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *ABitOfEverything_Nested) GetAmount() uint32 { + if m != nil { + return m.Amount + } + return 0 +} + +func (m *ABitOfEverything_Nested) GetOk() ABitOfEverything_Nested_DeepEnum { + if m != nil { + return m.Ok + } + return ABitOfEverything_Nested_FALSE +} + +func init() { + proto.RegisterType((*ABitOfEverything)(nil), "grpc.gateway.examples.examplepb.ABitOfEverything") + proto.RegisterType((*ABitOfEverything_Nested)(nil), "grpc.gateway.examples.examplepb.ABitOfEverything.Nested") + proto.RegisterEnum("grpc.gateway.examples.examplepb.NumericEnum", NumericEnum_name, NumericEnum_value) + proto.RegisterEnum("grpc.gateway.examples.examplepb.ABitOfEverything_Nested_DeepEnum", ABitOfEverything_Nested_DeepEnum_name, ABitOfEverything_Nested_DeepEnum_value) +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for ABitOfEverythingService service + +type ABitOfEverythingServiceClient interface { + Create(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) + CreateBody(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) + Lookup(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*ABitOfEverything, error) + Update(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + Delete(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + GetQuery(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + Echo(ctx context.Context, in *grpc_gateway_examples_sub.StringMessage, opts ...grpc.CallOption) (*grpc_gateway_examples_sub.StringMessage, error) + DeepPathEcho(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) + NoBindings(ctx context.Context, in *google_protobuf2.Duration, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + Timeout(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) +} + +type aBitOfEverythingServiceClient struct { + cc *grpc.ClientConn +} + +func NewABitOfEverythingServiceClient(cc *grpc.ClientConn) ABitOfEverythingServiceClient { + return &aBitOfEverythingServiceClient{cc} +} + +func (c *aBitOfEverythingServiceClient) Create(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { + out := new(ABitOfEverything) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Create", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aBitOfEverythingServiceClient) CreateBody(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { + out := new(ABitOfEverything) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CreateBody", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aBitOfEverythingServiceClient) Lookup(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*ABitOfEverything, error) { + out := new(ABitOfEverything) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Lookup", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aBitOfEverythingServiceClient) Update(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Update", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aBitOfEverythingServiceClient) Delete(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Delete", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aBitOfEverythingServiceClient) GetQuery(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetQuery", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aBitOfEverythingServiceClient) Echo(ctx context.Context, in *grpc_gateway_examples_sub.StringMessage, opts ...grpc.CallOption) (*grpc_gateway_examples_sub.StringMessage, error) { + out := new(grpc_gateway_examples_sub.StringMessage) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Echo", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aBitOfEverythingServiceClient) DeepPathEcho(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { + out := new(ABitOfEverything) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/DeepPathEcho", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aBitOfEverythingServiceClient) NoBindings(ctx context.Context, in *google_protobuf2.Duration, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/NoBindings", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aBitOfEverythingServiceClient) Timeout(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Timeout", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for ABitOfEverythingService service + +type ABitOfEverythingServiceServer interface { + Create(context.Context, *ABitOfEverything) (*ABitOfEverything, error) + CreateBody(context.Context, *ABitOfEverything) (*ABitOfEverything, error) + Lookup(context.Context, *sub2.IdMessage) (*ABitOfEverything, error) + Update(context.Context, *ABitOfEverything) (*google_protobuf1.Empty, error) + Delete(context.Context, *sub2.IdMessage) (*google_protobuf1.Empty, error) + GetQuery(context.Context, *ABitOfEverything) (*google_protobuf1.Empty, error) + Echo(context.Context, *grpc_gateway_examples_sub.StringMessage) (*grpc_gateway_examples_sub.StringMessage, error) + DeepPathEcho(context.Context, *ABitOfEverything) (*ABitOfEverything, error) + NoBindings(context.Context, *google_protobuf2.Duration) (*google_protobuf1.Empty, error) + Timeout(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) +} + +func RegisterABitOfEverythingServiceServer(s *grpc.Server, srv ABitOfEverythingServiceServer) { + s.RegisterService(&_ABitOfEverythingService_serviceDesc, srv) +} + +func _ABitOfEverythingService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ABitOfEverything) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Create(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Create", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Create(ctx, req.(*ABitOfEverything)) + } + return interceptor(ctx, in, info, handler) +} + +func _ABitOfEverythingService_CreateBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ABitOfEverything) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).CreateBody(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CreateBody", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).CreateBody(ctx, req.(*ABitOfEverything)) + } + return interceptor(ctx, in, info, handler) +} + +func _ABitOfEverythingService_Lookup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(sub2.IdMessage) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Lookup(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Lookup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Lookup(ctx, req.(*sub2.IdMessage)) + } + return interceptor(ctx, in, info, handler) +} + +func _ABitOfEverythingService_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ABitOfEverything) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Update(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Update", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Update(ctx, req.(*ABitOfEverything)) + } + return interceptor(ctx, in, info, handler) +} + +func _ABitOfEverythingService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(sub2.IdMessage) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Delete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Delete", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Delete(ctx, req.(*sub2.IdMessage)) + } + return interceptor(ctx, in, info, handler) +} + +func _ABitOfEverythingService_GetQuery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ABitOfEverything) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).GetQuery(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetQuery", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).GetQuery(ctx, req.(*ABitOfEverything)) + } + return interceptor(ctx, in, info, handler) +} + +func _ABitOfEverythingService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(grpc_gateway_examples_sub.StringMessage) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Echo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Echo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Echo(ctx, req.(*grpc_gateway_examples_sub.StringMessage)) + } + return interceptor(ctx, in, info, handler) +} + +func _ABitOfEverythingService_DeepPathEcho_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ABitOfEverything) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).DeepPathEcho(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/DeepPathEcho", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).DeepPathEcho(ctx, req.(*ABitOfEverything)) + } + return interceptor(ctx, in, info, handler) +} + +func _ABitOfEverythingService_NoBindings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(google_protobuf2.Duration) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).NoBindings(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/NoBindings", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).NoBindings(ctx, req.(*google_protobuf2.Duration)) + } + return interceptor(ctx, in, info, handler) +} + +func _ABitOfEverythingService_Timeout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(google_protobuf1.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).Timeout(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Timeout", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).Timeout(ctx, req.(*google_protobuf1.Empty)) + } + return interceptor(ctx, in, info, handler) +} + +var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.gateway.examples.examplepb.ABitOfEverythingService", + HandlerType: (*ABitOfEverythingServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Create", + Handler: _ABitOfEverythingService_Create_Handler, + }, + { + MethodName: "CreateBody", + Handler: _ABitOfEverythingService_CreateBody_Handler, + }, + { + MethodName: "Lookup", + Handler: _ABitOfEverythingService_Lookup_Handler, + }, + { + MethodName: "Update", + Handler: _ABitOfEverythingService_Update_Handler, + }, + { + MethodName: "Delete", + Handler: _ABitOfEverythingService_Delete_Handler, + }, + { + MethodName: "GetQuery", + Handler: _ABitOfEverythingService_GetQuery_Handler, + }, + { + MethodName: "Echo", + Handler: _ABitOfEverythingService_Echo_Handler, + }, + { + MethodName: "DeepPathEcho", + Handler: _ABitOfEverythingService_DeepPathEcho_Handler, + }, + { + MethodName: "NoBindings", + Handler: _ABitOfEverythingService_NoBindings_Handler, + }, + { + MethodName: "Timeout", + Handler: _ABitOfEverythingService_Timeout_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "examples/examplepb/a_bit_of_everything.proto", +} + +// Client API for AnotherServiceWithNoBindings service + +type AnotherServiceWithNoBindingsClient interface { + NoBindings(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) +} + +type anotherServiceWithNoBindingsClient struct { + cc *grpc.ClientConn +} + +func NewAnotherServiceWithNoBindingsClient(cc *grpc.ClientConn) AnotherServiceWithNoBindingsClient { + return &anotherServiceWithNoBindingsClient{cc} +} + +func (c *anotherServiceWithNoBindingsClient) NoBindings(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.AnotherServiceWithNoBindings/NoBindings", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for AnotherServiceWithNoBindings service + +type AnotherServiceWithNoBindingsServer interface { + NoBindings(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) +} + +func RegisterAnotherServiceWithNoBindingsServer(s *grpc.Server, srv AnotherServiceWithNoBindingsServer) { + s.RegisterService(&_AnotherServiceWithNoBindings_serviceDesc, srv) +} + +func _AnotherServiceWithNoBindings_NoBindings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(google_protobuf1.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AnotherServiceWithNoBindingsServer).NoBindings(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.AnotherServiceWithNoBindings/NoBindings", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AnotherServiceWithNoBindingsServer).NoBindings(ctx, req.(*google_protobuf1.Empty)) + } + return interceptor(ctx, in, info, handler) +} + +var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.gateway.examples.examplepb.AnotherServiceWithNoBindings", + HandlerType: (*AnotherServiceWithNoBindingsServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "NoBindings", + Handler: _AnotherServiceWithNoBindings_NoBindings_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "examples/examplepb/a_bit_of_everything.proto", +} + +func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) } + +var fileDescriptor1 = []byte{ + // 1297 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0xd8, 0x89, 0x13, 0x3f, 0xc7, 0x89, 0x33, 0x69, 0x53, 0xd7, 0x2d, 0x64, 0x71, 0x01, + 0xad, 0x42, 0xb5, 0xab, 0xba, 0x15, 0x6a, 0x23, 0x41, 0x95, 0x34, 0x86, 0x22, 0xda, 0xb4, 0xdd, + 0xfe, 0x41, 0x8a, 0x5a, 0xac, 0xb5, 0x3d, 0xb6, 0x57, 0xf1, 0xee, 0x2c, 0xbb, 0xb3, 0x26, 0x96, + 0x31, 0x07, 0x0e, 0x5c, 0x38, 0x72, 0xef, 0x05, 0x09, 0x71, 0xe1, 0xc8, 0x19, 0xbe, 0x03, 0x5f, + 0x81, 0x03, 0x1f, 0x03, 0xed, 0xcc, 0xec, 0x76, 0xd7, 0x89, 0xe5, 0x26, 0x45, 0xbd, 0xed, 0xcc, + 0x7b, 0xef, 0xf7, 0x7b, 0x7f, 0xe6, 0xbd, 0x99, 0x85, 0xab, 0xe4, 0xc8, 0xb4, 0xdd, 0x3e, 0xf1, + 0x75, 0xf9, 0xe1, 0x36, 0x75, 0xb3, 0xd1, 0xb4, 0x58, 0x83, 0x76, 0x1a, 0x64, 0x40, 0xbc, 0x21, + 0xeb, 0x59, 0x4e, 0x57, 0x73, 0x3d, 0xca, 0x28, 0xde, 0xec, 0x7a, 0x6e, 0x4b, 0xeb, 0x9a, 0x8c, + 0x7c, 0x6b, 0x0e, 0xb5, 0xc8, 0x54, 0x8b, 0x4d, 0x2b, 0x97, 0xbb, 0x94, 0x76, 0xfb, 0x44, 0x37, + 0x5d, 0x4b, 0x37, 0x1d, 0x87, 0x32, 0x93, 0x59, 0xd4, 0xf1, 0x85, 0x79, 0xe5, 0x92, 0x94, 0xf2, + 0x55, 0x33, 0xe8, 0xe8, 0xc4, 0x76, 0xd9, 0x50, 0x0a, 0xdf, 0x9d, 0x14, 0xb6, 0x03, 0x8f, 0x5b, + 0x4b, 0x79, 0x25, 0xf6, 0xd4, 0x0f, 0x9a, 0xba, 0x4d, 0x7c, 0xdf, 0xec, 0x92, 0x08, 0x38, 0x29, + 0xab, 0x4d, 0x08, 0x37, 0x27, 0x81, 0x99, 0x65, 0x13, 0x9f, 0x99, 0xb6, 0x2b, 0x14, 0xaa, 0x7f, + 0xad, 0x42, 0x69, 0x67, 0xd7, 0x62, 0x0f, 0x3a, 0xf5, 0x38, 0x60, 0xfc, 0x02, 0x8a, 0xbe, 0xe5, + 0x74, 0xfb, 0xa4, 0xe1, 0x10, 0x9f, 0x91, 0x76, 0xf9, 0xa2, 0x82, 0xd4, 0x42, 0xed, 0xa6, 0x36, + 0x23, 0x05, 0xda, 0x24, 0x92, 0xb6, 0xcf, 0xed, 0x8d, 0x65, 0x01, 0x27, 0x56, 0x18, 0xc3, 0x7c, + 0x10, 0x58, 0xed, 0x32, 0x52, 0x90, 0x9a, 0x37, 0xf8, 0x37, 0x7e, 0x08, 0x39, 0xc9, 0x95, 0x51, + 0xb2, 0x6f, 0xc4, 0x25, 0x71, 0xf0, 0x26, 0x14, 0x3a, 0x7d, 0x6a, 0xb2, 0xc6, 0xc0, 0xec, 0x07, + 0xa4, 0x9c, 0x55, 0x90, 0x9a, 0x31, 0x80, 0x6f, 0x3d, 0x0b, 0x77, 0xf0, 0x7b, 0xb0, 0xdc, 0xa6, + 0x41, 0xb3, 0x4f, 0xa4, 0xc6, 0xbc, 0x82, 0x54, 0x64, 0x14, 0xc4, 0x9e, 0x50, 0xd9, 0x84, 0x82, + 0xe5, 0xb0, 0x8f, 0x6f, 0x48, 0x8d, 0x05, 0x05, 0xa9, 0x59, 0x03, 0xf8, 0x56, 0x8c, 0x11, 0x24, + 0x35, 0x72, 0x0a, 0x52, 0xe7, 0x8d, 0x42, 0x90, 0x50, 0x11, 0x18, 0xd7, 0x6b, 0x52, 0x63, 0x51, + 0x41, 0xea, 0x02, 0xc7, 0xb8, 0x5e, 0x13, 0x0a, 0x57, 0xa0, 0xd8, 0xb1, 0x8e, 0x48, 0x3b, 0x06, + 0x59, 0x52, 0x90, 0x9a, 0x33, 0x96, 0xe5, 0x66, 0x5a, 0x29, 0xc6, 0xc9, 0x2b, 0x48, 0x5d, 0x94, + 0x4a, 0x11, 0xd2, 0x3b, 0x00, 0x4d, 0x4a, 0xfb, 0x52, 0x03, 0x14, 0xa4, 0x2e, 0x19, 0xf9, 0x70, + 0x27, 0x76, 0xd6, 0x67, 0x9e, 0xe5, 0x74, 0xa5, 0x42, 0x81, 0xe7, 0xbf, 0x20, 0xf6, 0x52, 0xf1, + 0xc4, 0x2c, 0x45, 0x05, 0xa9, 0x45, 0x11, 0x4f, 0x44, 0xf2, 0x25, 0x00, 0x71, 0x02, 0x5b, 0x2a, + 0xac, 0x28, 0x48, 0x5d, 0xa9, 0x5d, 0x9d, 0x59, 0xad, 0xfd, 0xc0, 0x26, 0x9e, 0xd5, 0xaa, 0x3b, + 0x81, 0x6d, 0xe4, 0x43, 0x7b, 0x01, 0xf6, 0x01, 0xac, 0xf8, 0xe9, 0xb8, 0x56, 0x15, 0xa4, 0xae, + 0x1a, 0x45, 0x3f, 0x15, 0x58, 0xac, 0x16, 0xe7, 0xa8, 0xa4, 0x20, 0xb5, 0x14, 0xa9, 0x25, 0xaa, + 0xe1, 0x27, 0xbd, 0x5f, 0x53, 0x90, 0xba, 0x66, 0x14, 0xfc, 0x84, 0xf7, 0x52, 0x25, 0xc6, 0xc1, + 0x0a, 0x52, 0xb1, 0x50, 0x89, 0x50, 0x6a, 0x70, 0xde, 0x23, 0x2e, 0x31, 0x19, 0x69, 0x37, 0x52, + 0xf9, 0x5a, 0x57, 0xb2, 0x6a, 0xde, 0x58, 0x8f, 0x84, 0x8f, 0x13, 0x79, 0xbb, 0x05, 0x05, 0xea, + 0x90, 0x70, 0x6c, 0x84, 0x5d, 0x5d, 0x3e, 0xc7, 0xfb, 0x65, 0x43, 0x13, 0xdd, 0xa7, 0x45, 0xdd, + 0xa7, 0xd5, 0x43, 0xe9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0xff, 0xab, 0xe5, 0x92, 0x0d, 0xc9, 0x0f, 0x00, + 0x00, +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.pb.gw.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.pb.gw.go new file mode 100644 index 0000000..f8f3eab --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -0,0 +1,839 @@ +// Code generated by protoc-gen-grpc-gateway +// source: examples/examplepb/a_bit_of_everything.proto +// DO NOT EDIT! + +/* +Package examplepb is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package examplepb + +import ( + "io" + "net/http" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes/empty" + "github.com/grpc-ecosystem/grpc-gateway/examples/sub" + "github.com/grpc-ecosystem/grpc-gateway/examples/sub2" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "golang.org/x/net/context" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" +) + +var _ codes.Code +var _ io.Reader +var _ = runtime.String +var _ = utilities.NewDoubleArray + +var ( + filter_ABitOfEverythingService_Create_0 = &utilities.DoubleArray{Encoding: map[string]int{"float_value": 0, "double_value": 1, "int64_value": 2, "uint64_value": 3, "int32_value": 4, "fixed64_value": 5, "fixed32_value": 6, "bool_value": 7, "string_value": 8, "uint32_value": 9, "sfixed32_value": 10, "sfixed64_value": 11, "sint32_value": 12, "sint64_value": 13, "nonConventionalNameValue": 14}, Base: []int{1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Check: []int{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}} +) + +func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ABitOfEverything + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["float_value"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "float_value") + } + + protoReq.FloatValue, err = runtime.Float32(val) + + if err != nil { + return nil, metadata, err + } + + val, ok = pathParams["double_value"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "double_value") + } + + protoReq.DoubleValue, err = runtime.Float64(val) + + if err != nil { + return nil, metadata, err + } + + val, ok = pathParams["int64_value"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "int64_value") + } + + protoReq.Int64Value, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, err + } + + val, ok = pathParams["uint64_value"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "uint64_value") + } + + protoReq.Uint64Value, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, err + } + + val, ok = pathParams["int32_value"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "int32_value") + } + + protoReq.Int32Value, err = runtime.Int32(val) + + if err != nil { + return nil, metadata, err + } + + val, ok = pathParams["fixed64_value"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "fixed64_value") + } + + protoReq.Fixed64Value, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, err + } + + val, ok = pathParams["fixed32_value"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "fixed32_value") + } + + protoReq.Fixed32Value, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, err + } + + val, ok = pathParams["bool_value"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "bool_value") + } + + protoReq.BoolValue, err = runtime.Bool(val) + + if err != nil { + return nil, metadata, err + } + + val, ok = pathParams["string_value"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "string_value") + } + + protoReq.StringValue, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + val, ok = pathParams["uint32_value"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "uint32_value") + } + + protoReq.Uint32Value, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, err + } + + val, ok = pathParams["sfixed32_value"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "sfixed32_value") + } + + protoReq.Sfixed32Value, err = runtime.Int32(val) + + if err != nil { + return nil, metadata, err + } + + val, ok = pathParams["sfixed64_value"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "sfixed64_value") + } + + protoReq.Sfixed64Value, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, err + } + + val, ok = pathParams["sint32_value"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "sint32_value") + } + + protoReq.Sint32Value, err = runtime.Int32(val) + + if err != nil { + return nil, metadata, err + } + + val, ok = pathParams["sint64_value"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "sint64_value") + } + + protoReq.Sint64Value, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, err + } + + val, ok = pathParams["nonConventionalNameValue"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "nonConventionalNameValue") + } + + protoReq.NonConventionalNameValue, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_Create_0); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Create(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_ABitOfEverythingService_CreateBody_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ABitOfEverything + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_ABitOfEverythingService_Lookup_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq sub2.IdMessage + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["uuid"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") + } + + protoReq.Uuid, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + msg, err := client.Lookup(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_ABitOfEverythingService_Update_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ABitOfEverything + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["uuid"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") + } + + protoReq.Uuid, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + msg, err := client.Update(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_ABitOfEverythingService_Delete_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq sub2.IdMessage + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["uuid"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") + } + + protoReq.Uuid, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + msg, err := client.Delete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +var ( + filter_ABitOfEverythingService_GetQuery_0 = &utilities.DoubleArray{Encoding: map[string]int{"uuid": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_ABitOfEverythingService_GetQuery_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ABitOfEverything + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["uuid"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid") + } + + protoReq.Uuid, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_GetQuery_0); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetQuery(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_ABitOfEverythingService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq sub.StringMessage + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["value"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "value") + } + + protoReq.Value, err = runtime.StringP(val) + + if err != nil { + return nil, metadata, err + } + + msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_ABitOfEverythingService_Echo_1(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq sub.StringMessage + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Value); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +var ( + filter_ABitOfEverythingService_Echo_2 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_ABitOfEverythingService_Echo_2(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq sub.StringMessage + var metadata runtime.ServerMetadata + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_Echo_2); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_ABitOfEverythingService_DeepPathEcho_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ABitOfEverything + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["single_nested.name"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "single_nested.name") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "single_nested.name", val) + + if err != nil { + return nil, metadata, err + } + + msg, err := client.DeepPathEcho(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_ABitOfEverythingService_Timeout_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq empty.Empty + var metadata runtime.ServerMetadata + + msg, err := client.Timeout(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +// RegisterABitOfEverythingServiceHandlerFromEndpoint is same as RegisterABitOfEverythingServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterABitOfEverythingServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterABitOfEverythingServiceHandler(ctx, mux, conn) +} + +// RegisterABitOfEverythingServiceHandler registers the http handlers for service ABitOfEverythingService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + client := NewABitOfEverythingServiceClient(conn) + + mux.Handle("POST", pattern_ABitOfEverythingService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_ABitOfEverythingService_Create_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_Create_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_ABitOfEverythingService_CreateBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_ABitOfEverythingService_CreateBody_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_CreateBody_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ABitOfEverythingService_Lookup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_ABitOfEverythingService_Lookup_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_Lookup_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_ABitOfEverythingService_Update_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_ABitOfEverythingService_Update_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_Update_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_ABitOfEverythingService_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_ABitOfEverythingService_Delete_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_Delete_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ABitOfEverythingService_GetQuery_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_ABitOfEverythingService_GetQuery_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_GetQuery_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ABitOfEverythingService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_ABitOfEverythingService_Echo_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_Echo_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_ABitOfEverythingService_Echo_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_ABitOfEverythingService_Echo_1(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_Echo_1(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ABitOfEverythingService_Echo_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_ABitOfEverythingService_Echo_2(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_Echo_2(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_ABitOfEverythingService_DeepPathEcho_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_ABitOfEverythingService_DeepPathEcho_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_DeepPathEcho_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ABitOfEverythingService_Timeout_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_ABitOfEverythingService_Timeout_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_Timeout_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_ABitOfEverythingService_Create_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 1, 0, 4, 1, 5, 8, 1, 0, 4, 1, 5, 9, 1, 0, 4, 1, 5, 10, 1, 0, 4, 1, 5, 11, 2, 12, 1, 0, 4, 2, 5, 13, 1, 0, 4, 1, 5, 14, 1, 0, 4, 1, 5, 15, 1, 0, 4, 1, 5, 16, 1, 0, 4, 1, 5, 17, 1, 0, 4, 1, 5, 18, 1, 0, 4, 1, 5, 19}, []string{"v1", "example", "a_bit_of_everything", "float_value", "double_value", "int64_value", "separator", "uint64_value", "int32_value", "fixed64_value", "fixed32_value", "bool_value", "strprefix", "string_value", "uint32_value", "sfixed32_value", "sfixed64_value", "sint32_value", "sint64_value", "nonConventionalNameValue"}, "")) + + pattern_ABitOfEverythingService_CreateBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "a_bit_of_everything"}, "")) + + pattern_ABitOfEverythingService_Lookup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "uuid"}, "")) + + pattern_ABitOfEverythingService_Update_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "uuid"}, "")) + + pattern_ABitOfEverythingService_Delete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "uuid"}, "")) + + pattern_ABitOfEverythingService_GetQuery_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "a_bit_of_everything", "query", "uuid"}, "")) + + pattern_ABitOfEverythingService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "a_bit_of_everything", "echo", "value"}, "")) + + pattern_ABitOfEverythingService_Echo_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "echo"}, "")) + + pattern_ABitOfEverythingService_Echo_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "echo"}, "")) + + pattern_ABitOfEverythingService_DeepPathEcho_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "single_nested.name"}, "")) + + pattern_ABitOfEverythingService_Timeout_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "timeout"}, "")) +) + +var ( + forward_ABitOfEverythingService_Create_0 = runtime.ForwardResponseMessage + + forward_ABitOfEverythingService_CreateBody_0 = runtime.ForwardResponseMessage + + forward_ABitOfEverythingService_Lookup_0 = runtime.ForwardResponseMessage + + forward_ABitOfEverythingService_Update_0 = runtime.ForwardResponseMessage + + forward_ABitOfEverythingService_Delete_0 = runtime.ForwardResponseMessage + + forward_ABitOfEverythingService_GetQuery_0 = runtime.ForwardResponseMessage + + forward_ABitOfEverythingService_Echo_0 = runtime.ForwardResponseMessage + + forward_ABitOfEverythingService_Echo_1 = runtime.ForwardResponseMessage + + forward_ABitOfEverythingService_Echo_2 = runtime.ForwardResponseMessage + + forward_ABitOfEverythingService_DeepPathEcho_0 = runtime.ForwardResponseMessage + + forward_ABitOfEverythingService_Timeout_0 = runtime.ForwardResponseMessage +) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.proto b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.proto new file mode 100644 index 0000000..91e561e --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.proto @@ -0,0 +1,137 @@ +syntax = "proto3"; +option go_package = "examplepb"; +package grpc.gateway.examples.examplepb; + +import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/duration.proto"; +import "examples/sub/message.proto"; +import "examples/sub2/message.proto"; +import "google/protobuf/timestamp.proto"; + +// Intentionaly complicated message type to cover much features of Protobuf. +// NEXT ID: 27 +message ABitOfEverything { + // Nested is nested type. + message Nested { + // name is nested field. + string name = 1; + uint32 amount = 2; + // DeepEnum is one or zero. + enum DeepEnum { + // FALSE is false. + FALSE = 0; + // TRUE is true. + TRUE = 1; + } + DeepEnum ok = 3; + } + Nested single_nested = 25; + + string uuid = 1; + repeated Nested nested = 2; + float float_value = 3; + double double_value = 4; + int64 int64_value = 5; + uint64 uint64_value = 6; + int32 int32_value = 7; + fixed64 fixed64_value = 8; + fixed32 fixed32_value = 9; + bool bool_value = 10; + string string_value = 11; + // TODO(yugui) add bytes_value + uint32 uint32_value = 13; + NumericEnum enum_value = 14; + sfixed32 sfixed32_value = 15; + sfixed64 sfixed64_value = 16; + sint32 sint32_value = 17; + sint64 sint64_value = 18; + repeated string repeated_string_value = 19; + oneof oneof_value { + google.protobuf.Empty oneof_empty = 20; + string oneof_string = 21; + } + + map map_value = 22; + map mapped_string_value = 23; + map mapped_nested_value = 24; + + string nonConventionalNameValue = 26; + + google.protobuf.Timestamp timestamp_value = 27; + + // repeated enum value. it is comma-separated in query + repeated NumericEnum repeated_enum_value = 28; +} + +// NumericEnum is one or zero. +enum NumericEnum { + // ZERO means 0 + ZERO = 0; + // ONE means 1 + ONE = 1; +} + +service ABitOfEverythingService { + rpc Create(ABitOfEverything) returns (ABitOfEverything) { + // TODO add enum_value + option (google.api.http) = { + post: "/v1/example/a_bit_of_everything/{float_value}/{double_value}/{int64_value}/separator/{uint64_value}/{int32_value}/{fixed64_value}/{fixed32_value}/{bool_value}/{string_value=strprefix/*}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}" + }; + } + rpc CreateBody(ABitOfEverything) returns (ABitOfEverything) { + option (google.api.http) = { + post: "/v1/example/a_bit_of_everything" + body: "*" + }; + } + rpc Lookup(sub2.IdMessage) returns (ABitOfEverything) { + option (google.api.http) = { + get: "/v1/example/a_bit_of_everything/{uuid}" + }; + } + rpc Update(ABitOfEverything) returns (google.protobuf.Empty) { + option (google.api.http) = { + put: "/v1/example/a_bit_of_everything/{uuid}" + body: "*" + }; + } + rpc Delete(sub2.IdMessage) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/example/a_bit_of_everything/{uuid}" + }; + } + rpc GetQuery(ABitOfEverything) returns (google.protobuf.Empty) { + option (google.api.http) = { + get: "/v1/example/a_bit_of_everything/query/{uuid}" + }; + } + rpc Echo(grpc.gateway.examples.sub.StringMessage) returns (grpc.gateway.examples.sub.StringMessage) { + option (google.api.http) = { + get: "/v1/example/a_bit_of_everything/echo/{value}" + additional_bindings { + post: "/v2/example/echo" + body: "value" + } + additional_bindings { + get: "/v2/example/echo" + } + }; + } + rpc DeepPathEcho(ABitOfEverything) returns (ABitOfEverything) { + option (google.api.http) = { + post: "/v1/example/a_bit_of_everything/{single_nested.name}" + body: "*" + }; + } + rpc NoBindings(google.protobuf.Duration) returns (google.protobuf.Empty) {} + rpc Timeout(google.protobuf.Empty) returns (google.protobuf.Empty) { + option (google.api.http) = { + get: "/v2/example/timeout", + }; + } +} + +service AnotherServiceWithNoBindings { + rpc NoBindings(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.swagger.json b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.swagger.json new file mode 100644 index 0000000..780d0d9 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.swagger.json @@ -0,0 +1,759 @@ +{ + "swagger": "2.0", + "info": { + "title": "examples/examplepb/a_bit_of_everything.proto", + "version": "version not set" + }, + "schemes": [ + "http", + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/example/a_bit_of_everything": { + "post": { + "operationId": "CreateBody", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/examplepbABitOfEverything" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/examplepbABitOfEverything" + } + } + ], + "tags": [ + "ABitOfEverythingService" + ] + } + }, + "/v1/example/a_bit_of_everything/echo/{value}": { + "get": { + "operationId": "Echo", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/subStringMessage" + } + } + }, + "parameters": [ + { + "name": "value", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "ABitOfEverythingService" + ] + } + }, + "/v1/example/a_bit_of_everything/query/{uuid}": { + "get": { + "operationId": "GetQuery", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/protobufEmpty" + } + } + }, + "parameters": [ + { + "name": "uuid", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "single_nested.name", + "description": "name is nested field.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "single_nested.amount", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "single_nested.ok", + "description": " - FALSE: FALSE is false.\n - TRUE: TRUE is true.", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "FALSE", + "TRUE" + ], + "default": "FALSE" + }, + { + "name": "float_value", + "in": "query", + "required": false, + "type": "number", + "format": "float" + }, + { + "name": "double_value", + "in": "query", + "required": false, + "type": "number", + "format": "double" + }, + { + "name": "int64_value", + "in": "query", + "required": false, + "type": "string", + "format": "int64" + }, + { + "name": "uint64_value", + "in": "query", + "required": false, + "type": "string", + "format": "uint64" + }, + { + "name": "int32_value", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "fixed64_value", + "in": "query", + "required": false, + "type": "string", + "format": "uint64" + }, + { + "name": "fixed32_value", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "bool_value", + "in": "query", + "required": false, + "type": "boolean", + "format": "boolean" + }, + { + "name": "string_value", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "uint32_value", + "description": "TODO(yugui) add bytes_value.", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "enum_value", + "description": " - ZERO: ZERO means 0\n - ONE: ONE means 1", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "ZERO", + "ONE" + ], + "default": "ZERO" + }, + { + "name": "sfixed32_value", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "sfixed64_value", + "in": "query", + "required": false, + "type": "string", + "format": "int64" + }, + { + "name": "sint32_value", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "sint64_value", + "in": "query", + "required": false, + "type": "string", + "format": "int64" + }, + { + "name": "repeated_string_value", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string" + } + }, + { + "name": "oneof_string", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "nonConventionalNameValue", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "timestamp_value", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "repeated_enum_value", + "description": "repeated enum value. it is comma-separated in query.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string", + "enum": [ + "ZERO", + "ONE" + ] + } + } + ], + "tags": [ + "ABitOfEverythingService" + ] + } + }, + "/v1/example/a_bit_of_everything/{float_value}/{double_value}/{int64_value}/separator/{uint64_value}/{int32_value}/{fixed64_value}/{fixed32_value}/{bool_value}/{string_value}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}": { + "post": { + "operationId": "Create", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/examplepbABitOfEverything" + } + } + }, + "parameters": [ + { + "name": "float_value", + "in": "path", + "required": true, + "type": "number", + "format": "float" + }, + { + "name": "double_value", + "in": "path", + "required": true, + "type": "number", + "format": "double" + }, + { + "name": "int64_value", + "in": "path", + "required": true, + "type": "string", + "format": "int64" + }, + { + "name": "uint64_value", + "in": "path", + "required": true, + "type": "string", + "format": "uint64" + }, + { + "name": "int32_value", + "in": "path", + "required": true, + "type": "integer", + "format": "int32" + }, + { + "name": "fixed64_value", + "in": "path", + "required": true, + "type": "string", + "format": "uint64" + }, + { + "name": "fixed32_value", + "in": "path", + "required": true, + "type": "integer", + "format": "int64" + }, + { + "name": "bool_value", + "in": "path", + "required": true, + "type": "boolean", + "format": "boolean" + }, + { + "name": "string_value", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "uint32_value", + "in": "path", + "required": true, + "type": "integer", + "format": "int64" + }, + { + "name": "sfixed32_value", + "in": "path", + "required": true, + "type": "integer", + "format": "int32" + }, + { + "name": "sfixed64_value", + "in": "path", + "required": true, + "type": "string", + "format": "int64" + }, + { + "name": "sint32_value", + "in": "path", + "required": true, + "type": "integer", + "format": "int32" + }, + { + "name": "sint64_value", + "in": "path", + "required": true, + "type": "string", + "format": "int64" + }, + { + "name": "nonConventionalNameValue", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "ABitOfEverythingService" + ] + } + }, + "/v1/example/a_bit_of_everything/{single_nested.name}": { + "post": { + "operationId": "DeepPathEcho", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/examplepbABitOfEverything" + } + } + }, + "parameters": [ + { + "name": "single_nested.name", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/examplepbABitOfEverything" + } + } + ], + "tags": [ + "ABitOfEverythingService" + ] + } + }, + "/v1/example/a_bit_of_everything/{uuid}": { + "get": { + "operationId": "Lookup", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/examplepbABitOfEverything" + } + } + }, + "parameters": [ + { + "name": "uuid", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "ABitOfEverythingService" + ] + }, + "delete": { + "operationId": "Delete", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/protobufEmpty" + } + } + }, + "parameters": [ + { + "name": "uuid", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "ABitOfEverythingService" + ] + }, + "put": { + "operationId": "Update", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/protobufEmpty" + } + } + }, + "parameters": [ + { + "name": "uuid", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/examplepbABitOfEverything" + } + } + ], + "tags": [ + "ABitOfEverythingService" + ] + } + }, + "/v2/example/echo": { + "get": { + "operationId": "Echo", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/subStringMessage" + } + } + }, + "parameters": [ + { + "name": "value", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "ABitOfEverythingService" + ] + }, + "post": { + "operationId": "Echo", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/subStringMessage" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "string" + } + } + ], + "tags": [ + "ABitOfEverythingService" + ] + } + }, + "/v2/example/timeout": { + "get": { + "operationId": "Timeout", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/protobufEmpty" + } + } + }, + "tags": [ + "ABitOfEverythingService" + ] + } + } + }, + "definitions": { + "ABitOfEverythingNested": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "name is nested field." + }, + "amount": { + "type": "integer", + "format": "int64" + }, + "ok": { + "$ref": "#/definitions/NestedDeepEnum" + } + }, + "description": "Nested is nested type." + }, + "NestedDeepEnum": { + "type": "string", + "enum": [ + "FALSE", + "TRUE" + ], + "default": "FALSE", + "description": "DeepEnum is one or zero.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true." + }, + "examplepbABitOfEverything": { + "type": "object", + "properties": { + "single_nested": { + "$ref": "#/definitions/ABitOfEverythingNested" + }, + "uuid": { + "type": "string" + }, + "nested": { + "type": "array", + "items": { + "$ref": "#/definitions/ABitOfEverythingNested" + } + }, + "float_value": { + "type": "number", + "format": "float" + }, + "double_value": { + "type": "number", + "format": "double" + }, + "int64_value": { + "type": "string", + "format": "int64" + }, + "uint64_value": { + "type": "string", + "format": "uint64" + }, + "int32_value": { + "type": "integer", + "format": "int32" + }, + "fixed64_value": { + "type": "string", + "format": "uint64" + }, + "fixed32_value": { + "type": "integer", + "format": "int64" + }, + "bool_value": { + "type": "boolean", + "format": "boolean" + }, + "string_value": { + "type": "string" + }, + "uint32_value": { + "type": "integer", + "format": "int64", + "title": "TODO(yugui) add bytes_value" + }, + "enum_value": { + "$ref": "#/definitions/examplepbNumericEnum" + }, + "sfixed32_value": { + "type": "integer", + "format": "int32" + }, + "sfixed64_value": { + "type": "string", + "format": "int64" + }, + "sint32_value": { + "type": "integer", + "format": "int32" + }, + "sint64_value": { + "type": "string", + "format": "int64" + }, + "repeated_string_value": { + "type": "array", + "items": { + "type": "string" + } + }, + "oneof_empty": { + "$ref": "#/definitions/protobufEmpty" + }, + "oneof_string": { + "type": "string" + }, + "map_value": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/examplepbNumericEnum" + } + }, + "mapped_string_value": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "mapped_nested_value": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/ABitOfEverythingNested" + } + }, + "nonConventionalNameValue": { + "type": "string" + }, + "timestamp_value": { + "type": "string", + "format": "date-time" + }, + "repeated_enum_value": { + "type": "array", + "items": { + "$ref": "#/definitions/examplepbNumericEnum" + }, + "title": "repeated enum value. it is comma-separated in query" + } + }, + "title": "Intentionaly complicated message type to cover much features of Protobuf.\nNEXT ID: 27" + }, + "examplepbNumericEnum": { + "type": "string", + "enum": [ + "ZERO", + "ONE" + ], + "default": "ZERO", + "description": "NumericEnum is one or zero.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1" + }, + "protobufDuration": { + "type": "object", + "properties": { + "seconds": { + "type": "string", + "format": "int64", + "description": "Signed seconds of the span of time. Must be from -315,576,000,000\nto +315,576,000,000 inclusive." + }, + "nanos": { + "type": "integer", + "format": "int32", + "description": "Signed fractions of a second at nanosecond resolution of the span\nof time. Durations less than one second are represented with a 0\n`seconds` field and a positive or negative `nanos` field. For durations\nof one second or more, a non-zero value for the `nanos` field must be\nof the same sign as the `seconds` field. Must be from -999,999,999\nto +999,999,999 inclusive." + } + }, + "description": "A Duration represents a signed, fixed-length span of time represented\nas a count of seconds and fractions of seconds at nanosecond\nresolution. It is independent of any calendar and concepts like \"day\"\nor \"month\". It is related to Timestamp in that the difference between\ntwo Timestamp values is a Duration and it can be added or subtracted\nfrom a Timestamp. Range is approximately +-10,000 years.\n\nExample 1: Compute Duration from two Timestamps in pseudo code.\n\n Timestamp start = ...;\n Timestamp end = ...;\n Duration duration = ...;\n\n duration.seconds = end.seconds - start.seconds;\n duration.nanos = end.nanos - start.nanos;\n\n if (duration.seconds \u003c 0 \u0026\u0026 duration.nanos \u003e 0) {\n duration.seconds += 1;\n duration.nanos -= 1000000000;\n } else if (durations.seconds \u003e 0 \u0026\u0026 duration.nanos \u003c 0) {\n duration.seconds -= 1;\n duration.nanos += 1000000000;\n }\n\nExample 2: Compute Timestamp from Timestamp + Duration in pseudo code.\n\n Timestamp start = ...;\n Duration duration = ...;\n Timestamp end = ...;\n\n end.seconds = start.seconds + duration.seconds;\n end.nanos = start.nanos + duration.nanos;\n\n if (end.nanos \u003c 0) {\n end.seconds -= 1;\n end.nanos += 1000000000;\n } else if (end.nanos \u003e= 1000000000) {\n end.seconds += 1;\n end.nanos -= 1000000000;\n }\n\nExample 3: Compute Duration from datetime.timedelta in Python.\n\n td = datetime.timedelta(days=3, minutes=10)\n duration = Duration()\n duration.FromTimedelta(td)" + }, + "protobufEmpty": { + "type": "object", + "description": "service Foo {\n rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n }\n\nThe JSON representation for `Empty` is empty JSON object `{}`.", + "title": "A generic empty message that you can re-use to avoid defining duplicated\nempty messages in your APIs. A typical example is to use it as the request\nor the response type of an API method. For instance:" + }, + "sub2IdMessage": { + "type": "object", + "properties": { + "uuid": { + "type": "string" + } + } + }, + "subStringMessage": { + "type": "object", + "properties": { + "value": { + "type": "string" + } + } + } + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/echo_service.pb.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/echo_service.pb.go new file mode 100644 index 0000000..8edcf61 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/echo_service.pb.go @@ -0,0 +1,207 @@ +// Code generated by protoc-gen-go. +// source: examples/examplepb/echo_service.proto +// DO NOT EDIT! + +/* +Package examplepb is a generated protocol buffer package. + +Echo Service + +Echo Service API consists of a single service which returns +a message. + +It is generated from these files: + examples/examplepb/echo_service.proto + examples/examplepb/a_bit_of_everything.proto + examples/examplepb/stream.proto + examples/examplepb/flow_combination.proto + +It has these top-level messages: + SimpleMessage + ABitOfEverything + EmptyProto + NonEmptyProto + UnaryProto + NestedProto + SingleNestedProto +*/ +package examplepb + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "google.golang.org/genproto/googleapis/api/annotations" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +// SimpleMessage represents a simple message sent to the Echo service. +type SimpleMessage struct { + // Id represents the message identifier. + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` +} + +func (m *SimpleMessage) Reset() { *m = SimpleMessage{} } +func (m *SimpleMessage) String() string { return proto.CompactTextString(m) } +func (*SimpleMessage) ProtoMessage() {} +func (*SimpleMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *SimpleMessage) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func init() { + proto.RegisterType((*SimpleMessage)(nil), "grpc.gateway.examples.examplepb.SimpleMessage") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for EchoService service + +type EchoServiceClient interface { + // Echo method receives a simple message and returns it. + // + // The message posted as the id parameter will also be + // returned. + Echo(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) + // EchoBody method receives a simple message and returns it. + EchoBody(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) +} + +type echoServiceClient struct { + cc *grpc.ClientConn +} + +func NewEchoServiceClient(cc *grpc.ClientConn) EchoServiceClient { + return &echoServiceClient{cc} +} + +func (c *echoServiceClient) Echo(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) { + out := new(SimpleMessage) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.EchoService/Echo", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *echoServiceClient) EchoBody(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) { + out := new(SimpleMessage) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.EchoService/EchoBody", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for EchoService service + +type EchoServiceServer interface { + // Echo method receives a simple message and returns it. + // + // The message posted as the id parameter will also be + // returned. + Echo(context.Context, *SimpleMessage) (*SimpleMessage, error) + // EchoBody method receives a simple message and returns it. + EchoBody(context.Context, *SimpleMessage) (*SimpleMessage, error) +} + +func RegisterEchoServiceServer(s *grpc.Server, srv EchoServiceServer) { + s.RegisterService(&_EchoService_serviceDesc, srv) +} + +func _EchoService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SimpleMessage) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(EchoServiceServer).Echo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.EchoService/Echo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(EchoServiceServer).Echo(ctx, req.(*SimpleMessage)) + } + return interceptor(ctx, in, info, handler) +} + +func _EchoService_EchoBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SimpleMessage) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(EchoServiceServer).EchoBody(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.EchoService/EchoBody", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(EchoServiceServer).EchoBody(ctx, req.(*SimpleMessage)) + } + return interceptor(ctx, in, info, handler) +} + +var _EchoService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.gateway.examples.examplepb.EchoService", + HandlerType: (*EchoServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Echo", + Handler: _EchoService_Echo_Handler, + }, + { + MethodName: "EchoBody", + Handler: _EchoService_EchoBody_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "examples/examplepb/echo_service.proto", +} + +func init() { proto.RegisterFile("examples/examplepb/echo_service.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 229 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0xad, 0x48, 0xcc, + 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x87, 0x32, 0x0a, 0x92, 0xf4, 0x53, 0x93, 0x33, 0xf2, 0xe3, 0x8b, + 0x53, 0x8b, 0xca, 0x32, 0x93, 0x53, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0xe4, 0xd3, 0x8b, + 0x0a, 0x92, 0xf5, 0xd2, 0x13, 0x4b, 0x52, 0xcb, 0x13, 0x2b, 0xf5, 0x60, 0x7a, 0xf4, 0xe0, 0x7a, + 0xa4, 0x64, 0xd2, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, 0x32, 0xf5, 0x13, 0xf3, 0xf2, + 0xf2, 0x4b, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x8a, 0x21, 0xda, 0x95, 0xe4, 0xb9, 0x78, 0x83, 0x33, + 0x41, 0x2a, 0x7d, 0x53, 0x8b, 0x8b, 0x13, 0xd3, 0x53, 0x85, 0xf8, 0xb8, 0x98, 0x32, 0x53, 0x24, + 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0x98, 0x32, 0x53, 0x8c, 0x96, 0x30, 0x71, 0x71, 0xbb, 0x26, + 0x67, 0xe4, 0x07, 0x43, 0x6c, 0x15, 0x6a, 0x65, 0xe4, 0x62, 0x01, 0xf1, 0x85, 0xf4, 0xf4, 0x08, + 0xd8, 0xac, 0x87, 0x62, 0xb0, 0x14, 0x89, 0xea, 0x95, 0x64, 0x9b, 0x2e, 0x3f, 0x99, 0xcc, 0x24, + 0xae, 0x24, 0xaa, 0x5f, 0x66, 0x08, 0x0b, 0x02, 0x70, 0x00, 0xe8, 0x57, 0x67, 0xa6, 0xd4, 0x0a, + 0xf5, 0x30, 0x72, 0x71, 0x80, 0xdc, 0xe1, 0x94, 0x9f, 0x52, 0x49, 0x73, 0xb7, 0x28, 0x80, 0xdd, + 0x22, 0x85, 0xe9, 0x96, 0xf8, 0xa4, 0xfc, 0x94, 0x4a, 0x2b, 0x46, 0x2d, 0x27, 0xee, 0x28, 0x4e, + 0xb8, 0xe6, 0x24, 0x36, 0x70, 0xd8, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x26, 0x96, 0x37, + 0xac, 0xc3, 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/echo_service.pb.gw.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/echo_service.pb.gw.go new file mode 100644 index 0000000..1913006 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/echo_service.pb.gw.go @@ -0,0 +1,169 @@ +// Code generated by protoc-gen-grpc-gateway +// source: examples/examplepb/echo_service.proto +// DO NOT EDIT! + +/* +Package examplepb is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package examplepb + +import ( + "io" + "net/http" + + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "golang.org/x/net/context" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" +) + +var _ codes.Code +var _ io.Reader +var _ = runtime.String +var _ = utilities.NewDoubleArray + +func request_EchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SimpleMessage + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_EchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SimpleMessage + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.EchoBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +// RegisterEchoServiceHandlerFromEndpoint is same as RegisterEchoServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterEchoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterEchoServiceHandler(ctx, mux, conn) +} + +// RegisterEchoServiceHandler registers the http handlers for service EchoService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + client := NewEchoServiceClient(conn) + + mux.Handle("POST", pattern_EchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_EchoService_Echo_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_EchoService_Echo_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_EchoService_EchoBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_EchoService_EchoBody_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_EchoService_EchoBody_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_EchoService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "echo", "id"}, "")) + + pattern_EchoService_EchoBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_body"}, "")) +) + +var ( + forward_EchoService_Echo_0 = runtime.ForwardResponseMessage + + forward_EchoService_EchoBody_0 = runtime.ForwardResponseMessage +) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/echo_service.proto b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/echo_service.proto new file mode 100644 index 0000000..44555e8 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/echo_service.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; +option go_package = "examplepb"; + +// Echo Service +// +// Echo Service API consists of a single service which returns +// a message. +package grpc.gateway.examples.examplepb; + +import "google/api/annotations.proto"; + +// SimpleMessage represents a simple message sent to the Echo service. +message SimpleMessage { + // Id represents the message identifier. + string id = 1; +} + +// Echo service responds to incoming echo requests. +service EchoService { + // Echo method receives a simple message and returns it. + // + // The message posted as the id parameter will also be + // returned. + rpc Echo(SimpleMessage) returns (SimpleMessage) { + option (google.api.http) = { + post: "/v1/example/echo/{id}" + }; + } + // EchoBody method receives a simple message and returns it. + rpc EchoBody(SimpleMessage) returns (SimpleMessage) { + option (google.api.http) = { + post: "/v1/example/echo_body" + body: "*" + }; + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/echo_service.swagger.json b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/echo_service.swagger.json new file mode 100644 index 0000000..9380472 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/echo_service.swagger.json @@ -0,0 +1,85 @@ +{ + "swagger": "2.0", + "info": { + "title": "Echo Service", + "description": "Echo Service API consists of a single service which returns\na message.", + "version": "version not set" + }, + "schemes": [ + "http", + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/example/echo/{id}": { + "post": { + "summary": "Echo method receives a simple message and returns it.", + "description": "The message posted as the id parameter will also be\nreturned.", + "operationId": "Echo", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/examplepbSimpleMessage" + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "EchoService" + ] + } + }, + "/v1/example/echo_body": { + "post": { + "summary": "EchoBody method receives a simple message and returns it.", + "operationId": "EchoBody", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/examplepbSimpleMessage" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/examplepbSimpleMessage" + } + } + ], + "tags": [ + "EchoService" + ] + } + } + }, + "definitions": { + "examplepbSimpleMessage": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Id represents the message identifier." + } + }, + "description": "SimpleMessage represents a simple message sent to the Echo service." + } + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/flow_combination.pb.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/flow_combination.pb.go new file mode 100644 index 0000000..486b7c6 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/flow_combination.pb.go @@ -0,0 +1,723 @@ +// Code generated by protoc-gen-go. +// source: examples/examplepb/flow_combination.proto +// DO NOT EDIT! + +package examplepb + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "google.golang.org/genproto/googleapis/api/annotations" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +type EmptyProto struct { +} + +func (m *EmptyProto) Reset() { *m = EmptyProto{} } +func (m *EmptyProto) String() string { return proto.CompactTextString(m) } +func (*EmptyProto) ProtoMessage() {} +func (*EmptyProto) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{0} } + +type NonEmptyProto struct { + A string `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"` + B string `protobuf:"bytes,2,opt,name=b" json:"b,omitempty"` + C string `protobuf:"bytes,3,opt,name=c" json:"c,omitempty"` +} + +func (m *NonEmptyProto) Reset() { *m = NonEmptyProto{} } +func (m *NonEmptyProto) String() string { return proto.CompactTextString(m) } +func (*NonEmptyProto) ProtoMessage() {} +func (*NonEmptyProto) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{1} } + +func (m *NonEmptyProto) GetA() string { + if m != nil { + return m.A + } + return "" +} + +func (m *NonEmptyProto) GetB() string { + if m != nil { + return m.B + } + return "" +} + +func (m *NonEmptyProto) GetC() string { + if m != nil { + return m.C + } + return "" +} + +type UnaryProto struct { + Str string `protobuf:"bytes,1,opt,name=str" json:"str,omitempty"` +} + +func (m *UnaryProto) Reset() { *m = UnaryProto{} } +func (m *UnaryProto) String() string { return proto.CompactTextString(m) } +func (*UnaryProto) ProtoMessage() {} +func (*UnaryProto) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{2} } + +func (m *UnaryProto) GetStr() string { + if m != nil { + return m.Str + } + return "" +} + +type NestedProto struct { + A *UnaryProto `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"` + B string `protobuf:"bytes,2,opt,name=b" json:"b,omitempty"` + C string `protobuf:"bytes,3,opt,name=c" json:"c,omitempty"` +} + +func (m *NestedProto) Reset() { *m = NestedProto{} } +func (m *NestedProto) String() string { return proto.CompactTextString(m) } +func (*NestedProto) ProtoMessage() {} +func (*NestedProto) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{3} } + +func (m *NestedProto) GetA() *UnaryProto { + if m != nil { + return m.A + } + return nil +} + +func (m *NestedProto) GetB() string { + if m != nil { + return m.B + } + return "" +} + +func (m *NestedProto) GetC() string { + if m != nil { + return m.C + } + return "" +} + +type SingleNestedProto struct { + A *UnaryProto `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"` +} + +func (m *SingleNestedProto) Reset() { *m = SingleNestedProto{} } +func (m *SingleNestedProto) String() string { return proto.CompactTextString(m) } +func (*SingleNestedProto) ProtoMessage() {} +func (*SingleNestedProto) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{4} } + +func (m *SingleNestedProto) GetA() *UnaryProto { + if m != nil { + return m.A + } + return nil +} + +func init() { + proto.RegisterType((*EmptyProto)(nil), "grpc.gateway.examples.examplepb.EmptyProto") + proto.RegisterType((*NonEmptyProto)(nil), "grpc.gateway.examples.examplepb.NonEmptyProto") + proto.RegisterType((*UnaryProto)(nil), "grpc.gateway.examples.examplepb.UnaryProto") + proto.RegisterType((*NestedProto)(nil), "grpc.gateway.examples.examplepb.NestedProto") + proto.RegisterType((*SingleNestedProto)(nil), "grpc.gateway.examples.examplepb.SingleNestedProto") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for FlowCombination service + +type FlowCombinationClient interface { + RpcEmptyRpc(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (*EmptyProto, error) + RpcEmptyStream(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcEmptyStreamClient, error) + StreamEmptyRpc(ctx context.Context, opts ...grpc.CallOption) (FlowCombination_StreamEmptyRpcClient, error) + StreamEmptyStream(ctx context.Context, opts ...grpc.CallOption) (FlowCombination_StreamEmptyStreamClient, error) + RpcBodyRpc(ctx context.Context, in *NonEmptyProto, opts ...grpc.CallOption) (*EmptyProto, error) + RpcPathSingleNestedRpc(ctx context.Context, in *SingleNestedProto, opts ...grpc.CallOption) (*EmptyProto, error) + RpcPathNestedRpc(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (*EmptyProto, error) + RpcBodyStream(ctx context.Context, in *NonEmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcBodyStreamClient, error) + RpcPathSingleNestedStream(ctx context.Context, in *SingleNestedProto, opts ...grpc.CallOption) (FlowCombination_RpcPathSingleNestedStreamClient, error) + RpcPathNestedStream(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (FlowCombination_RpcPathNestedStreamClient, error) +} + +type flowCombinationClient struct { + cc *grpc.ClientConn +} + +func NewFlowCombinationClient(cc *grpc.ClientConn) FlowCombinationClient { + return &flowCombinationClient{cc} +} + +func (c *flowCombinationClient) RpcEmptyRpc(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (*EmptyProto, error) { + out := new(EmptyProto) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyRpc", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *flowCombinationClient) RpcEmptyStream(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcEmptyStreamClient, error) { + stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[0], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyStream", opts...) + if err != nil { + return nil, err + } + x := &flowCombinationRpcEmptyStreamClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type FlowCombination_RpcEmptyStreamClient interface { + Recv() (*EmptyProto, error) + grpc.ClientStream +} + +type flowCombinationRpcEmptyStreamClient struct { + grpc.ClientStream +} + +func (x *flowCombinationRpcEmptyStreamClient) Recv() (*EmptyProto, error) { + m := new(EmptyProto) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *flowCombinationClient) StreamEmptyRpc(ctx context.Context, opts ...grpc.CallOption) (FlowCombination_StreamEmptyRpcClient, error) { + stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[1], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/StreamEmptyRpc", opts...) + if err != nil { + return nil, err + } + x := &flowCombinationStreamEmptyRpcClient{stream} + return x, nil +} + +type FlowCombination_StreamEmptyRpcClient interface { + Send(*EmptyProto) error + CloseAndRecv() (*EmptyProto, error) + grpc.ClientStream +} + +type flowCombinationStreamEmptyRpcClient struct { + grpc.ClientStream +} + +func (x *flowCombinationStreamEmptyRpcClient) Send(m *EmptyProto) error { + return x.ClientStream.SendMsg(m) +} + +func (x *flowCombinationStreamEmptyRpcClient) CloseAndRecv() (*EmptyProto, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(EmptyProto) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *flowCombinationClient) StreamEmptyStream(ctx context.Context, opts ...grpc.CallOption) (FlowCombination_StreamEmptyStreamClient, error) { + stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[2], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/StreamEmptyStream", opts...) + if err != nil { + return nil, err + } + x := &flowCombinationStreamEmptyStreamClient{stream} + return x, nil +} + +type FlowCombination_StreamEmptyStreamClient interface { + Send(*EmptyProto) error + Recv() (*EmptyProto, error) + grpc.ClientStream +} + +type flowCombinationStreamEmptyStreamClient struct { + grpc.ClientStream +} + +func (x *flowCombinationStreamEmptyStreamClient) Send(m *EmptyProto) error { + return x.ClientStream.SendMsg(m) +} + +func (x *flowCombinationStreamEmptyStreamClient) Recv() (*EmptyProto, error) { + m := new(EmptyProto) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *flowCombinationClient) RpcBodyRpc(ctx context.Context, in *NonEmptyProto, opts ...grpc.CallOption) (*EmptyProto, error) { + out := new(EmptyProto) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcBodyRpc", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *flowCombinationClient) RpcPathSingleNestedRpc(ctx context.Context, in *SingleNestedProto, opts ...grpc.CallOption) (*EmptyProto, error) { + out := new(EmptyProto) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedRpc", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *flowCombinationClient) RpcPathNestedRpc(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (*EmptyProto, error) { + out := new(EmptyProto) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedRpc", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *flowCombinationClient) RpcBodyStream(ctx context.Context, in *NonEmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcBodyStreamClient, error) { + stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[3], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/RpcBodyStream", opts...) + if err != nil { + return nil, err + } + x := &flowCombinationRpcBodyStreamClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type FlowCombination_RpcBodyStreamClient interface { + Recv() (*EmptyProto, error) + grpc.ClientStream +} + +type flowCombinationRpcBodyStreamClient struct { + grpc.ClientStream +} + +func (x *flowCombinationRpcBodyStreamClient) Recv() (*EmptyProto, error) { + m := new(EmptyProto) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *flowCombinationClient) RpcPathSingleNestedStream(ctx context.Context, in *SingleNestedProto, opts ...grpc.CallOption) (FlowCombination_RpcPathSingleNestedStreamClient, error) { + stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[4], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedStream", opts...) + if err != nil { + return nil, err + } + x := &flowCombinationRpcPathSingleNestedStreamClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type FlowCombination_RpcPathSingleNestedStreamClient interface { + Recv() (*EmptyProto, error) + grpc.ClientStream +} + +type flowCombinationRpcPathSingleNestedStreamClient struct { + grpc.ClientStream +} + +func (x *flowCombinationRpcPathSingleNestedStreamClient) Recv() (*EmptyProto, error) { + m := new(EmptyProto) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *flowCombinationClient) RpcPathNestedStream(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (FlowCombination_RpcPathNestedStreamClient, error) { + stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[5], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedStream", opts...) + if err != nil { + return nil, err + } + x := &flowCombinationRpcPathNestedStreamClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type FlowCombination_RpcPathNestedStreamClient interface { + Recv() (*EmptyProto, error) + grpc.ClientStream +} + +type flowCombinationRpcPathNestedStreamClient struct { + grpc.ClientStream +} + +func (x *flowCombinationRpcPathNestedStreamClient) Recv() (*EmptyProto, error) { + m := new(EmptyProto) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// Server API for FlowCombination service + +type FlowCombinationServer interface { + RpcEmptyRpc(context.Context, *EmptyProto) (*EmptyProto, error) + RpcEmptyStream(*EmptyProto, FlowCombination_RpcEmptyStreamServer) error + StreamEmptyRpc(FlowCombination_StreamEmptyRpcServer) error + StreamEmptyStream(FlowCombination_StreamEmptyStreamServer) error + RpcBodyRpc(context.Context, *NonEmptyProto) (*EmptyProto, error) + RpcPathSingleNestedRpc(context.Context, *SingleNestedProto) (*EmptyProto, error) + RpcPathNestedRpc(context.Context, *NestedProto) (*EmptyProto, error) + RpcBodyStream(*NonEmptyProto, FlowCombination_RpcBodyStreamServer) error + RpcPathSingleNestedStream(*SingleNestedProto, FlowCombination_RpcPathSingleNestedStreamServer) error + RpcPathNestedStream(*NestedProto, FlowCombination_RpcPathNestedStreamServer) error +} + +func RegisterFlowCombinationServer(s *grpc.Server, srv FlowCombinationServer) { + s.RegisterService(&_FlowCombination_serviceDesc, srv) +} + +func _FlowCombination_RpcEmptyRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(EmptyProto) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FlowCombinationServer).RpcEmptyRpc(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyRpc", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FlowCombinationServer).RpcEmptyRpc(ctx, req.(*EmptyProto)) + } + return interceptor(ctx, in, info, handler) +} + +func _FlowCombination_RpcEmptyStream_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(EmptyProto) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(FlowCombinationServer).RpcEmptyStream(m, &flowCombinationRpcEmptyStreamServer{stream}) +} + +type FlowCombination_RpcEmptyStreamServer interface { + Send(*EmptyProto) error + grpc.ServerStream +} + +type flowCombinationRpcEmptyStreamServer struct { + grpc.ServerStream +} + +func (x *flowCombinationRpcEmptyStreamServer) Send(m *EmptyProto) error { + return x.ServerStream.SendMsg(m) +} + +func _FlowCombination_StreamEmptyRpc_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(FlowCombinationServer).StreamEmptyRpc(&flowCombinationStreamEmptyRpcServer{stream}) +} + +type FlowCombination_StreamEmptyRpcServer interface { + SendAndClose(*EmptyProto) error + Recv() (*EmptyProto, error) + grpc.ServerStream +} + +type flowCombinationStreamEmptyRpcServer struct { + grpc.ServerStream +} + +func (x *flowCombinationStreamEmptyRpcServer) SendAndClose(m *EmptyProto) error { + return x.ServerStream.SendMsg(m) +} + +func (x *flowCombinationStreamEmptyRpcServer) Recv() (*EmptyProto, error) { + m := new(EmptyProto) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _FlowCombination_StreamEmptyStream_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(FlowCombinationServer).StreamEmptyStream(&flowCombinationStreamEmptyStreamServer{stream}) +} + +type FlowCombination_StreamEmptyStreamServer interface { + Send(*EmptyProto) error + Recv() (*EmptyProto, error) + grpc.ServerStream +} + +type flowCombinationStreamEmptyStreamServer struct { + grpc.ServerStream +} + +func (x *flowCombinationStreamEmptyStreamServer) Send(m *EmptyProto) error { + return x.ServerStream.SendMsg(m) +} + +func (x *flowCombinationStreamEmptyStreamServer) Recv() (*EmptyProto, error) { + m := new(EmptyProto) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _FlowCombination_RpcBodyRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NonEmptyProto) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FlowCombinationServer).RpcBodyRpc(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.FlowCombination/RpcBodyRpc", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FlowCombinationServer).RpcBodyRpc(ctx, req.(*NonEmptyProto)) + } + return interceptor(ctx, in, info, handler) +} + +func _FlowCombination_RpcPathSingleNestedRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SingleNestedProto) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FlowCombinationServer).RpcPathSingleNestedRpc(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedRpc", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FlowCombinationServer).RpcPathSingleNestedRpc(ctx, req.(*SingleNestedProto)) + } + return interceptor(ctx, in, info, handler) +} + +func _FlowCombination_RpcPathNestedRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NestedProto) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FlowCombinationServer).RpcPathNestedRpc(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedRpc", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FlowCombinationServer).RpcPathNestedRpc(ctx, req.(*NestedProto)) + } + return interceptor(ctx, in, info, handler) +} + +func _FlowCombination_RpcBodyStream_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(NonEmptyProto) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(FlowCombinationServer).RpcBodyStream(m, &flowCombinationRpcBodyStreamServer{stream}) +} + +type FlowCombination_RpcBodyStreamServer interface { + Send(*EmptyProto) error + grpc.ServerStream +} + +type flowCombinationRpcBodyStreamServer struct { + grpc.ServerStream +} + +func (x *flowCombinationRpcBodyStreamServer) Send(m *EmptyProto) error { + return x.ServerStream.SendMsg(m) +} + +func _FlowCombination_RpcPathSingleNestedStream_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(SingleNestedProto) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(FlowCombinationServer).RpcPathSingleNestedStream(m, &flowCombinationRpcPathSingleNestedStreamServer{stream}) +} + +type FlowCombination_RpcPathSingleNestedStreamServer interface { + Send(*EmptyProto) error + grpc.ServerStream +} + +type flowCombinationRpcPathSingleNestedStreamServer struct { + grpc.ServerStream +} + +func (x *flowCombinationRpcPathSingleNestedStreamServer) Send(m *EmptyProto) error { + return x.ServerStream.SendMsg(m) +} + +func _FlowCombination_RpcPathNestedStream_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(NestedProto) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(FlowCombinationServer).RpcPathNestedStream(m, &flowCombinationRpcPathNestedStreamServer{stream}) +} + +type FlowCombination_RpcPathNestedStreamServer interface { + Send(*EmptyProto) error + grpc.ServerStream +} + +type flowCombinationRpcPathNestedStreamServer struct { + grpc.ServerStream +} + +func (x *flowCombinationRpcPathNestedStreamServer) Send(m *EmptyProto) error { + return x.ServerStream.SendMsg(m) +} + +var _FlowCombination_serviceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.gateway.examples.examplepb.FlowCombination", + HandlerType: (*FlowCombinationServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RpcEmptyRpc", + Handler: _FlowCombination_RpcEmptyRpc_Handler, + }, + { + MethodName: "RpcBodyRpc", + Handler: _FlowCombination_RpcBodyRpc_Handler, + }, + { + MethodName: "RpcPathSingleNestedRpc", + Handler: _FlowCombination_RpcPathSingleNestedRpc_Handler, + }, + { + MethodName: "RpcPathNestedRpc", + Handler: _FlowCombination_RpcPathNestedRpc_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "RpcEmptyStream", + Handler: _FlowCombination_RpcEmptyStream_Handler, + ServerStreams: true, + }, + { + StreamName: "StreamEmptyRpc", + Handler: _FlowCombination_StreamEmptyRpc_Handler, + ClientStreams: true, + }, + { + StreamName: "StreamEmptyStream", + Handler: _FlowCombination_StreamEmptyStream_Handler, + ServerStreams: true, + ClientStreams: true, + }, + { + StreamName: "RpcBodyStream", + Handler: _FlowCombination_RpcBodyStream_Handler, + ServerStreams: true, + }, + { + StreamName: "RpcPathSingleNestedStream", + Handler: _FlowCombination_RpcPathSingleNestedStream_Handler, + ServerStreams: true, + }, + { + StreamName: "RpcPathNestedStream", + Handler: _FlowCombination_RpcPathNestedStream_Handler, + ServerStreams: true, + }, + }, + Metadata: "examples/examplepb/flow_combination.proto", +} + +func init() { proto.RegisterFile("examples/examplepb/flow_combination.proto", fileDescriptor3) } + +var fileDescriptor3 = []byte{ + // 656 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x96, 0x3f, 0x8f, 0x12, 0x4f, + 0x18, 0xc7, 0xf3, 0x70, 0xc9, 0x2f, 0xb9, 0xe1, 0xfe, 0x70, 0xcb, 0x2f, 0x08, 0x1c, 0x1e, 0x77, + 0xe3, 0x25, 0xe2, 0xbf, 0x5d, 0x82, 0xd5, 0x51, 0x9e, 0xd1, 0x92, 0x5c, 0xb8, 0xd8, 0x6c, 0x63, + 0x66, 0x87, 0x15, 0x48, 0x60, 0x67, 0x6e, 0x77, 0x0d, 0x5e, 0x08, 0x31, 0xb1, 0xb1, 0xb4, 0xf0, + 0x05, 0x58, 0x5a, 0xf9, 0x06, 0xec, 0xac, 0x6c, 0x4c, 0x2c, 0x4c, 0xec, 0xec, 0xec, 0x7c, 0x13, + 0x66, 0x67, 0x66, 0x77, 0x58, 0x05, 0x37, 0x18, 0xb1, 0xdb, 0x99, 0x79, 0x9e, 0x67, 0x3e, 0xf3, + 0x7d, 0xbe, 0x0f, 0x01, 0xdd, 0x70, 0x9f, 0x92, 0x31, 0x1f, 0xb9, 0x81, 0xa5, 0x3e, 0xb8, 0x63, + 0x3d, 0x1e, 0xb1, 0xc9, 0x23, 0xca, 0xc6, 0xce, 0xd0, 0x23, 0xe1, 0x90, 0x79, 0x26, 0xf7, 0x59, + 0xc8, 0x8c, 0x7a, 0xdf, 0xe7, 0xd4, 0xec, 0x93, 0xd0, 0x9d, 0x90, 0x4b, 0x33, 0xce, 0x33, 0x93, + 0xbc, 0x6a, 0xad, 0xcf, 0x58, 0x7f, 0xe4, 0x5a, 0x84, 0x0f, 0x2d, 0xe2, 0x79, 0x2c, 0x14, 0xd9, + 0x81, 0x4c, 0xc7, 0x5b, 0x08, 0xdd, 0x1f, 0xf3, 0xf0, 0xf2, 0x4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40, 0x91, 0x6f, 0xe7, 0x1f, 0x94, 0xf2, 0xad, 0x0c, + 0xb1, 0xe3, 0x9f, 0x24, 0xe9, 0x20, 0xb5, 0x89, 0xf1, 0xd5, 0x25, 0xee, 0x8d, 0x0b, 0x53, 0x7b, + 0x1f, 0x97, 0x7e, 0x36, 0xb0, 0x3e, 0x3c, 0xc6, 0xf5, 0xa5, 0x1e, 0xd6, 0x51, 0x35, 0x35, 0x24, + 0x0b, 0x03, 0x9a, 0x60, 0xbc, 0x01, 0x54, 0x59, 0xe0, 0x65, 0xa5, 0xea, 0xda, 0xed, 0x7c, 0x5d, + 0x08, 0x7b, 0xa4, 0x9e, 0xb2, 0xa8, 0xe3, 0x09, 0xe9, 0x77, 0x40, 0xc5, 0x94, 0xa7, 0x15, 0xe3, + 0x1a, 0x6d, 0x3d, 0x11, 0x74, 0x17, 0xf8, 0xda, 0x6f, 0x6d, 0xad, 0xc5, 0xce, 0x7e, 0x47, 0xd2, + 0xb5, 0xe5, 0x21, 0x6d, 0xa0, 0x4d, 0x38, 0xcd, 0xdb, 0x9b, 0x09, 0x92, 0xf3, 0x9f, 0xf8, 0x07, + 0x74, 0xf7, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0xaf, 0x85, 0xaf, 0x3c, 0x6d, 0x09, 0x00, 0x00, +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/flow_combination.pb.gw.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/flow_combination.pb.gw.go new file mode 100644 index 0000000..af9da8d --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/flow_combination.pb.gw.go @@ -0,0 +1,1854 @@ +// Code generated by protoc-gen-grpc-gateway +// source: examples/examplepb/flow_combination.proto +// DO NOT EDIT! + +/* +Package examplepb is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package examplepb + +import ( + "io" + "net/http" + + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "golang.org/x/net/context" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" +) + +var _ codes.Code +var _ io.Reader +var _ = runtime.String +var _ = utilities.NewDoubleArray + +func request_FlowCombination_RpcEmptyRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq EmptyProto + var metadata runtime.ServerMetadata + + msg, err := client.RpcEmptyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_FlowCombination_RpcEmptyStream_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcEmptyStreamClient, runtime.ServerMetadata, error) { + var protoReq EmptyProto + var metadata runtime.ServerMetadata + + stream, err := client.RpcEmptyStream(ctx, &protoReq) + if err != nil { + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil + +} + +func request_FlowCombination_StreamEmptyRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var metadata runtime.ServerMetadata + stream, err := client.StreamEmptyRpc(ctx) + if err != nil { + grpclog.Printf("Failed to start streaming: %v", err) + return nil, metadata, err + } + dec := marshaler.NewDecoder(req.Body) + for { + var protoReq EmptyProto + err = dec.Decode(&protoReq) + if err == io.EOF { + break + } + if err != nil { + grpclog.Printf("Failed to decode request: %v", err) + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + if err = stream.Send(&protoReq); err != nil { + grpclog.Printf("Failed to send request: %v", err) + return nil, metadata, err + } + } + + if err := stream.CloseSend(); err != nil { + grpclog.Printf("Failed to terminate client stream: %v", err) + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + grpclog.Printf("Failed to get header from client: %v", err) + return nil, metadata, err + } + metadata.HeaderMD = header + + msg, err := stream.CloseAndRecv() + metadata.TrailerMD = stream.Trailer() + return msg, metadata, err + +} + +func request_FlowCombination_StreamEmptyStream_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_StreamEmptyStreamClient, runtime.ServerMetadata, error) { + var metadata runtime.ServerMetadata + stream, err := client.StreamEmptyStream(ctx) + if err != nil { + grpclog.Printf("Failed to start streaming: %v", err) + return nil, metadata, err + } + dec := marshaler.NewDecoder(req.Body) + handleSend := func() error { + var protoReq EmptyProto + err = dec.Decode(&protoReq) + if err == io.EOF { + return err + } + if err != nil { + grpclog.Printf("Failed to decode request: %v", err) + return err + } + if err = stream.Send(&protoReq); err != nil { + grpclog.Printf("Failed to send request: %v", err) + return err + } + return nil + } + if err := handleSend(); err != nil { + if cerr := stream.CloseSend(); cerr != nil { + grpclog.Printf("Failed to terminate client stream: %v", cerr) + } + if err == io.EOF { + return stream, metadata, nil + } + return nil, metadata, err + } + go func() { + for { + if err := handleSend(); err != nil { + break + } + } + if err := stream.CloseSend(); err != nil { + grpclog.Printf("Failed to terminate client stream: %v", err) + } + }() + header, err := stream.Header() + if err != nil { + grpclog.Printf("Failed to get header from client: %v", err) + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil +} + +func request_FlowCombination_RpcBodyRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NonEmptyProto + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RpcBodyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_FlowCombination_RpcBodyRpc_1(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NonEmptyProto + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + } + + protoReq.A, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + val, ok = pathParams["b"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "b") + } + + protoReq.B, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + val, ok = pathParams["c"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "c") + } + + protoReq.C, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + msg, err := client.RpcBodyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +var ( + filter_FlowCombination_RpcBodyRpc_2 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_FlowCombination_RpcBodyRpc_2(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NonEmptyProto + var metadata runtime.ServerMetadata + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyRpc_2); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RpcBodyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_FlowCombination_RpcBodyRpc_3(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NonEmptyProto + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + } + + protoReq.A, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + val, ok = pathParams["b"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "b") + } + + protoReq.B, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + msg, err := client.RpcBodyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +var ( + filter_FlowCombination_RpcBodyRpc_4 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_FlowCombination_RpcBodyRpc_4(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NonEmptyProto + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyRpc_4); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RpcBodyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +var ( + filter_FlowCombination_RpcBodyRpc_5 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} +) + +func request_FlowCombination_RpcBodyRpc_5(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NonEmptyProto + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + } + + protoReq.A, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyRpc_5); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RpcBodyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +var ( + filter_FlowCombination_RpcBodyRpc_6 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_FlowCombination_RpcBodyRpc_6(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NonEmptyProto + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + } + + protoReq.A, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyRpc_6); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RpcBodyRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +var ( + filter_FlowCombination_RpcPathSingleNestedRpc_0 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0, "str": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} +) + +func request_FlowCombination_RpcPathSingleNestedRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SingleNestedProto + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a.str"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) + + if err != nil { + return nil, metadata, err + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathSingleNestedRpc_0); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RpcPathSingleNestedRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +var ( + filter_FlowCombination_RpcPathNestedRpc_0 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1, "str": 2, "b": 3}, Base: []int{1, 1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 3, 1, 2, 4, 5}} +) + +func request_FlowCombination_RpcPathNestedRpc_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NestedProto + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a.str"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) + + if err != nil { + return nil, metadata, err + } + + val, ok = pathParams["b"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "b") + } + + protoReq.B, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedRpc_0); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RpcPathNestedRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +var ( + filter_FlowCombination_RpcPathNestedRpc_1 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0, "str": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} +) + +func request_FlowCombination_RpcPathNestedRpc_1(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NestedProto + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a.str"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) + + if err != nil { + return nil, metadata, err + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedRpc_1); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RpcPathNestedRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +var ( + filter_FlowCombination_RpcPathNestedRpc_2 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1, "str": 2}, Base: []int{1, 1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 3, 2, 4}} +) + +func request_FlowCombination_RpcPathNestedRpc_2(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NestedProto + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a.str"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) + + if err != nil { + return nil, metadata, err + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedRpc_2); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RpcPathNestedRpc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_FlowCombination_RpcBodyStream_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { + var protoReq NonEmptyProto + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + stream, err := client.RpcBodyStream(ctx, &protoReq) + if err != nil { + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil + +} + +func request_FlowCombination_RpcBodyStream_1(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { + var protoReq NonEmptyProto + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + } + + protoReq.A, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + val, ok = pathParams["b"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "b") + } + + protoReq.B, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + val, ok = pathParams["c"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "c") + } + + protoReq.C, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + stream, err := client.RpcBodyStream(ctx, &protoReq) + if err != nil { + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil + +} + +var ( + filter_FlowCombination_RpcBodyStream_2 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_FlowCombination_RpcBodyStream_2(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { + var protoReq NonEmptyProto + var metadata runtime.ServerMetadata + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyStream_2); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + stream, err := client.RpcBodyStream(ctx, &protoReq) + if err != nil { + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil + +} + +func request_FlowCombination_RpcBodyStream_3(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { + var protoReq NonEmptyProto + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + } + + protoReq.A, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + val, ok = pathParams["b"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "b") + } + + protoReq.B, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + stream, err := client.RpcBodyStream(ctx, &protoReq) + if err != nil { + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil + +} + +var ( + filter_FlowCombination_RpcBodyStream_4 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_FlowCombination_RpcBodyStream_4(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { + var protoReq NonEmptyProto + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyStream_4); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + stream, err := client.RpcBodyStream(ctx, &protoReq) + if err != nil { + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil + +} + +var ( + filter_FlowCombination_RpcBodyStream_5 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} +) + +func request_FlowCombination_RpcBodyStream_5(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { + var protoReq NonEmptyProto + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + } + + protoReq.A, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyStream_5); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + stream, err := client.RpcBodyStream(ctx, &protoReq) + if err != nil { + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil + +} + +var ( + filter_FlowCombination_RpcBodyStream_6 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_FlowCombination_RpcBodyStream_6(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcBodyStreamClient, runtime.ServerMetadata, error) { + var protoReq NonEmptyProto + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + } + + protoReq.A, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcBodyStream_6); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + stream, err := client.RpcBodyStream(ctx, &protoReq) + if err != nil { + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil + +} + +var ( + filter_FlowCombination_RpcPathSingleNestedStream_0 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0, "str": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} +) + +func request_FlowCombination_RpcPathSingleNestedStream_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcPathSingleNestedStreamClient, runtime.ServerMetadata, error) { + var protoReq SingleNestedProto + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a.str"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) + + if err != nil { + return nil, metadata, err + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathSingleNestedStream_0); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + stream, err := client.RpcPathSingleNestedStream(ctx, &protoReq) + if err != nil { + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil + +} + +var ( + filter_FlowCombination_RpcPathNestedStream_0 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1, "str": 2, "b": 3}, Base: []int{1, 1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 3, 1, 2, 4, 5}} +) + +func request_FlowCombination_RpcPathNestedStream_0(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcPathNestedStreamClient, runtime.ServerMetadata, error) { + var protoReq NestedProto + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a.str"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) + + if err != nil { + return nil, metadata, err + } + + val, ok = pathParams["b"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "b") + } + + protoReq.B, err = runtime.String(val) + + if err != nil { + return nil, metadata, err + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedStream_0); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + stream, err := client.RpcPathNestedStream(ctx, &protoReq) + if err != nil { + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil + +} + +var ( + filter_FlowCombination_RpcPathNestedStream_1 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0, "str": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}} +) + +func request_FlowCombination_RpcPathNestedStream_1(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcPathNestedStreamClient, runtime.ServerMetadata, error) { + var protoReq NestedProto + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a.str"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) + + if err != nil { + return nil, metadata, err + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedStream_1); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + stream, err := client.RpcPathNestedStream(ctx, &protoReq) + if err != nil { + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil + +} + +var ( + filter_FlowCombination_RpcPathNestedStream_2 = &utilities.DoubleArray{Encoding: map[string]int{"c": 0, "a": 1, "str": 2}, Base: []int{1, 1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 3, 2, 4}} +) + +func request_FlowCombination_RpcPathNestedStream_2(ctx context.Context, marshaler runtime.Marshaler, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcPathNestedStreamClient, runtime.ServerMetadata, error) { + var protoReq NestedProto + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.C); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a.str"] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val) + + if err != nil { + return nil, metadata, err + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedStream_2); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + + stream, err := client.RpcPathNestedStream(ctx, &protoReq) + if err != nil { + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil + +} + +// RegisterFlowCombinationHandlerFromEndpoint is same as RegisterFlowCombinationHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterFlowCombinationHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterFlowCombinationHandler(ctx, mux, conn) +} + +// RegisterFlowCombinationHandler registers the http handlers for service FlowCombination to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + client := NewFlowCombinationClient(conn) + + mux.Handle("POST", pattern_FlowCombination_RpcEmptyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcEmptyRpc_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcEmptyRpc_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcEmptyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcEmptyStream_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcEmptyStream_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_StreamEmptyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_StreamEmptyRpc_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_StreamEmptyRpc_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_StreamEmptyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_StreamEmptyStream_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_StreamEmptyStream_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcBodyRpc_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcBodyRpc_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcBodyRpc_1(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcBodyRpc_1(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcBodyRpc_2(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcBodyRpc_2(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcBodyRpc_3(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcBodyRpc_3(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcBodyRpc_4(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcBodyRpc_4(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_5, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcBodyRpc_5(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcBodyRpc_5(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyRpc_6, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcBodyRpc_6(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcBodyRpc_6(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcPathSingleNestedRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcPathSingleNestedRpc_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcPathSingleNestedRpc_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcPathNestedRpc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcPathNestedRpc_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcPathNestedRpc_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcPathNestedRpc_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcPathNestedRpc_1(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcPathNestedRpc_1(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcPathNestedRpc_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcPathNestedRpc_2(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcPathNestedRpc_2(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcBodyStream_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcBodyStream_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcBodyStream_1(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcBodyStream_1(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcBodyStream_2(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcBodyStream_2(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcBodyStream_3(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcBodyStream_3(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcBodyStream_4(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcBodyStream_4(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_5, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcBodyStream_5(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcBodyStream_5(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcBodyStream_6, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcBodyStream_6(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcBodyStream_6(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcPathSingleNestedStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcPathSingleNestedStream_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcPathSingleNestedStream_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcPathNestedStream_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcPathNestedStream_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcPathNestedStream_1(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcPathNestedStream_1(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_FlowCombination_RpcPathNestedStream_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_FlowCombination_RpcPathNestedStream_2(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_FlowCombination_RpcPathNestedStream_2(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_FlowCombination_RpcEmptyRpc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 0}, []string{"rpc", "empty"}, "")) + + pattern_FlowCombination_RpcEmptyStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"rpc", "empty", "stream"}, "")) + + pattern_FlowCombination_StreamEmptyRpc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"stream", "empty", "rpc"}, "")) + + pattern_FlowCombination_StreamEmptyStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 0}, []string{"stream", "empty"}, "")) + + pattern_FlowCombination_RpcBodyRpc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 0}, []string{"rpc", "body"}, "")) + + pattern_FlowCombination_RpcBodyRpc_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 2, 0}, []string{"rpc", "path", "a", "b", "c"}, "")) + + pattern_FlowCombination_RpcBodyRpc_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 0}, []string{"rpc", "query"}, "")) + + pattern_FlowCombination_RpcBodyRpc_3 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 2, 0}, []string{"rpc", "body", "path", "a", "b"}, "")) + + pattern_FlowCombination_RpcBodyRpc_4 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 0}, []string{"rpc", "body", "query"}, "")) + + pattern_FlowCombination_RpcBodyRpc_5 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 2, 0}, []string{"rpc", "body", "path", "a", "query"}, "")) + + pattern_FlowCombination_RpcBodyRpc_6 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 2, 0}, []string{"rpc", "path", "a", "query"}, "")) + + pattern_FlowCombination_RpcPathSingleNestedRpc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 0}, []string{"rpc", "path-nested", "a.str"}, "")) + + pattern_FlowCombination_RpcPathNestedRpc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3, 2, 0}, []string{"rpc", "path-nested", "a.str", "b"}, "")) + + pattern_FlowCombination_RpcPathNestedRpc_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 0}, []string{"rpc", "path-nested", "a.str"}, "")) + + pattern_FlowCombination_RpcPathNestedRpc_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 0}, []string{"rpc", "path-nested", "a.str"}, "")) + + pattern_FlowCombination_RpcBodyStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"rpc", "body", "stream"}, "")) + + pattern_FlowCombination_RpcBodyStream_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"rpc", "path", "a", "b", "c", "stream"}, "")) + + pattern_FlowCombination_RpcBodyStream_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"rpc", "query", "stream"}, "")) + + pattern_FlowCombination_RpcBodyStream_3 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"rpc", "body", "path", "a", "b", "stream"}, "")) + + pattern_FlowCombination_RpcBodyStream_4 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"rpc", "body", "query", "stream"}, "")) + + pattern_FlowCombination_RpcBodyStream_5 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 2, 5}, []string{"rpc", "body", "path", "a", "query", "stream"}, "")) + + pattern_FlowCombination_RpcBodyStream_6 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 2, 4}, []string{"rpc", "path", "a", "query", "stream"}, "")) + + pattern_FlowCombination_RpcPathSingleNestedStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"rpc", "path-nested", "a.str", "stream"}, "")) + + pattern_FlowCombination_RpcPathNestedStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"rpc", "path-nested", "a.str", "b", "stream"}, "")) + + pattern_FlowCombination_RpcPathNestedStream_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"rpc", "path-nested", "a.str", "stream"}, "")) + + pattern_FlowCombination_RpcPathNestedStream_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"rpc", "path-nested", "a.str", "stream"}, "")) +) + +var ( + forward_FlowCombination_RpcEmptyRpc_0 = runtime.ForwardResponseMessage + + forward_FlowCombination_RpcEmptyStream_0 = runtime.ForwardResponseStream + + forward_FlowCombination_StreamEmptyRpc_0 = runtime.ForwardResponseMessage + + forward_FlowCombination_StreamEmptyStream_0 = runtime.ForwardResponseStream + + forward_FlowCombination_RpcBodyRpc_0 = runtime.ForwardResponseMessage + + forward_FlowCombination_RpcBodyRpc_1 = runtime.ForwardResponseMessage + + forward_FlowCombination_RpcBodyRpc_2 = runtime.ForwardResponseMessage + + forward_FlowCombination_RpcBodyRpc_3 = runtime.ForwardResponseMessage + + forward_FlowCombination_RpcBodyRpc_4 = runtime.ForwardResponseMessage + + forward_FlowCombination_RpcBodyRpc_5 = runtime.ForwardResponseMessage + + forward_FlowCombination_RpcBodyRpc_6 = runtime.ForwardResponseMessage + + forward_FlowCombination_RpcPathSingleNestedRpc_0 = runtime.ForwardResponseMessage + + forward_FlowCombination_RpcPathNestedRpc_0 = runtime.ForwardResponseMessage + + forward_FlowCombination_RpcPathNestedRpc_1 = runtime.ForwardResponseMessage + + forward_FlowCombination_RpcPathNestedRpc_2 = runtime.ForwardResponseMessage + + forward_FlowCombination_RpcBodyStream_0 = runtime.ForwardResponseStream + + forward_FlowCombination_RpcBodyStream_1 = runtime.ForwardResponseStream + + forward_FlowCombination_RpcBodyStream_2 = runtime.ForwardResponseStream + + forward_FlowCombination_RpcBodyStream_3 = runtime.ForwardResponseStream + + forward_FlowCombination_RpcBodyStream_4 = runtime.ForwardResponseStream + + forward_FlowCombination_RpcBodyStream_5 = runtime.ForwardResponseStream + + forward_FlowCombination_RpcBodyStream_6 = runtime.ForwardResponseStream + + forward_FlowCombination_RpcPathSingleNestedStream_0 = runtime.ForwardResponseStream + + forward_FlowCombination_RpcPathNestedStream_0 = runtime.ForwardResponseStream + + forward_FlowCombination_RpcPathNestedStream_1 = runtime.ForwardResponseStream + + forward_FlowCombination_RpcPathNestedStream_2 = runtime.ForwardResponseStream +) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/flow_combination.proto b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/flow_combination.proto new file mode 100644 index 0000000..6009608 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/flow_combination.proto @@ -0,0 +1,168 @@ +syntax = "proto3"; +option go_package = "examplepb"; +package grpc.gateway.examples.examplepb; + +import "google/api/annotations.proto"; + +message EmptyProto {} + +message NonEmptyProto { + string a = 1; + string b = 2; + string c = 3; +} + +message UnaryProto { + string str = 1; +} + +message NestedProto { + UnaryProto a = 1; + string b = 2; + string c = 3; +} + +message SingleNestedProto { + UnaryProto a = 1; +} + +service FlowCombination { + rpc RpcEmptyRpc(EmptyProto) returns (EmptyProto) { + option (google.api.http) = { + post: "/rpc/empty/rpc" + }; + } + rpc RpcEmptyStream(EmptyProto) returns (stream EmptyProto) { + option (google.api.http) = { + post: "/rpc/empty/stream" + }; + } + rpc StreamEmptyRpc(stream EmptyProto) returns (EmptyProto) { + option (google.api.http) = { + post: "/stream/empty/rpc" + }; + } + rpc StreamEmptyStream(stream EmptyProto) returns (stream EmptyProto) { + option (google.api.http) = { + post: "/stream/empty/stream" + }; + } + + rpc RpcBodyRpc(NonEmptyProto) returns (EmptyProto) { + option (google.api.http) = { + // w/ body; w/o path; w/o query + post: "/rpc/body/rpc" + body: "*" + + // w/o body; w/ path; w/o query + additional_bindings { + post: "/rpc/path/{a}/{b}/{c}/rpc" + } + // w/o body; w/o path; w/ query + additional_bindings { + post: "/rpc/query/rpc" + } + // w/ body; w/ path; w/o query + additional_bindings { + post: "/rpc/body/path/{a}/{b}/rpc" + body: "c" + } + // w/ body; w/o path; w/ query + additional_bindings { + post: "/rpc/body/query/rpc" + body: "c" + } + // w/ body; w/ path; w/ query + additional_bindings { + post: "/rpc/body/path/{a}/query/rpc" + body: "c" + } + // w/o body; w/ path; w/ query + additional_bindings { + post: "/rpc/path/{a}/query/rpc" + } + }; + } + rpc RpcPathSingleNestedRpc(SingleNestedProto) returns (EmptyProto) { + option (google.api.http) = { + // w/o body; w/ path (IsNestedProto3); w/o query + post: "/rpc/path-nested/{a.str}/rpc" + }; + } + rpc RpcPathNestedRpc(NestedProto) returns (EmptyProto) { + option (google.api.http) = { + // w/ body; w/ path (IsNestedProto3); w/o query + post: "/rpc/path-nested/{a.str}/{b}/rpc" + body: "c" + + // w/o body; w/ path (IsNestedProto3); w/ query + additional_bindings { + post: "/rpc/path-nested/{a.str}/rpc" + } + // w/ body; w/ path (IsNestedProto3); w/ query + additional_bindings { + post: "/rpc/path-nested/{a.str}/rpc" + body: "c" + } + }; + } + + rpc RpcBodyStream(NonEmptyProto) returns (stream EmptyProto) { + option (google.api.http) = { + // w/ body; w/o path; w/o query + post: "/rpc/body/stream" + body: "*" + + // w/o body; w/ path; w/o query + additional_bindings { + post: "/rpc/path/{a}/{b}/{c}/stream" + } + // w/o body; w/o path; w/ query + additional_bindings { + post: "/rpc/query/stream" + } + // w/ body; w/ path; w/o query + additional_bindings { + post: "/rpc/body/path/{a}/{b}/stream" + body: "c" + } + // w/ body; w/o path; w/ query + additional_bindings { + post: "/rpc/body/query/stream" + body: "c" + } + // w/ body; w/ path; w/ query + additional_bindings { + post: "/rpc/body/path/{a}/query/stream" + body: "c" + } + // w/o body; w/ path; w/ query + additional_bindings { + post: "/rpc/path/{a}/query/stream" + } + }; + } + rpc RpcPathSingleNestedStream(SingleNestedProto) returns (stream EmptyProto) { + option (google.api.http) = { + // w/o body; w/ path (IsNestedProto3); w/o query + post: "/rpc/path-nested/{a.str}/stream" + }; + } + rpc RpcPathNestedStream(NestedProto) returns (stream EmptyProto) { + option (google.api.http) = { + // w/ body; w/ path (IsNestedProto3); w/o query + post: "/rpc/path-nested/{a.str}/{b}/stream" + body: "c" + + // w/o body; w/ path (IsNestedProto3); w/ query + additional_bindings { + post: "/rpc/path-nested/{a.str}/stream" + } + // w/ body; w/ path (IsNestedProto3); w/ query + additional_bindings { + post: "/rpc/path-nested/{a.str}/stream" + body: "c" + } + }; + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/stream.pb.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/stream.pb.go new file mode 100644 index 0000000..2411be6 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/stream.pb.go @@ -0,0 +1,279 @@ +// Code generated by protoc-gen-go. +// source: examples/examplepb/stream.proto +// DO NOT EDIT! + +package examplepb + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "google.golang.org/genproto/googleapis/api/annotations" +import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" +import grpc_gateway_examples_sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for StreamService service + +type StreamServiceClient interface { + BulkCreate(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkCreateClient, error) + List(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (StreamService_ListClient, error) + BulkEcho(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkEchoClient, error) +} + +type streamServiceClient struct { + cc *grpc.ClientConn +} + +func NewStreamServiceClient(cc *grpc.ClientConn) StreamServiceClient { + return &streamServiceClient{cc} +} + +func (c *streamServiceClient) BulkCreate(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkCreateClient, error) { + stream, err := grpc.NewClientStream(ctx, &_StreamService_serviceDesc.Streams[0], c.cc, "/grpc.gateway.examples.examplepb.StreamService/BulkCreate", opts...) + if err != nil { + return nil, err + } + x := &streamServiceBulkCreateClient{stream} + return x, nil +} + +type StreamService_BulkCreateClient interface { + Send(*ABitOfEverything) error + CloseAndRecv() (*google_protobuf1.Empty, error) + grpc.ClientStream +} + +type streamServiceBulkCreateClient struct { + grpc.ClientStream +} + +func (x *streamServiceBulkCreateClient) Send(m *ABitOfEverything) error { + return x.ClientStream.SendMsg(m) +} + +func (x *streamServiceBulkCreateClient) CloseAndRecv() (*google_protobuf1.Empty, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(google_protobuf1.Empty) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *streamServiceClient) List(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (StreamService_ListClient, error) { + stream, err := grpc.NewClientStream(ctx, &_StreamService_serviceDesc.Streams[1], c.cc, "/grpc.gateway.examples.examplepb.StreamService/List", opts...) + if err != nil { + return nil, err + } + x := &streamServiceListClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type StreamService_ListClient interface { + Recv() (*ABitOfEverything, error) + grpc.ClientStream +} + +type streamServiceListClient struct { + grpc.ClientStream +} + +func (x *streamServiceListClient) Recv() (*ABitOfEverything, error) { + m := new(ABitOfEverything) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *streamServiceClient) BulkEcho(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkEchoClient, error) { + stream, err := grpc.NewClientStream(ctx, &_StreamService_serviceDesc.Streams[2], c.cc, "/grpc.gateway.examples.examplepb.StreamService/BulkEcho", opts...) + if err != nil { + return nil, err + } + x := &streamServiceBulkEchoClient{stream} + return x, nil +} + +type StreamService_BulkEchoClient interface { + Send(*grpc_gateway_examples_sub.StringMessage) error + Recv() (*grpc_gateway_examples_sub.StringMessage, error) + grpc.ClientStream +} + +type streamServiceBulkEchoClient struct { + grpc.ClientStream +} + +func (x *streamServiceBulkEchoClient) Send(m *grpc_gateway_examples_sub.StringMessage) error { + return x.ClientStream.SendMsg(m) +} + +func (x *streamServiceBulkEchoClient) Recv() (*grpc_gateway_examples_sub.StringMessage, error) { + m := new(grpc_gateway_examples_sub.StringMessage) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// Server API for StreamService service + +type StreamServiceServer interface { + BulkCreate(StreamService_BulkCreateServer) error + List(*google_protobuf1.Empty, StreamService_ListServer) error + BulkEcho(StreamService_BulkEchoServer) error +} + +func RegisterStreamServiceServer(s *grpc.Server, srv StreamServiceServer) { + s.RegisterService(&_StreamService_serviceDesc, srv) +} + +func _StreamService_BulkCreate_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(StreamServiceServer).BulkCreate(&streamServiceBulkCreateServer{stream}) +} + +type StreamService_BulkCreateServer interface { + SendAndClose(*google_protobuf1.Empty) error + Recv() (*ABitOfEverything, error) + grpc.ServerStream +} + +type streamServiceBulkCreateServer struct { + grpc.ServerStream +} + +func (x *streamServiceBulkCreateServer) SendAndClose(m *google_protobuf1.Empty) error { + return x.ServerStream.SendMsg(m) +} + +func (x *streamServiceBulkCreateServer) Recv() (*ABitOfEverything, error) { + m := new(ABitOfEverything) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _StreamService_List_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(google_protobuf1.Empty) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(StreamServiceServer).List(m, &streamServiceListServer{stream}) +} + +type StreamService_ListServer interface { + Send(*ABitOfEverything) error + grpc.ServerStream +} + +type streamServiceListServer struct { + grpc.ServerStream +} + +func (x *streamServiceListServer) Send(m *ABitOfEverything) error { + return x.ServerStream.SendMsg(m) +} + +func _StreamService_BulkEcho_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(StreamServiceServer).BulkEcho(&streamServiceBulkEchoServer{stream}) +} + +type StreamService_BulkEchoServer interface { + Send(*grpc_gateway_examples_sub.StringMessage) error + Recv() (*grpc_gateway_examples_sub.StringMessage, error) + grpc.ServerStream +} + +type streamServiceBulkEchoServer struct { + grpc.ServerStream +} + +func (x *streamServiceBulkEchoServer) Send(m *grpc_gateway_examples_sub.StringMessage) error { + return x.ServerStream.SendMsg(m) +} + +func (x *streamServiceBulkEchoServer) Recv() (*grpc_gateway_examples_sub.StringMessage, error) { + m := new(grpc_gateway_examples_sub.StringMessage) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +var _StreamService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.gateway.examples.examplepb.StreamService", + HandlerType: (*StreamServiceServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "BulkCreate", + Handler: _StreamService_BulkCreate_Handler, + ClientStreams: true, + }, + { + StreamName: "List", + Handler: _StreamService_List_Handler, + ServerStreams: true, + }, + { + StreamName: "BulkEcho", + Handler: _StreamService_BulkEcho_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "examples/examplepb/stream.proto", +} + +func init() { proto.RegisterFile("examples/examplepb/stream.proto", fileDescriptor2) } + +var fileDescriptor2 = []byte{ + // 314 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x90, 0xbf, 0x4a, 0x43, 0x31, + 0x14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0x4d, 0x2b, 0x3b, 0xe1, 0x25, 0x3b, 0xaf, 0xd9, 0xf9, + 0x60, 0xc9, 0xde, 0x16, 0x9f, 0x3f, 0xbf, 0x8b, 0x9d, 0xab, 0xf6, 0x85, 0x98, 0xf5, 0x6a, 0xf0, + 0x55, 0xd8, 0x42, 0xe5, 0xc9, 0xf4, 0x3e, 0xba, 0xee, 0x44, 0xf4, 0x83, 0xec, 0x3d, 0x99, 0x80, + 0x74, 0xcd, 0x97, 0xec, 0xff, 0x74, 0xed, 0xcb, 0x82, 0xe2, 0x9c, 0xb6, 0x36, 0x50, 0x74, 0x23, + 0xba, 0x88, 0xc8, 0xc1, 0x52, 0xc5, 0x20, 0x9e, 0x58, 0xda, 0x59, 0x53, 0x15, 0x72, 0xc5, 0x87, + 0xe8, 0x4d, 0xa6, 0x9f, 0x4b, 0xb3, 0x6c, 0xeb, 0xe4, 0xf6, 0x46, 0x20, 0x9e, 0xd8, 0xc2, 0x48, + 0x37, 0xea, 0x1f, 0xbd, 0x1e, 0x36, 0xeb, 0xa9, 0xfd, 0x42, 0xc8, 0xdd, 0x5f, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xbc, 0x52, 0x49, 0x85, 0x8f, 0x02, 0x00, 0x00, +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/stream.pb.gw.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/stream.pb.gw.go new file mode 100644 index 0000000..f256228 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/stream.pb.gw.go @@ -0,0 +1,273 @@ +// Code generated by protoc-gen-grpc-gateway +// source: examples/examplepb/stream.proto +// DO NOT EDIT! + +/* +Package examplepb is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package examplepb + +import ( + "io" + "net/http" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes/empty" + "github.com/grpc-ecosystem/grpc-gateway/examples/sub" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "golang.org/x/net/context" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" +) + +var _ codes.Code +var _ io.Reader +var _ = runtime.String +var _ = utilities.NewDoubleArray + +func request_StreamService_BulkCreate_0(ctx context.Context, marshaler runtime.Marshaler, client StreamServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var metadata runtime.ServerMetadata + stream, err := client.BulkCreate(ctx) + if err != nil { + grpclog.Printf("Failed to start streaming: %v", err) + return nil, metadata, err + } + dec := marshaler.NewDecoder(req.Body) + for { + var protoReq ABitOfEverything + err = dec.Decode(&protoReq) + if err == io.EOF { + break + } + if err != nil { + grpclog.Printf("Failed to decode request: %v", err) + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + if err = stream.Send(&protoReq); err != nil { + grpclog.Printf("Failed to send request: %v", err) + return nil, metadata, err + } + } + + if err := stream.CloseSend(); err != nil { + grpclog.Printf("Failed to terminate client stream: %v", err) + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + grpclog.Printf("Failed to get header from client: %v", err) + return nil, metadata, err + } + metadata.HeaderMD = header + + msg, err := stream.CloseAndRecv() + metadata.TrailerMD = stream.Trailer() + return msg, metadata, err + +} + +func request_StreamService_List_0(ctx context.Context, marshaler runtime.Marshaler, client StreamServiceClient, req *http.Request, pathParams map[string]string) (StreamService_ListClient, runtime.ServerMetadata, error) { + var protoReq empty.Empty + var metadata runtime.ServerMetadata + + stream, err := client.List(ctx, &protoReq) + if err != nil { + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil + +} + +func request_StreamService_BulkEcho_0(ctx context.Context, marshaler runtime.Marshaler, client StreamServiceClient, req *http.Request, pathParams map[string]string) (StreamService_BulkEchoClient, runtime.ServerMetadata, error) { + var metadata runtime.ServerMetadata + stream, err := client.BulkEcho(ctx) + if err != nil { + grpclog.Printf("Failed to start streaming: %v", err) + return nil, metadata, err + } + dec := marshaler.NewDecoder(req.Body) + handleSend := func() error { + var protoReq sub.StringMessage + err = dec.Decode(&protoReq) + if err == io.EOF { + return err + } + if err != nil { + grpclog.Printf("Failed to decode request: %v", err) + return err + } + if err = stream.Send(&protoReq); err != nil { + grpclog.Printf("Failed to send request: %v", err) + return err + } + return nil + } + if err := handleSend(); err != nil { + if cerr := stream.CloseSend(); cerr != nil { + grpclog.Printf("Failed to terminate client stream: %v", cerr) + } + if err == io.EOF { + return stream, metadata, nil + } + return nil, metadata, err + } + go func() { + for { + if err := handleSend(); err != nil { + break + } + } + if err := stream.CloseSend(); err != nil { + grpclog.Printf("Failed to terminate client stream: %v", err) + } + }() + header, err := stream.Header() + if err != nil { + grpclog.Printf("Failed to get header from client: %v", err) + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil +} + +// RegisterStreamServiceHandlerFromEndpoint is same as RegisterStreamServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterStreamServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterStreamServiceHandler(ctx, mux, conn) +} + +// RegisterStreamServiceHandler registers the http handlers for service StreamService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterStreamServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + client := NewStreamServiceClient(conn) + + mux.Handle("POST", pattern_StreamService_BulkCreate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_StreamService_BulkCreate_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_StreamService_BulkCreate_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_StreamService_List_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_StreamService_List_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_StreamService_List_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_StreamService_BulkEcho_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_StreamService_BulkEcho_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_StreamService_BulkEcho_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_StreamService_BulkCreate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "example", "a_bit_of_everything", "bulk"}, "")) + + pattern_StreamService_List_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "a_bit_of_everything"}, "")) + + pattern_StreamService_BulkEcho_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "example", "a_bit_of_everything", "echo"}, "")) +) + +var ( + forward_StreamService_BulkCreate_0 = runtime.ForwardResponseMessage + + forward_StreamService_List_0 = runtime.ForwardResponseStream + + forward_StreamService_BulkEcho_0 = runtime.ForwardResponseStream +) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/stream.proto b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/stream.proto new file mode 100644 index 0000000..573a2f4 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/stream.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; +option go_package = "examplepb"; +package grpc.gateway.examples.examplepb; + +import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; +import "examples/examplepb/a_bit_of_everything.proto"; +import "examples/sub/message.proto"; + +// Defines some more operations to be added to ABitOfEverythingService +service StreamService { + rpc BulkCreate(stream ABitOfEverything) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/example/a_bit_of_everything/bulk" + body: "*" + }; + } + rpc List(google.protobuf.Empty) returns (stream ABitOfEverything) { + option (google.api.http) = { + get: "/v1/example/a_bit_of_everything" + }; + } + rpc BulkEcho(stream grpc.gateway.examples.sub.StringMessage) returns (stream grpc.gateway.examples.sub.StringMessage) { + option (google.api.http) = { + post: "/v1/example/a_bit_of_everything/echo" + body: "*" + }; + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/integration_test.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/integration_test.go new file mode 100644 index 0000000..826fbdd --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/integration_test.go @@ -0,0 +1,719 @@ +package main + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "reflect" + "strconv" + "strings" + "sync" + "testing" + "time" + + "github.com/golang/protobuf/jsonpb" + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes/empty" + gw "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "golang.org/x/net/context" + "google.golang.org/grpc/codes" +) + +type errorBody struct { + Error string `json:"error"` + Code int `json:"code"` +} + +func TestEcho(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + + testEcho(t, 8080, "application/json") + testEchoBody(t) +} + +func TestForwardResponseOption(t *testing.T) { + go func() { + if err := Run( + ":8081", + runtime.WithForwardResponseOption( + func(_ context.Context, w http.ResponseWriter, _ proto.Message) error { + w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1.1+json") + return nil + }, + ), + ); err != nil { + t.Errorf("gw.Run() failed with %v; want success", err) + return + } + }() + + time.Sleep(100 * time.Millisecond) + testEcho(t, 8081, "application/vnd.docker.plugins.v1.1+json") +} + +func testEcho(t *testing.T, port int, contentType string) { + url := fmt.Sprintf("http://localhost:%d/v1/example/echo/myid", port) + resp, err := http.Post(url, "application/json", strings.NewReader("{}")) + if err != nil { + t.Errorf("http.Post(%q) failed with %v; want success", url, err) + return + } + defer resp.Body.Close() + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + return + } + + if got, want := resp.StatusCode, http.StatusOK; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + t.Logf("%s", buf) + } + + var msg gw.SimpleMessage + if err := jsonpb.UnmarshalString(string(buf), &msg); err != nil { + t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err) + return + } + if got, want := msg.Id, "myid"; got != want { + t.Errorf("msg.Id = %q; want %q", got, want) + } + + if value := resp.Header.Get("Content-Type"); value != contentType { + t.Errorf("Content-Type was %s, wanted %s", value, contentType) + } +} + +func testEchoBody(t *testing.T) { + sent := gw.SimpleMessage{Id: "example"} + var m jsonpb.Marshaler + payload, err := m.MarshalToString(&sent) + if err != nil { + t.Fatalf("m.MarshalToString(%#v) failed with %v; want success", payload, err) + } + + url := "http://localhost:8080/v1/example/echo_body" + resp, err := http.Post(url, "", strings.NewReader(payload)) + if err != nil { + t.Errorf("http.Post(%q) failed with %v; want success", url, err) + return + } + defer resp.Body.Close() + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + return + } + + if got, want := resp.StatusCode, http.StatusOK; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + t.Logf("%s", buf) + } + + var received gw.SimpleMessage + if err := jsonpb.UnmarshalString(string(buf), &received); err != nil { + t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err) + return + } + if got, want := received, sent; !reflect.DeepEqual(got, want) { + t.Errorf("msg.Id = %q; want %q", got, want) + } + + if got, want := resp.Header.Get("Grpc-Metadata-Foo"), "foo1"; got != want { + t.Errorf("Grpc-Metadata-Foo was %q, wanted %q", got, want) + } + if got, want := resp.Header.Get("Grpc-Metadata-Bar"), "bar1"; got != want { + t.Errorf("Grpc-Metadata-Bar was %q, wanted %q", got, want) + } + + if got, want := resp.Trailer.Get("Grpc-Trailer-Foo"), "foo2"; got != want { + t.Errorf("Grpc-Trailer-Foo was %q, wanted %q", got, want) + } + if got, want := resp.Trailer.Get("Grpc-Trailer-Bar"), "bar2"; got != want { + t.Errorf("Grpc-Trailer-Bar was %q, wanted %q", got, want) + } +} + +func TestABE(t *testing.T) { + if testing.Short() { + t.Skip() + return + } + + testABECreate(t) + testABECreateBody(t) + testABEBulkCreate(t) + testABELookup(t) + testABELookupNotFound(t) + testABEList(t) + testABEBulkEcho(t) + testABEBulkEchoZeroLength(t) + testAdditionalBindings(t) +} + +func testABECreate(t *testing.T) { + want := gw.ABitOfEverything{ + FloatValue: 1.5, + DoubleValue: 2.5, + Int64Value: 4294967296, + Uint64Value: 9223372036854775807, + Int32Value: -2147483648, + Fixed64Value: 9223372036854775807, + Fixed32Value: 4294967295, + BoolValue: true, + StringValue: "strprefix/foo", + Uint32Value: 4294967295, + Sfixed32Value: 2147483647, + Sfixed64Value: -4611686018427387904, + Sint32Value: 2147483647, + Sint64Value: 4611686018427387903, + NonConventionalNameValue: "camelCase", + } + url := fmt.Sprintf("http://localhost:8080/v1/example/a_bit_of_everything/%f/%f/%d/separator/%d/%d/%d/%d/%v/%s/%d/%d/%d/%d/%d/%s", want.FloatValue, want.DoubleValue, want.Int64Value, want.Uint64Value, want.Int32Value, want.Fixed64Value, want.Fixed32Value, want.BoolValue, want.StringValue, want.Uint32Value, want.Sfixed32Value, want.Sfixed64Value, want.Sint32Value, want.Sint64Value, want.NonConventionalNameValue) + + resp, err := http.Post(url, "application/json", strings.NewReader("{}")) + if err != nil { + t.Errorf("http.Post(%q) failed with %v; want success", url, err) + return + } + defer resp.Body.Close() + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + return + } + + if got, want := resp.StatusCode, http.StatusOK; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + t.Logf("%s", buf) + } + + var msg gw.ABitOfEverything + if err := jsonpb.UnmarshalString(string(buf), &msg); err != nil { + t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err) + return + } + if msg.Uuid == "" { + t.Error("msg.Uuid is empty; want not empty") + } + msg.Uuid = "" + if got := msg; !reflect.DeepEqual(got, want) { + t.Errorf("msg= %v; want %v", &got, &want) + } +} + +func testABECreateBody(t *testing.T) { + want := gw.ABitOfEverything{ + FloatValue: 1.5, + DoubleValue: 2.5, + Int64Value: 4294967296, + Uint64Value: 9223372036854775807, + Int32Value: -2147483648, + Fixed64Value: 9223372036854775807, + Fixed32Value: 4294967295, + BoolValue: true, + StringValue: "strprefix/foo", + Uint32Value: 4294967295, + Sfixed32Value: 2147483647, + Sfixed64Value: -4611686018427387904, + Sint32Value: 2147483647, + Sint64Value: 4611686018427387903, + NonConventionalNameValue: "camelCase", + + Nested: []*gw.ABitOfEverything_Nested{ + { + Name: "bar", + Amount: 10, + }, + { + Name: "baz", + Amount: 20, + }, + }, + RepeatedStringValue: []string{"a", "b", "c"}, + OneofValue: &gw.ABitOfEverything_OneofString{ + OneofString: "x", + }, + MapValue: map[string]gw.NumericEnum{ + "a": gw.NumericEnum_ONE, + "b": gw.NumericEnum_ZERO, + }, + MappedStringValue: map[string]string{ + "a": "x", + "b": "y", + }, + MappedNestedValue: map[string]*gw.ABitOfEverything_Nested{ + "a": {Name: "x", Amount: 1}, + "b": {Name: "y", Amount: 2}, + }, + } + url := "http://localhost:8080/v1/example/a_bit_of_everything" + var m jsonpb.Marshaler + payload, err := m.MarshalToString(&want) + if err != nil { + t.Fatalf("m.MarshalToString(%#v) failed with %v; want success", want, err) + } + + resp, err := http.Post(url, "application/json", strings.NewReader(payload)) + if err != nil { + t.Errorf("http.Post(%q) failed with %v; want success", url, err) + return + } + defer resp.Body.Close() + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + return + } + + if got, want := resp.StatusCode, http.StatusOK; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + t.Logf("%s", buf) + } + + var msg gw.ABitOfEverything + if err := jsonpb.UnmarshalString(string(buf), &msg); err != nil { + t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err) + return + } + if msg.Uuid == "" { + t.Error("msg.Uuid is empty; want not empty") + } + msg.Uuid = "" + if got := msg; !reflect.DeepEqual(got, want) { + t.Errorf("msg= %v; want %v", &got, &want) + } +} + +func testABEBulkCreate(t *testing.T) { + count := 0 + r, w := io.Pipe() + go func(w io.WriteCloser) { + defer func() { + if cerr := w.Close(); cerr != nil { + t.Errorf("w.Close() failed with %v; want success", cerr) + } + }() + for _, val := range []string{ + "foo", "bar", "baz", "qux", "quux", + } { + want := gw.ABitOfEverything{ + FloatValue: 1.5, + DoubleValue: 2.5, + Int64Value: 4294967296, + Uint64Value: 9223372036854775807, + Int32Value: -2147483648, + Fixed64Value: 9223372036854775807, + Fixed32Value: 4294967295, + BoolValue: true, + StringValue: fmt.Sprintf("strprefix/%s", val), + Uint32Value: 4294967295, + Sfixed32Value: 2147483647, + Sfixed64Value: -4611686018427387904, + Sint32Value: 2147483647, + Sint64Value: 4611686018427387903, + NonConventionalNameValue: "camelCase", + + Nested: []*gw.ABitOfEverything_Nested{ + { + Name: "hoge", + Amount: 10, + }, + { + Name: "fuga", + Amount: 20, + }, + }, + } + var m jsonpb.Marshaler + if err := m.Marshal(w, &want); err != nil { + t.Fatalf("m.Marshal(%#v, w) failed with %v; want success", want, err) + } + if _, err := io.WriteString(w, "\n"); err != nil { + t.Errorf("w.Write(%q) failed with %v; want success", "\n", err) + return + } + count++ + } + }(w) + url := "http://localhost:8080/v1/example/a_bit_of_everything/bulk" + resp, err := http.Post(url, "application/json", r) + if err != nil { + t.Errorf("http.Post(%q) failed with %v; want success", url, err) + return + } + defer resp.Body.Close() + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err) + return + } + + if got, want := resp.StatusCode, http.StatusOK; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + t.Logf("%s", buf) + } + + var msg empty.Empty + if err := jsonpb.UnmarshalString(string(buf), &msg); err != nil { + t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err) + return + } + + if got, want := resp.Header.Get("Grpc-Metadata-Count"), fmt.Sprintf("%d", count); got != want { + t.Errorf("Grpc-Metadata-Count was %q, wanted %q", got, want) + } + + if got, want := resp.Trailer.Get("Grpc-Trailer-Foo"), "foo2"; got != want { + t.Errorf("Grpc-Trailer-Foo was %q, wanted %q", got, want) + } + if got, want := resp.Trailer.Get("Grpc-Trailer-Bar"), "bar2"; got != want { + t.Errorf("Grpc-Trailer-Bar was %q, wanted %q", got, want) + } +} + +func testABELookup(t *testing.T) { + url := "http://localhost:8080/v1/example/a_bit_of_everything" + cresp, err := http.Post(url, "application/json", strings.NewReader(` + {"bool_value": true, "string_value": "strprefix/example"} + `)) + if err != nil { + t.Errorf("http.Post(%q) failed with %v; want success", url, err) + return + } + defer cresp.Body.Close() + buf, err := ioutil.ReadAll(cresp.Body) + if err != nil { + t.Errorf("iotuil.ReadAll(cresp.Body) failed with %v; want success", err) + return + } + if got, want := cresp.StatusCode, http.StatusOK; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + t.Logf("%s", buf) + return + } + + var want gw.ABitOfEverything + if err := jsonpb.UnmarshalString(string(buf), &want); err != nil { + t.Errorf("jsonpb.UnmarshalString(%s, &want) failed with %v; want success", buf, err) + return + } + + url = fmt.Sprintf("%s/%s", url, want.Uuid) + resp, err := http.Get(url) + if err != nil { + t.Errorf("http.Get(%q) failed with %v; want success", url, err) + return + } + defer resp.Body.Close() + + buf, err = ioutil.ReadAll(resp.Body) + if err != nil { + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) + return + } + + var msg gw.ABitOfEverything + if err := jsonpb.UnmarshalString(string(buf), &msg); err != nil { + t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err) + return + } + if got := msg; !reflect.DeepEqual(got, want) { + t.Errorf("msg= %v; want %v", &got, &want) + } + + if got, want := resp.Header.Get("Grpc-Metadata-Uuid"), want.Uuid; got != want { + t.Errorf("Grpc-Metadata-Uuid was %s, wanted %s", got, want) + } +} + +func testABELookupNotFound(t *testing.T) { + url := "http://localhost:8080/v1/example/a_bit_of_everything" + uuid := "not_exist" + url = fmt.Sprintf("%s/%s", url, uuid) + resp, err := http.Get(url) + if err != nil { + t.Errorf("http.Get(%q) failed with %v; want success", url, err) + return + } + defer resp.Body.Close() + + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err) + return + } + + if got, want := resp.StatusCode, http.StatusNotFound; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + t.Logf("%s", buf) + return + } + + var msg errorBody + if err := json.Unmarshal(buf, &msg); err != nil { + t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err) + return + } + + if got, want := msg.Code, int(codes.NotFound); got != want { + t.Errorf("msg.Code = %d; want %d", got, want) + return + } + + if got, want := resp.Header.Get("Grpc-Metadata-Uuid"), uuid; got != want { + t.Errorf("Grpc-Metadata-Uuid was %s, wanted %s", got, want) + } + if got, want := resp.Trailer.Get("Grpc-Trailer-Foo"), "foo2"; got != want { + t.Errorf("Grpc-Trailer-Foo was %q, wanted %q", got, want) + } + if got, want := resp.Trailer.Get("Grpc-Trailer-Bar"), "bar2"; got != want { + t.Errorf("Grpc-Trailer-Bar was %q, wanted %q", got, want) + } +} + +func testABEList(t *testing.T) { + url := "http://localhost:8080/v1/example/a_bit_of_everything" + resp, err := http.Get(url) + if err != nil { + t.Errorf("http.Get(%q) failed with %v; want success", url, err) + return + } + defer resp.Body.Close() + + dec := json.NewDecoder(resp.Body) + var i int + for i = 0; ; i++ { + var item struct { + Result json.RawMessage `json:"result"` + Error map[string]interface{} `json:"error"` + } + err := dec.Decode(&item) + if err == io.EOF { + break + } + if err != nil { + t.Errorf("dec.Decode(&item) failed with %v; want success; i = %d", err, i) + } + if len(item.Error) != 0 { + t.Errorf("item.Error = %#v; want empty; i = %d", item.Error, i) + continue + } + var msg gw.ABitOfEverything + if err := jsonpb.UnmarshalString(string(item.Result), &msg); err != nil { + t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", item.Result, err) + } + } + if i <= 0 { + t.Errorf("i == %d; want > 0", i) + } + + value := resp.Header.Get("Grpc-Metadata-Count") + if value == "" { + t.Errorf("Grpc-Metadata-Count should not be empty") + } + + count, err := strconv.Atoi(value) + if err != nil { + t.Errorf("failed to Atoi %q: %v", value, err) + } + + if count <= 0 { + t.Errorf("count == %d; want > 0", count) + } +} + +func testABEBulkEcho(t *testing.T) { + reqr, reqw := io.Pipe() + var wg sync.WaitGroup + var want []*sub.StringMessage + wg.Add(1) + go func() { + defer wg.Done() + defer reqw.Close() + var m jsonpb.Marshaler + for i := 0; i < 1000; i++ { + msg := sub.StringMessage{Value: proto.String(fmt.Sprintf("message %d", i))} + buf, err := m.MarshalToString(&msg) + if err != nil { + t.Errorf("m.Marshal(%v) failed with %v; want success", &msg, err) + return + } + if _, err := fmt.Fprintln(reqw, buf); err != nil { + t.Errorf("fmt.Fprintln(reqw, %q) failed with %v; want success", buf, err) + return + } + want = append(want, &msg) + } + }() + + url := "http://localhost:8080/v1/example/a_bit_of_everything/echo" + req, err := http.NewRequest("POST", url, reqr) + if err != nil { + t.Errorf("http.NewRequest(%q, %q, reqr) failed with %v; want success", "POST", url, err) + return + } + req.Header.Set("Content-Type", "application/json") + req.Header.Set("Transfer-Encoding", "chunked") + resp, err := http.DefaultClient.Do(req) + if err != nil { + t.Errorf("http.Post(%q, %q, req) failed with %v; want success", url, "application/json", err) + return + } + defer resp.Body.Close() + if got, want := resp.StatusCode, http.StatusOK; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + } + + var got []*sub.StringMessage + wg.Add(1) + go func() { + defer wg.Done() + + dec := json.NewDecoder(resp.Body) + for i := 0; ; i++ { + var item struct { + Result json.RawMessage `json:"result"` + Error map[string]interface{} `json:"error"` + } + err := dec.Decode(&item) + if err == io.EOF { + break + } + if err != nil { + t.Errorf("dec.Decode(&item) failed with %v; want success; i = %d", err, i) + } + if len(item.Error) != 0 { + t.Errorf("item.Error = %#v; want empty; i = %d", item.Error, i) + continue + } + var msg sub.StringMessage + if err := jsonpb.UnmarshalString(string(item.Result), &msg); err != nil { + t.Errorf("jsonpb.UnmarshalString(%q, &msg) failed with %v; want success", item.Result, err) + } + got = append(got, &msg) + } + }() + + wg.Wait() + if !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want %v", got, want) + } +} + +func testABEBulkEchoZeroLength(t *testing.T) { + url := "http://localhost:8080/v1/example/a_bit_of_everything/echo" + req, err := http.NewRequest("POST", url, bytes.NewReader(nil)) + if err != nil { + t.Errorf("http.NewRequest(%q, %q, bytes.NewReader(nil)) failed with %v; want success", "POST", url, err) + return + } + req.Header.Set("Content-Type", "application/json") + req.Header.Set("Transfer-Encoding", "chunked") + resp, err := http.DefaultClient.Do(req) + if err != nil { + t.Errorf("http.Post(%q, %q, req) failed with %v; want success", url, "application/json", err) + return + } + defer resp.Body.Close() + if got, want := resp.StatusCode, http.StatusOK; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + } + + dec := json.NewDecoder(resp.Body) + var item struct { + Result json.RawMessage `json:"result"` + Error map[string]interface{} `json:"error"` + } + if err := dec.Decode(&item); err == nil { + t.Errorf("dec.Decode(&item) succeeded; want io.EOF; item = %#v", item) + } else if err != io.EOF { + t.Errorf("dec.Decode(&item) failed with %v; want success", err) + return + } +} + +func testAdditionalBindings(t *testing.T) { + for i, f := range []func() *http.Response{ + func() *http.Response { + url := "http://localhost:8080/v1/example/a_bit_of_everything/echo/hello" + resp, err := http.Get(url) + if err != nil { + t.Errorf("http.Get(%q) failed with %v; want success", url, err) + return nil + } + return resp + }, + func() *http.Response { + url := "http://localhost:8080/v2/example/echo" + resp, err := http.Post(url, "application/json", strings.NewReader(`"hello"`)) + if err != nil { + t.Errorf("http.Post(%q, %q, %q) failed with %v; want success", url, "application/json", `"hello"`, err) + return nil + } + return resp + }, + func() *http.Response { + url := "http://localhost:8080/v2/example/echo?value=hello" + resp, err := http.Get(url) + if err != nil { + t.Errorf("http.Get(%q) failed with %v; want success", url, err) + return nil + } + return resp + }, + } { + resp := f() + if resp == nil { + continue + } + + defer resp.Body.Close() + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success; i=%d", err, i) + return + } + if got, want := resp.StatusCode, http.StatusOK; got != want { + t.Errorf("resp.StatusCode = %d; want %d; i=%d", got, want, i) + t.Logf("%s", buf) + } + + var msg sub.StringMessage + if err := jsonpb.UnmarshalString(string(buf), &msg); err != nil { + t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success; %d", buf, err, i) + return + } + if got, want := msg.GetValue(), "hello"; got != want { + t.Errorf("msg.GetValue() = %q; want %q", got, want) + } + } +} + +func TestTimeout(t *testing.T) { + url := "http://localhost:8080/v2/example/timeout" + req, err := http.NewRequest("GET", url, nil) + if err != nil { + t.Errorf(`http.NewRequest("GET", %q, nil) failed with %v; want success`, url, err) + return + } + req.Header.Set("Grpc-Timeout", "10m") + resp, err := http.DefaultClient.Do(req) + if err != nil { + t.Errorf("http.DefaultClient.Do(%#v) failed with %v; want success", req, err) + return + } + defer resp.Body.Close() + + if got, want := resp.StatusCode, http.StatusRequestTimeout; got != want { + t.Errorf("resp.StatusCode = %d; want %d", got, want) + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/main.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/main.go new file mode 100644 index 0000000..f6a16a8 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/main.go @@ -0,0 +1,109 @@ +package main + +import ( + "flag" + "net/http" + "path" + "strings" + + "github.com/golang/glog" + "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "golang.org/x/net/context" + "google.golang.org/grpc" +) + +var ( + echoEndpoint = flag.String("echo_endpoint", "localhost:9090", "endpoint of EchoService") + abeEndpoint = flag.String("more_endpoint", "localhost:9090", "endpoint of ABitOfEverythingService") + flowEndpoint = flag.String("flow_endpoint", "localhost:9090", "endpoint of FlowCombination") + + swaggerDir = flag.String("swagger_dir", "examples/examplepb", "path to the directory which contains swagger definitions") +) + +// newGateway returns a new gateway server which translates HTTP into gRPC. +func newGateway(ctx context.Context, opts ...runtime.ServeMuxOption) (http.Handler, error) { + mux := runtime.NewServeMux(opts...) + dialOpts := []grpc.DialOption{grpc.WithInsecure()} + err := examplepb.RegisterEchoServiceHandlerFromEndpoint(ctx, mux, *echoEndpoint, dialOpts) + if err != nil { + return nil, err + } + err = examplepb.RegisterStreamServiceHandlerFromEndpoint(ctx, mux, *abeEndpoint, dialOpts) + if err != nil { + return nil, err + } + err = examplepb.RegisterABitOfEverythingServiceHandlerFromEndpoint(ctx, mux, *abeEndpoint, dialOpts) + if err != nil { + return nil, err + } + err = examplepb.RegisterFlowCombinationHandlerFromEndpoint(ctx, mux, *flowEndpoint, dialOpts) + if err != nil { + return nil, err + } + return mux, nil +} + +func serveSwagger(w http.ResponseWriter, r *http.Request) { + if !strings.HasSuffix(r.URL.Path, ".swagger.json") { + glog.Errorf("Not Found: %s", r.URL.Path) + http.NotFound(w, r) + return + } + + glog.Infof("Serving %s", r.URL.Path) + p := strings.TrimPrefix(r.URL.Path, "/swagger/") + p = path.Join(*swaggerDir, p) + http.ServeFile(w, r, p) +} + +// allowCORS allows Cross Origin Resoruce Sharing from any origin. +// Don't do this without consideration in production systems. +func allowCORS(h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if origin := r.Header.Get("Origin"); origin != "" { + w.Header().Set("Access-Control-Allow-Origin", origin) + if r.Method == "OPTIONS" && r.Header.Get("Access-Control-Request-Method") != "" { + preflightHandler(w, r) + return + } + } + h.ServeHTTP(w, r) + }) +} + +func preflightHandler(w http.ResponseWriter, r *http.Request) { + headers := []string{"Content-Type", "Accept"} + w.Header().Set("Access-Control-Allow-Headers", strings.Join(headers, ",")) + methods := []string{"GET", "HEAD", "POST", "PUT", "DELETE"} + w.Header().Set("Access-Control-Allow-Methods", strings.Join(methods, ",")) + glog.Infof("preflight request for %s", r.URL.Path) + return +} + +// Run starts a HTTP server and blocks forever if successful. +func Run(address string, opts ...runtime.ServeMuxOption) error { + ctx := context.Background() + ctx, cancel := context.WithCancel(ctx) + defer cancel() + + mux := http.NewServeMux() + mux.HandleFunc("/swagger/", serveSwagger) + + gw, err := newGateway(ctx, opts...) + if err != nil { + return err + } + mux.Handle("/", gw) + + return http.ListenAndServe(address, allowCORS(mux)) +} + +func main() { + flag.Parse() + defer glog.Flush() + + if err := Run(":8080"); err != nil { + glog.Fatal(err) + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/main_test.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/main_test.go new file mode 100644 index 0000000..2742c38 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/main_test.go @@ -0,0 +1,45 @@ +package main + +import ( + "flag" + "fmt" + "os" + "testing" + "time" + + server "github.com/grpc-ecosystem/grpc-gateway/examples/server" +) + +func runServers() <-chan error { + ch := make(chan error, 2) + go func() { + if err := server.Run(); err != nil { + ch <- fmt.Errorf("cannot run grpc service: %v", err) + } + }() + go func() { + if err := Run(":8080"); err != nil { + ch <- fmt.Errorf("cannot run gateway service: %v", err) + } + }() + return ch +} + +func TestMain(m *testing.M) { + flag.Parse() + errCh := runServers() + + ch := make(chan int, 1) + go func() { + time.Sleep(100 * time.Millisecond) + ch <- m.Run() + }() + + select { + case err := <-errCh: + fmt.Fprintln(os.Stderr, err) + os.Exit(1) + case status := <-ch: + os.Exit(status) + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/a_bit_of_everything.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/a_bit_of_everything.go new file mode 100644 index 0000000..07bdcce --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/a_bit_of_everything.go @@ -0,0 +1,247 @@ +package server + +import ( + "fmt" + "io" + "sync" + + "github.com/golang/glog" + "github.com/golang/protobuf/ptypes/duration" + "github.com/golang/protobuf/ptypes/empty" + examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub" + sub2 "github.com/grpc-ecosystem/grpc-gateway/examples/sub2" + "github.com/rogpeppe/fastuuid" + "golang.org/x/net/context" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// Implements of ABitOfEverythingServiceServer + +var uuidgen = fastuuid.MustNewGenerator() + +type _ABitOfEverythingServer struct { + v map[string]*examples.ABitOfEverything + m sync.Mutex +} + +type ABitOfEverythingServer interface { + examples.ABitOfEverythingServiceServer + examples.StreamServiceServer +} + +func newABitOfEverythingServer() ABitOfEverythingServer { + return &_ABitOfEverythingServer{ + v: make(map[string]*examples.ABitOfEverything), + } +} + +func (s *_ABitOfEverythingServer) Create(ctx context.Context, msg *examples.ABitOfEverything) (*examples.ABitOfEverything, error) { + s.m.Lock() + defer s.m.Unlock() + + glog.Info(msg) + var uuid string + for { + uuid = fmt.Sprintf("%x", uuidgen.Next()) + if _, ok := s.v[uuid]; !ok { + break + } + } + s.v[uuid] = msg + s.v[uuid].Uuid = uuid + glog.Infof("%v", s.v[uuid]) + return s.v[uuid], nil +} + +func (s *_ABitOfEverythingServer) CreateBody(ctx context.Context, msg *examples.ABitOfEverything) (*examples.ABitOfEverything, error) { + return s.Create(ctx, msg) +} + +func (s *_ABitOfEverythingServer) BulkCreate(stream examples.StreamService_BulkCreateServer) error { + count := 0 + ctx := stream.Context() + for { + msg, err := stream.Recv() + if err == io.EOF { + break + } + if err != nil { + return err + } + count++ + glog.Error(msg) + if _, err = s.Create(ctx, msg); err != nil { + return err + } + } + + err := stream.SendHeader(metadata.New(map[string]string{ + "count": fmt.Sprintf("%d", count), + })) + if err != nil { + return nil + } + + stream.SetTrailer(metadata.New(map[string]string{ + "foo": "foo2", + "bar": "bar2", + })) + return stream.SendAndClose(new(empty.Empty)) +} + +func (s *_ABitOfEverythingServer) Lookup(ctx context.Context, msg *sub2.IdMessage) (*examples.ABitOfEverything, error) { + s.m.Lock() + defer s.m.Unlock() + glog.Info(msg) + + err := grpc.SendHeader(ctx, metadata.New(map[string]string{ + "uuid": msg.Uuid, + })) + if err != nil { + return nil, err + } + + if a, ok := s.v[msg.Uuid]; ok { + return a, nil + } + + grpc.SetTrailer(ctx, metadata.New(map[string]string{ + "foo": "foo2", + "bar": "bar2", + })) + return nil, grpc.Errorf(codes.NotFound, "not found") +} + +func (s *_ABitOfEverythingServer) List(_ *empty.Empty, stream examples.StreamService_ListServer) error { + s.m.Lock() + defer s.m.Unlock() + + err := stream.SendHeader(metadata.New(map[string]string{ + "count": fmt.Sprintf("%d", len(s.v)), + })) + if err != nil { + return nil + } + + for _, msg := range s.v { + if err := stream.Send(msg); err != nil { + return err + } + } + + // return error when metadata includes error header + if header, ok := metadata.FromContext(stream.Context()); ok { + if v, ok := header["error"]; ok { + stream.SetTrailer(metadata.New(map[string]string{ + "foo": "foo2", + "bar": "bar2", + })) + return grpc.Errorf(codes.InvalidArgument, "error metadata: %v", v) + } + } + return nil +} + +func (s *_ABitOfEverythingServer) Update(ctx context.Context, msg *examples.ABitOfEverything) (*empty.Empty, error) { + s.m.Lock() + defer s.m.Unlock() + + glog.Info(msg) + if _, ok := s.v[msg.Uuid]; ok { + s.v[msg.Uuid] = msg + } else { + return nil, grpc.Errorf(codes.NotFound, "not found") + } + return new(empty.Empty), nil +} + +func (s *_ABitOfEverythingServer) Delete(ctx context.Context, msg *sub2.IdMessage) (*empty.Empty, error) { + s.m.Lock() + defer s.m.Unlock() + + glog.Info(msg) + if _, ok := s.v[msg.Uuid]; ok { + delete(s.v, msg.Uuid) + } else { + return nil, grpc.Errorf(codes.NotFound, "not found") + } + return new(empty.Empty), nil +} + +func (s *_ABitOfEverythingServer) GetQuery(ctx context.Context, msg *examples.ABitOfEverything) (*empty.Empty, error) { + s.m.Lock() + defer s.m.Unlock() + + glog.Info(msg) + if _, ok := s.v[msg.Uuid]; ok { + s.v[msg.Uuid] = msg + } else { + return nil, grpc.Errorf(codes.NotFound, "not found") + } + return new(empty.Empty), nil +} + +func (s *_ABitOfEverythingServer) Echo(ctx context.Context, msg *sub.StringMessage) (*sub.StringMessage, error) { + s.m.Lock() + defer s.m.Unlock() + + glog.Info(msg) + return msg, nil +} + +func (s *_ABitOfEverythingServer) BulkEcho(stream examples.StreamService_BulkEchoServer) error { + var msgs []*sub.StringMessage + for { + msg, err := stream.Recv() + if err == io.EOF { + break + } + if err != nil { + return err + } + msgs = append(msgs, msg) + } + + hmd := metadata.New(map[string]string{ + "foo": "foo1", + "bar": "bar1", + }) + if err := stream.SendHeader(hmd); err != nil { + return err + } + + for _, msg := range msgs { + glog.Info(msg) + if err := stream.Send(msg); err != nil { + return err + } + } + + stream.SetTrailer(metadata.New(map[string]string{ + "foo": "foo2", + "bar": "bar2", + })) + return nil +} + +func (s *_ABitOfEverythingServer) DeepPathEcho(ctx context.Context, msg *examples.ABitOfEverything) (*examples.ABitOfEverything, error) { + s.m.Lock() + defer s.m.Unlock() + + glog.Info(msg) + return msg, nil +} + +func (s *_ABitOfEverythingServer) NoBindings(ctx context.Context, msg *duration.Duration) (*empty.Empty, error) { + return nil, nil +} + +func (s *_ABitOfEverythingServer) Timeout(ctx context.Context, msg *empty.Empty) (*empty.Empty, error) { + select { + case <-ctx.Done(): + return nil, ctx.Err() + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/cmd/example-server/main.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/cmd/example-server/main.go new file mode 100644 index 0000000..34b319a --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/cmd/example-server/main.go @@ -0,0 +1,17 @@ +package main + +import ( + "flag" + + "github.com/golang/glog" + "github.com/grpc-ecosystem/grpc-gateway/examples/server" +) + +func main() { + flag.Parse() + defer glog.Flush() + + if err := server.Run(); err != nil { + glog.Fatal(err) + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/echo.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/echo.go new file mode 100644 index 0000000..e87db2d --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/echo.go @@ -0,0 +1,35 @@ +package server + +import ( + "github.com/golang/glog" + examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + "golang.org/x/net/context" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" +) + +// Implements of EchoServiceServer + +type echoServer struct{} + +func newEchoServer() examples.EchoServiceServer { + return new(echoServer) +} + +func (s *echoServer) Echo(ctx context.Context, msg *examples.SimpleMessage) (*examples.SimpleMessage, error) { + glog.Info(msg) + return msg, nil +} + +func (s *echoServer) EchoBody(ctx context.Context, msg *examples.SimpleMessage) (*examples.SimpleMessage, error) { + glog.Info(msg) + grpc.SendHeader(ctx, metadata.New(map[string]string{ + "foo": "foo1", + "bar": "bar1", + })) + grpc.SetTrailer(ctx, metadata.New(map[string]string{ + "foo": "foo2", + "bar": "bar2", + })) + return msg, nil +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/flow_combination.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/flow_combination.go new file mode 100644 index 0000000..f1a90fa --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/flow_combination.go @@ -0,0 +1,72 @@ +package server + +import ( + "io" + + examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + "golang.org/x/net/context" +) + +type flowCombinationServer struct{} + +func newFlowCombinationServer() examples.FlowCombinationServer { + return &flowCombinationServer{} +} + +func (s flowCombinationServer) RpcEmptyRpc(ctx context.Context, req *examples.EmptyProto) (*examples.EmptyProto, error) { + return req, nil +} + +func (s flowCombinationServer) RpcEmptyStream(req *examples.EmptyProto, stream examples.FlowCombination_RpcEmptyStreamServer) error { + return stream.Send(req) +} + +func (s flowCombinationServer) StreamEmptyRpc(stream examples.FlowCombination_StreamEmptyRpcServer) error { + for { + _, err := stream.Recv() + if err == io.EOF { + break + } + if err != nil { + return err + } + } + return stream.SendAndClose(new(examples.EmptyProto)) +} + +func (s flowCombinationServer) StreamEmptyStream(stream examples.FlowCombination_StreamEmptyStreamServer) error { + for { + _, err := stream.Recv() + if err == io.EOF { + break + } + if err != nil { + return err + } + } + return stream.Send(new(examples.EmptyProto)) +} + +func (s flowCombinationServer) RpcBodyRpc(ctx context.Context, req *examples.NonEmptyProto) (*examples.EmptyProto, error) { + return new(examples.EmptyProto), nil +} + +func (s flowCombinationServer) RpcPathSingleNestedRpc(ctx context.Context, req *examples.SingleNestedProto) (*examples.EmptyProto, error) { + return new(examples.EmptyProto), nil +} + +func (s flowCombinationServer) RpcPathNestedRpc(ctx context.Context, req *examples.NestedProto) (*examples.EmptyProto, error) { + return new(examples.EmptyProto), nil +} + +func (s flowCombinationServer) RpcBodyStream(req *examples.NonEmptyProto, stream examples.FlowCombination_RpcBodyStreamServer) error { + return stream.Send(new(examples.EmptyProto)) +} + +func (s flowCombinationServer) RpcPathSingleNestedStream(req *examples.SingleNestedProto, stream examples.FlowCombination_RpcPathSingleNestedStreamServer) error { + return stream.Send(new(examples.EmptyProto)) +} + +func (s flowCombinationServer) RpcPathNestedStream(req *examples.NestedProto, stream examples.FlowCombination_RpcPathNestedStreamServer) error { + return stream.Send(new(examples.EmptyProto)) +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/main.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/main.go new file mode 100644 index 0000000..c5e6cb6 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/main.go @@ -0,0 +1,25 @@ +package server + +import ( + "net" + + examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + "google.golang.org/grpc" +) + +func Run() error { + l, err := net.Listen("tcp", ":9090") + if err != nil { + return err + } + s := grpc.NewServer() + examples.RegisterEchoServiceServer(s, newEchoServer()) + examples.RegisterFlowCombinationServer(s, newFlowCombinationServer()) + + abe := newABitOfEverythingServer() + examples.RegisterABitOfEverythingServiceServer(s, abe) + examples.RegisterStreamServiceServer(s, abe) + + s.Serve(l) + return nil +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/sub/message.pb.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/sub/message.pb.go new file mode 100644 index 0000000..57c4ecd --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/sub/message.pb.go @@ -0,0 +1,63 @@ +// Code generated by protoc-gen-go. +// source: examples/sub/message.proto +// DO NOT EDIT! + +/* +Package sub is a generated protocol buffer package. + +It is generated from these files: + examples/sub/message.proto + +It has these top-level messages: + StringMessage +*/ +package sub + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type StringMessage struct { + Value *string `protobuf:"bytes,1,req,name=value" json:"value,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *StringMessage) Reset() { *m = StringMessage{} } +func (m *StringMessage) String() string { return proto.CompactTextString(m) } +func (*StringMessage) ProtoMessage() {} +func (*StringMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *StringMessage) GetValue() string { + if m != nil && m.Value != nil { + return *m.Value + } + return "" +} + +func init() { + proto.RegisterType((*StringMessage)(nil), "grpc.gateway.examples.sub.StringMessage") +} + +func init() { proto.RegisterFile("examples/sub/message.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 111 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0xad, 0x48, 0xcc, + 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x2e, 0x4d, 0xd2, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, + 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x4c, 0x2f, 0x2a, 0x48, 0xd6, 0x4b, 0x4f, 0x2c, + 0x49, 0x2d, 0x4f, 0xac, 0xd4, 0x83, 0x29, 0xd4, 0x2b, 0x2e, 0x4d, 0x52, 0x52, 0xe5, 0xe2, 0x0d, + 0x2e, 0x29, 0xca, 0xcc, 0x4b, 0xf7, 0x85, 0xe8, 0x10, 0x12, 0xe1, 0x62, 0x2d, 0x4b, 0xcc, 0x29, + 0x4d, 0x95, 0x60, 0x54, 0x60, 0xd2, 0xe0, 0x0c, 0x82, 0x70, 0x9c, 0x58, 0xa3, 0x98, 0x8b, 0x4b, + 0x93, 0x00, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbc, 0x10, 0x60, 0xa9, 0x65, 0x00, 0x00, 0x00, +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/sub/message.proto b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/sub/message.proto new file mode 100644 index 0000000..7702a93 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/sub/message.proto @@ -0,0 +1,7 @@ +syntax = "proto2"; +option go_package = "sub"; +package grpc.gateway.examples.sub; + +message StringMessage { + required string value = 1; +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/sub2/message.pb.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/sub2/message.pb.go new file mode 100644 index 0000000..18569d9 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/sub2/message.pb.go @@ -0,0 +1,63 @@ +// Code generated by protoc-gen-go. +// source: examples/sub2/message.proto +// DO NOT EDIT! + +/* +Package sub2 is a generated protocol buffer package. + +It is generated from these files: + examples/sub2/message.proto + +It has these top-level messages: + IdMessage +*/ +package sub2 + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type IdMessage struct { + Uuid string `protobuf:"bytes,1,opt,name=uuid" json:"uuid,omitempty"` +} + +func (m *IdMessage) Reset() { *m = IdMessage{} } +func (m *IdMessage) String() string { return proto.CompactTextString(m) } +func (*IdMessage) ProtoMessage() {} +func (*IdMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *IdMessage) GetUuid() string { + if m != nil { + return m.Uuid + } + return "" +} + +func init() { + proto.RegisterType((*IdMessage)(nil), "sub2.IdMessage") +} + +func init() { proto.RegisterFile("examples/sub2/message.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 128 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xad, 0x48, 0xcc, + 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x2e, 0x4d, 0x32, 0xd2, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, + 0x4f, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x01, 0x89, 0x29, 0xc9, 0x73, 0x71, 0x7a, + 0xa6, 0xf8, 0x42, 0x24, 0x84, 0x84, 0xb8, 0x58, 0x4a, 0x4b, 0x33, 0x53, 0x24, 0x18, 0x15, 0x18, + 0x35, 0x38, 0x83, 0xc0, 0x6c, 0x27, 0xb3, 0x28, 0x93, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, + 0xe4, 0xfc, 0x5c, 0xfd, 0xf4, 0xa2, 0x82, 0x64, 0xdd, 0xd4, 0xe4, 0xfc, 0xe2, 0xca, 0xe2, 0x92, + 0x54, 0x28, 0x37, 0x3d, 0xb1, 0x24, 0xb5, 0x3c, 0xb1, 0x52, 0x1f, 0xc5, 0xb2, 0x24, 0x36, 0xb0, + 0x2d, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x53, 0x75, 0xef, 0xe0, 0x84, 0x00, 0x00, 0x00, +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/sub2/message.proto b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/sub2/message.proto new file mode 100644 index 0000000..9c26643 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/examples/sub2/message.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; +option go_package = "github.com/grpc-ecosystem/grpc-gateway/examples/sub2"; +package sub2; + +message IdMessage { + string uuid = 1; +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/options/options.proto b/vendor/github.com/grpc-ecosystem/grpc-gateway/options/options.proto new file mode 100644 index 0000000..be81c96 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/options/options.proto @@ -0,0 +1,27 @@ +syntax = "proto2"; +option go_package = "options"; + +package gengo.grpc.gateway; +import "google/protobuf/descriptor.proto"; + +message ApiMethodOptions { + // Use HttpRule instead. + option deprecated = true; + + extend google.protobuf.MethodOptions { + // Describes how the gRPC method should be exported as a RESTful API. + // + // The id is a globally unique id for this option, assigned by + // protobuf-global-extension-registry@google.com. + optional ApiMethodOptions api_options = 1022; + } + + // Path of the RESTful API method. + // Path components which start with colon is mapped to the corresponding fields in the request message. + required string path = 1; + // HTTP method of the RESTful API method + required string method = 2; + // Human-readable description of the method. + optional string description = 3; +} + diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/registry.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/registry.go new file mode 100644 index 0000000..1232809 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/registry.go @@ -0,0 +1,299 @@ +package descriptor + +import ( + "fmt" + "path" + "path/filepath" + "strings" + + "github.com/golang/glog" + descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + plugin "github.com/golang/protobuf/protoc-gen-go/plugin" +) + +// Registry is a registry of information extracted from plugin.CodeGeneratorRequest. +type Registry struct { + // msgs is a mapping from fully-qualified message name to descriptor + msgs map[string]*Message + + // enums is a mapping from fully-qualified enum name to descriptor + enums map[string]*Enum + + // files is a mapping from file path to descriptor + files map[string]*File + + // prefix is a prefix to be inserted to golang package paths generated from proto package names. + prefix string + + // pkgMap is a user-specified mapping from file path to proto package. + pkgMap map[string]string + + // pkgAliases is a mapping from package aliases to package paths in go which are already taken. + pkgAliases map[string]string + + // allowDeleteBody permits http delete methods to have a body + allowDeleteBody bool +} + +// NewRegistry returns a new Registry. +func NewRegistry() *Registry { + return &Registry{ + msgs: make(map[string]*Message), + enums: make(map[string]*Enum), + files: make(map[string]*File), + pkgMap: make(map[string]string), + pkgAliases: make(map[string]string), + } +} + +// Load loads definitions of services, methods, messages, enumerations and fields from "req". +func (r *Registry) Load(req *plugin.CodeGeneratorRequest) error { + for _, file := range req.GetProtoFile() { + r.loadFile(file) + } + + var targetPkg string + for _, name := range req.FileToGenerate { + target := r.files[name] + if target == nil { + return fmt.Errorf("no such file: %s", name) + } + name := packageIdentityName(target.FileDescriptorProto) + if targetPkg == "" { + targetPkg = name + } else { + if targetPkg != name { + return fmt.Errorf("inconsistent package names: %s %s", targetPkg, name) + } + } + + if err := r.loadServices(target); err != nil { + return err + } + } + return nil +} + +// loadFile loads messages, enumerations and fields from "file". +// It does not loads services and methods in "file". You need to call +// loadServices after loadFiles is called for all files to load services and methods. +func (r *Registry) loadFile(file *descriptor.FileDescriptorProto) { + pkg := GoPackage{ + Path: r.goPackagePath(file), + Name: defaultGoPackageName(file), + } + if err := r.ReserveGoPackageAlias(pkg.Name, pkg.Path); err != nil { + for i := 0; ; i++ { + alias := fmt.Sprintf("%s_%d", pkg.Name, i) + if err := r.ReserveGoPackageAlias(alias, pkg.Path); err == nil { + pkg.Alias = alias + break + } + } + } + f := &File{ + FileDescriptorProto: file, + GoPkg: pkg, + } + + r.files[file.GetName()] = f + r.registerMsg(f, nil, file.GetMessageType()) + r.registerEnum(f, nil, file.GetEnumType()) +} + +func (r *Registry) registerMsg(file *File, outerPath []string, msgs []*descriptor.DescriptorProto) { + for i, md := range msgs { + m := &Message{ + File: file, + Outers: outerPath, + DescriptorProto: md, + Index: i, + } + for _, fd := range md.GetField() { + m.Fields = append(m.Fields, &Field{ + Message: m, + FieldDescriptorProto: fd, + }) + } + file.Messages = append(file.Messages, m) + r.msgs[m.FQMN()] = m + glog.V(1).Infof("register name: %s", m.FQMN()) + + var outers []string + outers = append(outers, outerPath...) + outers = append(outers, m.GetName()) + r.registerMsg(file, outers, m.GetNestedType()) + r.registerEnum(file, outers, m.GetEnumType()) + } +} + +func (r *Registry) registerEnum(file *File, outerPath []string, enums []*descriptor.EnumDescriptorProto) { + for i, ed := range enums { + e := &Enum{ + File: file, + Outers: outerPath, + EnumDescriptorProto: ed, + Index: i, + } + file.Enums = append(file.Enums, e) + r.enums[e.FQEN()] = e + glog.V(1).Infof("register enum name: %s", e.FQEN()) + } +} + +// LookupMsg looks up a message type by "name". +// It tries to resolve "name" from "location" if "name" is a relative message name. +func (r *Registry) LookupMsg(location, name string) (*Message, error) { + glog.V(1).Infof("lookup %s from %s", name, location) + if strings.HasPrefix(name, ".") { + m, ok := r.msgs[name] + if !ok { + return nil, fmt.Errorf("no message found: %s", name) + } + return m, nil + } + + if !strings.HasPrefix(location, ".") { + location = fmt.Sprintf(".%s", location) + } + components := strings.Split(location, ".") + for len(components) > 0 { + fqmn := strings.Join(append(components, name), ".") + if m, ok := r.msgs[fqmn]; ok { + return m, nil + } + components = components[:len(components)-1] + } + return nil, fmt.Errorf("no message found: %s", name) +} + +// LookupEnum looks up a enum type by "name". +// It tries to resolve "name" from "location" if "name" is a relative enum name. +func (r *Registry) LookupEnum(location, name string) (*Enum, error) { + glog.V(1).Infof("lookup enum %s from %s", name, location) + if strings.HasPrefix(name, ".") { + e, ok := r.enums[name] + if !ok { + return nil, fmt.Errorf("no enum found: %s", name) + } + return e, nil + } + + if !strings.HasPrefix(location, ".") { + location = fmt.Sprintf(".%s", location) + } + components := strings.Split(location, ".") + for len(components) > 0 { + fqen := strings.Join(append(components, name), ".") + if e, ok := r.enums[fqen]; ok { + return e, nil + } + components = components[:len(components)-1] + } + return nil, fmt.Errorf("no enum found: %s", name) +} + +// LookupFile looks up a file by name. +func (r *Registry) LookupFile(name string) (*File, error) { + f, ok := r.files[name] + if !ok { + return nil, fmt.Errorf("no such file given: %s", name) + } + return f, nil +} + +// AddPkgMap adds a mapping from a .proto file to proto package name. +func (r *Registry) AddPkgMap(file, protoPkg string) { + r.pkgMap[file] = protoPkg +} + +// SetPrefix registeres the perfix to be added to go package paths generated from proto package names. +func (r *Registry) SetPrefix(prefix string) { + r.prefix = prefix +} + +// ReserveGoPackageAlias reserves the unique alias of go package. +// If succeeded, the alias will be never used for other packages in generated go files. +// If failed, the alias is already taken by another package, so you need to use another +// alias for the package in your go files. +func (r *Registry) ReserveGoPackageAlias(alias, pkgpath string) error { + if taken, ok := r.pkgAliases[alias]; ok { + if taken == pkgpath { + return nil + } + return fmt.Errorf("package name %s is already taken. Use another alias", alias) + } + r.pkgAliases[alias] = pkgpath + return nil +} + +// goPackagePath returns the go package path which go files generated from "f" should have. +// It respects the mapping registered by AddPkgMap if exists. Or use go_package as import path +// if it includes a slash, Otherwide, it generates a path from the file name of "f". +func (r *Registry) goPackagePath(f *descriptor.FileDescriptorProto) string { + name := f.GetName() + if pkg, ok := r.pkgMap[name]; ok { + return path.Join(r.prefix, pkg) + } + + gopkg := f.Options.GetGoPackage() + idx := strings.LastIndex(gopkg, "/") + if idx >= 0 { + return gopkg + } + + return path.Join(r.prefix, path.Dir(name)) +} + +// GetAllFQMNs returns a list of all FQMNs +func (r *Registry) GetAllFQMNs() []string { + var keys []string + for k := range r.msgs { + keys = append(keys, k) + } + return keys +} + +// GetAllFQENs returns a list of all FQENs +func (r *Registry) GetAllFQENs() []string { + var keys []string + for k := range r.enums { + keys = append(keys, k) + } + return keys +} + +// SetAllowDeleteBody controls whether http delete methods may have a +// body or fail loading if encountered. +func (r *Registry) SetAllowDeleteBody(allow bool) { + r.allowDeleteBody = allow +} + +// defaultGoPackageName returns the default go package name to be used for go files generated from "f". +// You might need to use an unique alias for the package when you import it. Use ReserveGoPackageAlias to get a unique alias. +func defaultGoPackageName(f *descriptor.FileDescriptorProto) string { + name := packageIdentityName(f) + return strings.Replace(name, ".", "_", -1) +} + +// packageIdentityName returns the identity of packages. +// protoc-gen-grpc-gateway rejects CodeGenerationRequests which contains more than one packages +// as protoc-gen-go does. +func packageIdentityName(f *descriptor.FileDescriptorProto) string { + if f.Options != nil && f.Options.GoPackage != nil { + gopkg := f.Options.GetGoPackage() + idx := strings.LastIndex(gopkg, "/") + if idx < 0 { + return gopkg + } + + return gopkg[idx+1:] + } + + if f.Package == nil { + base := filepath.Base(f.GetName()) + ext := filepath.Ext(base) + return strings.TrimSuffix(base, ext) + } + return f.GetPackage() +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/registry_test.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/registry_test.go new file mode 100644 index 0000000..ff3f4dc --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/registry_test.go @@ -0,0 +1,533 @@ +package descriptor + +import ( + "testing" + + "github.com/golang/protobuf/proto" + descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + plugin "github.com/golang/protobuf/protoc-gen-go/plugin" +) + +func loadFile(t *testing.T, reg *Registry, src string) *descriptor.FileDescriptorProto { + var file descriptor.FileDescriptorProto + if err := proto.UnmarshalText(src, &file); err != nil { + t.Fatalf("proto.UnmarshalText(%s, &file) failed with %v; want success", src, err) + } + reg.loadFile(&file) + return &file +} + +func load(t *testing.T, reg *Registry, src string) error { + var req plugin.CodeGeneratorRequest + if err := proto.UnmarshalText(src, &req); err != nil { + t.Fatalf("proto.UnmarshalText(%s, &file) failed with %v; want success", src, err) + } + return reg.Load(&req) +} + +func TestLoadFile(t *testing.T) { + reg := NewRegistry() + fd := loadFile(t, reg, ` + name: 'example.proto' + package: 'example' + message_type < + name: 'ExampleMessage' + field < + name: 'str' + label: LABEL_OPTIONAL + type: TYPE_STRING + number: 1 + > + > + `) + + file := reg.files["example.proto"] + if file == nil { + t.Errorf("reg.files[%q] = nil; want non-nil", "example.proto") + return + } + wantPkg := GoPackage{Path: ".", Name: "example"} + if got, want := file.GoPkg, wantPkg; got != want { + t.Errorf("file.GoPkg = %#v; want %#v", got, want) + } + + msg, err := reg.LookupMsg("", ".example.ExampleMessage") + if err != nil { + t.Errorf("reg.LookupMsg(%q, %q)) failed with %v; want success", "", ".example.ExampleMessage", err) + return + } + if got, want := msg.DescriptorProto, fd.MessageType[0]; got != want { + t.Errorf("reg.lookupMsg(%q, %q).DescriptorProto = %#v; want %#v", "", ".example.ExampleMessage", got, want) + } + if got, want := msg.File, file; got != want { + t.Errorf("msg.File = %v; want %v", got, want) + } + if got := msg.Outers; got != nil { + t.Errorf("msg.Outers = %v; want %v", got, nil) + } + if got, want := len(msg.Fields), 1; got != want { + t.Errorf("len(msg.Fields) = %d; want %d", got, want) + } else if got, want := msg.Fields[0].FieldDescriptorProto, fd.MessageType[0].Field[0]; got != want { + t.Errorf("msg.Fields[0].FieldDescriptorProto = %v; want %v", got, want) + } else if got, want := msg.Fields[0].Message, msg; got != want { + t.Errorf("msg.Fields[0].Message = %v; want %v", got, want) + } + + if got, want := len(file.Messages), 1; got != want { + t.Errorf("file.Meeesages = %#v; want %#v", file.Messages, []*Message{msg}) + } + if got, want := file.Messages[0], msg; got != want { + t.Errorf("file.Meeesages[0] = %v; want %v", got, want) + } +} + +func TestLoadFileNestedPackage(t *testing.T) { + reg := NewRegistry() + loadFile(t, reg, ` + name: 'example.proto' + package: 'example.nested.nested2' + `) + + file := reg.files["example.proto"] + if file == nil { + t.Errorf("reg.files[%q] = nil; want non-nil", "example.proto") + return + } + wantPkg := GoPackage{Path: ".", Name: "example_nested_nested2"} + if got, want := file.GoPkg, wantPkg; got != want { + t.Errorf("file.GoPkg = %#v; want %#v", got, want) + } +} + +func TestLoadFileWithDir(t *testing.T) { + reg := NewRegistry() + loadFile(t, reg, ` + name: 'path/to/example.proto' + package: 'example' + `) + + file := reg.files["path/to/example.proto"] + if file == nil { + t.Errorf("reg.files[%q] = nil; want non-nil", "example.proto") + return + } + wantPkg := GoPackage{Path: "path/to", Name: "example"} + if got, want := file.GoPkg, wantPkg; got != want { + t.Errorf("file.GoPkg = %#v; want %#v", got, want) + } +} + +func TestLoadFileWithoutPackage(t *testing.T) { + reg := NewRegistry() + loadFile(t, reg, ` + name: 'path/to/example_file.proto' + `) + + file := reg.files["path/to/example_file.proto"] + if file == nil { + t.Errorf("reg.files[%q] = nil; want non-nil", "example.proto") + return + } + wantPkg := GoPackage{Path: "path/to", Name: "example_file"} + if got, want := file.GoPkg, wantPkg; got != want { + t.Errorf("file.GoPkg = %#v; want %#v", got, want) + } +} + +func TestLoadFileWithMapping(t *testing.T) { + reg := NewRegistry() + reg.AddPkgMap("path/to/example.proto", "example.com/proj/example/proto") + loadFile(t, reg, ` + name: 'path/to/example.proto' + package: 'example' + `) + + file := reg.files["path/to/example.proto"] + if file == nil { + t.Errorf("reg.files[%q] = nil; want non-nil", "example.proto") + return + } + wantPkg := GoPackage{Path: "example.com/proj/example/proto", Name: "example"} + if got, want := file.GoPkg, wantPkg; got != want { + t.Errorf("file.GoPkg = %#v; want %#v", got, want) + } +} + +func TestLoadFileWithPackageNameCollision(t *testing.T) { + reg := NewRegistry() + loadFile(t, reg, ` + name: 'path/to/another.proto' + package: 'example' + `) + loadFile(t, reg, ` + name: 'path/to/example.proto' + package: 'example' + `) + if err := reg.ReserveGoPackageAlias("ioutil", "io/ioutil"); err != nil { + t.Fatalf("reg.ReserveGoPackageAlias(%q) failed with %v; want success", "ioutil", err) + } + loadFile(t, reg, ` + name: 'path/to/ioutil.proto' + package: 'ioutil' + `) + + file := reg.files["path/to/another.proto"] + if file == nil { + t.Errorf("reg.files[%q] = nil; want non-nil", "path/to/another.proto") + return + } + wantPkg := GoPackage{Path: "path/to", Name: "example"} + if got, want := file.GoPkg, wantPkg; got != want { + t.Errorf("file.GoPkg = %#v; want %#v", got, want) + } + + file = reg.files["path/to/example.proto"] + if file == nil { + t.Errorf("reg.files[%q] = nil; want non-nil", "path/to/example.proto") + return + } + wantPkg = GoPackage{Path: "path/to", Name: "example", Alias: ""} + if got, want := file.GoPkg, wantPkg; got != want { + t.Errorf("file.GoPkg = %#v; want %#v", got, want) + } + + file = reg.files["path/to/ioutil.proto"] + if file == nil { + t.Errorf("reg.files[%q] = nil; want non-nil", "path/to/ioutil.proto") + return + } + wantPkg = GoPackage{Path: "path/to", Name: "ioutil", Alias: "ioutil_0"} + if got, want := file.GoPkg, wantPkg; got != want { + t.Errorf("file.GoPkg = %#v; want %#v", got, want) + } +} + +func TestLoadFileWithIdenticalGoPkg(t *testing.T) { + reg := NewRegistry() + reg.AddPkgMap("path/to/another.proto", "example.com/example") + reg.AddPkgMap("path/to/example.proto", "example.com/example") + loadFile(t, reg, ` + name: 'path/to/another.proto' + package: 'example' + `) + loadFile(t, reg, ` + name: 'path/to/example.proto' + package: 'example' + `) + + file := reg.files["path/to/example.proto"] + if file == nil { + t.Errorf("reg.files[%q] = nil; want non-nil", "example.proto") + return + } + wantPkg := GoPackage{Path: "example.com/example", Name: "example"} + if got, want := file.GoPkg, wantPkg; got != want { + t.Errorf("file.GoPkg = %#v; want %#v", got, want) + } + + file = reg.files["path/to/another.proto"] + if file == nil { + t.Errorf("reg.files[%q] = nil; want non-nil", "example.proto") + return + } + wantPkg = GoPackage{Path: "example.com/example", Name: "example"} + if got, want := file.GoPkg, wantPkg; got != want { + t.Errorf("file.GoPkg = %#v; want %#v", got, want) + } +} + +func TestLoadFileWithPrefix(t *testing.T) { + reg := NewRegistry() + reg.SetPrefix("third_party") + loadFile(t, reg, ` + name: 'path/to/example.proto' + package: 'example' + `) + + file := reg.files["path/to/example.proto"] + if file == nil { + t.Errorf("reg.files[%q] = nil; want non-nil", "example.proto") + return + } + wantPkg := GoPackage{Path: "third_party/path/to", Name: "example"} + if got, want := file.GoPkg, wantPkg; got != want { + t.Errorf("file.GoPkg = %#v; want %#v", got, want) + } +} + +func TestLookupMsgWithoutPackage(t *testing.T) { + reg := NewRegistry() + fd := loadFile(t, reg, ` + name: 'example.proto' + message_type < + name: 'ExampleMessage' + field < + name: 'str' + label: LABEL_OPTIONAL + type: TYPE_STRING + number: 1 + > + > + `) + + msg, err := reg.LookupMsg("", ".ExampleMessage") + if err != nil { + t.Errorf("reg.LookupMsg(%q, %q)) failed with %v; want success", "", ".ExampleMessage", err) + return + } + if got, want := msg.DescriptorProto, fd.MessageType[0]; got != want { + t.Errorf("reg.lookupMsg(%q, %q).DescriptorProto = %#v; want %#v", "", ".ExampleMessage", got, want) + } +} + +func TestLookupMsgWithNestedPackage(t *testing.T) { + reg := NewRegistry() + fd := loadFile(t, reg, ` + name: 'example.proto' + package: 'nested.nested2.mypackage' + message_type < + name: 'ExampleMessage' + field < + name: 'str' + label: LABEL_OPTIONAL + type: TYPE_STRING + number: 1 + > + > + `) + + for _, name := range []string{ + "nested.nested2.mypackage.ExampleMessage", + "nested2.mypackage.ExampleMessage", + "mypackage.ExampleMessage", + "ExampleMessage", + } { + msg, err := reg.LookupMsg("nested.nested2.mypackage", name) + if err != nil { + t.Errorf("reg.LookupMsg(%q, %q)) failed with %v; want success", ".nested.nested2.mypackage", name, err) + return + } + if got, want := msg.DescriptorProto, fd.MessageType[0]; got != want { + t.Errorf("reg.lookupMsg(%q, %q).DescriptorProto = %#v; want %#v", ".nested.nested2.mypackage", name, got, want) + } + } + + for _, loc := range []string{ + ".nested.nested2.mypackage", + "nested.nested2.mypackage", + ".nested.nested2", + "nested.nested2", + ".nested", + "nested", + ".", + "", + "somewhere.else", + } { + name := "nested.nested2.mypackage.ExampleMessage" + msg, err := reg.LookupMsg(loc, name) + if err != nil { + t.Errorf("reg.LookupMsg(%q, %q)) failed with %v; want success", loc, name, err) + return + } + if got, want := msg.DescriptorProto, fd.MessageType[0]; got != want { + t.Errorf("reg.lookupMsg(%q, %q).DescriptorProto = %#v; want %#v", loc, name, got, want) + } + } + + for _, loc := range []string{ + ".nested.nested2.mypackage", + "nested.nested2.mypackage", + ".nested.nested2", + "nested.nested2", + ".nested", + "nested", + } { + name := "nested2.mypackage.ExampleMessage" + msg, err := reg.LookupMsg(loc, name) + if err != nil { + t.Errorf("reg.LookupMsg(%q, %q)) failed with %v; want success", loc, name, err) + return + } + if got, want := msg.DescriptorProto, fd.MessageType[0]; got != want { + t.Errorf("reg.lookupMsg(%q, %q).DescriptorProto = %#v; want %#v", loc, name, got, want) + } + } +} + +func TestLoadWithInconsistentTargetPackage(t *testing.T) { + for _, spec := range []struct { + req string + consistent bool + }{ + // root package, no explicit go package + { + req: ` + file_to_generate: 'a.proto' + file_to_generate: 'b.proto' + proto_file < + name: 'a.proto' + message_type < name: 'A' > + service < + name: "AService" + method < + name: "Meth" + input_type: "A" + output_type: "A" + options < + [google.api.http] < post: "/v1/a" body: "*" > + > + > + > + > + proto_file < + name: 'b.proto' + message_type < name: 'B' > + service < + name: "BService" + method < + name: "Meth" + input_type: "B" + output_type: "B" + options < + [google.api.http] < post: "/v1/b" body: "*" > + > + > + > + > + `, + consistent: false, + }, + // named package, no explicit go package + { + req: ` + file_to_generate: 'a.proto' + file_to_generate: 'b.proto' + proto_file < + name: 'a.proto' + package: 'example.foo' + message_type < name: 'A' > + service < + name: "AService" + method < + name: "Meth" + input_type: "A" + output_type: "A" + options < + [google.api.http] < post: "/v1/a" body: "*" > + > + > + > + > + proto_file < + name: 'b.proto' + package: 'example.foo' + message_type < name: 'B' > + service < + name: "BService" + method < + name: "Meth" + input_type: "B" + output_type: "B" + options < + [google.api.http] < post: "/v1/b" body: "*" > + > + > + > + > + `, + consistent: true, + }, + // root package, explicit go package + { + req: ` + file_to_generate: 'a.proto' + file_to_generate: 'b.proto' + proto_file < + name: 'a.proto' + options < go_package: 'foo' > + message_type < name: 'A' > + service < + name: "AService" + method < + name: "Meth" + input_type: "A" + output_type: "A" + options < + [google.api.http] < post: "/v1/a" body: "*" > + > + > + > + > + proto_file < + name: 'b.proto' + options < go_package: 'foo' > + message_type < name: 'B' > + service < + name: "BService" + method < + name: "Meth" + input_type: "B" + output_type: "B" + options < + [google.api.http] < post: "/v1/b" body: "*" > + > + > + > + > + `, + consistent: true, + }, + // named package, explicit go package + { + req: ` + file_to_generate: 'a.proto' + file_to_generate: 'b.proto' + proto_file < + name: 'a.proto' + package: 'example.foo' + options < go_package: 'foo' > + message_type < name: 'A' > + service < + name: "AService" + method < + name: "Meth" + input_type: "A" + output_type: "A" + options < + [google.api.http] < post: "/v1/a" body: "*" > + > + > + > + > + proto_file < + name: 'b.proto' + package: 'example.foo' + options < go_package: 'foo' > + message_type < name: 'B' > + service < + name: "BService" + method < + name: "Meth" + input_type: "B" + output_type: "B" + options < + [google.api.http] < post: "/v1/b" body: "*" > + > + > + > + > + `, + consistent: true, + }, + } { + reg := NewRegistry() + err := load(t, reg, spec.req) + if got, want := err == nil, spec.consistent; got != want { + if want { + t.Errorf("reg.Load(%s) failed with %v; want success", spec.req, err) + continue + } + t.Errorf("reg.Load(%s) succeeded; want an package inconsistency error", spec.req) + } + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/services.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/services.go new file mode 100644 index 0000000..c9dfec8 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/services.go @@ -0,0 +1,266 @@ +package descriptor + +import ( + "fmt" + "strings" + + "github.com/golang/glog" + "github.com/golang/protobuf/proto" + descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" + options "google.golang.org/genproto/googleapis/api/annotations" +) + +// loadServices registers services and their methods from "targetFile" to "r". +// It must be called after loadFile is called for all files so that loadServices +// can resolve names of message types and their fields. +func (r *Registry) loadServices(file *File) error { + glog.V(1).Infof("Loading services from %s", file.GetName()) + var svcs []*Service + for _, sd := range file.GetService() { + glog.V(2).Infof("Registering %s", sd.GetName()) + svc := &Service{ + File: file, + ServiceDescriptorProto: sd, + } + for _, md := range sd.GetMethod() { + glog.V(2).Infof("Processing %s.%s", sd.GetName(), md.GetName()) + opts, err := extractAPIOptions(md) + if err != nil { + glog.Errorf("Failed to extract ApiMethodOptions from %s.%s: %v", svc.GetName(), md.GetName(), err) + return err + } + if opts == nil { + glog.V(1).Infof("Found non-target method: %s.%s", svc.GetName(), md.GetName()) + } + meth, err := r.newMethod(svc, md, opts) + if err != nil { + return err + } + svc.Methods = append(svc.Methods, meth) + } + if len(svc.Methods) == 0 { + continue + } + glog.V(2).Infof("Registered %s with %d method(s)", svc.GetName(), len(svc.Methods)) + svcs = append(svcs, svc) + } + file.Services = svcs + return nil +} + +func (r *Registry) newMethod(svc *Service, md *descriptor.MethodDescriptorProto, opts *options.HttpRule) (*Method, error) { + requestType, err := r.LookupMsg(svc.File.GetPackage(), md.GetInputType()) + if err != nil { + return nil, err + } + responseType, err := r.LookupMsg(svc.File.GetPackage(), md.GetOutputType()) + if err != nil { + return nil, err + } + meth := &Method{ + Service: svc, + MethodDescriptorProto: md, + RequestType: requestType, + ResponseType: responseType, + } + + newBinding := func(opts *options.HttpRule, idx int) (*Binding, error) { + var ( + httpMethod string + pathTemplate string + ) + switch { + case opts.GetGet() != "": + httpMethod = "GET" + pathTemplate = opts.GetGet() + if opts.Body != "" { + return nil, fmt.Errorf("needs request body even though http method is GET: %s", md.GetName()) + } + + case opts.GetPut() != "": + httpMethod = "PUT" + pathTemplate = opts.GetPut() + + case opts.GetPost() != "": + httpMethod = "POST" + pathTemplate = opts.GetPost() + + case opts.GetDelete() != "": + httpMethod = "DELETE" + pathTemplate = opts.GetDelete() + if opts.Body != "" && !r.allowDeleteBody { + return nil, fmt.Errorf("needs request body even though http method is DELETE: %s", md.GetName()) + } + + case opts.GetPatch() != "": + httpMethod = "PATCH" + pathTemplate = opts.GetPatch() + + case opts.GetCustom() != nil: + custom := opts.GetCustom() + httpMethod = custom.Kind + pathTemplate = custom.Path + + default: + glog.V(1).Infof("No pattern specified in google.api.HttpRule: %s", md.GetName()) + return nil, nil + } + + parsed, err := httprule.Parse(pathTemplate) + if err != nil { + return nil, err + } + tmpl := parsed.Compile() + + if md.GetClientStreaming() && len(tmpl.Fields) > 0 { + return nil, fmt.Errorf("cannot use path parameter in client streaming") + } + + b := &Binding{ + Method: meth, + Index: idx, + PathTmpl: tmpl, + HTTPMethod: httpMethod, + } + + for _, f := range tmpl.Fields { + param, err := r.newParam(meth, f) + if err != nil { + return nil, err + } + b.PathParams = append(b.PathParams, param) + } + + // TODO(yugui) Handle query params + + b.Body, err = r.newBody(meth, opts.Body) + if err != nil { + return nil, err + } + + return b, nil + } + b, err := newBinding(opts, 0) + if err != nil { + return nil, err + } + + if b != nil { + meth.Bindings = append(meth.Bindings, b) + } + for i, additional := range opts.GetAdditionalBindings() { + if len(additional.AdditionalBindings) > 0 { + return nil, fmt.Errorf("additional_binding in additional_binding not allowed: %s.%s", svc.GetName(), meth.GetName()) + } + b, err := newBinding(additional, i+1) + if err != nil { + return nil, err + } + meth.Bindings = append(meth.Bindings, b) + } + + return meth, nil +} + +func extractAPIOptions(meth *descriptor.MethodDescriptorProto) (*options.HttpRule, error) { + if meth.Options == nil { + return nil, nil + } + if !proto.HasExtension(meth.Options, options.E_Http) { + return nil, nil + } + ext, err := proto.GetExtension(meth.Options, options.E_Http) + if err != nil { + return nil, err + } + opts, ok := ext.(*options.HttpRule) + if !ok { + return nil, fmt.Errorf("extension is %T; want an HttpRule", ext) + } + return opts, nil +} + +func (r *Registry) newParam(meth *Method, path string) (Parameter, error) { + msg := meth.RequestType + fields, err := r.resolveFiledPath(msg, path) + if err != nil { + return Parameter{}, err + } + l := len(fields) + if l == 0 { + return Parameter{}, fmt.Errorf("invalid field access list for %s", path) + } + target := fields[l-1].Target + switch target.GetType() { + case descriptor.FieldDescriptorProto_TYPE_MESSAGE, descriptor.FieldDescriptorProto_TYPE_GROUP: + return Parameter{}, fmt.Errorf("aggregate type %s in parameter of %s.%s: %s", target.Type, meth.Service.GetName(), meth.GetName(), path) + } + return Parameter{ + FieldPath: FieldPath(fields), + Method: meth, + Target: fields[l-1].Target, + }, nil +} + +func (r *Registry) newBody(meth *Method, path string) (*Body, error) { + msg := meth.RequestType + switch path { + case "": + return nil, nil + case "*": + return &Body{FieldPath: nil}, nil + } + fields, err := r.resolveFiledPath(msg, path) + if err != nil { + return nil, err + } + return &Body{FieldPath: FieldPath(fields)}, nil +} + +// lookupField looks up a field named "name" within "msg". +// It returns nil if no such field found. +func lookupField(msg *Message, name string) *Field { + for _, f := range msg.Fields { + if f.GetName() == name { + return f + } + } + return nil +} + +// resolveFieldPath resolves "path" into a list of fieldDescriptor, starting from "msg". +func (r *Registry) resolveFiledPath(msg *Message, path string) ([]FieldPathComponent, error) { + if path == "" { + return nil, nil + } + + root := msg + var result []FieldPathComponent + for i, c := range strings.Split(path, ".") { + if i > 0 { + f := result[i-1].Target + switch f.GetType() { + case descriptor.FieldDescriptorProto_TYPE_MESSAGE, descriptor.FieldDescriptorProto_TYPE_GROUP: + var err error + msg, err = r.LookupMsg(msg.FQMN(), f.GetTypeName()) + if err != nil { + return nil, err + } + default: + return nil, fmt.Errorf("not an aggregate type: %s in %s", f.GetName(), path) + } + } + + glog.V(2).Infof("Lookup %s in %s", c, msg.FQMN()) + f := lookupField(msg, c) + if f == nil { + return nil, fmt.Errorf("no field %q found in %s", path, root.GetName()) + } + if f.GetLabel() == descriptor.FieldDescriptorProto_LABEL_REPEATED { + return nil, fmt.Errorf("repeated field not allowed in field path: %s in %s", f.GetName(), path) + } + result = append(result, FieldPathComponent{Name: c, Target: f}) + } + return result, nil +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/services_test.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/services_test.go new file mode 100644 index 0000000..eda34d4 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/services_test.go @@ -0,0 +1,1210 @@ +package descriptor + +import ( + "reflect" + "testing" + + "github.com/golang/protobuf/proto" + descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" +) + +func compilePath(t *testing.T, path string) httprule.Template { + parsed, err := httprule.Parse(path) + if err != nil { + t.Fatalf("httprule.Parse(%q) failed with %v; want success", path, err) + } + return parsed.Compile() +} + +func testExtractServices(t *testing.T, input []*descriptor.FileDescriptorProto, target string, wantSvcs []*Service) { + reg := NewRegistry() + for _, file := range input { + reg.loadFile(file) + } + err := reg.loadServices(reg.files[target]) + if err != nil { + t.Errorf("loadServices(%q) failed with %v; want success; files=%v", target, err, input) + } + + file := reg.files[target] + svcs := file.Services + var i int + for i = 0; i < len(svcs) && i < len(wantSvcs); i++ { + svc, wantSvc := svcs[i], wantSvcs[i] + if got, want := svc.ServiceDescriptorProto, wantSvc.ServiceDescriptorProto; !proto.Equal(got, want) { + t.Errorf("svcs[%d].ServiceDescriptorProto = %v; want %v; input = %v", i, got, want, input) + continue + } + var j int + for j = 0; j < len(svc.Methods) && j < len(wantSvc.Methods); j++ { + meth, wantMeth := svc.Methods[j], wantSvc.Methods[j] + if got, want := meth.MethodDescriptorProto, wantMeth.MethodDescriptorProto; !proto.Equal(got, want) { + t.Errorf("svcs[%d].Methods[%d].MethodDescriptorProto = %v; want %v; input = %v", i, j, got, want, input) + continue + } + if got, want := meth.RequestType, wantMeth.RequestType; got.FQMN() != want.FQMN() { + t.Errorf("svcs[%d].Methods[%d].RequestType = %s; want %s; input = %v", i, j, got.FQMN(), want.FQMN(), input) + } + if got, want := meth.ResponseType, wantMeth.ResponseType; got.FQMN() != want.FQMN() { + t.Errorf("svcs[%d].Methods[%d].ResponseType = %s; want %s; input = %v", i, j, got.FQMN(), want.FQMN(), input) + } + var k int + for k = 0; k < len(meth.Bindings) && k < len(wantMeth.Bindings); k++ { + binding, wantBinding := meth.Bindings[k], wantMeth.Bindings[k] + if got, want := binding.Index, wantBinding.Index; got != want { + t.Errorf("svcs[%d].Methods[%d].Bindings[%d].Index = %d; want %d; input = %v", i, j, k, got, want, input) + } + if got, want := binding.PathTmpl, wantBinding.PathTmpl; !reflect.DeepEqual(got, want) { + t.Errorf("svcs[%d].Methods[%d].Bindings[%d].PathTmpl = %#v; want %#v; input = %v", i, j, k, got, want, input) + } + if got, want := binding.HTTPMethod, wantBinding.HTTPMethod; got != want { + t.Errorf("svcs[%d].Methods[%d].Bindings[%d].HTTPMethod = %q; want %q; input = %v", i, j, k, got, want, input) + } + + var l int + for l = 0; l < len(binding.PathParams) && l < len(wantBinding.PathParams); l++ { + param, wantParam := binding.PathParams[l], wantBinding.PathParams[l] + if got, want := param.FieldPath.String(), wantParam.FieldPath.String(); got != want { + t.Errorf("svcs[%d].Methods[%d].Bindings[%d].PathParams[%d].FieldPath.String() = %q; want %q; input = %v", i, j, k, l, got, want, input) + continue + } + for m := 0; m < len(param.FieldPath) && m < len(wantParam.FieldPath); m++ { + field, wantField := param.FieldPath[m].Target, wantParam.FieldPath[m].Target + if got, want := field.FieldDescriptorProto, wantField.FieldDescriptorProto; !proto.Equal(got, want) { + t.Errorf("svcs[%d].Methods[%d].Bindings[%d].PathParams[%d].FieldPath[%d].Target.FieldDescriptorProto = %v; want %v; input = %v", i, j, k, l, m, got, want, input) + } + } + } + for ; l < len(binding.PathParams); l++ { + got := binding.PathParams[l].FieldPath.String() + t.Errorf("svcs[%d].Methods[%d].Bindings[%d].PathParams[%d] = %q; want it to be missing; input = %v", i, j, k, l, got, input) + } + for ; l < len(wantBinding.PathParams); l++ { + want := wantBinding.PathParams[l].FieldPath.String() + t.Errorf("svcs[%d].Methods[%d].Bindings[%d].PathParams[%d] missing; want %q; input = %v", i, j, k, l, want, input) + } + + if got, want := (binding.Body != nil), (wantBinding.Body != nil); got != want { + if got { + t.Errorf("svcs[%d].Methods[%d].Bindings[%d].Body = %q; want it to be missing; input = %v", i, j, k, binding.Body.FieldPath.String(), input) + } else { + t.Errorf("svcs[%d].Methods[%d].Bindings[%d].Body missing; want %q; input = %v", i, j, k, wantBinding.Body.FieldPath.String(), input) + } + } else if binding.Body != nil { + if got, want := binding.Body.FieldPath.String(), wantBinding.Body.FieldPath.String(); got != want { + t.Errorf("svcs[%d].Methods[%d].Bindings[%d].Body = %q; want %q; input = %v", i, j, k, got, want, input) + } + } + } + for ; k < len(meth.Bindings); k++ { + got := meth.Bindings[k] + t.Errorf("svcs[%d].Methods[%d].Bindings[%d] = %q; want it to be missing; input = %v", i, j, k, got, input) + } + for ; k < len(wantMeth.Bindings); k++ { + want := wantMeth.Bindings[k] + t.Errorf("svcs[%d].Methods[%d].Bindings[%d] missing; want %q; input = %v", i, j, k, want, input) + } + } + for ; j < len(svc.Methods); j++ { + got := svc.Methods[j].MethodDescriptorProto + t.Errorf("svcs[%d].Methods[%d] = %v; want it to be missing; input = %v", i, j, got, input) + } + for ; j < len(wantSvc.Methods); j++ { + want := wantSvc.Methods[j].MethodDescriptorProto + t.Errorf("svcs[%d].Methods[%d] missing; want %v; input = %v", i, j, want, input) + } + } + for ; i < len(svcs); i++ { + got := svcs[i].ServiceDescriptorProto + t.Errorf("svcs[%d] = %v; want it to be missing; input = %v", i, got, input) + } + for ; i < len(wantSvcs); i++ { + want := wantSvcs[i].ServiceDescriptorProto + t.Errorf("svcs[%d] missing; want %v; input = %v", i, want, input) + } +} + +func crossLinkFixture(f *File) *File { + for _, m := range f.Messages { + m.File = f + for _, f := range m.Fields { + f.Message = m + } + } + for _, svc := range f.Services { + svc.File = f + for _, m := range svc.Methods { + m.Service = svc + for _, b := range m.Bindings { + b.Method = m + for _, param := range b.PathParams { + param.Method = m + } + } + } + } + return f +} + +func TestExtractServicesSimple(t *testing.T) { + src := ` + name: "path/to/example.proto", + package: "example" + message_type < + name: "StringMessage" + field < + name: "string" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + > + > + service < + name: "ExampleService" + method < + name: "Echo" + input_type: "StringMessage" + output_type: "StringMessage" + options < + [google.api.http] < + post: "/v1/example/echo" + body: "*" + > + > + > + > + ` + var fd descriptor.FileDescriptorProto + if err := proto.UnmarshalText(src, &fd); err != nil { + t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err) + } + msg := &Message{ + DescriptorProto: fd.MessageType[0], + Fields: []*Field{ + { + FieldDescriptorProto: fd.MessageType[0].Field[0], + }, + }, + } + file := &File{ + FileDescriptorProto: &fd, + GoPkg: GoPackage{ + Path: "path/to/example.pb", + Name: "example_pb", + }, + Messages: []*Message{msg}, + Services: []*Service{ + { + ServiceDescriptorProto: fd.Service[0], + Methods: []*Method{ + { + MethodDescriptorProto: fd.Service[0].Method[0], + RequestType: msg, + ResponseType: msg, + Bindings: []*Binding{ + { + PathTmpl: compilePath(t, "/v1/example/echo"), + HTTPMethod: "POST", + Body: &Body{FieldPath: nil}, + }, + }, + }, + }, + }, + }, + } + + crossLinkFixture(file) + testExtractServices(t, []*descriptor.FileDescriptorProto{&fd}, "path/to/example.proto", file.Services) +} + +func TestExtractServicesCrossPackage(t *testing.T) { + srcs := []string{ + ` + name: "path/to/example.proto", + package: "example" + message_type < + name: "StringMessage" + field < + name: "string" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + > + > + service < + name: "ExampleService" + method < + name: "ToString" + input_type: ".another.example.BoolMessage" + output_type: "StringMessage" + options < + [google.api.http] < + post: "/v1/example/to_s" + body: "*" + > + > + > + > + `, ` + name: "path/to/another/example.proto", + package: "another.example" + message_type < + name: "BoolMessage" + field < + name: "bool" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_BOOL + > + > + `, + } + var fds []*descriptor.FileDescriptorProto + for _, src := range srcs { + var fd descriptor.FileDescriptorProto + if err := proto.UnmarshalText(src, &fd); err != nil { + t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err) + } + fds = append(fds, &fd) + } + stringMsg := &Message{ + DescriptorProto: fds[0].MessageType[0], + Fields: []*Field{ + { + FieldDescriptorProto: fds[0].MessageType[0].Field[0], + }, + }, + } + boolMsg := &Message{ + DescriptorProto: fds[1].MessageType[0], + Fields: []*Field{ + { + FieldDescriptorProto: fds[1].MessageType[0].Field[0], + }, + }, + } + files := []*File{ + { + FileDescriptorProto: fds[0], + GoPkg: GoPackage{ + Path: "path/to/example.pb", + Name: "example_pb", + }, + Messages: []*Message{stringMsg}, + Services: []*Service{ + { + ServiceDescriptorProto: fds[0].Service[0], + Methods: []*Method{ + { + MethodDescriptorProto: fds[0].Service[0].Method[0], + RequestType: boolMsg, + ResponseType: stringMsg, + Bindings: []*Binding{ + { + PathTmpl: compilePath(t, "/v1/example/to_s"), + HTTPMethod: "POST", + Body: &Body{FieldPath: nil}, + }, + }, + }, + }, + }, + }, + }, + { + FileDescriptorProto: fds[1], + GoPkg: GoPackage{ + Path: "path/to/another/example.pb", + Name: "example_pb", + }, + Messages: []*Message{boolMsg}, + }, + } + + for _, file := range files { + crossLinkFixture(file) + } + testExtractServices(t, fds, "path/to/example.proto", files[0].Services) +} + +func TestExtractServicesWithBodyPath(t *testing.T) { + src := ` + name: "path/to/example.proto", + package: "example" + message_type < + name: "OuterMessage" + nested_type < + name: "StringMessage" + field < + name: "string" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + > + > + field < + name: "nested" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: "StringMessage" + > + > + service < + name: "ExampleService" + method < + name: "Echo" + input_type: "OuterMessage" + output_type: "OuterMessage" + options < + [google.api.http] < + post: "/v1/example/echo" + body: "nested" + > + > + > + > + ` + var fd descriptor.FileDescriptorProto + if err := proto.UnmarshalText(src, &fd); err != nil { + t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err) + } + msg := &Message{ + DescriptorProto: fd.MessageType[0], + Fields: []*Field{ + { + FieldDescriptorProto: fd.MessageType[0].Field[0], + }, + }, + } + file := &File{ + FileDescriptorProto: &fd, + GoPkg: GoPackage{ + Path: "path/to/example.pb", + Name: "example_pb", + }, + Messages: []*Message{msg}, + Services: []*Service{ + { + ServiceDescriptorProto: fd.Service[0], + Methods: []*Method{ + { + MethodDescriptorProto: fd.Service[0].Method[0], + RequestType: msg, + ResponseType: msg, + Bindings: []*Binding{ + { + PathTmpl: compilePath(t, "/v1/example/echo"), + HTTPMethod: "POST", + Body: &Body{ + FieldPath: FieldPath{ + { + Name: "nested", + Target: msg.Fields[0], + }, + }, + }, + }, + }, + }, + }, + }, + }, + } + + crossLinkFixture(file) + testExtractServices(t, []*descriptor.FileDescriptorProto{&fd}, "path/to/example.proto", file.Services) +} + +func TestExtractServicesWithPathParam(t *testing.T) { + src := ` + name: "path/to/example.proto", + package: "example" + message_type < + name: "StringMessage" + field < + name: "string" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + > + > + service < + name: "ExampleService" + method < + name: "Echo" + input_type: "StringMessage" + output_type: "StringMessage" + options < + [google.api.http] < + get: "/v1/example/echo/{string=*}" + > + > + > + > + ` + var fd descriptor.FileDescriptorProto + if err := proto.UnmarshalText(src, &fd); err != nil { + t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err) + } + msg := &Message{ + DescriptorProto: fd.MessageType[0], + Fields: []*Field{ + { + FieldDescriptorProto: fd.MessageType[0].Field[0], + }, + }, + } + file := &File{ + FileDescriptorProto: &fd, + GoPkg: GoPackage{ + Path: "path/to/example.pb", + Name: "example_pb", + }, + Messages: []*Message{msg}, + Services: []*Service{ + { + ServiceDescriptorProto: fd.Service[0], + Methods: []*Method{ + { + MethodDescriptorProto: fd.Service[0].Method[0], + RequestType: msg, + ResponseType: msg, + Bindings: []*Binding{ + { + PathTmpl: compilePath(t, "/v1/example/echo/{string=*}"), + HTTPMethod: "GET", + PathParams: []Parameter{ + { + FieldPath: FieldPath{ + { + Name: "string", + Target: msg.Fields[0], + }, + }, + Target: msg.Fields[0], + }, + }, + }, + }, + }, + }, + }, + }, + } + + crossLinkFixture(file) + testExtractServices(t, []*descriptor.FileDescriptorProto{&fd}, "path/to/example.proto", file.Services) +} + +func TestExtractServicesWithAdditionalBinding(t *testing.T) { + src := ` + name: "path/to/example.proto", + package: "example" + message_type < + name: "StringMessage" + field < + name: "string" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + > + > + service < + name: "ExampleService" + method < + name: "Echo" + input_type: "StringMessage" + output_type: "StringMessage" + options < + [google.api.http] < + post: "/v1/example/echo" + body: "*" + additional_bindings < + get: "/v1/example/echo/{string}" + > + additional_bindings < + post: "/v2/example/echo" + body: "string" + > + > + > + > + > + ` + var fd descriptor.FileDescriptorProto + if err := proto.UnmarshalText(src, &fd); err != nil { + t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err) + } + msg := &Message{ + DescriptorProto: fd.MessageType[0], + Fields: []*Field{ + { + FieldDescriptorProto: fd.MessageType[0].Field[0], + }, + }, + } + file := &File{ + FileDescriptorProto: &fd, + GoPkg: GoPackage{ + Path: "path/to/example.pb", + Name: "example_pb", + }, + Messages: []*Message{msg}, + Services: []*Service{ + { + ServiceDescriptorProto: fd.Service[0], + Methods: []*Method{ + { + MethodDescriptorProto: fd.Service[0].Method[0], + RequestType: msg, + ResponseType: msg, + Bindings: []*Binding{ + { + Index: 0, + PathTmpl: compilePath(t, "/v1/example/echo"), + HTTPMethod: "POST", + Body: &Body{FieldPath: nil}, + }, + { + Index: 1, + PathTmpl: compilePath(t, "/v1/example/echo/{string}"), + HTTPMethod: "GET", + PathParams: []Parameter{ + { + FieldPath: FieldPath{ + { + Name: "string", + Target: msg.Fields[0], + }, + }, + Target: msg.Fields[0], + }, + }, + Body: nil, + }, + { + Index: 2, + PathTmpl: compilePath(t, "/v2/example/echo"), + HTTPMethod: "POST", + Body: &Body{ + FieldPath: FieldPath{ + FieldPathComponent{ + Name: "string", + Target: msg.Fields[0], + }, + }, + }, + }, + }, + }, + }, + }, + }, + } + + crossLinkFixture(file) + testExtractServices(t, []*descriptor.FileDescriptorProto{&fd}, "path/to/example.proto", file.Services) +} + +func TestExtractServicesWithError(t *testing.T) { + for _, spec := range []struct { + target string + srcs []string + }{ + { + target: "path/to/example.proto", + srcs: []string{ + // message not found + ` + name: "path/to/example.proto", + package: "example" + service < + name: "ExampleService" + method < + name: "Echo" + input_type: "StringMessage" + output_type: "StringMessage" + options < + [google.api.http] < + post: "/v1/example/echo" + body: "*" + > + > + > + > + `, + }, + }, + // body field path not resolved + { + target: "path/to/example.proto", + srcs: []string{` + name: "path/to/example.proto", + package: "example" + message_type < + name: "StringMessage" + field < + name: "string" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + > + > + service < + name: "ExampleService" + method < + name: "Echo" + input_type: "StringMessage" + output_type: "StringMessage" + options < + [google.api.http] < + post: "/v1/example/echo" + body: "bool" + > + > + > + >`, + }, + }, + // param field path not resolved + { + target: "path/to/example.proto", + srcs: []string{ + ` + name: "path/to/example.proto", + package: "example" + message_type < + name: "StringMessage" + field < + name: "string" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + > + > + service < + name: "ExampleService" + method < + name: "Echo" + input_type: "StringMessage" + output_type: "StringMessage" + options < + [google.api.http] < + post: "/v1/example/echo/{bool=*}" + > + > + > + > + `, + }, + }, + // non aggregate type on field path + { + target: "path/to/example.proto", + srcs: []string{ + ` + name: "path/to/example.proto", + package: "example" + message_type < + name: "OuterMessage" + field < + name: "mid" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + > + field < + name: "bool" + number: 2 + label: LABEL_OPTIONAL + type: TYPE_BOOL + > + > + service < + name: "ExampleService" + method < + name: "Echo" + input_type: "OuterMessage" + output_type: "OuterMessage" + options < + [google.api.http] < + post: "/v1/example/echo/{mid.bool=*}" + > + > + > + > + `, + }, + }, + // path param in client streaming + { + target: "path/to/example.proto", + srcs: []string{ + ` + name: "path/to/example.proto", + package: "example" + message_type < + name: "StringMessage" + field < + name: "string" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + > + > + service < + name: "ExampleService" + method < + name: "Echo" + input_type: "StringMessage" + output_type: "StringMessage" + options < + [google.api.http] < + post: "/v1/example/echo/{bool=*}" + > + > + client_streaming: true + > + > + `, + }, + }, + // body for GET + { + target: "path/to/example.proto", + srcs: []string{ + ` + name: "path/to/example.proto", + package: "example" + message_type < + name: "StringMessage" + field < + name: "string" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + > + > + service < + name: "ExampleService" + method < + name: "Echo" + input_type: "StringMessage" + output_type: "StringMessage" + options < + [google.api.http] < + get: "/v1/example/echo" + body: "string" + > + > + > + > + `, + }, + }, + // body for DELETE + { + target: "path/to/example.proto", + srcs: []string{ + ` + name: "path/to/example.proto", + package: "example" + message_type < + name: "StringMessage" + field < + name: "string" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + > + > + service < + name: "ExampleService" + method < + name: "RemoveResource" + input_type: "StringMessage" + output_type: "StringMessage" + options < + [google.api.http] < + delete: "/v1/example/resource" + body: "string" + > + > + > + > + `, + }, + }, + // no pattern specified + { + target: "path/to/example.proto", + srcs: []string{ + ` + name: "path/to/example.proto", + package: "example" + service < + name: "ExampleService" + method < + name: "RemoveResource" + input_type: "StringMessage" + output_type: "StringMessage" + options < + [google.api.http] < + body: "string" + > + > + > + > + `, + }, + }, + // unsupported path parameter type + { + target: "path/to/example.proto", + srcs: []string{` + name: "path/to/example.proto", + package: "example" + message_type < + name: "OuterMessage" + nested_type < + name: "StringMessage" + field < + name: "value" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + > + > + field < + name: "string" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: "StringMessage" + > + > + service < + name: "ExampleService" + method < + name: "Echo" + input_type: "OuterMessage" + output_type: "OuterMessage" + options < + [google.api.http] < + get: "/v1/example/echo/{string=*}" + > + > + > + > + `, + }, + }, + } { + reg := NewRegistry() + + var fds []*descriptor.FileDescriptorProto + for _, src := range spec.srcs { + var fd descriptor.FileDescriptorProto + if err := proto.UnmarshalText(src, &fd); err != nil { + t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err) + } + reg.loadFile(&fd) + fds = append(fds, &fd) + } + err := reg.loadServices(reg.files[spec.target]) + if err == nil { + t.Errorf("loadServices(%q) succeeded; want an error; files=%v", spec.target, spec.srcs) + } + t.Log(err) + } +} + +func TestResolveFieldPath(t *testing.T) { + for _, spec := range []struct { + src string + path string + wantErr bool + }{ + { + src: ` + name: 'example.proto' + package: 'example' + message_type < + name: 'ExampleMessage' + field < + name: 'string' + type: TYPE_STRING + label: LABEL_OPTIONAL + number: 1 + > + > + `, + path: "string", + wantErr: false, + }, + // no such field + { + src: ` + name: 'example.proto' + package: 'example' + message_type < + name: 'ExampleMessage' + field < + name: 'string' + type: TYPE_STRING + label: LABEL_OPTIONAL + number: 1 + > + > + `, + path: "something_else", + wantErr: true, + }, + // repeated field + { + src: ` + name: 'example.proto' + package: 'example' + message_type < + name: 'ExampleMessage' + field < + name: 'string' + type: TYPE_STRING + label: LABEL_REPEATED + number: 1 + > + > + `, + path: "string", + wantErr: true, + }, + // nested field + { + src: ` + name: 'example.proto' + package: 'example' + message_type < + name: 'ExampleMessage' + field < + name: 'nested' + type: TYPE_MESSAGE + type_name: 'AnotherMessage' + label: LABEL_OPTIONAL + number: 1 + > + field < + name: 'terminal' + type: TYPE_BOOL + label: LABEL_OPTIONAL + number: 2 + > + > + message_type < + name: 'AnotherMessage' + field < + name: 'nested2' + type: TYPE_MESSAGE + type_name: 'ExampleMessage' + label: LABEL_OPTIONAL + number: 1 + > + > + `, + path: "nested.nested2.nested.nested2.nested.nested2.terminal", + wantErr: false, + }, + // non aggregate field on the path + { + src: ` + name: 'example.proto' + package: 'example' + message_type < + name: 'ExampleMessage' + field < + name: 'nested' + type: TYPE_MESSAGE + type_name: 'AnotherMessage' + label: LABEL_OPTIONAL + number: 1 + > + field < + name: 'terminal' + type: TYPE_BOOL + label: LABEL_OPTIONAL + number: 2 + > + > + message_type < + name: 'AnotherMessage' + field < + name: 'nested2' + type: TYPE_MESSAGE + type_name: 'ExampleMessage' + label: LABEL_OPTIONAL + number: 1 + > + > + `, + path: "nested.terminal.nested2", + wantErr: true, + }, + // repeated field + { + src: ` + name: 'example.proto' + package: 'example' + message_type < + name: 'ExampleMessage' + field < + name: 'nested' + type: TYPE_MESSAGE + type_name: 'AnotherMessage' + label: LABEL_OPTIONAL + number: 1 + > + field < + name: 'terminal' + type: TYPE_BOOL + label: LABEL_OPTIONAL + number: 2 + > + > + message_type < + name: 'AnotherMessage' + field < + name: 'nested2' + type: TYPE_MESSAGE + type_name: 'ExampleMessage' + label: LABEL_REPEATED + number: 1 + > + > + `, + path: "nested.nested2.terminal", + wantErr: true, + }, + } { + var file descriptor.FileDescriptorProto + if err := proto.UnmarshalText(spec.src, &file); err != nil { + t.Fatalf("proto.Unmarshal(%s) failed with %v; want success", spec.src, err) + } + reg := NewRegistry() + reg.loadFile(&file) + f, err := reg.LookupFile(file.GetName()) + if err != nil { + t.Fatalf("reg.LookupFile(%q) failed with %v; want success; on file=%s", file.GetName(), err, spec.src) + } + _, err = reg.resolveFiledPath(f.Messages[0], spec.path) + if got, want := err != nil, spec.wantErr; got != want { + if want { + t.Errorf("reg.resolveFiledPath(%q, %q) succeeded; want an error", f.Messages[0].GetName(), spec.path) + continue + } + t.Errorf("reg.resolveFiledPath(%q, %q) failed with %v; want success", f.Messages[0].GetName(), spec.path, err) + } + } +} + +func TestExtractServicesWithDeleteBody(t *testing.T) { + for _, spec := range []struct { + allowDeleteBody bool + expectErr bool + target string + srcs []string + }{ + // body for DELETE, but registry configured to allow it + { + allowDeleteBody: true, + expectErr: false, + target: "path/to/example.proto", + srcs: []string{ + ` + name: "path/to/example.proto", + package: "example" + message_type < + name: "StringMessage" + field < + name: "string" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + > + > + service < + name: "ExampleService" + method < + name: "RemoveResource" + input_type: "StringMessage" + output_type: "StringMessage" + options < + [google.api.http] < + delete: "/v1/example/resource" + body: "string" + > + > + > + > + `, + }, + }, + // body for DELETE, registry configured not to allow it + { + allowDeleteBody: false, + expectErr: true, + target: "path/to/example.proto", + srcs: []string{ + ` + name: "path/to/example.proto", + package: "example" + message_type < + name: "StringMessage" + field < + name: "string" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + > + > + service < + name: "ExampleService" + method < + name: "RemoveResource" + input_type: "StringMessage" + output_type: "StringMessage" + options < + [google.api.http] < + delete: "/v1/example/resource" + body: "string" + > + > + > + > + `, + }, + }, + } { + reg := NewRegistry() + reg.SetAllowDeleteBody(spec.allowDeleteBody) + + var fds []*descriptor.FileDescriptorProto + for _, src := range spec.srcs { + var fd descriptor.FileDescriptorProto + if err := proto.UnmarshalText(src, &fd); err != nil { + t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err) + } + reg.loadFile(&fd) + fds = append(fds, &fd) + } + err := reg.loadServices(reg.files[spec.target]) + if spec.expectErr && err == nil { + t.Errorf("loadServices(%q) succeeded; want an error; allowDeleteBody=%v, files=%v", spec.target, spec.allowDeleteBody, spec.srcs) + } + if !spec.expectErr && err != nil { + t.Errorf("loadServices(%q) failed; do not want an error; allowDeleteBody=%v, files=%v", spec.target, spec.allowDeleteBody, spec.srcs) + } + t.Log(err) + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/types.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/types.go new file mode 100644 index 0000000..248538e --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/types.go @@ -0,0 +1,322 @@ +package descriptor + +import ( + "fmt" + "strings" + + descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + gogen "github.com/golang/protobuf/protoc-gen-go/generator" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" +) + +// GoPackage represents a golang package +type GoPackage struct { + // Path is the package path to the package. + Path string + // Name is the package name of the package + Name string + // Alias is an alias of the package unique within the current invokation of grpc-gateway generator. + Alias string +} + +// Standard returns whether the import is a golang standard package. +func (p GoPackage) Standard() bool { + return !strings.Contains(p.Path, ".") +} + +// String returns a string representation of this package in the form of import line in golang. +func (p GoPackage) String() string { + if p.Alias == "" { + return fmt.Sprintf("%q", p.Path) + } + return fmt.Sprintf("%s %q", p.Alias, p.Path) +} + +// File wraps descriptor.FileDescriptorProto for richer features. +type File struct { + *descriptor.FileDescriptorProto + // GoPkg is the go package of the go file generated from this file.. + GoPkg GoPackage + // Messages is the list of messages defined in this file. + Messages []*Message + // Enums is the list of enums defined in this file. + Enums []*Enum + // Services is the list of services defined in this file. + Services []*Service +} + +// proto2 determines if the syntax of the file is proto2. +func (f *File) proto2() bool { + return f.Syntax == nil || f.GetSyntax() == "proto2" +} + +// Message describes a protocol buffer message types +type Message struct { + // File is the file where the message is defined + File *File + // Outers is a list of outer messages if this message is a nested type. + Outers []string + *descriptor.DescriptorProto + Fields []*Field + + // Index is proto path index of this message in File. + Index int +} + +// FQMN returns a fully qualified message name of this message. +func (m *Message) FQMN() string { + components := []string{""} + if m.File.Package != nil { + components = append(components, m.File.GetPackage()) + } + components = append(components, m.Outers...) + components = append(components, m.GetName()) + return strings.Join(components, ".") +} + +// GoType returns a go type name for the message type. +// It prefixes the type name with the package alias if +// its belonging package is not "currentPackage". +func (m *Message) GoType(currentPackage string) string { + var components []string + components = append(components, m.Outers...) + components = append(components, m.GetName()) + + name := strings.Join(components, "_") + if m.File.GoPkg.Path == currentPackage { + return name + } + pkg := m.File.GoPkg.Name + if alias := m.File.GoPkg.Alias; alias != "" { + pkg = alias + } + return fmt.Sprintf("%s.%s", pkg, name) +} + +// Enum describes a protocol buffer enum types +type Enum struct { + // File is the file where the enum is defined + File *File + // Outers is a list of outer messages if this enum is a nested type. + Outers []string + *descriptor.EnumDescriptorProto + + Index int +} + +// FQEN returns a fully qualified enum name of this enum. +func (e *Enum) FQEN() string { + components := []string{""} + if e.File.Package != nil { + components = append(components, e.File.GetPackage()) + } + components = append(components, e.Outers...) + components = append(components, e.GetName()) + return strings.Join(components, ".") +} + +// Service wraps descriptor.ServiceDescriptorProto for richer features. +type Service struct { + // File is the file where this service is defined. + File *File + *descriptor.ServiceDescriptorProto + // Methods is the list of methods defined in this service. + Methods []*Method +} + +// Method wraps descriptor.MethodDescriptorProto for richer features. +type Method struct { + // Service is the service which this method belongs to. + Service *Service + *descriptor.MethodDescriptorProto + + // RequestType is the message type of requests to this method. + RequestType *Message + // ResponseType is the message type of responses from this method. + ResponseType *Message + Bindings []*Binding +} + +// Binding describes how an HTTP endpoint is bound to a gRPC method. +type Binding struct { + // Method is the method which the endpoint is bound to. + Method *Method + // Index is a zero-origin index of the binding in the target method + Index int + // PathTmpl is path template where this method is mapped to. + PathTmpl httprule.Template + // HTTPMethod is the HTTP method which this method is mapped to. + HTTPMethod string + // PathParams is the list of parameters provided in HTTP request paths. + PathParams []Parameter + // Body describes parameters provided in HTTP request body. + Body *Body +} + +// ExplicitParams returns a list of explicitly bound parameters of "b", +// i.e. a union of field path for body and field paths for path parameters. +func (b *Binding) ExplicitParams() []string { + var result []string + if b.Body != nil { + result = append(result, b.Body.FieldPath.String()) + } + for _, p := range b.PathParams { + result = append(result, p.FieldPath.String()) + } + return result +} + +// Field wraps descriptor.FieldDescriptorProto for richer features. +type Field struct { + // Message is the message type which this field belongs to. + Message *Message + // FieldMessage is the message type of the field. + FieldMessage *Message + *descriptor.FieldDescriptorProto +} + +// Parameter is a parameter provided in http requests +type Parameter struct { + // FieldPath is a path to a proto field which this parameter is mapped to. + FieldPath + // Target is the proto field which this parameter is mapped to. + Target *Field + // Method is the method which this parameter is used for. + Method *Method +} + +// ConvertFuncExpr returns a go expression of a converter function. +// The converter function converts a string into a value for the parameter. +func (p Parameter) ConvertFuncExpr() (string, error) { + tbl := proto3ConvertFuncs + if p.Target.Message.File.proto2() { + tbl = proto2ConvertFuncs + } + typ := p.Target.GetType() + conv, ok := tbl[typ] + if !ok { + return "", fmt.Errorf("unsupported field type %s of parameter %s in %s.%s", typ, p.FieldPath, p.Method.Service.GetName(), p.Method.GetName()) + } + return conv, nil +} + +// Body describes a http requtest body to be sent to the method. +type Body struct { + // FieldPath is a path to a proto field which the request body is mapped to. + // The request body is mapped to the request type itself if FieldPath is empty. + FieldPath FieldPath +} + +// RHS returns a right-hand-side expression in go to be used to initialize method request object. +// It starts with "msgExpr", which is the go expression of the method request object. +func (b Body) RHS(msgExpr string) string { + return b.FieldPath.RHS(msgExpr) +} + +// FieldPath is a path to a field from a request message. +type FieldPath []FieldPathComponent + +// String returns a string representation of the field path. +func (p FieldPath) String() string { + var components []string + for _, c := range p { + components = append(components, c.Name) + } + return strings.Join(components, ".") +} + +// IsNestedProto3 indicates whether the FieldPath is a nested Proto3 path. +func (p FieldPath) IsNestedProto3() bool { + if len(p) > 1 && !p[0].Target.Message.File.proto2() { + return true + } + return false +} + +// RHS is a right-hand-side expression in go to be used to assign a value to the target field. +// It starts with "msgExpr", which is the go expression of the method request object. +func (p FieldPath) RHS(msgExpr string) string { + l := len(p) + if l == 0 { + return msgExpr + } + components := []string{msgExpr} + for i, c := range p { + if i == l-1 { + components = append(components, c.RHS()) + continue + } + components = append(components, c.LHS()) + } + return strings.Join(components, ".") +} + +// FieldPathComponent is a path component in FieldPath +type FieldPathComponent struct { + // Name is a name of the proto field which this component corresponds to. + // TODO(yugui) is this necessary? + Name string + // Target is the proto field which this component corresponds to. + Target *Field +} + +// RHS returns a right-hand-side expression in go for this field. +func (c FieldPathComponent) RHS() string { + return gogen.CamelCase(c.Name) +} + +// LHS returns a left-hand-side expression in go for this field. +func (c FieldPathComponent) LHS() string { + if c.Target.Message.File.proto2() { + return fmt.Sprintf("Get%s()", gogen.CamelCase(c.Name)) + } + return gogen.CamelCase(c.Name) +} + +var ( + proto3ConvertFuncs = map[descriptor.FieldDescriptorProto_Type]string{ + descriptor.FieldDescriptorProto_TYPE_DOUBLE: "runtime.Float64", + descriptor.FieldDescriptorProto_TYPE_FLOAT: "runtime.Float32", + descriptor.FieldDescriptorProto_TYPE_INT64: "runtime.Int64", + descriptor.FieldDescriptorProto_TYPE_UINT64: "runtime.Uint64", + descriptor.FieldDescriptorProto_TYPE_INT32: "runtime.Int32", + descriptor.FieldDescriptorProto_TYPE_FIXED64: "runtime.Uint64", + descriptor.FieldDescriptorProto_TYPE_FIXED32: "runtime.Uint32", + descriptor.FieldDescriptorProto_TYPE_BOOL: "runtime.Bool", + descriptor.FieldDescriptorProto_TYPE_STRING: "runtime.String", + // FieldDescriptorProto_TYPE_GROUP + // FieldDescriptorProto_TYPE_MESSAGE + // FieldDescriptorProto_TYPE_BYTES + // TODO(yugui) Handle bytes + descriptor.FieldDescriptorProto_TYPE_UINT32: "runtime.Uint32", + // FieldDescriptorProto_TYPE_ENUM + // TODO(yugui) Handle Enum + descriptor.FieldDescriptorProto_TYPE_SFIXED32: "runtime.Int32", + descriptor.FieldDescriptorProto_TYPE_SFIXED64: "runtime.Int64", + descriptor.FieldDescriptorProto_TYPE_SINT32: "runtime.Int32", + descriptor.FieldDescriptorProto_TYPE_SINT64: "runtime.Int64", + } + + proto2ConvertFuncs = map[descriptor.FieldDescriptorProto_Type]string{ + descriptor.FieldDescriptorProto_TYPE_DOUBLE: "runtime.Float64P", + descriptor.FieldDescriptorProto_TYPE_FLOAT: "runtime.Float32P", + descriptor.FieldDescriptorProto_TYPE_INT64: "runtime.Int64P", + descriptor.FieldDescriptorProto_TYPE_UINT64: "runtime.Uint64P", + descriptor.FieldDescriptorProto_TYPE_INT32: "runtime.Int32P", + descriptor.FieldDescriptorProto_TYPE_FIXED64: "runtime.Uint64P", + descriptor.FieldDescriptorProto_TYPE_FIXED32: "runtime.Uint32P", + descriptor.FieldDescriptorProto_TYPE_BOOL: "runtime.BoolP", + descriptor.FieldDescriptorProto_TYPE_STRING: "runtime.StringP", + // FieldDescriptorProto_TYPE_GROUP + // FieldDescriptorProto_TYPE_MESSAGE + // FieldDescriptorProto_TYPE_BYTES + // TODO(yugui) Handle bytes + descriptor.FieldDescriptorProto_TYPE_UINT32: "runtime.Uint32P", + // FieldDescriptorProto_TYPE_ENUM + // TODO(yugui) Handle Enum + descriptor.FieldDescriptorProto_TYPE_SFIXED32: "runtime.Int32P", + descriptor.FieldDescriptorProto_TYPE_SFIXED64: "runtime.Int64P", + descriptor.FieldDescriptorProto_TYPE_SINT32: "runtime.Int32P", + descriptor.FieldDescriptorProto_TYPE_SINT64: "runtime.Int64P", + } +) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/types_test.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/types_test.go new file mode 100644 index 0000000..ef2162a --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/types_test.go @@ -0,0 +1,206 @@ +package descriptor + +import ( + "testing" + + "github.com/golang/protobuf/proto" + descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" +) + +func TestGoPackageStandard(t *testing.T) { + for _, spec := range []struct { + pkg GoPackage + want bool + }{ + { + pkg: GoPackage{Path: "fmt", Name: "fmt"}, + want: true, + }, + { + pkg: GoPackage{Path: "encoding/json", Name: "json"}, + want: true, + }, + { + pkg: GoPackage{Path: "github.com/golang/protobuf/jsonpb", Name: "jsonpb"}, + want: false, + }, + { + pkg: GoPackage{Path: "golang.org/x/net/context", Name: "context"}, + want: false, + }, + { + pkg: GoPackage{Path: "github.com/grpc-ecosystem/grpc-gateway", Name: "main"}, + want: false, + }, + { + pkg: GoPackage{Path: "github.com/google/googleapis/google/api/http.pb", Name: "http_pb", Alias: "htpb"}, + want: false, + }, + } { + if got, want := spec.pkg.Standard(), spec.want; got != want { + t.Errorf("%#v.Standard() = %v; want %v", spec.pkg, got, want) + } + } +} + +func TestGoPackageString(t *testing.T) { + for _, spec := range []struct { + pkg GoPackage + want string + }{ + { + pkg: GoPackage{Path: "fmt", Name: "fmt"}, + want: `"fmt"`, + }, + { + pkg: GoPackage{Path: "encoding/json", Name: "json"}, + want: `"encoding/json"`, + }, + { + pkg: GoPackage{Path: "github.com/golang/protobuf/jsonpb", Name: "jsonpb"}, + want: `"github.com/golang/protobuf/jsonpb"`, + }, + { + pkg: GoPackage{Path: "golang.org/x/net/context", Name: "context"}, + want: `"golang.org/x/net/context"`, + }, + { + pkg: GoPackage{Path: "github.com/grpc-ecosystem/grpc-gateway", Name: "main"}, + want: `"github.com/grpc-ecosystem/grpc-gateway"`, + }, + { + pkg: GoPackage{Path: "github.com/google/googleapis/google/api/http.pb", Name: "http_pb", Alias: "htpb"}, + want: `htpb "github.com/google/googleapis/google/api/http.pb"`, + }, + } { + if got, want := spec.pkg.String(), spec.want; got != want { + t.Errorf("%#v.String() = %q; want %q", spec.pkg, got, want) + } + } +} + +func TestFieldPath(t *testing.T) { + var fds []*descriptor.FileDescriptorProto + for _, src := range []string{ + ` + name: 'example.proto' + package: 'example' + message_type < + name: 'Nest' + field < + name: 'nest2_field' + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: 'Nest2' + number: 1 + > + field < + name: 'terminal_field' + label: LABEL_OPTIONAL + type: TYPE_STRING + number: 2 + > + > + syntax: "proto3" + `, ` + name: 'another.proto' + package: 'example' + message_type < + name: 'Nest2' + field < + name: 'nest_field' + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: 'Nest' + number: 1 + > + field < + name: 'terminal_field' + label: LABEL_OPTIONAL + type: TYPE_STRING + number: 2 + > + > + syntax: "proto2" + `, + } { + var fd descriptor.FileDescriptorProto + if err := proto.UnmarshalText(src, &fd); err != nil { + t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err) + } + fds = append(fds, &fd) + } + nest := &Message{ + DescriptorProto: fds[0].MessageType[0], + Fields: []*Field{ + {FieldDescriptorProto: fds[0].MessageType[0].Field[0]}, + {FieldDescriptorProto: fds[0].MessageType[0].Field[1]}, + }, + } + nest2 := &Message{ + DescriptorProto: fds[1].MessageType[0], + Fields: []*Field{ + {FieldDescriptorProto: fds[1].MessageType[0].Field[0]}, + {FieldDescriptorProto: fds[1].MessageType[0].Field[1]}, + }, + } + file1 := &File{ + FileDescriptorProto: fds[0], + GoPkg: GoPackage{Path: "example", Name: "example"}, + Messages: []*Message{nest}, + } + file2 := &File{ + FileDescriptorProto: fds[1], + GoPkg: GoPackage{Path: "example", Name: "example"}, + Messages: []*Message{nest2}, + } + crossLinkFixture(file1) + crossLinkFixture(file2) + + c1 := FieldPathComponent{ + Name: "nest_field", + Target: nest2.Fields[0], + } + if got, want := c1.LHS(), "GetNestField()"; got != want { + t.Errorf("c1.LHS() = %q; want %q", got, want) + } + if got, want := c1.RHS(), "NestField"; got != want { + t.Errorf("c1.RHS() = %q; want %q", got, want) + } + + c2 := FieldPathComponent{ + Name: "nest2_field", + Target: nest.Fields[0], + } + if got, want := c2.LHS(), "Nest2Field"; got != want { + t.Errorf("c2.LHS() = %q; want %q", got, want) + } + if got, want := c2.LHS(), "Nest2Field"; got != want { + t.Errorf("c2.LHS() = %q; want %q", got, want) + } + + fp := FieldPath{ + c1, c2, c1, FieldPathComponent{ + Name: "terminal_field", + Target: nest.Fields[1], + }, + } + if got, want := fp.RHS("resp"), "resp.GetNestField().Nest2Field.GetNestField().TerminalField"; got != want { + t.Errorf("fp.RHS(%q) = %q; want %q", "resp", got, want) + } + + fp2 := FieldPath{ + c2, c1, c2, FieldPathComponent{ + Name: "terminal_field", + Target: nest2.Fields[1], + }, + } + if got, want := fp2.RHS("resp"), "resp.Nest2Field.GetNestField().Nest2Field.TerminalField"; got != want { + t.Errorf("fp2.RHS(%q) = %q; want %q", "resp", got, want) + } + + var fpEmpty FieldPath + if got, want := fpEmpty.RHS("resp"), "resp"; got != want { + t.Errorf("fpEmpty.RHS(%q) = %q; want %q", "resp", got, want) + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator/generator.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator/generator.go new file mode 100644 index 0000000..df55da4 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator/generator.go @@ -0,0 +1,13 @@ +// Package generator provides an abstract interface to code generators. +package generator + +import ( + plugin "github.com/golang/protobuf/protoc-gen-go/plugin" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" +) + +// Generator is an abstraction of code generators. +type Generator interface { + // Generate generates output files from input .proto files. + Generate(targets []*descriptor.File) ([]*plugin.CodeGeneratorResponse_File, error) +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway/doc.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway/doc.go new file mode 100644 index 0000000..223d810 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway/doc.go @@ -0,0 +1,2 @@ +// Package gengateway provides a code generator for grpc gateway files. +package gengateway diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway/generator.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway/generator.go new file mode 100644 index 0000000..a2aecd0 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway/generator.go @@ -0,0 +1,111 @@ +package gengateway + +import ( + "errors" + "fmt" + "go/format" + "path" + "path/filepath" + "strings" + + "github.com/golang/glog" + "github.com/golang/protobuf/proto" + plugin "github.com/golang/protobuf/protoc-gen-go/plugin" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + gen "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator" + options "google.golang.org/genproto/googleapis/api/annotations" +) + +var ( + errNoTargetService = errors.New("no target service defined in the file") +) + +type generator struct { + reg *descriptor.Registry + baseImports []descriptor.GoPackage + useRequestContext bool +} + +// New returns a new generator which generates grpc gateway files. +func New(reg *descriptor.Registry, useRequestContext bool) gen.Generator { + var imports []descriptor.GoPackage + for _, pkgpath := range []string{ + "io", + "net/http", + "github.com/grpc-ecosystem/grpc-gateway/runtime", + "github.com/grpc-ecosystem/grpc-gateway/utilities", + "github.com/golang/protobuf/proto", + "golang.org/x/net/context", + "google.golang.org/grpc", + "google.golang.org/grpc/codes", + "google.golang.org/grpc/grpclog", + } { + pkg := descriptor.GoPackage{ + Path: pkgpath, + Name: path.Base(pkgpath), + } + if err := reg.ReserveGoPackageAlias(pkg.Name, pkg.Path); err != nil { + for i := 0; ; i++ { + alias := fmt.Sprintf("%s_%d", pkg.Name, i) + if err := reg.ReserveGoPackageAlias(alias, pkg.Path); err != nil { + continue + } + pkg.Alias = alias + break + } + } + imports = append(imports, pkg) + } + return &generator{reg: reg, baseImports: imports, useRequestContext: useRequestContext} +} + +func (g *generator) Generate(targets []*descriptor.File) ([]*plugin.CodeGeneratorResponse_File, error) { + var files []*plugin.CodeGeneratorResponse_File + for _, file := range targets { + glog.V(1).Infof("Processing %s", file.GetName()) + code, err := g.generate(file) + if err == errNoTargetService { + glog.V(1).Infof("%s: %v", file.GetName(), err) + continue + } + if err != nil { + return nil, err + } + formatted, err := format.Source([]byte(code)) + if err != nil { + glog.Errorf("%v: %s", err, code) + return nil, err + } + name := file.GetName() + ext := filepath.Ext(name) + base := strings.TrimSuffix(name, ext) + output := fmt.Sprintf("%s.pb.gw.go", base) + files = append(files, &plugin.CodeGeneratorResponse_File{ + Name: proto.String(output), + Content: proto.String(string(formatted)), + }) + glog.V(1).Infof("Will emit %s", output) + } + return files, nil +} + +func (g *generator) generate(file *descriptor.File) (string, error) { + pkgSeen := make(map[string]bool) + var imports []descriptor.GoPackage + for _, pkg := range g.baseImports { + pkgSeen[pkg.Path] = true + imports = append(imports, pkg) + } + for _, svc := range file.Services { + for _, m := range svc.Methods { + pkg := m.RequestType.File.GoPkg + if m.Options == nil || !proto.HasExtension(m.Options, options.E_Http) || + pkg == file.GoPkg || pkgSeen[pkg.Path] { + continue + } + pkgSeen[pkg.Path] = true + imports = append(imports, pkg) + } + } + return applyTemplate(param{File: file, Imports: imports, UseRequestContext: g.useRequestContext}) +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway/generator_test.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway/generator_test.go new file mode 100644 index 0000000..755a092 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway/generator_test.go @@ -0,0 +1,88 @@ +package gengateway + +import ( + "strings" + "testing" + + "github.com/golang/protobuf/proto" + protodescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" +) + +func TestGenerateServiceWithoutBindings(t *testing.T) { + msgdesc := &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + } + msg := &descriptor.Message{ + DescriptorProto: msgdesc, + } + msg1 := &descriptor.Message{ + DescriptorProto: msgdesc, + File: &descriptor.File{ + GoPkg: descriptor.GoPackage{ + Path: "github.com/golang/protobuf/ptypes/empty", + Name: "empty", + }, + }, + } + meth := &protodescriptor.MethodDescriptorProto{ + Name: proto.String("Example"), + InputType: proto.String("ExampleMessage"), + OutputType: proto.String("ExampleMessage"), + } + meth1 := &protodescriptor.MethodDescriptorProto{ + Name: proto.String("ExampleWithoutBindings"), + InputType: proto.String("empty.Empty"), + OutputType: proto.String("empty.Empty"), + } + svc := &protodescriptor.ServiceDescriptorProto{ + Name: proto.String("ExampleService"), + Method: []*protodescriptor.MethodDescriptorProto{meth, meth1}, + } + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + Name: proto.String("example.proto"), + Package: proto.String("example"), + Dependency: []string{"a.example/b/c.proto", "a.example/d/e.proto"}, + MessageType: []*protodescriptor.DescriptorProto{msgdesc}, + Service: []*protodescriptor.ServiceDescriptorProto{svc}, + }, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + Messages: []*descriptor.Message{msg}, + Services: []*descriptor.Service{ + { + ServiceDescriptorProto: svc, + Methods: []*descriptor.Method{ + { + MethodDescriptorProto: meth, + RequestType: msg, + ResponseType: msg, + Bindings: []*descriptor.Binding{ + { + HTTPMethod: "GET", + Body: &descriptor.Body{FieldPath: nil}, + }, + }, + }, + { + MethodDescriptorProto: meth1, + RequestType: msg1, + ResponseType: msg1, + }, + }, + }, + }, + } + g := &generator{} + got, err := g.generate(crossLinkFixture(&file)) + if err != nil { + t.Errorf("generate(%#v) failed with %v; want success", file, err) + return + } + if notwanted := `"github.com/golang/protobuf/ptypes/empty"`; strings.Contains(got, notwanted) { + t.Errorf("generate(%#v) = %s; does not want to contain %s", file, got, notwanted) + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway/template.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway/template.go new file mode 100644 index 0000000..e43904a --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway/template.go @@ -0,0 +1,398 @@ +package gengateway + +import ( + "bytes" + "fmt" + "strings" + "text/template" + + "github.com/golang/glog" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/utilities" +) + +type param struct { + *descriptor.File + Imports []descriptor.GoPackage + UseRequestContext bool +} + +type binding struct { + *descriptor.Binding +} + +// HasQueryParam determines if the binding needs parameters in query string. +// +// It sometimes returns true even though actually the binding does not need. +// But it is not serious because it just results in a small amount of extra codes generated. +func (b binding) HasQueryParam() bool { + if b.Body != nil && len(b.Body.FieldPath) == 0 { + return false + } + fields := make(map[string]bool) + for _, f := range b.Method.RequestType.Fields { + fields[f.GetName()] = true + } + if b.Body != nil { + delete(fields, b.Body.FieldPath.String()) + } + for _, p := range b.PathParams { + delete(fields, p.FieldPath.String()) + } + return len(fields) > 0 +} + +func (b binding) QueryParamFilter() queryParamFilter { + var seqs [][]string + if b.Body != nil { + seqs = append(seqs, strings.Split(b.Body.FieldPath.String(), ".")) + } + for _, p := range b.PathParams { + seqs = append(seqs, strings.Split(p.FieldPath.String(), ".")) + } + return queryParamFilter{utilities.NewDoubleArray(seqs)} +} + +// queryParamFilter is a wrapper of utilities.DoubleArray which provides String() to output DoubleArray.Encoding in a stable and predictable format. +type queryParamFilter struct { + *utilities.DoubleArray +} + +func (f queryParamFilter) String() string { + encodings := make([]string, len(f.Encoding)) + for str, enc := range f.Encoding { + encodings[enc] = fmt.Sprintf("%q: %d", str, enc) + } + e := strings.Join(encodings, ", ") + return fmt.Sprintf("&utilities.DoubleArray{Encoding: map[string]int{%s}, Base: %#v, Check: %#v}", e, f.Base, f.Check) +} + +type trailerParams struct { + Services []*descriptor.Service + UseRequestContext bool +} + +func applyTemplate(p param) (string, error) { + w := bytes.NewBuffer(nil) + if err := headerTemplate.Execute(w, p); err != nil { + return "", err + } + var targetServices []*descriptor.Service + for _, svc := range p.Services { + var methodWithBindingsSeen bool + for _, meth := range svc.Methods { + glog.V(2).Infof("Processing %s.%s", svc.GetName(), meth.GetName()) + methName := strings.Title(*meth.Name) + meth.Name = &methName + for _, b := range meth.Bindings { + methodWithBindingsSeen = true + if err := handlerTemplate.Execute(w, binding{Binding: b}); err != nil { + return "", err + } + } + } + if methodWithBindingsSeen { + targetServices = append(targetServices, svc) + } + } + if len(targetServices) == 0 { + return "", errNoTargetService + } + + tp := trailerParams{ + Services: targetServices, + UseRequestContext: p.UseRequestContext, + } + if err := trailerTemplate.Execute(w, tp); err != nil { + return "", err + } + return w.String(), nil +} + +var ( + headerTemplate = template.Must(template.New("header").Parse(` +// Code generated by protoc-gen-grpc-gateway +// source: {{.GetName}} +// DO NOT EDIT! + +/* +Package {{.GoPkg.Name}} is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package {{.GoPkg.Name}} +import ( + {{range $i := .Imports}}{{if $i.Standard}}{{$i | printf "%s\n"}}{{end}}{{end}} + + {{range $i := .Imports}}{{if not $i.Standard}}{{$i | printf "%s\n"}}{{end}}{{end}} +) + +var _ codes.Code +var _ io.Reader +var _ = runtime.String +var _ = utilities.NewDoubleArray +`)) + + handlerTemplate = template.Must(template.New("handler").Parse(` +{{if and .Method.GetClientStreaming .Method.GetServerStreaming}} +{{template "bidi-streaming-request-func" .}} +{{else if .Method.GetClientStreaming}} +{{template "client-streaming-request-func" .}} +{{else}} +{{template "client-rpc-request-func" .}} +{{end}} +`)) + + _ = template.Must(handlerTemplate.New("request-func-signature").Parse(strings.Replace(` +{{if .Method.GetServerStreaming}} +func request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ctx context.Context, marshaler runtime.Marshaler, client {{.Method.Service.GetName}}Client, req *http.Request, pathParams map[string]string) ({{.Method.Service.GetName}}_{{.Method.GetName}}Client, runtime.ServerMetadata, error) +{{else}} +func request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ctx context.Context, marshaler runtime.Marshaler, client {{.Method.Service.GetName}}Client, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) +{{end}}`, "\n", "", -1))) + + _ = template.Must(handlerTemplate.New("client-streaming-request-func").Parse(` +{{template "request-func-signature" .}} { + var metadata runtime.ServerMetadata + stream, err := client.{{.Method.GetName}}(ctx) + if err != nil { + grpclog.Printf("Failed to start streaming: %v", err) + return nil, metadata, err + } + dec := marshaler.NewDecoder(req.Body) + for { + var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} + err = dec.Decode(&protoReq) + if err == io.EOF { + break + } + if err != nil { + grpclog.Printf("Failed to decode request: %v", err) + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + if err = stream.Send(&protoReq); err != nil { + grpclog.Printf("Failed to send request: %v", err) + return nil, metadata, err + } + } + + if err := stream.CloseSend(); err != nil { + grpclog.Printf("Failed to terminate client stream: %v", err) + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + grpclog.Printf("Failed to get header from client: %v", err) + return nil, metadata, err + } + metadata.HeaderMD = header +{{if .Method.GetServerStreaming}} + return stream, metadata, nil +{{else}} + msg, err := stream.CloseAndRecv() + metadata.TrailerMD = stream.Trailer() + return msg, metadata, err +{{end}} +} +`)) + + _ = template.Must(handlerTemplate.New("client-rpc-request-func").Parse(` +{{if .HasQueryParam}} +var ( + filter_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}} = {{.QueryParamFilter}} +) +{{end}} +{{template "request-func-signature" .}} { + var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} + var metadata runtime.ServerMetadata +{{if .Body}} + if err := marshaler.NewDecoder(req.Body).Decode(&{{.Body.RHS "protoReq"}}); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } +{{end}} +{{if .PathParams}} + var ( + val string + ok bool + err error + _ = err + ) + {{range $param := .PathParams}} + val, ok = pathParams[{{$param | printf "%q"}}] + if !ok { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", {{$param | printf "%q"}}) + } +{{if $param.IsNestedProto3 }} + err = runtime.PopulateFieldFromPath(&protoReq, {{$param | printf "%q"}}, val) +{{else}} + {{$param.RHS "protoReq"}}, err = {{$param.ConvertFuncExpr}}(val) +{{end}} + if err != nil { + return nil, metadata, err + } + {{end}} +{{end}} +{{if .HasQueryParam}} + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}); err != nil { + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } +{{end}} +{{if .Method.GetServerStreaming}} + stream, err := client.{{.Method.GetName}}(ctx, &protoReq) + if err != nil { + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil +{{else}} + msg, err := client.{{.Method.GetName}}(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +{{end}} +}`)) + + _ = template.Must(handlerTemplate.New("bidi-streaming-request-func").Parse(` +{{template "request-func-signature" .}} { + var metadata runtime.ServerMetadata + stream, err := client.{{.Method.GetName}}(ctx) + if err != nil { + grpclog.Printf("Failed to start streaming: %v", err) + return nil, metadata, err + } + dec := marshaler.NewDecoder(req.Body) + handleSend := func() error { + var protoReq {{.Method.RequestType.GoType .Method.Service.File.GoPkg.Path}} + err = dec.Decode(&protoReq) + if err == io.EOF { + return err + } + if err != nil { + grpclog.Printf("Failed to decode request: %v", err) + return err + } + if err = stream.Send(&protoReq); err != nil { + grpclog.Printf("Failed to send request: %v", err) + return err + } + return nil + } + if err := handleSend(); err != nil { + if cerr := stream.CloseSend(); cerr != nil { + grpclog.Printf("Failed to terminate client stream: %v", cerr) + } + if err == io.EOF { + return stream, metadata, nil + } + return nil, metadata, err + } + go func() { + for { + if err := handleSend(); err != nil { + break + } + } + if err := stream.CloseSend(); err != nil { + grpclog.Printf("Failed to terminate client stream: %v", err) + } + }() + header, err := stream.Header() + if err != nil { + grpclog.Printf("Failed to get header from client: %v", err) + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil +} +`)) + + trailerTemplate = template.Must(template.New("trailer").Parse(` +{{$UseRequestContext := .UseRequestContext}} +{{range $svc := .Services}} +// Register{{$svc.GetName}}HandlerFromEndpoint is same as Register{{$svc.GetName}}Handler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func Register{{$svc.GetName}}HandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return Register{{$svc.GetName}}Handler(ctx, mux, conn) +} + +// Register{{$svc.GetName}}Handler registers the http handlers for service {{$svc.GetName}} to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func Register{{$svc.GetName}}Handler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + client := New{{$svc.GetName}}Client(conn) + {{range $m := $svc.Methods}} + {{range $b := $m.Bindings}} + mux.Handle({{$b.HTTPMethod | printf "%q"}}, pattern_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + {{- if $UseRequestContext }} + ctx, cancel := context.WithCancel(req.Context()) + {{- else -}} + ctx, cancel := context.WithCancel(ctx) + {{- end }} + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + {{if $m.GetServerStreaming}} + forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + {{else}} + forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}}(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + {{end}} + }) + {{end}} + {{end}} + return nil +} + +var ( + {{range $m := $svc.Methods}} + {{range $b := $m.Bindings}} + pattern_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}} = runtime.MustPattern(runtime.NewPattern({{$b.PathTmpl.Version}}, {{$b.PathTmpl.OpCodes | printf "%#v"}}, {{$b.PathTmpl.Pool | printf "%#v"}}, {{$b.PathTmpl.Verb | printf "%q"}})) + {{end}} + {{end}} +) + +var ( + {{range $m := $svc.Methods}} + {{range $b := $m.Bindings}} + forward_{{$svc.GetName}}_{{$m.GetName}}_{{$b.Index}} = {{if $m.GetServerStreaming}}runtime.ForwardResponseStream{{else}}runtime.ForwardResponseMessage{{end}} + {{end}} + {{end}} +) +{{end}}`)) +) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway/template_test.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway/template_test.go new file mode 100644 index 0000000..c5fb2f9 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway/template_test.go @@ -0,0 +1,404 @@ +package gengateway + +import ( + "strings" + "testing" + + "github.com/golang/protobuf/proto" + protodescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" +) + +func crossLinkFixture(f *descriptor.File) *descriptor.File { + for _, m := range f.Messages { + m.File = f + } + for _, svc := range f.Services { + svc.File = f + for _, m := range svc.Methods { + m.Service = svc + for _, b := range m.Bindings { + b.Method = m + for _, param := range b.PathParams { + param.Method = m + } + } + } + } + return f +} + +func TestApplyTemplateHeader(t *testing.T) { + msgdesc := &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + } + meth := &protodescriptor.MethodDescriptorProto{ + Name: proto.String("Example"), + InputType: proto.String("ExampleMessage"), + OutputType: proto.String("ExampleMessage"), + } + svc := &protodescriptor.ServiceDescriptorProto{ + Name: proto.String("ExampleService"), + Method: []*protodescriptor.MethodDescriptorProto{meth}, + } + msg := &descriptor.Message{ + DescriptorProto: msgdesc, + } + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + Name: proto.String("example.proto"), + Package: proto.String("example"), + Dependency: []string{"a.example/b/c.proto", "a.example/d/e.proto"}, + MessageType: []*protodescriptor.DescriptorProto{msgdesc}, + Service: []*protodescriptor.ServiceDescriptorProto{svc}, + }, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + Messages: []*descriptor.Message{msg}, + Services: []*descriptor.Service{ + { + ServiceDescriptorProto: svc, + Methods: []*descriptor.Method{ + { + MethodDescriptorProto: meth, + RequestType: msg, + ResponseType: msg, + Bindings: []*descriptor.Binding{ + { + HTTPMethod: "GET", + Body: &descriptor.Body{FieldPath: nil}, + }, + }, + }, + }, + }, + }, + } + got, err := applyTemplate(param{File: crossLinkFixture(&file)}) + if err != nil { + t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) + return + } + if want := "package example_pb\n"; !strings.Contains(got, want) { + t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) + } +} + +func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { + msgdesc := &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("nested"), + Label: protodescriptor.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: protodescriptor.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: proto.String("NestedMessage"), + Number: proto.Int32(1), + }, + }, + } + nesteddesc := &protodescriptor.DescriptorProto{ + Name: proto.String("NestedMessage"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("int32"), + Label: protodescriptor.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: protodescriptor.FieldDescriptorProto_TYPE_INT32.Enum(), + Number: proto.Int32(1), + }, + { + Name: proto.String("bool"), + Label: protodescriptor.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: protodescriptor.FieldDescriptorProto_TYPE_BOOL.Enum(), + Number: proto.Int32(2), + }, + }, + } + meth := &protodescriptor.MethodDescriptorProto{ + Name: proto.String("Echo"), + InputType: proto.String("ExampleMessage"), + OutputType: proto.String("ExampleMessage"), + ClientStreaming: proto.Bool(false), + } + svc := &protodescriptor.ServiceDescriptorProto{ + Name: proto.String("ExampleService"), + Method: []*protodescriptor.MethodDescriptorProto{meth}, + } + for _, spec := range []struct { + serverStreaming bool + sigWant string + }{ + { + serverStreaming: false, + sigWant: `func request_ExampleService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client ExampleServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {`, + }, + { + serverStreaming: true, + sigWant: `func request_ExampleService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client ExampleServiceClient, req *http.Request, pathParams map[string]string) (ExampleService_EchoClient, runtime.ServerMetadata, error) {`, + }, + } { + meth.ServerStreaming = proto.Bool(spec.serverStreaming) + + msg := &descriptor.Message{ + DescriptorProto: msgdesc, + } + nested := &descriptor.Message{ + DescriptorProto: nesteddesc, + } + + nestedField := &descriptor.Field{ + Message: msg, + FieldDescriptorProto: msg.GetField()[0], + } + intField := &descriptor.Field{ + Message: nested, + FieldDescriptorProto: nested.GetField()[0], + } + boolField := &descriptor.Field{ + Message: nested, + FieldDescriptorProto: nested.GetField()[1], + } + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + Name: proto.String("example.proto"), + Package: proto.String("example"), + MessageType: []*protodescriptor.DescriptorProto{msgdesc, nesteddesc}, + Service: []*protodescriptor.ServiceDescriptorProto{svc}, + }, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + Messages: []*descriptor.Message{msg, nested}, + Services: []*descriptor.Service{ + { + ServiceDescriptorProto: svc, + Methods: []*descriptor.Method{ + { + MethodDescriptorProto: meth, + RequestType: msg, + ResponseType: msg, + Bindings: []*descriptor.Binding{ + { + HTTPMethod: "POST", + PathTmpl: httprule.Template{ + Version: 1, + OpCodes: []int{0, 0}, + }, + PathParams: []descriptor.Parameter{ + { + FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ + { + Name: "nested", + Target: nestedField, + }, + { + Name: "int32", + Target: intField, + }, + }), + Target: intField, + }, + }, + Body: &descriptor.Body{ + FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ + { + Name: "nested", + Target: nestedField, + }, + { + Name: "bool", + Target: boolField, + }, + }), + }, + }, + }, + }, + }, + }, + }, + } + got, err := applyTemplate(param{File: crossLinkFixture(&file)}) + if err != nil { + t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) + return + } + if want := spec.sigWant; !strings.Contains(got, want) { + t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) + } + if want := `marshaler.NewDecoder(req.Body).Decode(&protoReq.GetNested().Bool)`; !strings.Contains(got, want) { + t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) + } + if want := `val, ok = pathParams["nested.int32"]`; !strings.Contains(got, want) { + t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) + } + if want := `protoReq.GetNested().Int32, err = runtime.Int32P(val)`; !strings.Contains(got, want) { + t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) + } + if want := `func RegisterExampleServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {`; !strings.Contains(got, want) { + t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) + } + if want := `pattern_ExampleService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{0, 0}, []string(nil), ""))`; !strings.Contains(got, want) { + t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) + } + } +} + +func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { + msgdesc := &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("nested"), + Label: protodescriptor.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: protodescriptor.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: proto.String("NestedMessage"), + Number: proto.Int32(1), + }, + }, + } + nesteddesc := &protodescriptor.DescriptorProto{ + Name: proto.String("NestedMessage"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("int32"), + Label: protodescriptor.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: protodescriptor.FieldDescriptorProto_TYPE_INT32.Enum(), + Number: proto.Int32(1), + }, + { + Name: proto.String("bool"), + Label: protodescriptor.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: protodescriptor.FieldDescriptorProto_TYPE_BOOL.Enum(), + Number: proto.Int32(2), + }, + }, + } + meth := &protodescriptor.MethodDescriptorProto{ + Name: proto.String("Echo"), + InputType: proto.String("ExampleMessage"), + OutputType: proto.String("ExampleMessage"), + ClientStreaming: proto.Bool(true), + } + svc := &protodescriptor.ServiceDescriptorProto{ + Name: proto.String("ExampleService"), + Method: []*protodescriptor.MethodDescriptorProto{meth}, + } + for _, spec := range []struct { + serverStreaming bool + sigWant string + }{ + { + serverStreaming: false, + sigWant: `func request_ExampleService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client ExampleServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {`, + }, + { + serverStreaming: true, + sigWant: `func request_ExampleService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client ExampleServiceClient, req *http.Request, pathParams map[string]string) (ExampleService_EchoClient, runtime.ServerMetadata, error) {`, + }, + } { + meth.ServerStreaming = proto.Bool(spec.serverStreaming) + + msg := &descriptor.Message{ + DescriptorProto: msgdesc, + } + nested := &descriptor.Message{ + DescriptorProto: nesteddesc, + } + + nestedField := &descriptor.Field{ + Message: msg, + FieldDescriptorProto: msg.GetField()[0], + } + intField := &descriptor.Field{ + Message: nested, + FieldDescriptorProto: nested.GetField()[0], + } + boolField := &descriptor.Field{ + Message: nested, + FieldDescriptorProto: nested.GetField()[1], + } + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + Name: proto.String("example.proto"), + Package: proto.String("example"), + MessageType: []*protodescriptor.DescriptorProto{msgdesc, nesteddesc}, + Service: []*protodescriptor.ServiceDescriptorProto{svc}, + }, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + Messages: []*descriptor.Message{msg, nested}, + Services: []*descriptor.Service{ + { + ServiceDescriptorProto: svc, + Methods: []*descriptor.Method{ + { + MethodDescriptorProto: meth, + RequestType: msg, + ResponseType: msg, + Bindings: []*descriptor.Binding{ + { + HTTPMethod: "POST", + PathTmpl: httprule.Template{ + Version: 1, + OpCodes: []int{0, 0}, + }, + PathParams: []descriptor.Parameter{ + { + FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ + { + Name: "nested", + Target: nestedField, + }, + { + Name: "int32", + Target: intField, + }, + }), + Target: intField, + }, + }, + Body: &descriptor.Body{ + FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ + { + Name: "nested", + Target: nestedField, + }, + { + Name: "bool", + Target: boolField, + }, + }), + }, + }, + }, + }, + }, + }, + }, + } + got, err := applyTemplate(param{File: crossLinkFixture(&file)}) + if err != nil { + t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) + return + } + if want := spec.sigWant; !strings.Contains(got, want) { + t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) + } + if want := `marshaler.NewDecoder(req.Body)`; !strings.Contains(got, want) { + t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) + } + if want := `func RegisterExampleServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {`; !strings.Contains(got, want) { + t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) + } + if want := `pattern_ExampleService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{0, 0}, []string(nil), ""))`; !strings.Contains(got, want) { + t.Errorf("applyTemplate(%#v) = %s; want to contain %s", file, got, want) + } + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule/compile.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule/compile.go new file mode 100644 index 0000000..437039a --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule/compile.go @@ -0,0 +1,117 @@ +package httprule + +import ( + "github.com/grpc-ecosystem/grpc-gateway/utilities" +) + +const ( + opcodeVersion = 1 +) + +// Template is a compiled representation of path templates. +type Template struct { + // Version is the version number of the format. + Version int + // OpCodes is a sequence of operations. + OpCodes []int + // Pool is a constant pool + Pool []string + // Verb is a VERB part in the template. + Verb string + // Fields is a list of field paths bound in this template. + Fields []string + // Original template (example: /v1/a_bit_of_everything) + Template string +} + +// Compiler compiles utilities representation of path templates into marshallable operations. +// They can be unmarshalled by runtime.NewPattern. +type Compiler interface { + Compile() Template +} + +type op struct { + // code is the opcode of the operation + code utilities.OpCode + + // str is a string operand of the code. + // num is ignored if str is not empty. + str string + + // num is a numeric operand of the code. + num int +} + +func (w wildcard) compile() []op { + return []op{ + {code: utilities.OpPush}, + } +} + +func (w deepWildcard) compile() []op { + return []op{ + {code: utilities.OpPushM}, + } +} + +func (l literal) compile() []op { + return []op{ + { + code: utilities.OpLitPush, + str: string(l), + }, + } +} + +func (v variable) compile() []op { + var ops []op + for _, s := range v.segments { + ops = append(ops, s.compile()...) + } + ops = append(ops, op{ + code: utilities.OpConcatN, + num: len(v.segments), + }, op{ + code: utilities.OpCapture, + str: v.path, + }) + + return ops +} + +func (t template) Compile() Template { + var rawOps []op + for _, s := range t.segments { + rawOps = append(rawOps, s.compile()...) + } + + var ( + ops []int + pool []string + fields []string + ) + consts := make(map[string]int) + for _, op := range rawOps { + ops = append(ops, int(op.code)) + if op.str == "" { + ops = append(ops, op.num) + } else { + if _, ok := consts[op.str]; !ok { + consts[op.str] = len(pool) + pool = append(pool, op.str) + } + ops = append(ops, consts[op.str]) + } + if op.code == utilities.OpCapture { + fields = append(fields, op.str) + } + } + return Template{ + Version: opcodeVersion, + OpCodes: ops, + Pool: pool, + Verb: t.verb, + Fields: fields, + Template: t.template, + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule/compile_test.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule/compile_test.go new file mode 100644 index 0000000..9ef2975 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule/compile_test.go @@ -0,0 +1,122 @@ +package httprule + +import ( + "reflect" + "testing" + + "github.com/grpc-ecosystem/grpc-gateway/utilities" +) + +const ( + operandFiller = 0 +) + +func TestCompile(t *testing.T) { + for _, spec := range []struct { + segs []segment + verb string + + ops []int + pool []string + fields []string + }{ + {}, + { + segs: []segment{ + wildcard{}, + }, + ops: []int{int(utilities.OpPush), operandFiller}, + }, + { + segs: []segment{ + deepWildcard{}, + }, + ops: []int{int(utilities.OpPushM), operandFiller}, + }, + { + segs: []segment{ + literal("v1"), + }, + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"v1"}, + }, + { + segs: []segment{ + literal("v1"), + }, + verb: "LOCK", + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"v1"}, + }, + { + segs: []segment{ + variable{ + path: "name.nested", + segments: []segment{ + wildcard{}, + }, + }, + }, + ops: []int{ + int(utilities.OpPush), operandFiller, + int(utilities.OpConcatN), 1, + int(utilities.OpCapture), 0, + }, + pool: []string{"name.nested"}, + fields: []string{"name.nested"}, + }, + { + segs: []segment{ + literal("obj"), + variable{ + path: "name.nested", + segments: []segment{ + literal("a"), + wildcard{}, + literal("b"), + }, + }, + variable{ + path: "obj", + segments: []segment{ + deepWildcard{}, + }, + }, + }, + ops: []int{ + int(utilities.OpLitPush), 0, + int(utilities.OpLitPush), 1, + int(utilities.OpPush), operandFiller, + int(utilities.OpLitPush), 2, + int(utilities.OpConcatN), 3, + int(utilities.OpCapture), 3, + int(utilities.OpPushM), operandFiller, + int(utilities.OpConcatN), 1, + int(utilities.OpCapture), 0, + }, + pool: []string{"obj", "a", "b", "name.nested"}, + fields: []string{"name.nested", "obj"}, + }, + } { + tmpl := template{ + segments: spec.segs, + verb: spec.verb, + } + compiled := tmpl.Compile() + if got, want := compiled.Version, opcodeVersion; got != want { + t.Errorf("tmpl.Compile().Version = %d; want %d; segs=%#v, verb=%q", got, want, spec.segs, spec.verb) + } + if got, want := compiled.OpCodes, spec.ops; !reflect.DeepEqual(got, want) { + t.Errorf("tmpl.Compile().OpCodes = %v; want %v; segs=%#v, verb=%q", got, want, spec.segs, spec.verb) + } + if got, want := compiled.Pool, spec.pool; !reflect.DeepEqual(got, want) { + t.Errorf("tmpl.Compile().Pool = %q; want %q; segs=%#v, verb=%q", got, want, spec.segs, spec.verb) + } + if got, want := compiled.Verb, spec.verb; got != want { + t.Errorf("tmpl.Compile().Verb = %q; want %q; segs=%#v, verb=%q", got, want, spec.segs, spec.verb) + } + if got, want := compiled.Fields, spec.fields; !reflect.DeepEqual(got, want) { + t.Errorf("tmpl.Compile().Fields = %q; want %q; segs=%#v, verb=%q", got, want, spec.segs, spec.verb) + } + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule/parse.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule/parse.go new file mode 100644 index 0000000..3be7426 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule/parse.go @@ -0,0 +1,351 @@ +package httprule + +import ( + "fmt" + "strings" + + "github.com/golang/glog" +) + +// InvalidTemplateError indicates that the path template is not valid. +type InvalidTemplateError struct { + tmpl string + msg string +} + +func (e InvalidTemplateError) Error() string { + return fmt.Sprintf("%s: %s", e.msg, e.tmpl) +} + +// Parse parses the string representation of path template +func Parse(tmpl string) (Compiler, error) { + if !strings.HasPrefix(tmpl, "/") { + return template{}, InvalidTemplateError{tmpl: tmpl, msg: "no leading /"} + } + tokens, verb := tokenize(tmpl[1:]) + + p := parser{tokens: tokens} + segs, err := p.topLevelSegments() + if err != nil { + return template{}, InvalidTemplateError{tmpl: tmpl, msg: err.Error()} + } + + return template{ + segments: segs, + verb: verb, + template: tmpl, + }, nil +} + +func tokenize(path string) (tokens []string, verb string) { + if path == "" { + return []string{eof}, "" + } + + const ( + init = iota + field + nested + ) + var ( + st = init + ) + for path != "" { + var idx int + switch st { + case init: + idx = strings.IndexAny(path, "/{") + case field: + idx = strings.IndexAny(path, ".=}") + case nested: + idx = strings.IndexAny(path, "/}") + } + if idx < 0 { + tokens = append(tokens, path) + break + } + switch r := path[idx]; r { + case '/', '.': + case '{': + st = field + case '=': + st = nested + case '}': + st = init + } + if idx == 0 { + tokens = append(tokens, path[idx:idx+1]) + } else { + tokens = append(tokens, path[:idx], path[idx:idx+1]) + } + path = path[idx+1:] + } + + l := len(tokens) + t := tokens[l-1] + if idx := strings.LastIndex(t, ":"); idx == 0 { + tokens, verb = tokens[:l-1], t[1:] + } else if idx > 0 { + tokens[l-1], verb = t[:idx], t[idx+1:] + } + tokens = append(tokens, eof) + return tokens, verb +} + +// parser is a parser of the template syntax defined in github.com/googleapis/googleapis/google/api/http.proto. +type parser struct { + tokens []string + accepted []string +} + +// topLevelSegments is the target of this parser. +func (p *parser) topLevelSegments() ([]segment, error) { + glog.V(1).Infof("Parsing %q", p.tokens) + segs, err := p.segments() + if err != nil { + return nil, err + } + glog.V(2).Infof("accept segments: %q; %q", p.accepted, p.tokens) + if _, err := p.accept(typeEOF); err != nil { + return nil, fmt.Errorf("unexpected token %q after segments %q", p.tokens[0], strings.Join(p.accepted, "")) + } + glog.V(2).Infof("accept eof: %q; %q", p.accepted, p.tokens) + return segs, nil +} + +func (p *parser) segments() ([]segment, error) { + s, err := p.segment() + if err != nil { + return nil, err + } + glog.V(2).Infof("accept segment: %q; %q", p.accepted, p.tokens) + + segs := []segment{s} + for { + if _, err := p.accept("/"); err != nil { + return segs, nil + } + s, err := p.segment() + if err != nil { + return segs, err + } + segs = append(segs, s) + glog.V(2).Infof("accept segment: %q; %q", p.accepted, p.tokens) + } +} + +func (p *parser) segment() (segment, error) { + if _, err := p.accept("*"); err == nil { + return wildcard{}, nil + } + if _, err := p.accept("**"); err == nil { + return deepWildcard{}, nil + } + if l, err := p.literal(); err == nil { + return l, nil + } + + v, err := p.variable() + if err != nil { + return nil, fmt.Errorf("segment neither wildcards, literal or variable: %v", err) + } + return v, err +} + +func (p *parser) literal() (segment, error) { + lit, err := p.accept(typeLiteral) + if err != nil { + return nil, err + } + return literal(lit), nil +} + +func (p *parser) variable() (segment, error) { + if _, err := p.accept("{"); err != nil { + return nil, err + } + + path, err := p.fieldPath() + if err != nil { + return nil, err + } + + var segs []segment + if _, err := p.accept("="); err == nil { + segs, err = p.segments() + if err != nil { + return nil, fmt.Errorf("invalid segment in variable %q: %v", path, err) + } + } else { + segs = []segment{wildcard{}} + } + + if _, err := p.accept("}"); err != nil { + return nil, fmt.Errorf("unterminated variable segment: %s", path) + } + return variable{ + path: path, + segments: segs, + }, nil +} + +func (p *parser) fieldPath() (string, error) { + c, err := p.accept(typeIdent) + if err != nil { + return "", err + } + components := []string{c} + for { + if _, err = p.accept("."); err != nil { + return strings.Join(components, "."), nil + } + c, err := p.accept(typeIdent) + if err != nil { + return "", fmt.Errorf("invalid field path component: %v", err) + } + components = append(components, c) + } +} + +// A termType is a type of terminal symbols. +type termType string + +// These constants define some of valid values of termType. +// They improve readability of parse functions. +// +// You can also use "/", "*", "**", "." or "=" as valid values. +const ( + typeIdent = termType("ident") + typeLiteral = termType("literal") + typeEOF = termType("$") +) + +const ( + // eof is the terminal symbol which always appears at the end of token sequence. + eof = "\u0000" +) + +// accept tries to accept a token in "p". +// This function consumes a token and returns it if it matches to the specified "term". +// If it doesn't match, the function does not consume any tokens and return an error. +func (p *parser) accept(term termType) (string, error) { + t := p.tokens[0] + switch term { + case "/", "*", "**", ".", "=", "{", "}": + if t != string(term) { + return "", fmt.Errorf("expected %q but got %q", term, t) + } + case typeEOF: + if t != eof { + return "", fmt.Errorf("expected EOF but got %q", t) + } + case typeIdent: + if err := expectIdent(t); err != nil { + return "", err + } + case typeLiteral: + if err := expectPChars(t); err != nil { + return "", err + } + default: + return "", fmt.Errorf("unknown termType %q", term) + } + p.tokens = p.tokens[1:] + p.accepted = append(p.accepted, t) + return t, nil +} + +// expectPChars determines if "t" consists of only pchars defined in RFC3986. +// +// https://www.ietf.org/rfc/rfc3986.txt, P.49 +// pchar = unreserved / pct-encoded / sub-delims / ":" / "@" +// unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" +// sub-delims = "!" / "$" / "&" / "'" / "(" / ")" +// / "*" / "+" / "," / ";" / "=" +// pct-encoded = "%" HEXDIG HEXDIG +func expectPChars(t string) error { + const ( + init = iota + pct1 + pct2 + ) + st := init + for _, r := range t { + if st != init { + if !isHexDigit(r) { + return fmt.Errorf("invalid hexdigit: %c(%U)", r, r) + } + switch st { + case pct1: + st = pct2 + case pct2: + st = init + } + continue + } + + // unreserved + switch { + case 'A' <= r && r <= 'Z': + continue + case 'a' <= r && r <= 'z': + continue + case '0' <= r && r <= '9': + continue + } + switch r { + case '-', '.', '_', '~': + // unreserved + case '!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '=': + // sub-delims + case ':', '@': + // rest of pchar + case '%': + // pct-encoded + st = pct1 + default: + return fmt.Errorf("invalid character in path segment: %q(%U)", r, r) + } + } + if st != init { + return fmt.Errorf("invalid percent-encoding in %q", t) + } + return nil +} + +// expectIdent determines if "ident" is a valid identifier in .proto schema ([[:alpha:]_][[:alphanum:]_]*). +func expectIdent(ident string) error { + if ident == "" { + return fmt.Errorf("empty identifier") + } + for pos, r := range ident { + switch { + case '0' <= r && r <= '9': + if pos == 0 { + return fmt.Errorf("identifier starting with digit: %s", ident) + } + continue + case 'A' <= r && r <= 'Z': + continue + case 'a' <= r && r <= 'z': + continue + case r == '_': + continue + default: + return fmt.Errorf("invalid character %q(%U) in identifier: %s", r, r, ident) + } + } + return nil +} + +func isHexDigit(r rune) bool { + switch { + case '0' <= r && r <= '9': + return true + case 'A' <= r && r <= 'F': + return true + case 'a' <= r && r <= 'f': + return true + } + return false +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule/parse_test.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule/parse_test.go new file mode 100644 index 0000000..6a49c71 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule/parse_test.go @@ -0,0 +1,313 @@ +package httprule + +import ( + "flag" + "fmt" + "reflect" + "testing" + + "github.com/golang/glog" +) + +func TestTokenize(t *testing.T) { + for _, spec := range []struct { + src string + tokens []string + }{ + { + src: "", + tokens: []string{eof}, + }, + { + src: "v1", + tokens: []string{"v1", eof}, + }, + { + src: "v1/b", + tokens: []string{"v1", "/", "b", eof}, + }, + { + src: "v1/endpoint/*", + tokens: []string{"v1", "/", "endpoint", "/", "*", eof}, + }, + { + src: "v1/endpoint/**", + tokens: []string{"v1", "/", "endpoint", "/", "**", eof}, + }, + { + src: "v1/b/{bucket_name=*}", + tokens: []string{ + "v1", "/", + "b", "/", + "{", "bucket_name", "=", "*", "}", + eof, + }, + }, + { + src: "v1/b/{bucket_name=buckets/*}", + tokens: []string{ + "v1", "/", + "b", "/", + "{", "bucket_name", "=", "buckets", "/", "*", "}", + eof, + }, + }, + { + src: "v1/b/{bucket_name=buckets/*}/o", + tokens: []string{ + "v1", "/", + "b", "/", + "{", "bucket_name", "=", "buckets", "/", "*", "}", "/", + "o", + eof, + }, + }, + { + src: "v1/b/{bucket_name=buckets/*}/o/{name}", + tokens: []string{ + "v1", "/", + "b", "/", + "{", "bucket_name", "=", "buckets", "/", "*", "}", "/", + "o", "/", "{", "name", "}", + eof, + }, + }, + { + src: "v1/a=b&c=d;e=f:g/endpoint.rdf", + tokens: []string{ + "v1", "/", + "a=b&c=d;e=f:g", "/", + "endpoint.rdf", + eof, + }, + }, + } { + tokens, verb := tokenize(spec.src) + if got, want := tokens, spec.tokens; !reflect.DeepEqual(got, want) { + t.Errorf("tokenize(%q) = %q, _; want %q, _", spec.src, got, want) + } + if got, want := verb, ""; got != want { + t.Errorf("tokenize(%q) = _, %q; want _, %q", spec.src, got, want) + } + + src := fmt.Sprintf("%s:%s", spec.src, "LOCK") + tokens, verb = tokenize(src) + if got, want := tokens, spec.tokens; !reflect.DeepEqual(got, want) { + t.Errorf("tokenize(%q) = %q, _; want %q, _", src, got, want) + } + if got, want := verb, "LOCK"; got != want { + t.Errorf("tokenize(%q) = _, %q; want _, %q", src, got, want) + } + } +} + +func TestParseSegments(t *testing.T) { + flag.Set("v", "3") + for _, spec := range []struct { + tokens []string + want []segment + }{ + { + tokens: []string{"v1", eof}, + want: []segment{ + literal("v1"), + }, + }, + { + tokens: []string{"-._~!$&'()*+,;=:@", eof}, + want: []segment{ + literal("-._~!$&'()*+,;=:@"), + }, + }, + { + tokens: []string{"%e7%ac%ac%e4%b8%80%e7%89%88", eof}, + want: []segment{ + literal("%e7%ac%ac%e4%b8%80%e7%89%88"), + }, + }, + { + tokens: []string{"v1", "/", "*", eof}, + want: []segment{ + literal("v1"), + wildcard{}, + }, + }, + { + tokens: []string{"v1", "/", "**", eof}, + want: []segment{ + literal("v1"), + deepWildcard{}, + }, + }, + { + tokens: []string{"{", "name", "}", eof}, + want: []segment{ + variable{ + path: "name", + segments: []segment{ + wildcard{}, + }, + }, + }, + }, + { + tokens: []string{"{", "name", "=", "*", "}", eof}, + want: []segment{ + variable{ + path: "name", + segments: []segment{ + wildcard{}, + }, + }, + }, + }, + { + tokens: []string{"{", "field", ".", "nested", ".", "nested2", "=", "*", "}", eof}, + want: []segment{ + variable{ + path: "field.nested.nested2", + segments: []segment{ + wildcard{}, + }, + }, + }, + }, + { + tokens: []string{"{", "name", "=", "a", "/", "b", "/", "*", "}", eof}, + want: []segment{ + variable{ + path: "name", + segments: []segment{ + literal("a"), + literal("b"), + wildcard{}, + }, + }, + }, + }, + { + tokens: []string{ + "v1", "/", + "{", + "name", ".", "nested", ".", "nested2", + "=", + "a", "/", "b", "/", "*", + "}", "/", + "o", "/", + "{", + "another_name", + "=", + "a", "/", "b", "/", "*", "/", "c", + "}", "/", + "**", + eof}, + want: []segment{ + literal("v1"), + variable{ + path: "name.nested.nested2", + segments: []segment{ + literal("a"), + literal("b"), + wildcard{}, + }, + }, + literal("o"), + variable{ + path: "another_name", + segments: []segment{ + literal("a"), + literal("b"), + wildcard{}, + literal("c"), + }, + }, + deepWildcard{}, + }, + }, + } { + p := parser{tokens: spec.tokens} + segs, err := p.topLevelSegments() + if err != nil { + t.Errorf("parser{%q}.segments() failed with %v; want success", spec.tokens, err) + continue + } + if got, want := segs, spec.want; !reflect.DeepEqual(got, want) { + t.Errorf("parser{%q}.segments() = %#v; want %#v", spec.tokens, got, want) + } + if got := p.tokens; len(got) > 0 { + t.Errorf("p.tokens = %q; want []; spec.tokens=%q", got, spec.tokens) + } + } +} + +func TestParseSegmentsWithErrors(t *testing.T) { + flag.Set("v", "3") + for _, spec := range []struct { + tokens []string + }{ + { + // double slash + tokens: []string{"/", eof}, + }, + { + // invalid literal + tokens: []string{"a?b", eof}, + }, + { + // invalid percent-encoding + tokens: []string{"%", eof}, + }, + { + // invalid percent-encoding + tokens: []string{"%2", eof}, + }, + { + // invalid percent-encoding + tokens: []string{"a%2z", eof}, + }, + { + // empty segments + tokens: []string{eof}, + }, + { + // unterminated variable + tokens: []string{"{", "name", eof}, + }, + { + // unterminated variable + tokens: []string{"{", "name", "=", eof}, + }, + { + // unterminated variable + tokens: []string{"{", "name", "=", "*", eof}, + }, + { + // empty component in field path + tokens: []string{"{", "name", ".", "}", eof}, + }, + { + // empty component in field path + tokens: []string{"{", "name", ".", ".", "nested", "}", eof}, + }, + { + // invalid character in identifier + tokens: []string{"{", "field-name", "}", eof}, + }, + { + // no slash between segments + tokens: []string{"v1", "endpoint", eof}, + }, + { + // no slash between segments + tokens: []string{"v1", "{", "name", "}", eof}, + }, + } { + p := parser{tokens: spec.tokens} + segs, err := p.topLevelSegments() + if err == nil { + t.Errorf("parser{%q}.segments() succeeded; want InvalidTemplateError; accepted %#v", spec.tokens, segs) + continue + } + glog.V(1).Info(err) + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule/types.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule/types.go new file mode 100644 index 0000000..5a814a0 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule/types.go @@ -0,0 +1,60 @@ +package httprule + +import ( + "fmt" + "strings" +) + +type template struct { + segments []segment + verb string + template string +} + +type segment interface { + fmt.Stringer + compile() (ops []op) +} + +type wildcard struct{} + +type deepWildcard struct{} + +type literal string + +type variable struct { + path string + segments []segment +} + +func (wildcard) String() string { + return "*" +} + +func (deepWildcard) String() string { + return "**" +} + +func (l literal) String() string { + return string(l) +} + +func (v variable) String() string { + var segs []string + for _, s := range v.segments { + segs = append(segs, s.String()) + } + return fmt.Sprintf("{%s=%s}", v.path, strings.Join(segs, "/")) +} + +func (t template) String() string { + var segs []string + for _, s := range t.segments { + segs = append(segs, s.String()) + } + str := strings.Join(segs, "/") + if t.verb != "" { + str = fmt.Sprintf("%s:%s", str, t.verb) + } + return "/" + str +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule/types_test.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule/types_test.go new file mode 100644 index 0000000..7ed0c5c --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule/types_test.go @@ -0,0 +1,91 @@ +package httprule + +import ( + "fmt" + "testing" +) + +func TestTemplateStringer(t *testing.T) { + for _, spec := range []struct { + segs []segment + want string + }{ + { + segs: []segment{ + literal("v1"), + }, + want: "/v1", + }, + { + segs: []segment{ + wildcard{}, + }, + want: "/*", + }, + { + segs: []segment{ + deepWildcard{}, + }, + want: "/**", + }, + { + segs: []segment{ + variable{ + path: "name", + segments: []segment{ + literal("a"), + }, + }, + }, + want: "/{name=a}", + }, + { + segs: []segment{ + variable{ + path: "name", + segments: []segment{ + literal("a"), + wildcard{}, + literal("b"), + }, + }, + }, + want: "/{name=a/*/b}", + }, + { + segs: []segment{ + literal("v1"), + variable{ + path: "name", + segments: []segment{ + literal("a"), + wildcard{}, + literal("b"), + }, + }, + literal("c"), + variable{ + path: "field.nested", + segments: []segment{ + wildcard{}, + literal("d"), + }, + }, + wildcard{}, + literal("e"), + deepWildcard{}, + }, + want: "/v1/{name=a/*/b}/c/{field.nested=*/d}/*/e/**", + }, + } { + tmpl := template{segments: spec.segs} + if got, want := tmpl.String(), spec.want; got != want { + t.Errorf("%#v.String() = %q; want %q", tmpl, got, want) + } + + tmpl.verb = "LOCK" + if got, want := tmpl.String(), fmt.Sprintf("%s:LOCK", spec.want); got != want { + t.Errorf("%#v.String() = %q; want %q", tmpl, got, want) + } + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/main.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/main.go new file mode 100644 index 0000000..0e2c54f --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/main.go @@ -0,0 +1,119 @@ +// Command protoc-gen-grpc-gateway is a plugin for Google protocol buffer +// compiler to generate a reverse-proxy, which converts incoming RESTful +// HTTP/1 requests gRPC invocation. +// You rarely need to run this program directly. Instead, put this program +// into your $PATH with a name "protoc-gen-grpc-gateway" and run +// protoc --grpc-gateway_out=output_directory path/to/input.proto +// +// See README.md for more details. +package main + +import ( + "flag" + "io" + "io/ioutil" + "os" + "strings" + + "github.com/golang/glog" + "github.com/golang/protobuf/proto" + plugin "github.com/golang/protobuf/protoc-gen-go/plugin" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway" +) + +var ( + importPrefix = flag.String("import_prefix", "", "prefix to be added to go package paths for imported proto files") + useRequestContext = flag.Bool("request_context", false, "determine whether to use http.Request's context or not") +) + +func parseReq(r io.Reader) (*plugin.CodeGeneratorRequest, error) { + glog.V(1).Info("Parsing code generator request") + input, err := ioutil.ReadAll(r) + if err != nil { + glog.Errorf("Failed to read code generator request: %v", err) + return nil, err + } + req := new(plugin.CodeGeneratorRequest) + if err = proto.Unmarshal(input, req); err != nil { + glog.Errorf("Failed to unmarshal code generator request: %v", err) + return nil, err + } + glog.V(1).Info("Parsed code generator request") + return req, nil +} + +func main() { + flag.Parse() + defer glog.Flush() + + reg := descriptor.NewRegistry() + + glog.V(1).Info("Processing code generator request") + req, err := parseReq(os.Stdin) + if err != nil { + glog.Fatal(err) + } + if req.Parameter != nil { + for _, p := range strings.Split(req.GetParameter(), ",") { + spec := strings.SplitN(p, "=", 2) + if len(spec) == 1 { + if err := flag.CommandLine.Set(spec[0], ""); err != nil { + glog.Fatalf("Cannot set flag %s", p) + } + continue + } + name, value := spec[0], spec[1] + if strings.HasPrefix(name, "M") { + reg.AddPkgMap(name[1:], value) + continue + } + if err := flag.CommandLine.Set(name, value); err != nil { + glog.Fatalf("Cannot set flag %s", p) + } + } + } + + g := gengateway.New(reg, *useRequestContext) + + reg.SetPrefix(*importPrefix) + if err := reg.Load(req); err != nil { + emitError(err) + return + } + + var targets []*descriptor.File + for _, target := range req.FileToGenerate { + f, err := reg.LookupFile(target) + if err != nil { + glog.Fatal(err) + } + targets = append(targets, f) + } + + out, err := g.Generate(targets) + glog.V(1).Info("Processed code generator request") + if err != nil { + emitError(err) + return + } + emitFiles(out) +} + +func emitFiles(out []*plugin.CodeGeneratorResponse_File) { + emitResp(&plugin.CodeGeneratorResponse{File: out}) +} + +func emitError(err error) { + emitResp(&plugin.CodeGeneratorResponse{Error: proto.String(err.Error())}) +} + +func emitResp(resp *plugin.CodeGeneratorResponse) { + buf, err := proto.Marshal(resp) + if err != nil { + glog.Fatal(err) + } + if _, err := os.Stdout.Write(buf); err != nil { + glog.Fatal(err) + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger/doc.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger/doc.go new file mode 100644 index 0000000..4d28716 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger/doc.go @@ -0,0 +1,2 @@ +// Package genswagger provides a code generator for swagger. +package genswagger diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger/generator.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger/generator.go new file mode 100644 index 0000000..697e540 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger/generator.go @@ -0,0 +1,58 @@ +package genswagger + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "path/filepath" + "strings" + + "github.com/golang/glog" + "github.com/golang/protobuf/proto" + plugin "github.com/golang/protobuf/protoc-gen-go/plugin" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + gen "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator" +) + +var ( + errNoTargetService = errors.New("no target service defined in the file") +) + +type generator struct { + reg *descriptor.Registry +} + +// New returns a new generator which generates grpc gateway files. +func New(reg *descriptor.Registry) gen.Generator { + return &generator{reg: reg} +} + +func (g *generator) Generate(targets []*descriptor.File) ([]*plugin.CodeGeneratorResponse_File, error) { + var files []*plugin.CodeGeneratorResponse_File + for _, file := range targets { + glog.V(1).Infof("Processing %s", file.GetName()) + code, err := applyTemplate(param{File: file, reg: g.reg}) + if err == errNoTargetService { + glog.V(1).Infof("%s: %v", file.GetName(), err) + continue + } + if err != nil { + return nil, err + } + + var formatted bytes.Buffer + json.Indent(&formatted, []byte(code), "", " ") + + name := file.GetName() + ext := filepath.Ext(name) + base := strings.TrimSuffix(name, ext) + output := fmt.Sprintf("%s.swagger.json", base) + files = append(files, &plugin.CodeGeneratorResponse_File{ + Name: proto.String(output), + Content: proto.String(formatted.String()), + }) + glog.V(1).Infof("Will emit %s", output) + } + return files, nil +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger/template.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger/template.go new file mode 100644 index 0000000..022b649 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger/template.go @@ -0,0 +1,835 @@ +package genswagger + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "regexp" + "strconv" + "strings" + + pbdescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" +) + +func listEnumNames(enum *descriptor.Enum) (names []string) { + for _, value := range enum.GetValue() { + names = append(names, value.GetName()) + } + return names +} + +func getEnumDefault(enum *descriptor.Enum) string { + for _, value := range enum.GetValue() { + if value.GetNumber() == 0 { + return value.GetName() + } + } + return "" +} + +// messageToQueryParameters converts a message to a list of swagger query parameters. +func messageToQueryParameters(message *descriptor.Message, reg *descriptor.Registry, pathParams []descriptor.Parameter) (params []swaggerParameterObject, err error) { + for _, field := range message.Fields { + p, err := queryParams(message, field, "", reg, pathParams) + if err != nil { + return nil, err + } + params = append(params, p...) + } + return params, nil +} + +// queryParams converts a field to a list of swagger query parameters recuresively. +func queryParams(message *descriptor.Message, field *descriptor.Field, prefix string, reg *descriptor.Registry, pathParams []descriptor.Parameter) (params []swaggerParameterObject, err error) { + // make sure the parameter is not already listed as a path parameter + for _, pathParam := range pathParams { + if pathParam.Target == field { + return nil, nil + } + } + schema := schemaOfField(field, reg) + fieldType := field.GetTypeName() + if message.File != nil { + comments := fieldProtoComments(reg, message, field) + if err := updateSwaggerDataFromComments(&schema, comments); err != nil { + return nil, err + } + } + + isEnum := field.GetType() == pbdescriptor.FieldDescriptorProto_TYPE_ENUM + items := schema.Items + if schema.Type != "" || isEnum { + if schema.Type == "object" { + return nil, nil // TODO: currently, mapping object in query parameter is not supported + } + if items != nil && (items.Type == "" || items.Type == "object") && !isEnum { + return nil, nil // TODO: currently, mapping object in query parameter is not supported + } + desc := schema.Description + if schema.Title != "" { // merge title because title of parameter object will be ignored + desc = strings.TrimSpace(schema.Title + ". " + schema.Description) + } + param := swaggerParameterObject{ + Name: prefix + field.GetName(), + Description: desc, + In: "query", + Type: schema.Type, + Items: schema.Items, + Format: schema.Format, + } + if isEnum { + enum, err := reg.LookupEnum("", fieldType) + if err != nil { + return nil, fmt.Errorf("unknown enum type %s", fieldType) + } + if items != nil { // array + param.Items = &swaggerItemsObject{ + Type: "string", + Enum: listEnumNames(enum), + } + } else { + param.Type = "string" + param.Enum = listEnumNames(enum) + param.Default = getEnumDefault(enum) + } + valueComments := enumValueProtoComments(reg, enum) + if valueComments != "" { + param.Description = strings.TrimLeft(param.Description+"\n\n "+valueComments, "\n") + } + } + return []swaggerParameterObject{param}, nil + } + + // nested type, recurse + msg, err := reg.LookupMsg("", fieldType) + if err != nil { + return nil, fmt.Errorf("unknown message type %s", fieldType) + } + for _, nestedField := range msg.Fields { + p, err := queryParams(msg, nestedField, prefix+field.GetName()+".", reg, pathParams) + if err != nil { + return nil, err + } + params = append(params, p...) + } + return params, nil +} + +// findServicesMessagesAndEnumerations discovers all messages and enums defined in the RPC methods of the service. +func findServicesMessagesAndEnumerations(s []*descriptor.Service, reg *descriptor.Registry, m messageMap, e enumMap) { + for _, svc := range s { + for _, meth := range svc.Methods { + m[fullyQualifiedNameToSwaggerName(meth.RequestType.FQMN(), reg)] = meth.RequestType + findNestedMessagesAndEnumerations(meth.RequestType, reg, m, e) + m[fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg)] = meth.ResponseType + findNestedMessagesAndEnumerations(meth.ResponseType, reg, m, e) + } + } +} + +// findNestedMessagesAndEnumerations those can be generated by the services. +func findNestedMessagesAndEnumerations(message *descriptor.Message, reg *descriptor.Registry, m messageMap, e enumMap) { + // Iterate over all the fields that + for _, t := range message.Fields { + fieldType := t.GetTypeName() + // If the type is an empty string then it is a proto primitive + if fieldType != "" { + if _, ok := m[fieldType]; !ok { + msg, err := reg.LookupMsg("", fieldType) + if err != nil { + enum, err := reg.LookupEnum("", fieldType) + if err != nil { + panic(err) + } + e[fieldType] = enum + continue + } + m[fieldType] = msg + findNestedMessagesAndEnumerations(msg, reg, m, e) + } + } + } +} + +func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, reg *descriptor.Registry) { + for name, msg := range messages { + switch name { + case ".google.protobuf.Timestamp": + continue + } + if opt := msg.GetOptions(); opt != nil && opt.MapEntry != nil && *opt.MapEntry { + continue + } + schema := swaggerSchemaObject{ + schemaCore: schemaCore{ + Type: "object", + }, + } + msgComments := protoComments(reg, msg.File, msg.Outers, "MessageType", int32(msg.Index)) + if err := updateSwaggerDataFromComments(&schema, msgComments); err != nil { + panic(err) + } + + for _, f := range msg.Fields { + fieldValue := schemaOfField(f, reg) + comments := fieldProtoComments(reg, msg, f) + if err := updateSwaggerDataFromComments(&fieldValue, comments); err != nil { + panic(err) + } + + schema.Properties = append(schema.Properties, keyVal{f.GetName(), fieldValue}) + } + d[fullyQualifiedNameToSwaggerName(msg.FQMN(), reg)] = schema + } +} + +// schemaOfField returns a swagger Schema Object for a protobuf field. +func schemaOfField(f *descriptor.Field, reg *descriptor.Registry) swaggerSchemaObject { + const ( + singular = 0 + array = 1 + object = 2 + ) + var ( + core schemaCore + aggregate int + ) + + fd := f.FieldDescriptorProto + if m, err := reg.LookupMsg("", f.GetTypeName()); err == nil { + if opt := m.GetOptions(); opt != nil && opt.MapEntry != nil && *opt.MapEntry { + fd = m.GetField()[1] + aggregate = object + } + } + if fd.GetLabel() == pbdescriptor.FieldDescriptorProto_LABEL_REPEATED { + aggregate = array + } + + switch ft := fd.GetType(); ft { + case pbdescriptor.FieldDescriptorProto_TYPE_ENUM, pbdescriptor.FieldDescriptorProto_TYPE_MESSAGE, pbdescriptor.FieldDescriptorProto_TYPE_GROUP: + if fd.GetTypeName() == ".google.protobuf.Timestamp" && pbdescriptor.FieldDescriptorProto_TYPE_MESSAGE == ft { + core = schemaCore{ + Type: "string", + Format: "date-time", + } + } else { + core = schemaCore{ + Ref: "#/definitions/" + fullyQualifiedNameToSwaggerName(fd.GetTypeName(), reg), + } + } + default: + ftype, format, ok := primitiveSchema(ft) + if ok { + core = schemaCore{Type: ftype, Format: format} + } else { + core = schemaCore{Type: ft.String(), Format: "UNKNOWN"} + } + } + switch aggregate { + case array: + return swaggerSchemaObject{ + schemaCore: schemaCore{ + Type: "array", + Items: (*swaggerItemsObject)(&core), + }, + } + case object: + return swaggerSchemaObject{ + schemaCore: schemaCore{ + Type: "object", + }, + AdditionalProperties: &swaggerSchemaObject{schemaCore: core}, + } + default: + return swaggerSchemaObject{schemaCore: core} + } +} + +// primitiveSchema returns a pair of "Type" and "Format" in JSON Schema for +// the given primitive field type. +// The last return parameter is true iff the field type is actually primitive. +func primitiveSchema(t pbdescriptor.FieldDescriptorProto_Type) (ftype, format string, ok bool) { + switch t { + case pbdescriptor.FieldDescriptorProto_TYPE_DOUBLE: + return "number", "double", true + case pbdescriptor.FieldDescriptorProto_TYPE_FLOAT: + return "number", "float", true + case pbdescriptor.FieldDescriptorProto_TYPE_INT64: + return "string", "int64", true + case pbdescriptor.FieldDescriptorProto_TYPE_UINT64: + // 64bit integer types are marshaled as string in the default JSONPb marshaler. + // TODO(yugui) Add an option to declare 64bit integers as int64. + // + // NOTE: uint64 is not a predefined format of integer type in Swagger spec. + // So we cannot expect that uint64 is commonly supported by swagger processor. + return "string", "uint64", true + case pbdescriptor.FieldDescriptorProto_TYPE_INT32: + return "integer", "int32", true + case pbdescriptor.FieldDescriptorProto_TYPE_FIXED64: + // Ditto. + return "string", "uint64", true + case pbdescriptor.FieldDescriptorProto_TYPE_FIXED32: + // Ditto. + return "integer", "int64", true + case pbdescriptor.FieldDescriptorProto_TYPE_BOOL: + return "boolean", "boolean", true + case pbdescriptor.FieldDescriptorProto_TYPE_STRING: + // NOTE: in swagger specifition, format should be empty on string type + return "string", "", true + case pbdescriptor.FieldDescriptorProto_TYPE_BYTES: + return "string", "byte", true + case pbdescriptor.FieldDescriptorProto_TYPE_UINT32: + // Ditto. + return "integer", "int64", true + case pbdescriptor.FieldDescriptorProto_TYPE_SFIXED32: + return "integer", "int32", true + case pbdescriptor.FieldDescriptorProto_TYPE_SFIXED64: + return "string", "int64", true + case pbdescriptor.FieldDescriptorProto_TYPE_SINT32: + return "integer", "int32", true + case pbdescriptor.FieldDescriptorProto_TYPE_SINT64: + return "string", "int64", true + default: + return "", "", false + } +} + +// renderEnumerationsAsDefinition inserts enums into the definitions object. +func renderEnumerationsAsDefinition(enums enumMap, d swaggerDefinitionsObject, reg *descriptor.Registry) { + for _, enum := range enums { + enumComments := protoComments(reg, enum.File, enum.Outers, "EnumType", int32(enum.Index)) + + // it may be necessary to sort the result of the GetValue function. + enumNames := listEnumNames(enum) + defaultValue := getEnumDefault(enum) + valueComments := enumValueProtoComments(reg, enum) + if valueComments != "" { + enumComments = strings.TrimLeft(enumComments+"\n\n "+valueComments, "\n") + } + enumSchemaObject := swaggerSchemaObject{ + schemaCore: schemaCore{ + Type: "string", + Enum: enumNames, + Default: defaultValue, + }, + } + if err := updateSwaggerDataFromComments(&enumSchemaObject, enumComments); err != nil { + panic(err) + } + + d[fullyQualifiedNameToSwaggerName(enum.FQEN(), reg)] = enumSchemaObject + } +} + +// Take in a FQMN or FQEN and return a swagger safe version of the FQMN +func fullyQualifiedNameToSwaggerName(fqn string, reg *descriptor.Registry) string { + return resolveFullyQualifiedNameToSwaggerName(fqn, append(reg.GetAllFQMNs(), reg.GetAllFQENs()...)) +} + +// Take the names of every proto and "uniq-ify" them. The idea is to produce a +// set of names that meet a couple of conditions. They must be stable, they +// must be unique, and they must be shorter than the FQN. +// +// This likely could be made better. This will always generate the same names +// but may not always produce optimal names. This is a reasonably close +// approximation of what they should look like in most cases. +func resolveFullyQualifiedNameToSwaggerName(fqn string, messages []string) string { + packagesByDepth := make(map[int][][]string) + uniqueNames := make(map[string]string) + + hierarchy := func(pkg string) []string { + return strings.Split(pkg, ".") + } + + for _, p := range messages { + h := hierarchy(p) + for depth := range h { + if _, ok := packagesByDepth[depth]; !ok { + packagesByDepth[depth] = make([][]string, 0) + } + packagesByDepth[depth] = append(packagesByDepth[depth], h[len(h)-depth:]) + } + } + + count := func(list [][]string, item []string) int { + i := 0 + for _, element := range list { + if reflect.DeepEqual(element, item) { + i++ + } + } + return i + } + + for _, p := range messages { + h := hierarchy(p) + for depth := 0; depth < len(h); depth++ { + if count(packagesByDepth[depth], h[len(h)-depth:]) == 1 { + uniqueNames[p] = strings.Join(h[len(h)-depth-1:], "") + break + } + if depth == len(h)-1 { + uniqueNames[p] = strings.Join(h, "") + } + } + } + return uniqueNames[fqn] +} + +// Swagger expects paths of the form /path/{string_value} but grpc-gateway paths are expected to be of the form /path/{string_value=strprefix/*}. This should reformat it correctly. +func templateToSwaggerPath(path string) string { + // It seems like the right thing to do here is to just use + // strings.Split(path, "/") but that breaks badly when you hit a url like + // /{my_field=prefix/*}/ and end up with 2 sections representing my_field. + // Instead do the right thing and write a small pushdown (counter) automata + // for it. + var parts []string + depth := 0 + buffer := "" + for _, char := range path { + switch char { + case '{': + // Push on the stack + depth++ + buffer += string(char) + break + case '}': + if depth == 0 { + panic("Encountered } without matching { before it.") + } + // Pop from the stack + depth-- + buffer += "}" + case '/': + if depth == 0 { + parts = append(parts, buffer) + buffer = "" + // Since the stack was empty when we hit the '/' we are done with this + // section. + continue + } + default: + buffer += string(char) + break + } + } + + // Now append the last element to parts + parts = append(parts, buffer) + + // Parts is now an array of segments of the path. Interestingly, since the + // syntax for this subsection CAN be handled by a regexp since it has no + // memory. + re := regexp.MustCompile("{([a-zA-Z][a-zA-Z0-9_.]*).*}") + for index, part := range parts { + parts[index] = re.ReplaceAllString(part, "{$1}") + } + + return strings.Join(parts, "/") +} + +func renderServices(services []*descriptor.Service, paths swaggerPathsObject, reg *descriptor.Registry) error { + // Correctness of svcIdx and methIdx depends on 'services' containing the services in the same order as the 'file.Service' array. + for svcIdx, svc := range services { + for methIdx, meth := range svc.Methods { + for _, b := range meth.Bindings { + // Iterate over all the swagger parameters + parameters := swaggerParametersObject{} + for _, parameter := range b.PathParams { + + var paramType, paramFormat string + switch pt := parameter.Target.GetType(); pt { + case pbdescriptor.FieldDescriptorProto_TYPE_GROUP, pbdescriptor.FieldDescriptorProto_TYPE_MESSAGE: + return fmt.Errorf("only primitive types are allowed in path parameters") + case pbdescriptor.FieldDescriptorProto_TYPE_ENUM: + paramType = fullyQualifiedNameToSwaggerName(parameter.Target.GetTypeName(), reg) + paramFormat = "" + default: + var ok bool + paramType, paramFormat, ok = primitiveSchema(pt) + if !ok { + return fmt.Errorf("unknown field type %v", pt) + } + } + + parameters = append(parameters, swaggerParameterObject{ + Name: parameter.String(), + In: "path", + Required: true, + // Parameters in gRPC-Gateway can only be strings? + Type: paramType, + Format: paramFormat, + }) + } + // Now check if there is a body parameter + if b.Body != nil { + var schema swaggerSchemaObject + + if len(b.Body.FieldPath) == 0 { + schema = swaggerSchemaObject{ + schemaCore: schemaCore{ + Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(meth.RequestType.FQMN(), reg)), + }, + } + } else { + lastField := b.Body.FieldPath[len(b.Body.FieldPath)-1] + schema = schemaOfField(lastField.Target, reg) + } + + desc := "" + if meth.GetClientStreaming() { + desc = "(streaming inputs)" + } + parameters = append(parameters, swaggerParameterObject{ + Name: "body", + Description: desc, + In: "body", + Required: true, + Schema: &schema, + }) + } else if b.HTTPMethod == "GET" { + // add the parameters to the query string + queryParams, err := messageToQueryParameters(meth.RequestType, reg, b.PathParams) + if err != nil { + return err + } + parameters = append(parameters, queryParams...) + } + + pathItemObject, ok := paths[templateToSwaggerPath(b.PathTmpl.Template)] + if !ok { + pathItemObject = swaggerPathItemObject{} + } + + methProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.ServiceDescriptorProto)(nil)), "Method") + desc := "" + if meth.GetServerStreaming() { + desc += "(streaming responses)" + } + operationObject := &swaggerOperationObject{ + Tags: []string{svc.GetName()}, + OperationID: fmt.Sprintf("%s", meth.GetName()), + Parameters: parameters, + Responses: swaggerResponsesObject{ + "200": swaggerResponseObject{ + Description: desc, + Schema: swaggerSchemaObject{ + schemaCore: schemaCore{ + Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg)), + }, + }, + }, + }, + } + methComments := protoComments(reg, svc.File, nil, "Service", int32(svcIdx), methProtoPath, int32(methIdx)) + if err := updateSwaggerDataFromComments(operationObject, methComments); err != nil { + panic(err) + } + + switch b.HTTPMethod { + case "DELETE": + pathItemObject.Delete = operationObject + break + case "GET": + pathItemObject.Get = operationObject + break + case "POST": + pathItemObject.Post = operationObject + break + case "PUT": + pathItemObject.Put = operationObject + break + case "PATCH": + pathItemObject.Patch = operationObject + break + } + paths[templateToSwaggerPath(b.PathTmpl.Template)] = pathItemObject + } + } + } + + // Success! return nil on the error object + return nil +} + +// This function is called with a param which contains the entire definition of a method. +func applyTemplate(p param) (string, error) { + // Create the basic template object. This is the object that everything is + // defined off of. + s := swaggerObject{ + // Swagger 2.0 is the version of this document + Swagger: "2.0", + Schemes: []string{"http", "https"}, + Consumes: []string{"application/json"}, + Produces: []string{"application/json"}, + Paths: make(swaggerPathsObject), + Definitions: make(swaggerDefinitionsObject), + Info: swaggerInfoObject{ + Title: *p.File.Name, + Version: "version not set", + }, + } + + // Loops through all the services and their exposed GET/POST/PUT/DELETE definitions + // and create entries for all of them. + if err := renderServices(p.Services, s.Paths, p.reg); err != nil { + panic(err) + } + + // Find all the service's messages and enumerations that are defined (recursively) and then + // write their request and response types out as definition objects. + m := messageMap{} + e := enumMap{} + findServicesMessagesAndEnumerations(p.Services, p.reg, m, e) + renderMessagesAsDefinition(m, s.Definitions, p.reg) + renderEnumerationsAsDefinition(e, s.Definitions, p.reg) + + // File itself might have some comments and metadata. + packageProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), "Package") + packageComments := protoComments(p.reg, p.File, nil, "Package", packageProtoPath) + if err := updateSwaggerDataFromComments(&s, packageComments); err != nil { + panic(err) + } + + // We now have rendered the entire swagger object. Write the bytes out to a + // string so it can be written to disk. + var w bytes.Buffer + enc := json.NewEncoder(&w) + enc.Encode(&s) + + return w.String(), nil +} + +// updateSwaggerDataFromComments updates a Swagger object based on a comment +// from the proto file. +// +// First paragraph of a comment is used for summary. Remaining paragraphs of a +// comment are used for description. If 'Summary' field is not present on the +// passed swaggerObject, the summary and description are joined by \n\n. +// +// If there is a field named 'Info', its 'Summary' and 'Description' fields +// will be updated instead. +// +// If there is no 'Summary', the same behavior will be attempted on 'Title', +// but only if the last character is not a period. +func updateSwaggerDataFromComments(swaggerObject interface{}, comment string) error { + if len(comment) == 0 { + return nil + } + + // Figure out what to apply changes to. + swaggerObjectValue := reflect.ValueOf(swaggerObject) + infoObjectValue := swaggerObjectValue.Elem().FieldByName("Info") + if !infoObjectValue.CanSet() { + // No such field? Apply summary and description directly to + // passed object. + infoObjectValue = swaggerObjectValue.Elem() + } + + // Figure out which properties to update. + summaryValue := infoObjectValue.FieldByName("Summary") + descriptionValue := infoObjectValue.FieldByName("Description") + usingTitle := false + if !summaryValue.CanSet() { + summaryValue = infoObjectValue.FieldByName("Title") + usingTitle = true + } + + // If there is a summary (or summary-equivalent), use the first + // paragraph as summary, and the rest as description. + if summaryValue.CanSet() { + paragraphs := strings.Split(comment, "\n\n") + + summary := strings.TrimSpace(paragraphs[0]) + description := strings.TrimSpace(strings.Join(paragraphs[1:], "\n\n")) + if !usingTitle || summary == "" || summary[len(summary)-1] != '.' { + if len(summary) > 0 { + summaryValue.Set(reflect.ValueOf(summary)) + } + if len(description) > 0 { + if !descriptionValue.CanSet() { + return fmt.Errorf("Encountered object type with a summary, but no description") + } + descriptionValue.Set(reflect.ValueOf(description)) + } + return nil + } + } + + // There was no summary field on the swaggerObject. Try to apply the + // whole comment into description. + if descriptionValue.CanSet() { + descriptionValue.Set(reflect.ValueOf(comment)) + return nil + } + + return fmt.Errorf("no description nor summary property") +} + +func fieldProtoComments(reg *descriptor.Registry, msg *descriptor.Message, field *descriptor.Field) string { + protoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.DescriptorProto)(nil)), "Field") + for i, f := range msg.Fields { + if f == field { + return protoComments(reg, msg.File, msg.Outers, "MessageType", int32(msg.Index), protoPath, int32(i)) + } + } + return "" +} + +func enumValueProtoComments(reg *descriptor.Registry, enum *descriptor.Enum) string { + protoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.EnumDescriptorProto)(nil)), "Value") + var comments []string + for idx, value := range enum.GetValue() { + name := value.GetName() + str := protoComments(reg, enum.File, enum.Outers, "EnumType", int32(enum.Index), protoPath, int32(idx)) + if str != "" { + comments = append(comments, name+": "+str) + } + } + if len(comments) > 0 { + return "- " + strings.Join(comments, "\n - ") + } + return "" +} + +func protoComments(reg *descriptor.Registry, file *descriptor.File, outers []string, typeName string, typeIndex int32, fieldPaths ...int32) string { + if file.SourceCodeInfo == nil { + // Curious! A file without any source code info. + // This could be a test that's providing incomplete + // descriptor.File information. + // + // We could simply return no comments, but panic + // could make debugging easier. + panic("descriptor.File should not contain nil SourceCodeInfo") + } + + outerPaths := make([]int32, len(outers)) + for i := range outers { + location := "" + if file.Package != nil { + location = file.GetPackage() + } + + msg, err := reg.LookupMsg(location, strings.Join(outers[:i+1], ".")) + if err != nil { + panic(err) + } + outerPaths[i] = int32(msg.Index) + } + + for _, loc := range file.SourceCodeInfo.Location { + if !isProtoPathMatches(loc.Path, outerPaths, typeName, typeIndex, fieldPaths) { + continue + } + comments := "" + if loc.LeadingComments != nil { + comments = strings.TrimRight(*loc.LeadingComments, "\n") + comments = strings.TrimSpace(comments) + // TODO(ivucica): this is a hack to fix "// " being interpreted as "//". + // perhaps we should: + // - split by \n + // - determine if every (but first and last) line begins with " " + // - trim every line only if that is the case + // - join by \n + comments = strings.Replace(comments, "\n ", "\n", -1) + } + return comments + } + return "" +} + +var messageProtoPath = protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), "MessageType") +var nestedProtoPath = protoPathIndex(reflect.TypeOf((*pbdescriptor.DescriptorProto)(nil)), "NestedType") +var packageProtoPath = protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), "Package") + +func isProtoPathMatches(paths []int32, outerPaths []int32, typeName string, typeIndex int32, fieldPaths []int32) bool { + if typeName == "Package" && typeIndex == packageProtoPath { + // path for package comments is just [2], and all the other processing + // is too complex for it. + if len(paths) == 0 || typeIndex != paths[0] { + return false + } + return true + } + + if len(paths) != len(outerPaths)*2+2+len(fieldPaths) { + return false + } + + typeNameDescriptor := reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)) + if len(outerPaths) > 0 { + if paths[0] != messageProtoPath || paths[1] != outerPaths[0] { + return false + } + paths = paths[2:] + outerPaths = outerPaths[1:] + + for i, v := range outerPaths { + if paths[i*2] != nestedProtoPath || paths[i*2+1] != v { + return false + } + } + paths = paths[len(outerPaths)*2:] + + if typeName == "MessageType" { + typeName = "NestedType" + } + typeNameDescriptor = reflect.TypeOf((*pbdescriptor.DescriptorProto)(nil)) + } + + if paths[0] != protoPathIndex(typeNameDescriptor, typeName) || paths[1] != typeIndex { + return false + } + paths = paths[2:] + + for i, v := range fieldPaths { + if paths[i] != v { + return false + } + } + return true +} + +// protoPathIndex returns a path component for google.protobuf.descriptor.SourceCode_Location. +// +// Specifically, it returns an id as generated from descriptor proto which +// can be used to determine what type the id following it in the path is. +// For example, if we are trying to locate comments related to a field named +// `Address` in a message named `Person`, the path will be: +// +// [4, a, 2, b] +// +// While `a` gets determined by the order in which the messages appear in +// the proto file, and `b` is the field index specified in the proto +// file itself, the path actually needs to specify that `a` refers to a +// message and not, say, a service; and that `b` refers to a field and not +// an option. +// +// protoPathIndex figures out the values 4 and 2 in the above example. Because +// messages are top level objects, the value of 4 comes from field id for +// `MessageType` inside `google.protobuf.descriptor.FileDescriptor` message. +// This field has a message type `google.protobuf.descriptor.DescriptorProto`. +// And inside message `DescriptorProto`, there is a field named `Field` with id +// 2. +// +// Some code generators seem to be hardcoding these values; this method instead +// interprets them from `descriptor.proto`-derived Go source as necessary. +func protoPathIndex(descriptorType reflect.Type, what string) int32 { + field, ok := descriptorType.Elem().FieldByName(what) + if !ok { + panic(fmt.Errorf("could not find protobuf descriptor type id for %s", what)) + } + pbtag := field.Tag.Get("protobuf") + if pbtag == "" { + panic(fmt.Errorf("no Go tag 'protobuf' on protobuf descriptor for %s", what)) + } + path, err := strconv.Atoi(strings.Split(pbtag, ",")[1]) + if err != nil { + panic(fmt.Errorf("protobuf descriptor id for %s cannot be converted to a number: %s", what, err.Error())) + } + + return int32(path) +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger/template_test.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger/template_test.go new file mode 100644 index 0000000..e0b25c1 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger/template_test.go @@ -0,0 +1,661 @@ +package genswagger + +import ( + "encoding/json" + "reflect" + "testing" + + "github.com/golang/protobuf/proto" + protodescriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + plugin "github.com/golang/protobuf/protoc-gen-go/plugin" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule" +) + +func crossLinkFixture(f *descriptor.File) *descriptor.File { + for _, m := range f.Messages { + m.File = f + } + for _, svc := range f.Services { + svc.File = f + for _, m := range svc.Methods { + m.Service = svc + for _, b := range m.Bindings { + b.Method = m + for _, param := range b.PathParams { + param.Method = m + } + } + } + } + return f +} + +func TestMessageToQueryParameters(t *testing.T) { + type test struct { + MsgDescs []*protodescriptor.DescriptorProto + Message string + Params []swaggerParameterObject + } + + tests := []test{ + { + MsgDescs: []*protodescriptor.DescriptorProto{ + &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("a"), + Type: protodescriptor.FieldDescriptorProto_TYPE_STRING.Enum(), + Number: proto.Int32(1), + }, + { + Name: proto.String("b"), + Type: protodescriptor.FieldDescriptorProto_TYPE_DOUBLE.Enum(), + Number: proto.Int32(2), + }, + }, + }, + }, + Message: "ExampleMessage", + Params: []swaggerParameterObject{ + swaggerParameterObject{ + Name: "a", + In: "query", + Required: false, + Type: "string", + }, + swaggerParameterObject{ + Name: "b", + In: "query", + Required: false, + Type: "number", + Format: "double", + }, + }, + }, + { + MsgDescs: []*protodescriptor.DescriptorProto{ + &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("nested"), + Type: protodescriptor.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: proto.String(".example.Nested"), + Number: proto.Int32(1), + }, + }, + }, + &protodescriptor.DescriptorProto{ + Name: proto.String("Nested"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("a"), + Type: protodescriptor.FieldDescriptorProto_TYPE_STRING.Enum(), + Number: proto.Int32(1), + }, + { + Name: proto.String("deep"), + Type: protodescriptor.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: proto.String(".example.Nested.DeepNested"), + Number: proto.Int32(2), + }, + }, + NestedType: []*protodescriptor.DescriptorProto{{ + Name: proto.String("DeepNested"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("b"), + Type: protodescriptor.FieldDescriptorProto_TYPE_STRING.Enum(), + Number: proto.Int32(1), + }, + { + Name: proto.String("c"), + Type: protodescriptor.FieldDescriptorProto_TYPE_ENUM.Enum(), + TypeName: proto.String(".example.Nested.DeepNested.DeepEnum"), + Number: proto.Int32(2), + }, + }, + EnumType: []*protodescriptor.EnumDescriptorProto{ + { + Name: proto.String("DeepEnum"), + Value: []*protodescriptor.EnumValueDescriptorProto{ + {Name: proto.String("FALSE"), Number: proto.Int32(0)}, + {Name: proto.String("TRUE"), Number: proto.Int32(1)}, + }, + }, + }, + }}, + }, + }, + Message: "ExampleMessage", + Params: []swaggerParameterObject{ + swaggerParameterObject{ + Name: "nested.a", + In: "query", + Required: false, + Type: "string", + }, + swaggerParameterObject{ + Name: "nested.deep.b", + In: "query", + Required: false, + Type: "string", + }, + swaggerParameterObject{ + Name: "nested.deep.c", + In: "query", + Required: false, + Type: "string", + Enum: []string{"FALSE", "TRUE"}, + Default: "FALSE", + }, + }, + }, + } + + for _, test := range tests { + reg := descriptor.NewRegistry() + msgs := []*descriptor.Message{} + for _, msgdesc := range test.MsgDescs { + msgs = append(msgs, &descriptor.Message{DescriptorProto: msgdesc}) + } + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + SourceCodeInfo: &protodescriptor.SourceCodeInfo{}, + Name: proto.String("example.proto"), + Package: proto.String("example"), + Dependency: []string{}, + MessageType: test.MsgDescs, + Service: []*protodescriptor.ServiceDescriptorProto{}, + }, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + Messages: msgs, + } + reg.Load(&plugin.CodeGeneratorRequest{ + ProtoFile: []*protodescriptor.FileDescriptorProto{file.FileDescriptorProto}, + }) + + message, err := reg.LookupMsg("", ".example."+test.Message) + if err != nil { + t.Fatalf("failed to lookup message: %s", err) + } + params, err := messageToQueryParameters(message, reg, []descriptor.Parameter{}) + if err != nil { + t.Fatalf("failed to convert message to query parameters: %s", err) + } + if !reflect.DeepEqual(params, test.Params) { + t.Errorf("expected %v, got %v", test.Params, params) + } + } +} + +func TestApplyTemplateSimple(t *testing.T) { + msgdesc := &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + } + meth := &protodescriptor.MethodDescriptorProto{ + Name: proto.String("Example"), + InputType: proto.String("ExampleMessage"), + OutputType: proto.String("ExampleMessage"), + } + svc := &protodescriptor.ServiceDescriptorProto{ + Name: proto.String("ExampleService"), + Method: []*protodescriptor.MethodDescriptorProto{meth}, + } + msg := &descriptor.Message{ + DescriptorProto: msgdesc, + } + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + SourceCodeInfo: &protodescriptor.SourceCodeInfo{}, + Name: proto.String("example.proto"), + Package: proto.String("example"), + Dependency: []string{"a.example/b/c.proto", "a.example/d/e.proto"}, + MessageType: []*protodescriptor.DescriptorProto{msgdesc}, + Service: []*protodescriptor.ServiceDescriptorProto{svc}, + }, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + Messages: []*descriptor.Message{msg}, + Services: []*descriptor.Service{ + { + ServiceDescriptorProto: svc, + Methods: []*descriptor.Method{ + { + MethodDescriptorProto: meth, + RequestType: msg, + ResponseType: msg, + Bindings: []*descriptor.Binding{ + { + HTTPMethod: "GET", + Body: &descriptor.Body{FieldPath: nil}, + PathTmpl: httprule.Template{ + Version: 1, + OpCodes: []int{0, 0}, + Template: "/v1/echo", // TODO(achew22): Figure out what this should really be + }, + }, + }, + }, + }, + }, + }, + } + result, err := applyTemplate(param{File: crossLinkFixture(&file), reg: descriptor.NewRegistry()}) + if err != nil { + t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) + return + } + got := new(swaggerObject) + err = json.Unmarshal([]byte(result), got) + if err != nil { + t.Errorf("json.Unmarshal(%s) failed with %v; want success", result, err) + return + } + if want, is, name := "2.0", got.Swagger, "Swagger"; !reflect.DeepEqual(is, want) { + t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) + } + if want, is, name := "", got.BasePath, "BasePath"; !reflect.DeepEqual(is, want) { + t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) + } + if want, is, name := []string{"http", "https"}, got.Schemes, "Schemes"; !reflect.DeepEqual(is, want) { + t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) + } + if want, is, name := []string{"application/json"}, got.Consumes, "Consumes"; !reflect.DeepEqual(is, want) { + t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) + } + if want, is, name := []string{"application/json"}, got.Produces, "Produces"; !reflect.DeepEqual(is, want) { + t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want) + } + + // If there was a failure, print out the input and the json result for debugging. + if t.Failed() { + t.Errorf("had: %s", file) + t.Errorf("got: %s", result) + } +} + +func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) { + t.Skip() + msgdesc := &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("nested"), + Label: protodescriptor.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: protodescriptor.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: proto.String("NestedMessage"), + Number: proto.Int32(1), + }, + }, + } + nesteddesc := &protodescriptor.DescriptorProto{ + Name: proto.String("NestedMessage"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("int32"), + Label: protodescriptor.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: protodescriptor.FieldDescriptorProto_TYPE_INT32.Enum(), + Number: proto.Int32(1), + }, + { + Name: proto.String("bool"), + Label: protodescriptor.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: protodescriptor.FieldDescriptorProto_TYPE_BOOL.Enum(), + Number: proto.Int32(2), + }, + }, + } + meth := &protodescriptor.MethodDescriptorProto{ + Name: proto.String("Echo"), + InputType: proto.String("ExampleMessage"), + OutputType: proto.String("ExampleMessage"), + ClientStreaming: proto.Bool(false), + } + svc := &protodescriptor.ServiceDescriptorProto{ + Name: proto.String("ExampleService"), + Method: []*protodescriptor.MethodDescriptorProto{meth}, + } + + meth.ServerStreaming = proto.Bool(false) + + msg := &descriptor.Message{ + DescriptorProto: msgdesc, + } + nested := &descriptor.Message{ + DescriptorProto: nesteddesc, + } + + nestedField := &descriptor.Field{ + Message: msg, + FieldDescriptorProto: msg.GetField()[0], + } + intField := &descriptor.Field{ + Message: nested, + FieldDescriptorProto: nested.GetField()[0], + } + boolField := &descriptor.Field{ + Message: nested, + FieldDescriptorProto: nested.GetField()[1], + } + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + SourceCodeInfo: &protodescriptor.SourceCodeInfo{}, + Name: proto.String("example.proto"), + Package: proto.String("example"), + MessageType: []*protodescriptor.DescriptorProto{msgdesc, nesteddesc}, + Service: []*protodescriptor.ServiceDescriptorProto{svc}, + }, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + Messages: []*descriptor.Message{msg, nested}, + Services: []*descriptor.Service{ + { + ServiceDescriptorProto: svc, + Methods: []*descriptor.Method{ + { + MethodDescriptorProto: meth, + RequestType: msg, + ResponseType: msg, + Bindings: []*descriptor.Binding{ + { + HTTPMethod: "POST", + PathTmpl: httprule.Template{ + Version: 1, + OpCodes: []int{0, 0}, + Template: "/v1/echo", // TODO(achew): Figure out what this hsould really be + }, + PathParams: []descriptor.Parameter{ + { + FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ + { + Name: "nested", + Target: nestedField, + }, + { + Name: "int32", + Target: intField, + }, + }), + Target: intField, + }, + }, + Body: &descriptor.Body{ + FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ + { + Name: "nested", + Target: nestedField, + }, + { + Name: "bool", + Target: boolField, + }, + }), + }, + }, + }, + }, + }, + }, + }, + } + result, err := applyTemplate(param{File: crossLinkFixture(&file)}) + if err != nil { + t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) + return + } + var obj swaggerObject + err = json.Unmarshal([]byte(result), &obj) + if err != nil { + t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err) + return + } + if want, got := "2.0", obj.Swagger; !reflect.DeepEqual(got, want) { + t.Errorf("applyTemplate(%#v).Swagger = %s want to be %s", file, got, want) + } + if want, got := "", obj.BasePath; !reflect.DeepEqual(got, want) { + t.Errorf("applyTemplate(%#v).BasePath = %s want to be %s", file, got, want) + } + if want, got := []string{"http", "https"}, obj.Schemes; !reflect.DeepEqual(got, want) { + t.Errorf("applyTemplate(%#v).Schemes = %s want to be %s", file, got, want) + } + if want, got := []string{"application/json"}, obj.Consumes; !reflect.DeepEqual(got, want) { + t.Errorf("applyTemplate(%#v).Consumes = %s want to be %s", file, got, want) + } + if want, got := []string{"application/json"}, obj.Produces; !reflect.DeepEqual(got, want) { + t.Errorf("applyTemplate(%#v).Produces = %s want to be %s", file, got, want) + } + if want, got, name := "Generated for ExampleService.Echo - ", obj.Paths["/v1/echo"].Post.Summary, "Paths[/v1/echo].Post.Summary"; !reflect.DeepEqual(got, want) { + t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want) + } + + // If there was a failure, print out the input and the json result for debugging. + if t.Failed() { + t.Errorf("had: %s", file) + t.Errorf("got: %s", result) + } +} + +func TestApplyTemplateRequestWithClientStreaming(t *testing.T) { + t.Skip() + msgdesc := &protodescriptor.DescriptorProto{ + Name: proto.String("ExampleMessage"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("nested"), + Label: protodescriptor.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: protodescriptor.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: proto.String("NestedMessage"), + Number: proto.Int32(1), + }, + }, + } + nesteddesc := &protodescriptor.DescriptorProto{ + Name: proto.String("NestedMessage"), + Field: []*protodescriptor.FieldDescriptorProto{ + { + Name: proto.String("int32"), + Label: protodescriptor.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: protodescriptor.FieldDescriptorProto_TYPE_INT32.Enum(), + Number: proto.Int32(1), + }, + { + Name: proto.String("bool"), + Label: protodescriptor.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: protodescriptor.FieldDescriptorProto_TYPE_BOOL.Enum(), + Number: proto.Int32(2), + }, + }, + } + meth := &protodescriptor.MethodDescriptorProto{ + Name: proto.String("Echo"), + InputType: proto.String("ExampleMessage"), + OutputType: proto.String("ExampleMessage"), + ClientStreaming: proto.Bool(true), + ServerStreaming: proto.Bool(true), + } + svc := &protodescriptor.ServiceDescriptorProto{ + Name: proto.String("ExampleService"), + Method: []*protodescriptor.MethodDescriptorProto{meth}, + } + + msg := &descriptor.Message{ + DescriptorProto: msgdesc, + } + nested := &descriptor.Message{ + DescriptorProto: nesteddesc, + } + + nestedField := &descriptor.Field{ + Message: msg, + FieldDescriptorProto: msg.GetField()[0], + } + intField := &descriptor.Field{ + Message: nested, + FieldDescriptorProto: nested.GetField()[0], + } + boolField := &descriptor.Field{ + Message: nested, + FieldDescriptorProto: nested.GetField()[1], + } + file := descriptor.File{ + FileDescriptorProto: &protodescriptor.FileDescriptorProto{ + SourceCodeInfo: &protodescriptor.SourceCodeInfo{}, + Name: proto.String("example.proto"), + Package: proto.String("example"), + MessageType: []*protodescriptor.DescriptorProto{msgdesc, nesteddesc}, + Service: []*protodescriptor.ServiceDescriptorProto{svc}, + }, + GoPkg: descriptor.GoPackage{ + Path: "example.com/path/to/example/example.pb", + Name: "example_pb", + }, + Messages: []*descriptor.Message{msg, nested}, + Services: []*descriptor.Service{ + { + ServiceDescriptorProto: svc, + Methods: []*descriptor.Method{ + { + MethodDescriptorProto: meth, + RequestType: msg, + ResponseType: msg, + Bindings: []*descriptor.Binding{ + { + HTTPMethod: "POST", + PathTmpl: httprule.Template{ + Version: 1, + OpCodes: []int{0, 0}, + Template: "/v1/echo", // TODO(achew): Figure out what this hsould really be + }, + PathParams: []descriptor.Parameter{ + { + FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ + { + Name: "nested", + Target: nestedField, + }, + { + Name: "int32", + Target: intField, + }, + }), + Target: intField, + }, + }, + Body: &descriptor.Body{ + FieldPath: descriptor.FieldPath([]descriptor.FieldPathComponent{ + { + Name: "nested", + Target: nestedField, + }, + { + Name: "bool", + Target: boolField, + }, + }), + }, + }, + }, + }, + }, + }, + }, + } + _, err := applyTemplate(param{File: crossLinkFixture(&file)}) + if err == nil { + t.Errorf("applyTemplate(%#v) should have failed cause swagger doesn't support streaming", file) + return + } +} + +func TestTemplateToSwaggerPath(t *testing.T) { + var tests = []struct { + input string + expected string + }{ + {"/test", "/test"}, + {"/{test}", "/{test}"}, + {"/{test=prefix/*}", "/{test}"}, + {"/{test=prefix/that/has/multiple/parts/to/it/*}", "/{test}"}, + {"/{test1}/{test2}", "/{test1}/{test2}"}, + {"/{test1}/{test2}/", "/{test1}/{test2}/"}, + } + + for _, data := range tests { + actual := templateToSwaggerPath(data.input) + if data.expected != actual { + t.Errorf("Expected templateToSwaggerPath(%v) = %v, actual: %v", data.input, data.expected, actual) + } + } +} + +func TestResolveFullyQualifiedNameToSwaggerName(t *testing.T) { + var tests = []struct { + input string + output string + listOfFQMNs []string + }{ + { + ".a.b.C", + "C", + []string{ + ".a.b.C", + }, + }, + { + ".a.b.C", + "abC", + []string{ + ".a.C", + ".a.b.C", + }, + }, + { + ".a.b.C", + "abC", + []string{ + ".C", + ".a.C", + ".a.b.C", + }, + }, + } + + for _, data := range tests { + output := resolveFullyQualifiedNameToSwaggerName(data.input, data.listOfFQMNs) + if output != data.output { + t.Errorf("Expected fullyQualifiedNameToSwaggerName(%v) to be %s but got %s", + data.input, data.output, output) + } + } +} + +func TestFQMNtoSwaggerName(t *testing.T) { + var tests = []struct { + input string + expected string + }{ + {"/test", "/test"}, + {"/{test}", "/{test}"}, + {"/{test=prefix/*}", "/{test}"}, + {"/{test=prefix/that/has/multiple/parts/to/it/*}", "/{test}"}, + {"/{test1}/{test2}", "/{test1}/{test2}"}, + {"/{test1}/{test2}/", "/{test1}/{test2}/"}, + } + + for _, data := range tests { + actual := templateToSwaggerPath(data.input) + if data.expected != actual { + t.Errorf("Expected templateToSwaggerPath(%v) = %v, actual: %v", data.input, data.expected, actual) + } + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger/types.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger/types.go new file mode 100644 index 0000000..3c6a5c9 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger/types.go @@ -0,0 +1,189 @@ +package genswagger + +import ( + "bytes" + "encoding/json" + + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" +) + +type param struct { + *descriptor.File + reg *descriptor.Registry +} + +type binding struct { + *descriptor.Binding +} + +// http://swagger.io/specification/#infoObject +type swaggerInfoObject struct { + Title string `json:"title"` + Description string `json:"description,omitempty"` + TermsOfService string `json:"termsOfService,omitempty"` + Version string `json:"version"` + + Contact *swaggerContactObject `json:"contact,omitempty"` + License *swaggerLicenseObject `json:"license,omitempty"` + ExternalDocs *swaggerExternalDocumentationObject `json:"externalDocs,omitempty"` +} + +// http://swagger.io/specification/#contactObject +type swaggerContactObject struct { + Name string `json:"name,omitempty"` + URL string `json:"url,omitempty"` + Email string `json:"email,omitempty"` +} + +// http://swagger.io/specification/#licenseObject +type swaggerLicenseObject struct { + Name string `json:"name,omitempty"` + URL string `json:"url,omitempty"` +} + +// http://swagger.io/specification/#externalDocumentationObject +type swaggerExternalDocumentationObject struct { + Description string `json:"description,omitempty"` + URL string `json:"url,omitempty"` +} + +// http://swagger.io/specification/#swaggerObject +type swaggerObject struct { + Swagger string `json:"swagger"` + Info swaggerInfoObject `json:"info"` + Host string `json:"host,omitempty"` + BasePath string `json:"basePath,omitempty"` + Schemes []string `json:"schemes"` + Consumes []string `json:"consumes"` + Produces []string `json:"produces"` + Paths swaggerPathsObject `json:"paths"` + Definitions swaggerDefinitionsObject `json:"definitions"` +} + +// http://swagger.io/specification/#pathsObject +type swaggerPathsObject map[string]swaggerPathItemObject + +// http://swagger.io/specification/#pathItemObject +type swaggerPathItemObject struct { + Get *swaggerOperationObject `json:"get,omitempty"` + Delete *swaggerOperationObject `json:"delete,omitempty"` + Post *swaggerOperationObject `json:"post,omitempty"` + Put *swaggerOperationObject `json:"put,omitempty"` + Patch *swaggerOperationObject `json:"patch,omitempty"` +} + +// http://swagger.io/specification/#operationObject +type swaggerOperationObject struct { + Summary string `json:"summary,omitempty"` + Description string `json:"description,omitempty"` + OperationID string `json:"operationId"` + Responses swaggerResponsesObject `json:"responses"` + Parameters swaggerParametersObject `json:"parameters,omitempty"` + Tags []string `json:"tags,omitempty"` + + ExternalDocs *swaggerExternalDocumentationObject `json:"externalDocs,omitempty"` +} + +type swaggerParametersObject []swaggerParameterObject + +// http://swagger.io/specification/#parameterObject +type swaggerParameterObject struct { + Name string `json:"name"` + Description string `json:"description,omitempty"` + In string `json:"in,omitempty"` + Required bool `json:"required"` + Type string `json:"type,omitempty"` + Format string `json:"format,omitempty"` + Items *swaggerItemsObject `json:"items,omitempty"` + Enum []string `json:"enum,omitempty"` + Default string `json:"default,omitempty"` + + // Or you can explicitly refer to another type. If this is defined all + // other fields should be empty + Schema *swaggerSchemaObject `json:"schema,omitempty"` +} + +// core part of schema, which is common to itemsObject and schemaObject. +// http://swagger.io/specification/#itemsObject +type schemaCore struct { + Type string `json:"type,omitempty"` + Format string `json:"format,omitempty"` + Ref string `json:"$ref,omitempty"` + + Items *swaggerItemsObject `json:"items,omitempty"` + + // If the item is an enumeration include a list of all the *NAMES* of the + // enum values. I'm not sure how well this will work but assuming all enums + // start from 0 index it will be great. I don't think that is a good assumption. + Enum []string `json:"enum,omitempty"` + Default string `json:"default,omitempty"` +} + +type swaggerItemsObject schemaCore + +// http://swagger.io/specification/#responsesObject +type swaggerResponsesObject map[string]swaggerResponseObject + +// http://swagger.io/specification/#responseObject +type swaggerResponseObject struct { + Description string `json:"description"` + Schema swaggerSchemaObject `json:"schema"` +} + +type keyVal struct { + Key string + Value interface{} +} + +type swaggerSchemaObjectProperties []keyVal + +func (op swaggerSchemaObjectProperties) MarshalJSON() ([]byte, error) { + var buf bytes.Buffer + buf.WriteString("{") + for i, kv := range op { + if i != 0 { + buf.WriteString(",") + } + key, err := json.Marshal(kv.Key) + if err != nil { + return nil, err + } + buf.Write(key) + buf.WriteString(":") + val, err := json.Marshal(kv.Value) + if err != nil { + return nil, err + } + buf.Write(val) + } + + buf.WriteString("}") + return buf.Bytes(), nil +} + +// http://swagger.io/specification/#schemaObject +type swaggerSchemaObject struct { + schemaCore + // Properties can be recursively defined + Properties swaggerSchemaObjectProperties `json:"properties,omitempty"` + AdditionalProperties *swaggerSchemaObject `json:"additionalProperties,omitempty"` + + Description string `json:"description,omitempty"` + Title string `json:"title,omitempty"` +} + +// http://swagger.io/specification/#referenceObject +type swaggerReferenceObject struct { + Ref string `json:"$ref"` +} + +// http://swagger.io/specification/#definitionsObject +type swaggerDefinitionsObject map[string]swaggerSchemaObject + +// Internal type mapping from FQMN to descriptor.Message. Used as a set by the +// findServiceMessages function. +type messageMap map[string]*descriptor.Message + +// Internal type mapping from FQEN to descriptor.Enum. Used as a set by the +// findServiceMessages function. +type enumMap map[string]*descriptor.Enum diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/main.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/main.go new file mode 100644 index 0000000..db74770 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/main.go @@ -0,0 +1,144 @@ +package main + +import ( + "flag" + "fmt" + "io" + "io/ioutil" + "os" + "strings" + + "github.com/golang/glog" + "github.com/golang/protobuf/proto" + plugin "github.com/golang/protobuf/protoc-gen-go/plugin" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" + "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger" +) + +var ( + importPrefix = flag.String("import_prefix", "", "prefix to be added to go package paths for imported proto files") + file = flag.String("file", "stdin", "where to load data from") + allowDeleteBody = flag.Bool("allow_delete_body", false, "unless set, HTTP DELETE methods may not have a body") +) + +func parseReq(r io.Reader) (*plugin.CodeGeneratorRequest, error) { + glog.V(1).Info("Parsing code generator request") + input, err := ioutil.ReadAll(r) + if err != nil { + glog.Errorf("Failed to read code generator request: %v", err) + return nil, err + } + req := new(plugin.CodeGeneratorRequest) + if err = proto.Unmarshal(input, req); err != nil { + glog.Errorf("Failed to unmarshal code generator request: %v", err) + return nil, err + } + glog.V(1).Info("Parsed code generator request") + return req, nil +} + +func main() { + flag.Parse() + defer glog.Flush() + + reg := descriptor.NewRegistry() + + glog.V(1).Info("Processing code generator request") + f := os.Stdin + if *file != "stdin" { + f, _ = os.Open("input.txt") + } + req, err := parseReq(f) + if err != nil { + glog.Fatal(err) + } + pkgMap := make(map[string]string) + if req.Parameter != nil { + err := parseReqParam(req.GetParameter(), flag.CommandLine, pkgMap) + if err != nil { + glog.Fatalf("Error parsing flags: %v", err) + } + } + + reg.SetPrefix(*importPrefix) + reg.SetAllowDeleteBody(*allowDeleteBody) + for k, v := range pkgMap { + reg.AddPkgMap(k, v) + } + g := genswagger.New(reg) + + if err := reg.Load(req); err != nil { + emitError(err) + return + } + + var targets []*descriptor.File + for _, target := range req.FileToGenerate { + f, err := reg.LookupFile(target) + if err != nil { + glog.Fatal(err) + } + targets = append(targets, f) + } + + out, err := g.Generate(targets) + glog.V(1).Info("Processed code generator request") + if err != nil { + emitError(err) + return + } + emitFiles(out) +} + +func emitFiles(out []*plugin.CodeGeneratorResponse_File) { + emitResp(&plugin.CodeGeneratorResponse{File: out}) +} + +func emitError(err error) { + emitResp(&plugin.CodeGeneratorResponse{Error: proto.String(err.Error())}) +} + +func emitResp(resp *plugin.CodeGeneratorResponse) { + buf, err := proto.Marshal(resp) + if err != nil { + glog.Fatal(err) + } + if _, err := os.Stdout.Write(buf); err != nil { + glog.Fatal(err) + } +} + +// parseReqParam parses a CodeGeneratorRequest parameter and adds the +// extracted values to the given FlagSet and pkgMap. Returns a non-nil +// error if setting a flag failed. +func parseReqParam(param string, f *flag.FlagSet, pkgMap map[string]string) error { + if param == "" { + return nil + } + for _, p := range strings.Split(param, ",") { + spec := strings.SplitN(p, "=", 2) + if len(spec) == 1 { + if spec[0] == "allow_delete_body" { + err := f.Set(spec[0], "true") + if err != nil { + return fmt.Errorf("Cannot set flag %s: %v", p, err) + } + continue + } + err := f.Set(spec[0], "") + if err != nil { + return fmt.Errorf("Cannot set flag %s: %v", p, err) + } + continue + } + name, value := spec[0], spec[1] + if strings.HasPrefix(name, "M") { + pkgMap[name[1:]] = value + continue + } + if err := f.Set(name, value); err != nil { + return fmt.Errorf("Cannot set flag %s: %v", p, err) + } + } + return nil +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/main_test.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/main_test.go new file mode 100644 index 0000000..c4d12dd --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/main_test.go @@ -0,0 +1,129 @@ +package main + +import ( + "flag" + "reflect" + "testing" +) + +func TestParseReqParam(t *testing.T) { + + f := flag.CommandLine + + // this one must be first - with no leading clearFlags call it + // verifies our expectation of default values as we reset by + // clearFlags + pkgMap := make(map[string]string) + expected := map[string]string{} + err := parseReqParam("", f, pkgMap) + if err != nil { + t.Errorf("Test 0: unexpected parse error '%v'", err) + } + if !reflect.DeepEqual(pkgMap, expected) { + t.Errorf("Test 0: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) + } + checkFlags(false, "stdin", "", t, 0) + + clearFlags() + pkgMap = make(map[string]string) + expected = map[string]string{"google/api/annotations.proto": "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api"} + err = parseReqParam("allow_delete_body,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api", f, pkgMap) + if err != nil { + t.Errorf("Test 1: unexpected parse error '%v'", err) + } + if !reflect.DeepEqual(pkgMap, expected) { + t.Errorf("Test 1: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) + } + checkFlags(true, "./foo.pb", "/bar/baz", t, 1) + + clearFlags() + pkgMap = make(map[string]string) + expected = map[string]string{"google/api/annotations.proto": "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api"} + err = parseReqParam("allow_delete_body=true,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api", f, pkgMap) + if err != nil { + t.Errorf("Test 2: unexpected parse error '%v'", err) + } + if !reflect.DeepEqual(pkgMap, expected) { + t.Errorf("Test 2: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) + } + checkFlags(true, "./foo.pb", "/bar/baz", t, 2) + + clearFlags() + pkgMap = make(map[string]string) + expected = map[string]string{"a/b/c.proto": "github.com/x/y/z", "f/g/h.proto": "github.com/1/2/3/"} + err = parseReqParam("allow_delete_body=false,Ma/b/c.proto=github.com/x/y/z,Mf/g/h.proto=github.com/1/2/3/", f, pkgMap) + if err != nil { + t.Errorf("Test 3: unexpected parse error '%v'", err) + } + if !reflect.DeepEqual(pkgMap, expected) { + t.Errorf("Test 3: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) + } + checkFlags(false, "stdin", "", t, 3) + + clearFlags() + pkgMap = make(map[string]string) + expected = map[string]string{} + err = parseReqParam("", f, pkgMap) + if err != nil { + t.Errorf("Test 4: unexpected parse error '%v'", err) + } + if !reflect.DeepEqual(pkgMap, expected) { + t.Errorf("Test 4: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) + } + checkFlags(false, "stdin", "", t, 4) + + clearFlags() + pkgMap = make(map[string]string) + expected = map[string]string{} + err = parseReqParam("unknown_param=17", f, pkgMap) + if err == nil { + t.Error("Test 5: expected parse error not returned") + } + if !reflect.DeepEqual(pkgMap, expected) { + t.Errorf("Test 5: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) + } + checkFlags(false, "stdin", "", t, 5) + + clearFlags() + pkgMap = make(map[string]string) + expected = map[string]string{} + err = parseReqParam("Mfoo", f, pkgMap) + if err == nil { + t.Error("Test 6: expected parse error not returned") + } + if !reflect.DeepEqual(pkgMap, expected) { + t.Errorf("Test 6: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) + } + checkFlags(false, "stdin", "", t, 6) + + clearFlags() + pkgMap = make(map[string]string) + expected = map[string]string{} + err = parseReqParam("allow_delete_body,file,import_prefix", f, pkgMap) + if err != nil { + t.Errorf("Test 7: unexpected parse error '%v'", err) + } + if !reflect.DeepEqual(pkgMap, expected) { + t.Errorf("Test 7: pkgMap parse error, expected '%v', got '%v'", expected, pkgMap) + } + checkFlags(true, "", "", t, 7) + +} + +func checkFlags(allowDeleteV bool, fileV, importPathV string, t *testing.T, tid int) { + if *importPrefix != importPathV { + t.Errorf("Test %v: import_prefix misparsed, expected '%v', got '%v'", tid, importPathV, *importPrefix) + } + if *file != fileV { + t.Errorf("Test %v: file misparsed, expected '%v', got '%v'", tid, fileV, *file) + } + if *allowDeleteBody != allowDeleteV { + t.Errorf("Test %v: allow_delete_body misparsed, expected '%v', got '%v'", tid, allowDeleteV, *allowDeleteBody) + } +} + +func clearFlags() { + *importPrefix = "" + *file = "stdin" + *allowDeleteBody = false +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/context.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/context.go new file mode 100644 index 0000000..ded3b2e --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/context.go @@ -0,0 +1,187 @@ +package runtime + +import ( + "fmt" + "net" + "net/http" + "strconv" + "strings" + "time" + + "golang.org/x/net/context" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" +) + +// MetadataHeaderPrefix is the http prefix that represents custom metadata +// parameters to or from a gRPC call. +const MetadataHeaderPrefix = "Grpc-Metadata-" + +// MetadataPrefix is the prefix for grpc-gateway supplied custom metadata fields. +const MetadataPrefix = "grpcgateway-" + +// MetadataTrailerPrefix is prepended to gRPC metadata as it is converted to +// HTTP headers in a response handled by grpc-gateway +const MetadataTrailerPrefix = "Grpc-Trailer-" + +const metadataGrpcTimeout = "Grpc-Timeout" + +const xForwardedFor = "X-Forwarded-For" +const xForwardedHost = "X-Forwarded-Host" + +var ( + // DefaultContextTimeout is used for gRPC call context.WithTimeout whenever a Grpc-Timeout inbound + // header isn't present. If the value is 0 the sent `context` will not have a timeout. + DefaultContextTimeout = 0 * time.Second +) + +/* +AnnotateContext adds context information such as metadata from the request. + +At a minimum, the RemoteAddr is included in the fashion of "X-Forwarded-For", +except that the forwarded destination is not another HTTP service but rather +a gRPC service. +*/ +func AnnotateContext(ctx context.Context, req *http.Request) (context.Context, error) { + var pairs []string + timeout := DefaultContextTimeout + if tm := req.Header.Get(metadataGrpcTimeout); tm != "" { + var err error + timeout, err = timeoutDecode(tm) + if err != nil { + return nil, grpc.Errorf(codes.InvalidArgument, "invalid grpc-timeout: %s", tm) + } + } + + for key, vals := range req.Header { + for _, val := range vals { + // For backwards-compatibility, pass through 'authorization' header with no prefix. + if strings.ToLower(key) == "authorization" { + pairs = append(pairs, "authorization", val) + } + if isPermanentHTTPHeader(key) { + pairs = append(pairs, strings.ToLower(fmt.Sprintf("%s%s", MetadataPrefix, key)), val) + continue + } + if strings.HasPrefix(key, MetadataHeaderPrefix) { + pairs = append(pairs, key[len(MetadataHeaderPrefix):], val) + } + } + } + if host := req.Header.Get(xForwardedHost); host != "" { + pairs = append(pairs, strings.ToLower(xForwardedHost), host) + } else if req.Host != "" { + pairs = append(pairs, strings.ToLower(xForwardedHost), req.Host) + } + + if addr := req.RemoteAddr; addr != "" { + if remoteIP, _, err := net.SplitHostPort(addr); err == nil { + if fwd := req.Header.Get(xForwardedFor); fwd == "" { + pairs = append(pairs, strings.ToLower(xForwardedFor), remoteIP) + } else { + pairs = append(pairs, strings.ToLower(xForwardedFor), fmt.Sprintf("%s, %s", fwd, remoteIP)) + } + } else { + grpclog.Printf("invalid remote addr: %s", addr) + } + } + + if timeout != 0 { + ctx, _ = context.WithTimeout(ctx, timeout) + } + if len(pairs) == 0 { + return ctx, nil + } + return metadata.NewOutgoingContext(ctx, metadata.Pairs(pairs...)), nil +} + +// ServerMetadata consists of metadata sent from gRPC server. +type ServerMetadata struct { + HeaderMD metadata.MD + TrailerMD metadata.MD +} + +type serverMetadataKey struct{} + +// NewServerMetadataContext creates a new context with ServerMetadata +func NewServerMetadataContext(ctx context.Context, md ServerMetadata) context.Context { + return context.WithValue(ctx, serverMetadataKey{}, md) +} + +// ServerMetadataFromContext returns the ServerMetadata in ctx +func ServerMetadataFromContext(ctx context.Context) (md ServerMetadata, ok bool) { + md, ok = ctx.Value(serverMetadataKey{}).(ServerMetadata) + return +} + +func timeoutDecode(s string) (time.Duration, error) { + size := len(s) + if size < 2 { + return 0, fmt.Errorf("timeout string is too short: %q", s) + } + d, ok := timeoutUnitToDuration(s[size-1]) + if !ok { + return 0, fmt.Errorf("timeout unit is not recognized: %q", s) + } + t, err := strconv.ParseInt(s[:size-1], 10, 64) + if err != nil { + return 0, err + } + return d * time.Duration(t), nil +} + +func timeoutUnitToDuration(u uint8) (d time.Duration, ok bool) { + switch u { + case 'H': + return time.Hour, true + case 'M': + return time.Minute, true + case 'S': + return time.Second, true + case 'm': + return time.Millisecond, true + case 'u': + return time.Microsecond, true + case 'n': + return time.Nanosecond, true + default: + } + return +} + +// isPermanentHTTPHeader checks whether hdr belongs to the list of +// permenant request headers maintained by IANA. +// http://www.iana.org/assignments/message-headers/message-headers.xml +func isPermanentHTTPHeader(hdr string) bool { + switch hdr { + case + "Accept", + "Accept-Charset", + "Accept-Language", + "Accept-Ranges", + "Authorization", + "Cache-Control", + "Content-Type", + "Cookie", + "Date", + "Expect", + "From", + "Host", + "If-Match", + "If-Modified-Since", + "If-None-Match", + "If-Schedule-Tag-Match", + "If-Unmodified-Since", + "Max-Forwards", + "Origin", + "Pragma", + "Referer", + "User-Agent", + "Via", + "Warning": + return true + } + return false +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/context_test.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/context_test.go new file mode 100644 index 0000000..a479b5a --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/context_test.go @@ -0,0 +1,172 @@ +package runtime_test + +import ( + "net/http" + "reflect" + "testing" + "time" + + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "golang.org/x/net/context" + "google.golang.org/grpc/metadata" +) + +const ( + emptyForwardMetaCount = 1 +) + +func TestAnnotateContext_WorksWithEmpty(t *testing.T) { + ctx := context.Background() + + request, err := http.NewRequest("GET", "http://www.example.com", nil) + if err != nil { + t.Fatalf("http.NewRequest(%q, %q, nil) failed with %v; want success", "GET", "http://www.example.com", err) + } + request.Header.Add("Some-Irrelevant-Header", "some value") + annotated, err := runtime.AnnotateContext(ctx, request) + if err != nil { + t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) + return + } + md, ok := metadata.FromOutgoingContext(annotated) + if !ok || len(md) != emptyForwardMetaCount { + t.Errorf("Expected %d metadata items in context; got %v", emptyForwardMetaCount, md) + } +} + +func TestAnnotateContext_ForwardsGrpcMetadata(t *testing.T) { + ctx := context.Background() + request, err := http.NewRequest("GET", "http://www.example.com", nil) + if err != nil { + t.Fatalf("http.NewRequest(%q, %q, nil) failed with %v; want success", "GET", "http://www.example.com", err) + } + request.Header.Add("Some-Irrelevant-Header", "some value") + request.Header.Add("Grpc-Metadata-FooBar", "Value1") + request.Header.Add("Grpc-Metadata-Foo-BAZ", "Value2") + request.Header.Add("Grpc-Metadata-foo-bAz", "Value3") + request.Header.Add("Authorization", "Token 1234567890") + annotated, err := runtime.AnnotateContext(ctx, request) + if err != nil { + t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) + return + } + md, ok := metadata.FromOutgoingContext(annotated) + if got, want := len(md), emptyForwardMetaCount+4; !ok || got != want { + t.Errorf("metadata items in context = %d want %d: %v", got, want, md) + } + if got, want := md["foobar"], []string{"Value1"}; !reflect.DeepEqual(got, want) { + t.Errorf(`md["grpcgateway-foobar"] = %q; want %q`, got, want) + } + if got, want := md["foo-baz"], []string{"Value2", "Value3"}; !reflect.DeepEqual(got, want) { + t.Errorf(`md["grpcgateway-foo-baz"] = %q want %q`, got, want) + } + if got, want := md["grpcgateway-authorization"], []string{"Token 1234567890"}; !reflect.DeepEqual(got, want) { + t.Errorf(`md["grpcgateway-authorization"] = %q want %q`, got, want) + } + if got, want := md["authorization"], []string{"Token 1234567890"}; !reflect.DeepEqual(got, want) { + t.Errorf(`md["authorization"] = %q want %q`, got, want) + } +} + +func TestAnnotateContext_XForwardedFor(t *testing.T) { + ctx := context.Background() + request, err := http.NewRequest("GET", "http://bar.foo.example.com", nil) + if err != nil { + t.Fatalf("http.NewRequest(%q, %q, nil) failed with %v; want success", "GET", "http://bar.foo.example.com", err) + } + request.Header.Add("X-Forwarded-For", "192.0.2.100") // client + request.RemoteAddr = "192.0.2.200:12345" // proxy + + annotated, err := runtime.AnnotateContext(ctx, request) + if err != nil { + t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) + return + } + md, ok := metadata.FromOutgoingContext(annotated) + if !ok || len(md) != emptyForwardMetaCount+1 { + t.Errorf("Expected %d metadata items in context; got %v", emptyForwardMetaCount+1, md) + } + if got, want := md["x-forwarded-host"], []string{"bar.foo.example.com"}; !reflect.DeepEqual(got, want) { + t.Errorf(`md["host"] = %v; want %v`, got, want) + } + // Note: it must be in order client, proxy1, proxy2 + if got, want := md["x-forwarded-for"], []string{"192.0.2.100, 192.0.2.200"}; !reflect.DeepEqual(got, want) { + t.Errorf(`md["x-forwarded-for"] = %v want %v`, got, want) + } +} + +func TestAnnotateContext_SupportsTimeouts(t *testing.T) { + ctx := context.Background() + request, err := http.NewRequest("GET", "http://example.com", nil) + if err != nil { + t.Fatalf(`http.NewRequest("GET", "http://example.com", nil failed with %v; want success`, err) + } + annotated, err := runtime.AnnotateContext(ctx, request) + if err != nil { + t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) + return + } + if _, ok := annotated.Deadline(); ok { + // no deadline by default + t.Errorf("annotated.Deadline() = _, true; want _, false") + } + + const acceptableError = 50 * time.Millisecond + runtime.DefaultContextTimeout = 10 * time.Second + annotated, err = runtime.AnnotateContext(ctx, request) + if err != nil { + t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) + return + } + deadline, ok := annotated.Deadline() + if !ok { + t.Errorf("annotated.Deadline() = _, false; want _, true") + } + if got, want := deadline.Sub(time.Now()), runtime.DefaultContextTimeout; got-want > acceptableError || got-want < -acceptableError { + t.Errorf("deadline.Sub(time.Now()) = %v; want %v; with error %v", got, want, acceptableError) + } + + for _, spec := range []struct { + timeout string + want time.Duration + }{ + { + timeout: "17H", + want: 17 * time.Hour, + }, + { + timeout: "19M", + want: 19 * time.Minute, + }, + { + timeout: "23S", + want: 23 * time.Second, + }, + { + timeout: "1009m", + want: 1009 * time.Millisecond, + }, + { + timeout: "1000003u", + want: 1000003 * time.Microsecond, + }, + { + timeout: "100000007n", + want: 100000007 * time.Nanosecond, + }, + } { + request.Header.Set("Grpc-Timeout", spec.timeout) + annotated, err = runtime.AnnotateContext(ctx, request) + if err != nil { + t.Errorf("runtime.AnnotateContext(ctx, %#v) failed with %v; want success", request, err) + return + } + deadline, ok := annotated.Deadline() + if !ok { + t.Errorf("annotated.Deadline() = _, false; want _, true; timeout = %q", spec.timeout) + } + if got, want := deadline.Sub(time.Now()), spec.want; got-want > acceptableError || got-want < -acceptableError { + t.Errorf("deadline.Sub(time.Now()) = %v; want %v; with error %v; timeout= %q", got, want, acceptableError, spec.timeout) + } + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/convert.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/convert.go new file mode 100644 index 0000000..1af5cc4 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/convert.go @@ -0,0 +1,58 @@ +package runtime + +import ( + "strconv" +) + +// String just returns the given string. +// It is just for compatibility to other types. +func String(val string) (string, error) { + return val, nil +} + +// Bool converts the given string representation of a boolean value into bool. +func Bool(val string) (bool, error) { + return strconv.ParseBool(val) +} + +// Float64 converts the given string representation into representation of a floating point number into float64. +func Float64(val string) (float64, error) { + return strconv.ParseFloat(val, 64) +} + +// Float32 converts the given string representation of a floating point number into float32. +func Float32(val string) (float32, error) { + f, err := strconv.ParseFloat(val, 32) + if err != nil { + return 0, err + } + return float32(f), nil +} + +// Int64 converts the given string representation of an integer into int64. +func Int64(val string) (int64, error) { + return strconv.ParseInt(val, 0, 64) +} + +// Int32 converts the given string representation of an integer into int32. +func Int32(val string) (int32, error) { + i, err := strconv.ParseInt(val, 0, 32) + if err != nil { + return 0, err + } + return int32(i), nil +} + +// Uint64 converts the given string representation of an integer into uint64. +func Uint64(val string) (uint64, error) { + return strconv.ParseUint(val, 0, 64) +} + +// Uint32 converts the given string representation of an integer into uint32. +func Uint32(val string) (uint32, error) { + i, err := strconv.ParseUint(val, 0, 32) + if err != nil { + return 0, err + } + return uint32(i), nil +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/doc.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/doc.go new file mode 100644 index 0000000..b6e5ddf --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/doc.go @@ -0,0 +1,5 @@ +/* +Package runtime contains runtime helper functions used by +servers which protoc-gen-grpc-gateway generates. +*/ +package runtime diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/errors.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/errors.go new file mode 100644 index 0000000..5a51d02 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/errors.go @@ -0,0 +1,121 @@ +package runtime + +import ( + "io" + "net/http" + + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" +) + +// HTTPStatusFromCode converts a gRPC error code into the corresponding HTTP response status. +func HTTPStatusFromCode(code codes.Code) int { + switch code { + case codes.OK: + return http.StatusOK + case codes.Canceled: + return http.StatusRequestTimeout + case codes.Unknown: + return http.StatusInternalServerError + case codes.InvalidArgument: + return http.StatusBadRequest + case codes.DeadlineExceeded: + return http.StatusRequestTimeout + case codes.NotFound: + return http.StatusNotFound + case codes.AlreadyExists: + return http.StatusConflict + case codes.PermissionDenied: + return http.StatusForbidden + case codes.Unauthenticated: + return http.StatusUnauthorized + case codes.ResourceExhausted: + return http.StatusForbidden + case codes.FailedPrecondition: + return http.StatusPreconditionFailed + case codes.Aborted: + return http.StatusConflict + case codes.OutOfRange: + return http.StatusBadRequest + case codes.Unimplemented: + return http.StatusNotImplemented + case codes.Internal: + return http.StatusInternalServerError + case codes.Unavailable: + return http.StatusServiceUnavailable + case codes.DataLoss: + return http.StatusInternalServerError + } + + grpclog.Printf("Unknown gRPC error code: %v", code) + return http.StatusInternalServerError +} + +var ( + // HTTPError replies to the request with the error. + // You can set a custom function to this variable to customize error format. + HTTPError = DefaultHTTPError + // OtherErrorHandler handles the following error used by the gateway: StatusMethodNotAllowed StatusNotFound and StatusBadRequest + OtherErrorHandler = DefaultOtherErrorHandler +) + +type errorBody struct { + Error string `protobuf:"bytes,1,name=error" json:"error"` + Code int32 `protobuf:"varint,2,name=code" json:"code"` +} + +//Make this also conform to proto.Message for builtin JSONPb Marshaler +func (e *errorBody) Reset() { *e = errorBody{} } +func (e *errorBody) String() string { return proto.CompactTextString(e) } +func (*errorBody) ProtoMessage() {} + +// DefaultHTTPError is the default implementation of HTTPError. +// If "err" is an error from gRPC system, the function replies with the status code mapped by HTTPStatusFromCode. +// If otherwise, it replies with http.StatusInternalServerError. +// +// The response body returned by this function is a JSON object, +// which contains a member whose key is "error" and whose value is err.Error(). +func DefaultHTTPError(ctx context.Context, marshaler Marshaler, w http.ResponseWriter, _ *http.Request, err error) { + const fallback = `{"error": "failed to marshal error message"}` + + w.Header().Del("Trailer") + w.Header().Set("Content-Type", marshaler.ContentType()) + body := &errorBody{ + Error: grpc.ErrorDesc(err), + Code: int32(grpc.Code(err)), + } + + buf, merr := marshaler.Marshal(body) + if merr != nil { + grpclog.Printf("Failed to marshal error message %q: %v", body, merr) + w.WriteHeader(http.StatusInternalServerError) + if _, err := io.WriteString(w, fallback); err != nil { + grpclog.Printf("Failed to write response: %v", err) + } + return + } + + md, ok := ServerMetadataFromContext(ctx) + if !ok { + grpclog.Printf("Failed to extract ServerMetadata from context") + } + + handleForwardResponseServerMetadata(w, md) + handleForwardResponseTrailerHeader(w, md) + st := HTTPStatusFromCode(grpc.Code(err)) + w.WriteHeader(st) + if _, err := w.Write(buf); err != nil { + grpclog.Printf("Failed to write response: %v", err) + } + + handleForwardResponseTrailer(w, md) +} + +// DefaultOtherErrorHandler is the default implementation of OtherErrorHandler. +// It simply writes a string representation of the given error into "w". +func DefaultOtherErrorHandler(w http.ResponseWriter, _ *http.Request, msg string, code int) { + http.Error(w, msg, code) +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/errors_test.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/errors_test.go new file mode 100644 index 0000000..2bdfca6 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/errors_test.go @@ -0,0 +1,56 @@ +package runtime_test + +import ( + "encoding/json" + "fmt" + "net/http" + "net/http/httptest" + "strings" + "testing" + + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "golang.org/x/net/context" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" +) + +func TestDefaultHTTPError(t *testing.T) { + ctx := context.Background() + + for _, spec := range []struct { + err error + status int + msg string + }{ + { + err: fmt.Errorf("example error"), + status: http.StatusInternalServerError, + msg: "example error", + }, + { + err: grpc.Errorf(codes.NotFound, "no such resource"), + status: http.StatusNotFound, + msg: "no such resource", + }, + } { + w := httptest.NewRecorder() + req, _ := http.NewRequest("", "", nil) // Pass in an empty request to match the signature + runtime.DefaultHTTPError(ctx, &runtime.JSONBuiltin{}, w, req, spec.err) + + if got, want := w.Header().Get("Content-Type"), "application/json"; got != want { + t.Errorf(`w.Header().Get("Content-Type") = %q; want %q; on spec.err=%v`, got, want, spec.err) + } + if got, want := w.Code, spec.status; got != want { + t.Errorf("w.Code = %d; want %d", got, want) + } + + body := make(map[string]interface{}) + if err := json.Unmarshal(w.Body.Bytes(), &body); err != nil { + t.Errorf("json.Unmarshal(%q, &body) failed with %v; want success", w.Body.Bytes(), err) + continue + } + if got, want := body["error"].(string), spec.msg; !strings.Contains(got, want) { + t.Errorf(`body["error"] = %q; want %q; on spec.err=%v`, got, want, spec.err) + } + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/handler.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/handler.go new file mode 100644 index 0000000..d704085 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/handler.go @@ -0,0 +1,164 @@ +package runtime + +import ( + "fmt" + "io" + "net/http" + "net/textproto" + + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime/internal" + "golang.org/x/net/context" + "google.golang.org/grpc" + "google.golang.org/grpc/grpclog" +) + +// ForwardResponseStream forwards the stream from gRPC server to REST client. +func ForwardResponseStream(ctx context.Context, marshaler Marshaler, w http.ResponseWriter, req *http.Request, recv func() (proto.Message, error), opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { + f, ok := w.(http.Flusher) + if !ok { + grpclog.Printf("Flush not supported in %T", w) + http.Error(w, "unexpected type of web server", http.StatusInternalServerError) + return + } + + md, ok := ServerMetadataFromContext(ctx) + if !ok { + grpclog.Printf("Failed to extract ServerMetadata from context") + http.Error(w, "unexpected error", http.StatusInternalServerError) + return + } + handleForwardResponseServerMetadata(w, md) + + w.Header().Set("Transfer-Encoding", "chunked") + w.Header().Set("Content-Type", marshaler.ContentType()) + if err := handleForwardResponseOptions(ctx, w, nil, opts); err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + w.WriteHeader(http.StatusOK) + f.Flush() + for { + resp, err := recv() + if err == io.EOF { + return + } + if err != nil { + handleForwardResponseStreamError(marshaler, w, err) + return + } + if err := handleForwardResponseOptions(ctx, w, resp, opts); err != nil { + handleForwardResponseStreamError(marshaler, w, err) + return + } + + buf, err := marshaler.Marshal(streamChunk(resp, nil)) + if err != nil { + grpclog.Printf("Failed to marshal response chunk: %v", err) + return + } + if _, err = fmt.Fprintf(w, "%s\n", buf); err != nil { + grpclog.Printf("Failed to send response chunk: %v", err) + return + } + f.Flush() + } +} + +func handleForwardResponseServerMetadata(w http.ResponseWriter, md ServerMetadata) { + for k, vs := range md.HeaderMD { + hKey := fmt.Sprintf("%s%s", MetadataHeaderPrefix, k) + for i := range vs { + w.Header().Add(hKey, vs[i]) + } + } +} + +func handleForwardResponseTrailerHeader(w http.ResponseWriter, md ServerMetadata) { + for k := range md.TrailerMD { + tKey := textproto.CanonicalMIMEHeaderKey(fmt.Sprintf("%s%s", MetadataTrailerPrefix, k)) + w.Header().Add("Trailer", tKey) + } +} + +func handleForwardResponseTrailer(w http.ResponseWriter, md ServerMetadata) { + for k, vs := range md.TrailerMD { + tKey := fmt.Sprintf("%s%s", MetadataTrailerPrefix, k) + for i := range vs { + w.Header().Add(tKey, vs[i]) + } + } +} + +// ForwardResponseMessage forwards the message "resp" from gRPC server to REST client. +func ForwardResponseMessage(ctx context.Context, marshaler Marshaler, w http.ResponseWriter, req *http.Request, resp proto.Message, opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { + md, ok := ServerMetadataFromContext(ctx) + if !ok { + grpclog.Printf("Failed to extract ServerMetadata from context") + } + + handleForwardResponseServerMetadata(w, md) + handleForwardResponseTrailerHeader(w, md) + w.Header().Set("Content-Type", marshaler.ContentType()) + if err := handleForwardResponseOptions(ctx, w, resp, opts); err != nil { + HTTPError(ctx, marshaler, w, req, err) + return + } + + buf, err := marshaler.Marshal(resp) + if err != nil { + grpclog.Printf("Marshal error: %v", err) + HTTPError(ctx, marshaler, w, req, err) + return + } + + if _, err = w.Write(buf); err != nil { + grpclog.Printf("Failed to write response: %v", err) + } + + handleForwardResponseTrailer(w, md) +} + +func handleForwardResponseOptions(ctx context.Context, w http.ResponseWriter, resp proto.Message, opts []func(context.Context, http.ResponseWriter, proto.Message) error) error { + if len(opts) == 0 { + return nil + } + for _, opt := range opts { + if err := opt(ctx, w, resp); err != nil { + grpclog.Printf("Error handling ForwardResponseOptions: %v", err) + return err + } + } + return nil +} + +func handleForwardResponseStreamError(marshaler Marshaler, w http.ResponseWriter, err error) { + buf, merr := marshaler.Marshal(streamChunk(nil, err)) + if merr != nil { + grpclog.Printf("Failed to marshal an error: %v", merr) + return + } + if _, werr := fmt.Fprintf(w, "%s\n", buf); werr != nil { + grpclog.Printf("Failed to notify error to client: %v", werr) + return + } +} + +func streamChunk(result proto.Message, err error) map[string]proto.Message { + if err != nil { + grpcCode := grpc.Code(err) + httpCode := HTTPStatusFromCode(grpcCode) + return map[string]proto.Message{ + "error": &internal.StreamError{ + GrpcCode: int32(grpcCode), + HttpCode: int32(httpCode), + Message: err.Error(), + HttpStatus: http.StatusText(httpCode), + }, + } + } + if result == nil { + return streamChunk(nil, fmt.Errorf("empty response")) + } + return map[string]proto.Message{"result": result} +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/internal/stream_chunk.pb.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/internal/stream_chunk.pb.go new file mode 100644 index 0000000..9a14055 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/internal/stream_chunk.pb.go @@ -0,0 +1,93 @@ +// Code generated by protoc-gen-go. +// source: runtime/internal/stream_chunk.proto +// DO NOT EDIT! + +/* +Package internal is a generated protocol buffer package. + +It is generated from these files: + runtime/internal/stream_chunk.proto + +It has these top-level messages: + StreamError +*/ +package internal + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +// StreamError is a response type which is returned when +// streaming rpc returns an error. +type StreamError struct { + GrpcCode int32 `protobuf:"varint,1,opt,name=grpc_code,json=grpcCode" json:"grpc_code,omitempty"` + HttpCode int32 `protobuf:"varint,2,opt,name=http_code,json=httpCode" json:"http_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message" json:"message,omitempty"` + HttpStatus string `protobuf:"bytes,4,opt,name=http_status,json=httpStatus" json:"http_status,omitempty"` +} + +func (m *StreamError) Reset() { *m = StreamError{} } +func (m *StreamError) String() string { return proto.CompactTextString(m) } +func (*StreamError) ProtoMessage() {} +func (*StreamError) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *StreamError) GetGrpcCode() int32 { + if m != nil { + return m.GrpcCode + } + return 0 +} + +func (m *StreamError) GetHttpCode() int32 { + if m != nil { + return m.HttpCode + } + return 0 +} + +func (m *StreamError) GetMessage() string { + if m != nil { + return m.Message + } + return "" +} + +func (m *StreamError) GetHttpStatus() string { + if m != nil { + return m.HttpStatus + } + return "" +} + +func init() { + proto.RegisterType((*StreamError)(nil), "grpc.gateway.runtime.StreamError") +} + +func init() { proto.RegisterFile("runtime/internal/stream_chunk.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 181 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x8e, 0xbf, 0xee, 0x82, 0x30, + 0x14, 0x85, 0xd3, 0xdf, 0x1f, 0x85, 0xcb, 0x46, 0x1c, 0x9a, 0x38, 0x48, 0x74, 0x61, 0x82, 0xc1, + 0x37, 0xd0, 0xf8, 0x02, 0xb0, 0xb9, 0x90, 0x0a, 0x37, 0x40, 0x94, 0x96, 0xdc, 0x5e, 0x62, 0x5c, + 0x7d, 0x72, 0xd3, 0x22, 0xe3, 0xf9, 0xbe, 0x73, 0x92, 0x03, 0x07, 0x9a, 0x34, 0xf7, 0x03, 0xe6, + 0xbd, 0x66, 0x24, 0xad, 0x1e, 0xb9, 0x65, 0x42, 0x35, 0x54, 0x75, 0x37, 0xe9, 0x7b, 0x36, 0x92, + 0x61, 0x13, 0x6f, 0x5a, 0x1a, 0xeb, 0xac, 0x55, 0x8c, 0x4f, 0xf5, 0xca, 0xbe, 0x8b, 0xfd, 0x5b, + 0x40, 0x54, 0xfa, 0xf2, 0x85, 0xc8, 0x50, 0xbc, 0x85, 0xd0, 0xf5, 0xaa, 0xda, 0x34, 0x28, 0x45, + 0x22, 0xd2, 0xff, 0x22, 0x70, 0xe0, 0x6c, 0x1a, 0x74, 0xb2, 0x63, 0x1e, 0x67, 0xf9, 0x33, 0x4b, + 0x07, 0xbc, 0x94, 0xb0, 0x1e, 0xd0, 0x5a, 0xd5, 0xa2, 0xfc, 0x4d, 0x44, 0x1a, 0x16, 0x4b, 0x8c, + 0x77, 0x10, 0xf9, 0x99, 0x65, 0xc5, 0x93, 0x95, 0x7f, 0xde, 0x82, 0x43, 0xa5, 0x27, 0x27, 0xb8, + 0x06, 0xcb, 0xf3, 0xdb, 0xca, 0xbf, 0x3d, 0x7e, 0x02, 0x00, 0x00, 0xff, 0xff, 0xa9, 0x07, 0x92, + 0xb6, 0xd4, 0x00, 0x00, 0x00, +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/internal/stream_chunk.proto b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/internal/stream_chunk.proto new file mode 100644 index 0000000..f7fba56 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/internal/stream_chunk.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; +package grpc.gateway.runtime; +option go_package = "internal"; + +// StreamError is a response type which is returned when +// streaming rpc returns an error. +message StreamError { + int32 grpc_code = 1; + int32 http_code = 2; + string message = 3; + string http_status = 4; +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_json.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_json.go new file mode 100644 index 0000000..0acd2ca --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_json.go @@ -0,0 +1,37 @@ +package runtime + +import ( + "encoding/json" + "io" +) + +// JSONBuiltin is a Marshaler which marshals/unmarshals into/from JSON +// with the standard "encoding/json" package of Golang. +// Although it is generally faster for simple proto messages than JSONPb, +// it does not support advanced features of protobuf, e.g. map, oneof, .... +type JSONBuiltin struct{} + +// ContentType always Returns "application/json". +func (*JSONBuiltin) ContentType() string { + return "application/json" +} + +// Marshal marshals "v" into JSON +func (j *JSONBuiltin) Marshal(v interface{}) ([]byte, error) { + return json.Marshal(v) +} + +// Unmarshal unmarshals JSON data into "v". +func (j *JSONBuiltin) Unmarshal(data []byte, v interface{}) error { + return json.Unmarshal(data, v) +} + +// NewDecoder returns a Decoder which reads JSON stream from "r". +func (j *JSONBuiltin) NewDecoder(r io.Reader) Decoder { + return json.NewDecoder(r) +} + +// NewEncoder returns an Encoder which writes JSON stream into "w". +func (j *JSONBuiltin) NewEncoder(w io.Writer) Encoder { + return json.NewEncoder(w) +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_json_test.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_json_test.go new file mode 100644 index 0000000..e6efa29 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_json_test.go @@ -0,0 +1,245 @@ +package runtime_test + +import ( + "bytes" + "encoding/json" + "reflect" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes/empty" + structpb "github.com/golang/protobuf/ptypes/struct" + "github.com/golang/protobuf/ptypes/timestamp" + "github.com/golang/protobuf/ptypes/wrappers" + "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + "github.com/grpc-ecosystem/grpc-gateway/runtime" +) + +func TestJSONBuiltinMarshal(t *testing.T) { + var m runtime.JSONBuiltin + msg := examplepb.SimpleMessage{ + Id: "foo", + } + + buf, err := m.Marshal(&msg) + if err != nil { + t.Errorf("m.Marshal(%v) failed with %v; want success", &msg, err) + } + + var got examplepb.SimpleMessage + if err := json.Unmarshal(buf, &got); err != nil { + t.Errorf("json.Unmarshal(%q, &got) failed with %v; want success", buf, err) + } + if want := msg; !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want %v", &got, &want) + } +} + +func TestJSONBuiltinMarshalField(t *testing.T) { + var m runtime.JSONBuiltin + for _, fixt := range builtinFieldFixtures { + buf, err := m.Marshal(fixt.data) + if err != nil { + t.Errorf("m.Marshal(%v) failed with %v; want success", fixt.data, err) + } + if got, want := string(buf), fixt.json; got != want { + t.Errorf("got = %q; want %q; data = %#v", got, want, fixt.data) + } + } +} + +func TestJSONBuiltinMarshalFieldKnownErrors(t *testing.T) { + var m runtime.JSONBuiltin + for _, fixt := range builtinKnownErrors { + buf, err := m.Marshal(fixt.data) + if err != nil { + t.Errorf("m.Marshal(%v) failed with %v; want success", fixt.data, err) + } + if got, want := string(buf), fixt.json; got == want { + t.Errorf("surprisingly got = %q; as want %q; data = %#v", got, want, fixt.data) + } + } +} + +func TestJSONBuiltinsnmarshal(t *testing.T) { + var ( + m runtime.JSONBuiltin + got examplepb.SimpleMessage + + data = []byte(`{"id": "foo"}`) + ) + if err := m.Unmarshal(data, &got); err != nil { + t.Errorf("m.Unmarshal(%q, &got) failed with %v; want success", data, err) + } + + want := examplepb.SimpleMessage{ + Id: "foo", + } + if !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want = %v", &got, &want) + } +} + +func TestJSONBuiltinUnmarshalField(t *testing.T) { + var m runtime.JSONBuiltin + for _, fixt := range builtinFieldFixtures { + dest := reflect.New(reflect.TypeOf(fixt.data)) + if err := m.Unmarshal([]byte(fixt.json), dest.Interface()); err != nil { + t.Errorf("m.Unmarshal(%q, dest) failed with %v; want success", fixt.json, err) + } + + if got, want := dest.Elem().Interface(), fixt.data; !reflect.DeepEqual(got, want) { + t.Errorf("got = %#v; want = %#v; input = %q", got, want, fixt.json) + } + } +} + +func TestJSONBuiltinUnmarshalFieldKnownErrors(t *testing.T) { + var m runtime.JSONBuiltin + for _, fixt := range builtinKnownErrors { + dest := reflect.New(reflect.TypeOf(fixt.data)) + if err := m.Unmarshal([]byte(fixt.json), dest.Interface()); err == nil { + t.Errorf("m.Unmarshal(%q, dest) succeeded; want ane error", fixt.json) + } + } +} + +func TestJSONBuiltinEncoder(t *testing.T) { + var m runtime.JSONBuiltin + msg := examplepb.SimpleMessage{ + Id: "foo", + } + + var buf bytes.Buffer + enc := m.NewEncoder(&buf) + if err := enc.Encode(&msg); err != nil { + t.Errorf("enc.Encode(%v) failed with %v; want success", &msg, err) + } + + var got examplepb.SimpleMessage + if err := json.Unmarshal(buf.Bytes(), &got); err != nil { + t.Errorf("json.Unmarshal(%q, &got) failed with %v; want success", buf.String(), err) + } + if want := msg; !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want %v", &got, &want) + } +} + +func TestJSONBuiltinEncoderFields(t *testing.T) { + var m runtime.JSONBuiltin + for _, fixt := range builtinFieldFixtures { + var buf bytes.Buffer + enc := m.NewEncoder(&buf) + if err := enc.Encode(fixt.data); err != nil { + t.Errorf("enc.Encode(%#v) failed with %v; want success", fixt.data, err) + } + + if got, want := buf.String(), fixt.json+"\n"; got != want { + t.Errorf("got = %q; want %q; data = %#v", got, want, fixt.data) + } + } +} + +func TestJSONBuiltinDecoder(t *testing.T) { + var ( + m runtime.JSONBuiltin + got examplepb.SimpleMessage + + data = `{"id": "foo"}` + ) + r := strings.NewReader(data) + dec := m.NewDecoder(r) + if err := dec.Decode(&got); err != nil { + t.Errorf("m.Unmarshal(&got) failed with %v; want success", err) + } + + want := examplepb.SimpleMessage{ + Id: "foo", + } + if !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want = %v", &got, &want) + } +} + +func TestJSONBuiltinDecoderFields(t *testing.T) { + var m runtime.JSONBuiltin + for _, fixt := range builtinFieldFixtures { + r := strings.NewReader(fixt.json) + dec := m.NewDecoder(r) + dest := reflect.New(reflect.TypeOf(fixt.data)) + if err := dec.Decode(dest.Interface()); err != nil { + t.Errorf("dec.Decode(dest) failed with %v; want success; data = %q", err, fixt.json) + } + + if got, want := dest.Elem().Interface(), fixt.data; !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want = %v; input = %q", got, want, fixt.json) + } + } +} + +var ( + builtinFieldFixtures = []struct { + data interface{} + json string + }{ + {data: "", json: `""`}, + {data: proto.String(""), json: `""`}, + {data: "foo", json: `"foo"`}, + {data: proto.String("foo"), json: `"foo"`}, + {data: int32(-1), json: "-1"}, + {data: proto.Int32(-1), json: "-1"}, + {data: int64(-1), json: "-1"}, + {data: proto.Int64(-1), json: "-1"}, + {data: uint32(123), json: "123"}, + {data: proto.Uint32(123), json: "123"}, + {data: uint64(123), json: "123"}, + {data: proto.Uint64(123), json: "123"}, + {data: float32(-1.5), json: "-1.5"}, + {data: proto.Float32(-1.5), json: "-1.5"}, + {data: float64(-1.5), json: "-1.5"}, + {data: proto.Float64(-1.5), json: "-1.5"}, + {data: true, json: "true"}, + {data: proto.Bool(true), json: "true"}, + {data: (*string)(nil), json: "null"}, + {data: new(empty.Empty), json: "{}"}, + {data: examplepb.NumericEnum_ONE, json: "1"}, + { + data: (*examplepb.NumericEnum)(proto.Int32(int32(examplepb.NumericEnum_ONE))), + json: "1", + }, + } + builtinKnownErrors = []struct { + data interface{} + json string + }{ + {data: examplepb.NumericEnum_ONE, json: "ONE"}, + { + data: (*examplepb.NumericEnum)(proto.Int32(int32(examplepb.NumericEnum_ONE))), + json: "ONE", + }, + { + data: &examplepb.ABitOfEverything_OneofString{OneofString: "abc"}, + json: `"abc"`, + }, + { + data: ×tamp.Timestamp{ + Seconds: 1462875553, + Nanos: 123000000, + }, + json: `"2016-05-10T10:19:13.123Z"`, + }, + { + data: &wrappers.Int32Value{Value: 123}, + json: "123", + }, + { + data: &structpb.Value{ + Kind: &structpb.Value_StringValue{ + StringValue: "abc", + }, + }, + json: `"abc"`, + }, + } +) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_jsonpb.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_jsonpb.go new file mode 100644 index 0000000..49f13f7 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_jsonpb.go @@ -0,0 +1,184 @@ +package runtime + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "reflect" + + "github.com/golang/protobuf/jsonpb" + "github.com/golang/protobuf/proto" +) + +// JSONPb is a Marshaler which marshals/unmarshals into/from JSON +// with the "github.com/golang/protobuf/jsonpb". +// It supports fully functionality of protobuf unlike JSONBuiltin. +type JSONPb jsonpb.Marshaler + +// ContentType always returns "application/json". +func (*JSONPb) ContentType() string { + return "application/json" +} + +// Marshal marshals "v" into JSON +// Currently it can marshal only proto.Message. +// TODO(yugui) Support fields of primitive types in a message. +func (j *JSONPb) Marshal(v interface{}) ([]byte, error) { + if _, ok := v.(proto.Message); !ok { + return j.marshalNonProtoField(v) + } + + var buf bytes.Buffer + if err := j.marshalTo(&buf, v); err != nil { + return nil, err + } + return buf.Bytes(), nil +} + +func (j *JSONPb) marshalTo(w io.Writer, v interface{}) error { + p, ok := v.(proto.Message) + if !ok { + buf, err := j.marshalNonProtoField(v) + if err != nil { + return err + } + _, err = w.Write(buf) + return err + } + return (*jsonpb.Marshaler)(j).Marshal(w, p) +} + +// marshalNonProto marshals a non-message field of a protobuf message. +// This function does not correctly marshals arbitary data structure into JSON, +// but it is only capable of marshaling non-message field values of protobuf, +// i.e. primitive types, enums; pointers to primitives or enums; maps from +// integer/string types to primitives/enums/pointers to messages. +func (j *JSONPb) marshalNonProtoField(v interface{}) ([]byte, error) { + rv := reflect.ValueOf(v) + for rv.Kind() == reflect.Ptr { + if rv.IsNil() { + return []byte("null"), nil + } + rv = rv.Elem() + } + + if rv.Kind() == reflect.Map { + m := make(map[string]*json.RawMessage) + for _, k := range rv.MapKeys() { + buf, err := j.Marshal(rv.MapIndex(k).Interface()) + if err != nil { + return nil, err + } + m[fmt.Sprintf("%v", k.Interface())] = (*json.RawMessage)(&buf) + } + if j.Indent != "" { + return json.MarshalIndent(m, "", j.Indent) + } + return json.Marshal(m) + } + if enum, ok := rv.Interface().(protoEnum); ok && !j.EnumsAsInts { + return json.Marshal(enum.String()) + } + return json.Marshal(rv.Interface()) +} + +// Unmarshal unmarshals JSON "data" into "v" +// Currently it can marshal only proto.Message. +// TODO(yugui) Support fields of primitive types in a message. +func (j *JSONPb) Unmarshal(data []byte, v interface{}) error { + return unmarshalJSONPb(data, v) +} + +// NewDecoder returns a Decoder which reads JSON stream from "r". +func (j *JSONPb) NewDecoder(r io.Reader) Decoder { + d := json.NewDecoder(r) + return DecoderFunc(func(v interface{}) error { return decodeJSONPb(d, v) }) +} + +// NewEncoder returns an Encoder which writes JSON stream into "w". +func (j *JSONPb) NewEncoder(w io.Writer) Encoder { + return EncoderFunc(func(v interface{}) error { return j.marshalTo(w, v) }) +} + +func unmarshalJSONPb(data []byte, v interface{}) error { + d := json.NewDecoder(bytes.NewReader(data)) + return decodeJSONPb(d, v) +} + +func decodeJSONPb(d *json.Decoder, v interface{}) error { + p, ok := v.(proto.Message) + if !ok { + return decodeNonProtoField(d, v) + } + unmarshaler := &jsonpb.Unmarshaler{AllowUnknownFields: true} + return unmarshaler.UnmarshalNext(d, p) +} + +func decodeNonProtoField(d *json.Decoder, v interface{}) error { + rv := reflect.ValueOf(v) + if rv.Kind() != reflect.Ptr { + return fmt.Errorf("%T is not a pointer", v) + } + for rv.Kind() == reflect.Ptr { + if rv.IsNil() { + rv.Set(reflect.New(rv.Type().Elem())) + } + if rv.Type().ConvertibleTo(typeProtoMessage) { + unmarshaler := &jsonpb.Unmarshaler{AllowUnknownFields: true} + return unmarshaler.UnmarshalNext(d, rv.Interface().(proto.Message)) + } + rv = rv.Elem() + } + if rv.Kind() == reflect.Map { + if rv.IsNil() { + rv.Set(reflect.MakeMap(rv.Type())) + } + conv, ok := convFromType[rv.Type().Key().Kind()] + if !ok { + return fmt.Errorf("unsupported type of map field key: %v", rv.Type().Key()) + } + + m := make(map[string]*json.RawMessage) + if err := d.Decode(&m); err != nil { + return err + } + for k, v := range m { + result := conv.Call([]reflect.Value{reflect.ValueOf(k)}) + if err := result[1].Interface(); err != nil { + return err.(error) + } + bk := result[0] + bv := reflect.New(rv.Type().Elem()) + if err := unmarshalJSONPb([]byte(*v), bv.Interface()); err != nil { + return err + } + rv.SetMapIndex(bk, bv.Elem()) + } + return nil + } + if _, ok := rv.Interface().(protoEnum); ok { + var repr interface{} + if err := d.Decode(&repr); err != nil { + return err + } + switch repr.(type) { + case string: + // TODO(yugui) Should use proto.StructProperties? + return fmt.Errorf("unmarshaling of symbolic enum %q not supported: %T", repr, rv.Interface()) + case float64: + rv.Set(reflect.ValueOf(int32(repr.(float64))).Convert(rv.Type())) + return nil + default: + return fmt.Errorf("cannot assign %#v into Go type %T", repr, rv.Interface()) + } + } + return d.Decode(v) +} + +type protoEnum interface { + fmt.Stringer + EnumDescriptor() ([]byte, []int) +} + +var typeProtoMessage = reflect.TypeOf((*proto.Message)(nil)).Elem() diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_jsonpb_test.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_jsonpb_test.go new file mode 100644 index 0000000..01e7ce8 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_jsonpb_test.go @@ -0,0 +1,606 @@ +package runtime_test + +import ( + "bytes" + "reflect" + "strings" + "testing" + + "github.com/golang/protobuf/jsonpb" + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes/duration" + "github.com/golang/protobuf/ptypes/empty" + structpb "github.com/golang/protobuf/ptypes/struct" + "github.com/golang/protobuf/ptypes/timestamp" + "github.com/golang/protobuf/ptypes/wrappers" + "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb" + "github.com/grpc-ecosystem/grpc-gateway/runtime" +) + +func TestJSONPbMarshal(t *testing.T) { + msg := examplepb.ABitOfEverything{ + Uuid: "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + Nested: []*examplepb.ABitOfEverything_Nested{ + { + Name: "foo", + Amount: 12345, + }, + }, + Uint64Value: 0xFFFFFFFFFFFFFFFF, + EnumValue: examplepb.NumericEnum_ONE, + OneofValue: &examplepb.ABitOfEverything_OneofString{ + OneofString: "bar", + }, + MapValue: map[string]examplepb.NumericEnum{ + "a": examplepb.NumericEnum_ONE, + "b": examplepb.NumericEnum_ZERO, + }, + } + + for _, spec := range []struct { + enumsAsInts, emitDefaults bool + indent string + origName bool + verifier func(json string) + }{ + { + verifier: func(json string) { + if strings.ContainsAny(json, " \t\r\n") { + t.Errorf("strings.ContainsAny(%q, %q) = true; want false", json, " \t\r\n") + } + if !strings.Contains(json, "ONE") { + t.Errorf(`strings.Contains(%q, "ONE") = false; want true`, json) + } + if want := "uint64Value"; !strings.Contains(json, want) { + t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) + } + }, + }, + { + enumsAsInts: true, + verifier: func(json string) { + if strings.Contains(json, "ONE") { + t.Errorf(`strings.Contains(%q, "ONE") = true; want false`, json) + } + }, + }, + { + emitDefaults: true, + verifier: func(json string) { + if want := `"sfixed32Value"`; !strings.Contains(json, want) { + t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) + } + }, + }, + { + indent: "\t\t", + verifier: func(json string) { + if want := "\t\t\"amount\":"; !strings.Contains(json, want) { + t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) + } + }, + }, + { + origName: true, + verifier: func(json string) { + if want := "uint64_value"; !strings.Contains(json, want) { + t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) + } + }, + }, + } { + m := runtime.JSONPb{ + EnumsAsInts: spec.enumsAsInts, + EmitDefaults: spec.emitDefaults, + Indent: spec.indent, + OrigName: spec.origName, + } + buf, err := m.Marshal(&msg) + if err != nil { + t.Errorf("m.Marshal(%v) failed with %v; want success; spec=%v", &msg, err, spec) + } + + var got examplepb.ABitOfEverything + if err := jsonpb.UnmarshalString(string(buf), &got); err != nil { + t.Errorf("jsonpb.UnmarshalString(%q, &got) failed with %v; want success; spec=%v", string(buf), err, spec) + } + if want := msg; !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want %v; spec=%v", &got, &want, spec) + } + if spec.verifier != nil { + spec.verifier(string(buf)) + } + } +} + +func TestJSONPbMarshalFields(t *testing.T) { + var m runtime.JSONPb + for _, spec := range []struct { + val interface{} + want string + }{} { + buf, err := m.Marshal(spec.val) + if err != nil { + t.Errorf("m.Marshal(%#v) failed with %v; want success", spec.val, err) + } + if got, want := string(buf), spec.want; got != want { + t.Errorf("m.Marshal(%#v) = %q; want %q", spec.val, got, want) + } + } + + m.EnumsAsInts = true + buf, err := m.Marshal(examplepb.NumericEnum_ONE) + if err != nil { + t.Errorf("m.Marshal(%#v) failed with %v; want success", examplepb.NumericEnum_ONE, err) + } + if got, want := string(buf), "1"; got != want { + t.Errorf("m.Marshal(%#v) = %q; want %q", examplepb.NumericEnum_ONE, got, want) + } +} + +func TestJSONPbUnmarshal(t *testing.T) { + var ( + m runtime.JSONPb + got examplepb.ABitOfEverything + ) + for _, data := range []string{ + `{ + "uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + "nested": [ + {"name": "foo", "amount": 12345} + ], + "uint64Value": 18446744073709551615, + "enumValue": "ONE", + "oneofString": "bar", + "mapValue": { + "a": 1, + "b": 0 + } + }`, + `{ + "uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + "nested": [ + {"name": "foo", "amount": 12345} + ], + "uint64Value": "18446744073709551615", + "enumValue": "ONE", + "oneofString": "bar", + "mapValue": { + "a": 1, + "b": 0 + } + }`, + `{ + "uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + "nested": [ + {"name": "foo", "amount": 12345} + ], + "uint64Value": 18446744073709551615, + "enumValue": 1, + "oneofString": "bar", + "mapValue": { + "a": 1, + "b": 0 + } + }`, + } { + if err := m.Unmarshal([]byte(data), &got); err != nil { + t.Errorf("m.Unmarshal(%q, &got) failed with %v; want success", data, err) + } + + want := examplepb.ABitOfEverything{ + Uuid: "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + Nested: []*examplepb.ABitOfEverything_Nested{ + { + Name: "foo", + Amount: 12345, + }, + }, + Uint64Value: 0xFFFFFFFFFFFFFFFF, + EnumValue: examplepb.NumericEnum_ONE, + OneofValue: &examplepb.ABitOfEverything_OneofString{ + OneofString: "bar", + }, + MapValue: map[string]examplepb.NumericEnum{ + "a": examplepb.NumericEnum_ONE, + "b": examplepb.NumericEnum_ZERO, + }, + } + + if !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want = %v", &got, &want) + } + } +} + +func TestJSONPbUnmarshalFields(t *testing.T) { + var m runtime.JSONPb + for _, fixt := range fieldFixtures { + if fixt.skipUnmarshal { + continue + } + + dest := reflect.New(reflect.TypeOf(fixt.data)) + if err := m.Unmarshal([]byte(fixt.json), dest.Interface()); err != nil { + t.Errorf("m.Unmarshal(%q, %T) failed with %v; want success", fixt.json, dest.Interface(), err) + } + if got, want := dest.Elem().Interface(), fixt.data; !reflect.DeepEqual(got, want) { + t.Errorf("dest = %#v; want %#v; input = %v", got, want, fixt.json) + } + } +} + +func TestJSONPbEncoder(t *testing.T) { + msg := examplepb.ABitOfEverything{ + Uuid: "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + Nested: []*examplepb.ABitOfEverything_Nested{ + { + Name: "foo", + Amount: 12345, + }, + }, + Uint64Value: 0xFFFFFFFFFFFFFFFF, + OneofValue: &examplepb.ABitOfEverything_OneofString{ + OneofString: "bar", + }, + MapValue: map[string]examplepb.NumericEnum{ + "a": examplepb.NumericEnum_ONE, + "b": examplepb.NumericEnum_ZERO, + }, + } + + for _, spec := range []struct { + enumsAsInts, emitDefaults bool + indent string + origName bool + verifier func(json string) + }{ + { + verifier: func(json string) { + if strings.ContainsAny(json, " \t\r\n") { + t.Errorf("strings.ContainsAny(%q, %q) = true; want false", json, " \t\r\n") + } + if strings.Contains(json, "ONE") { + t.Errorf(`strings.Contains(%q, "ONE") = true; want false`, json) + } + if want := "uint64Value"; !strings.Contains(json, want) { + t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) + } + }, + }, + { + enumsAsInts: true, + verifier: func(json string) { + if strings.Contains(json, "ONE") { + t.Errorf(`strings.Contains(%q, "ONE") = true; want false`, json) + } + }, + }, + { + emitDefaults: true, + verifier: func(json string) { + if want := `"sfixed32Value"`; !strings.Contains(json, want) { + t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) + } + }, + }, + { + indent: "\t\t", + verifier: func(json string) { + if want := "\t\t\"amount\":"; !strings.Contains(json, want) { + t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) + } + }, + }, + { + origName: true, + verifier: func(json string) { + if want := "uint64_value"; !strings.Contains(json, want) { + t.Errorf(`strings.Contains(%q, %q) = false; want true`, json, want) + } + }, + }, + } { + m := runtime.JSONPb{ + EnumsAsInts: spec.enumsAsInts, + EmitDefaults: spec.emitDefaults, + Indent: spec.indent, + OrigName: spec.origName, + } + + var buf bytes.Buffer + enc := m.NewEncoder(&buf) + if err := enc.Encode(&msg); err != nil { + t.Errorf("enc.Encode(%v) failed with %v; want success; spec=%v", &msg, err, spec) + } + + var got examplepb.ABitOfEverything + if err := jsonpb.UnmarshalString(buf.String(), &got); err != nil { + t.Errorf("jsonpb.UnmarshalString(%q, &got) failed with %v; want success; spec=%v", buf.String(), err, spec) + } + if want := msg; !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want %v; spec=%v", &got, &want, spec) + } + if spec.verifier != nil { + spec.verifier(buf.String()) + } + } +} + +func TestJSONPbEncoderFields(t *testing.T) { + var m runtime.JSONPb + for _, fixt := range fieldFixtures { + var buf bytes.Buffer + enc := m.NewEncoder(&buf) + if err := enc.Encode(fixt.data); err != nil { + t.Errorf("enc.Encode(%#v) failed with %v; want success", fixt.data, err) + } + if got, want := buf.String(), fixt.json; got != want { + t.Errorf("enc.Encode(%#v) = %q; want %q", fixt.data, got, want) + } + } + + m.EnumsAsInts = true + buf, err := m.Marshal(examplepb.NumericEnum_ONE) + if err != nil { + t.Errorf("m.Marshal(%#v) failed with %v; want success", examplepb.NumericEnum_ONE, err) + } + if got, want := string(buf), "1"; got != want { + t.Errorf("m.Marshal(%#v) = %q; want %q", examplepb.NumericEnum_ONE, got, want) + } +} + +func TestJSONPbDecoder(t *testing.T) { + var ( + m runtime.JSONPb + got examplepb.ABitOfEverything + ) + for _, data := range []string{ + `{ + "uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + "nested": [ + {"name": "foo", "amount": 12345} + ], + "uint64Value": 18446744073709551615, + "enumValue": "ONE", + "oneofString": "bar", + "mapValue": { + "a": 1, + "b": 0 + } + }`, + `{ + "uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + "nested": [ + {"name": "foo", "amount": 12345} + ], + "uint64Value": "18446744073709551615", + "enumValue": "ONE", + "oneofString": "bar", + "mapValue": { + "a": 1, + "b": 0 + } + }`, + `{ + "uuid": "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + "nested": [ + {"name": "foo", "amount": 12345} + ], + "uint64Value": 18446744073709551615, + "enumValue": 1, + "oneofString": "bar", + "mapValue": { + "a": 1, + "b": 0 + } + }`, + } { + r := strings.NewReader(data) + dec := m.NewDecoder(r) + if err := dec.Decode(&got); err != nil { + t.Errorf("m.Unmarshal(&got) failed with %v; want success; data=%q", err, data) + } + + want := examplepb.ABitOfEverything{ + Uuid: "6EC2446F-7E89-4127-B3E6-5C05E6BECBA7", + Nested: []*examplepb.ABitOfEverything_Nested{ + { + Name: "foo", + Amount: 12345, + }, + }, + Uint64Value: 0xFFFFFFFFFFFFFFFF, + EnumValue: examplepb.NumericEnum_ONE, + OneofValue: &examplepb.ABitOfEverything_OneofString{ + OneofString: "bar", + }, + MapValue: map[string]examplepb.NumericEnum{ + "a": examplepb.NumericEnum_ONE, + "b": examplepb.NumericEnum_ZERO, + }, + } + if !reflect.DeepEqual(got, want) { + t.Errorf("got = %v; want = %v; data = %v", &got, &want, data) + } + } +} + +func TestJSONPbDecoderFields(t *testing.T) { + var m runtime.JSONPb + for _, fixt := range fieldFixtures { + if fixt.skipUnmarshal { + continue + } + + dest := reflect.New(reflect.TypeOf(fixt.data)) + dec := m.NewDecoder(strings.NewReader(fixt.json)) + if err := dec.Decode(dest.Interface()); err != nil { + t.Errorf("dec.Decode(%T) failed with %v; want success; input = %q", dest.Interface(), err, fixt.json) + } + if got, want := dest.Elem().Interface(), fixt.data; !reflect.DeepEqual(got, want) { + t.Errorf("dest = %#v; want %#v; input = %v", got, want, fixt.json) + } + } +} + +var ( + fieldFixtures = []struct { + data interface{} + json string + skipUnmarshal bool + }{ + {data: int32(1), json: "1"}, + {data: proto.Int32(1), json: "1"}, + {data: int64(1), json: "1"}, + {data: proto.Int64(1), json: "1"}, + {data: uint32(1), json: "1"}, + {data: proto.Uint32(1), json: "1"}, + {data: uint64(1), json: "1"}, + {data: proto.Uint64(1), json: "1"}, + {data: "abc", json: `"abc"`}, + {data: proto.String("abc"), json: `"abc"`}, + {data: float32(1.5), json: "1.5"}, + {data: proto.Float32(1.5), json: "1.5"}, + {data: float64(1.5), json: "1.5"}, + {data: proto.Float64(1.5), json: "1.5"}, + {data: true, json: "true"}, + {data: false, json: "false"}, + {data: (*string)(nil), json: "null"}, + { + data: examplepb.NumericEnum_ONE, + json: `"ONE"`, + // TODO(yugui) support unmarshaling of symbolic enum + skipUnmarshal: true, + }, + { + data: (*examplepb.NumericEnum)(proto.Int32(int32(examplepb.NumericEnum_ONE))), + json: `"ONE"`, + // TODO(yugui) support unmarshaling of symbolic enum + skipUnmarshal: true, + }, + + { + data: map[string]int32{ + "foo": 1, + }, + json: `{"foo":1}`, + }, + { + data: map[string]*examplepb.SimpleMessage{ + "foo": {Id: "bar"}, + }, + json: `{"foo":{"id":"bar"}}`, + }, + { + data: map[int32]*examplepb.SimpleMessage{ + 1: {Id: "foo"}, + }, + json: `{"1":{"id":"foo"}}`, + }, + { + data: map[bool]*examplepb.SimpleMessage{ + true: {Id: "foo"}, + }, + json: `{"true":{"id":"foo"}}`, + }, + { + data: &duration.Duration{ + Seconds: 123, + Nanos: 456000000, + }, + json: `"123.456s"`, + }, + { + data: ×tamp.Timestamp{ + Seconds: 1462875553, + Nanos: 123000000, + }, + json: `"2016-05-10T10:19:13.123Z"`, + }, + { + data: new(empty.Empty), + json: "{}", + }, + + // TODO(yugui) Enable unmarshaling of the following examples + // once jsonpb supports them. + { + data: &structpb.Value{ + Kind: new(structpb.Value_NullValue), + }, + json: "null", + skipUnmarshal: true, + }, + { + data: &structpb.Value{ + Kind: &structpb.Value_NumberValue{ + NumberValue: 123.4, + }, + }, + json: "123.4", + skipUnmarshal: true, + }, + { + data: &structpb.Value{ + Kind: &structpb.Value_StringValue{ + StringValue: "abc", + }, + }, + json: `"abc"`, + skipUnmarshal: true, + }, + { + data: &structpb.Value{ + Kind: &structpb.Value_BoolValue{ + BoolValue: true, + }, + }, + json: "true", + skipUnmarshal: true, + }, + { + data: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "foo_bar": { + Kind: &structpb.Value_BoolValue{ + BoolValue: true, + }, + }, + }, + }, + json: `{"foo_bar":true}`, + skipUnmarshal: true, + }, + + { + data: &wrappers.BoolValue{Value: true}, + json: "true", + }, + { + data: &wrappers.DoubleValue{Value: 123.456}, + json: "123.456", + }, + { + data: &wrappers.FloatValue{Value: 123.456}, + json: "123.456", + }, + { + data: &wrappers.Int32Value{Value: -123}, + json: "-123", + }, + { + data: &wrappers.Int64Value{Value: -123}, + json: `"-123"`, + }, + { + data: &wrappers.UInt32Value{Value: 123}, + json: "123", + }, + { + data: &wrappers.UInt64Value{Value: 123}, + json: `"123"`, + }, + // TODO(yugui) Add other well-known types once jsonpb supports them + } +) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler.go new file mode 100644 index 0000000..6d434f1 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler.go @@ -0,0 +1,42 @@ +package runtime + +import ( + "io" +) + +// Marshaler defines a conversion between byte sequence and gRPC payloads / fields. +type Marshaler interface { + // Marshal marshals "v" into byte sequence. + Marshal(v interface{}) ([]byte, error) + // Unmarshal unmarshals "data" into "v". + // "v" must be a pointer value. + Unmarshal(data []byte, v interface{}) error + // NewDecoder returns a Decoder which reads byte sequence from "r". + NewDecoder(r io.Reader) Decoder + // NewEncoder returns an Encoder which writes bytes sequence into "w". + NewEncoder(w io.Writer) Encoder + // ContentType returns the Content-Type which this marshaler is responsible for. + ContentType() string +} + +// Decoder decodes a byte sequence +type Decoder interface { + Decode(v interface{}) error +} + +// Encoder encodes gRPC payloads / fields into byte sequence. +type Encoder interface { + Encode(v interface{}) error +} + +// DecoderFunc adapts an decoder function into Decoder. +type DecoderFunc func(v interface{}) error + +// Decode delegates invocations to the underlying function itself. +func (f DecoderFunc) Decode(v interface{}) error { return f(v) } + +// EncoderFunc adapts an encoder function into Encoder +type EncoderFunc func(v interface{}) error + +// Encode delegates invocations to the underlying function itself. +func (f EncoderFunc) Encode(v interface{}) error { return f(v) } diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler_registry.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler_registry.go new file mode 100644 index 0000000..928f073 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler_registry.go @@ -0,0 +1,91 @@ +package runtime + +import ( + "errors" + "net/http" +) + +// MIMEWildcard is the fallback MIME type used for requests which do not match +// a registered MIME type. +const MIMEWildcard = "*" + +var ( + acceptHeader = http.CanonicalHeaderKey("Accept") + contentTypeHeader = http.CanonicalHeaderKey("Content-Type") + + defaultMarshaler = &JSONPb{OrigName: true} +) + +// MarshalerForRequest returns the inbound/outbound marshalers for this request. +// It checks the registry on the ServeMux for the MIME type set by the Content-Type header. +// If it isn't set (or the request Content-Type is empty), checks for "*". +// If there are multiple Content-Type headers set, choose the first one that it can +// exactly match in the registry. +// Otherwise, it follows the above logic for "*"/InboundMarshaler/OutboundMarshaler. +func MarshalerForRequest(mux *ServeMux, r *http.Request) (inbound Marshaler, outbound Marshaler) { + for _, acceptVal := range r.Header[acceptHeader] { + if m, ok := mux.marshalers.mimeMap[acceptVal]; ok { + outbound = m + break + } + } + + for _, contentTypeVal := range r.Header[contentTypeHeader] { + if m, ok := mux.marshalers.mimeMap[contentTypeVal]; ok { + inbound = m + break + } + } + + if inbound == nil { + inbound = mux.marshalers.mimeMap[MIMEWildcard] + } + if outbound == nil { + outbound = inbound + } + + return inbound, outbound +} + +// marshalerRegistry is a mapping from MIME types to Marshalers. +type marshalerRegistry struct { + mimeMap map[string]Marshaler +} + +// add adds a marshaler for a case-sensitive MIME type string ("*" to match any +// MIME type). +func (m marshalerRegistry) add(mime string, marshaler Marshaler) error { + if len(mime) == 0 { + return errors.New("empty MIME type") + } + + m.mimeMap[mime] = marshaler + + return nil +} + +// makeMarshalerMIMERegistry returns a new registry of marshalers. +// It allows for a mapping of case-sensitive Content-Type MIME type string to runtime.Marshaler interfaces. +// +// For example, you could allow the client to specify the use of the runtime.JSONPb marshaler +// with a "applicaton/jsonpb" Content-Type and the use of the runtime.JSONBuiltin marshaler +// with a "application/json" Content-Type. +// "*" can be used to match any Content-Type. +// This can be attached to a ServerMux with the marshaler option. +func makeMarshalerMIMERegistry() marshalerRegistry { + return marshalerRegistry{ + mimeMap: map[string]Marshaler{ + MIMEWildcard: defaultMarshaler, + }, + } +} + +// WithMarshalerOption returns a ServeMuxOption which associates inbound and outbound +// Marshalers to a MIME type in mux. +func WithMarshalerOption(mime string, marshaler Marshaler) ServeMuxOption { + return func(mux *ServeMux) { + if err := mux.marshalers.add(mime, marshaler); err != nil { + panic(err) + } + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler_registry_test.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler_registry_test.go new file mode 100644 index 0000000..194de6f --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler_registry_test.go @@ -0,0 +1,107 @@ +package runtime_test + +import ( + "errors" + "io" + "net/http" + "testing" + + "github.com/grpc-ecosystem/grpc-gateway/runtime" +) + +func TestMarshalerForRequest(t *testing.T) { + r, err := http.NewRequest("GET", "http://example.com", nil) + if err != nil { + t.Fatalf(`http.NewRequest("GET", "http://example.com", nil) failed with %v; want success`, err) + } + r.Header.Set("Accept", "application/x-out") + r.Header.Set("Content-Type", "application/x-in") + + mux := runtime.NewServeMux() + + in, out := runtime.MarshalerForRequest(mux, r) + if _, ok := in.(*runtime.JSONPb); !ok { + t.Errorf("in = %#v; want a runtime.JSONPb", in) + } + if _, ok := out.(*runtime.JSONPb); !ok { + t.Errorf("out = %#v; want a runtime.JSONPb", in) + } + + var marshalers [3]dummyMarshaler + specs := []struct { + opt runtime.ServeMuxOption + + wantIn runtime.Marshaler + wantOut runtime.Marshaler + }{ + { + opt: runtime.WithMarshalerOption(runtime.MIMEWildcard, &marshalers[0]), + wantIn: &marshalers[0], + wantOut: &marshalers[0], + }, + { + opt: runtime.WithMarshalerOption("application/x-in", &marshalers[1]), + wantIn: &marshalers[1], + wantOut: &marshalers[0], + }, + { + opt: runtime.WithMarshalerOption("application/x-out", &marshalers[2]), + wantIn: &marshalers[1], + wantOut: &marshalers[2], + }, + } + for i, spec := range specs { + var opts []runtime.ServeMuxOption + for _, s := range specs[:i+1] { + opts = append(opts, s.opt) + } + mux = runtime.NewServeMux(opts...) + + in, out = runtime.MarshalerForRequest(mux, r) + if got, want := in, spec.wantIn; got != want { + t.Errorf("in = %#v; want %#v", got, want) + } + if got, want := out, spec.wantOut; got != want { + t.Errorf("out = %#v; want %#v", got, want) + } + } + + r.Header.Set("Content-Type", "application/x-another") + in, out = runtime.MarshalerForRequest(mux, r) + if got, want := in, &marshalers[1]; got != want { + t.Errorf("in = %#v; want %#v", got, want) + } + if got, want := out, &marshalers[0]; got != want { + t.Errorf("out = %#v; want %#v", got, want) + } +} + +type dummyMarshaler struct{} + +func (dummyMarshaler) ContentType() string { return "" } +func (dummyMarshaler) Marshal(interface{}) ([]byte, error) { + return nil, errors.New("not implemented") +} + +func (dummyMarshaler) Unmarshal([]byte, interface{}) error { + return errors.New("not implemented") +} + +func (dummyMarshaler) NewDecoder(r io.Reader) runtime.Decoder { + return dummyDecoder{} +} +func (dummyMarshaler) NewEncoder(w io.Writer) runtime.Encoder { + return dummyEncoder{} +} + +type dummyDecoder struct{} + +func (dummyDecoder) Decode(interface{}) error { + return errors.New("not implemented") +} + +type dummyEncoder struct{} + +func (dummyEncoder) Encode(interface{}) error { + return errors.New("not implemented") +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/mux.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/mux.go new file mode 100644 index 0000000..2e6c562 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/mux.go @@ -0,0 +1,132 @@ +package runtime + +import ( + "net/http" + "strings" + + "golang.org/x/net/context" + + "github.com/golang/protobuf/proto" +) + +// A HandlerFunc handles a specific pair of path pattern and HTTP method. +type HandlerFunc func(w http.ResponseWriter, r *http.Request, pathParams map[string]string) + +// ServeMux is a request multiplexer for grpc-gateway. +// It matches http requests to patterns and invokes the corresponding handler. +type ServeMux struct { + // handlers maps HTTP method to a list of handlers. + handlers map[string][]handler + forwardResponseOptions []func(context.Context, http.ResponseWriter, proto.Message) error + marshalers marshalerRegistry +} + +// ServeMuxOption is an option that can be given to a ServeMux on construction. +type ServeMuxOption func(*ServeMux) + +// WithForwardResponseOption returns a ServeMuxOption representing the forwardResponseOption. +// +// forwardResponseOption is an option that will be called on the relevant context.Context, +// http.ResponseWriter, and proto.Message before every forwarded response. +// +// The message may be nil in the case where just a header is being sent. +func WithForwardResponseOption(forwardResponseOption func(context.Context, http.ResponseWriter, proto.Message) error) ServeMuxOption { + return func(serveMux *ServeMux) { + serveMux.forwardResponseOptions = append(serveMux.forwardResponseOptions, forwardResponseOption) + } +} + +// NewServeMux returns a new ServeMux whose internal mapping is empty. +func NewServeMux(opts ...ServeMuxOption) *ServeMux { + serveMux := &ServeMux{ + handlers: make(map[string][]handler), + forwardResponseOptions: make([]func(context.Context, http.ResponseWriter, proto.Message) error, 0), + marshalers: makeMarshalerMIMERegistry(), + } + + for _, opt := range opts { + opt(serveMux) + } + return serveMux +} + +// Handle associates "h" to the pair of HTTP method and path pattern. +func (s *ServeMux) Handle(meth string, pat Pattern, h HandlerFunc) { + s.handlers[meth] = append(s.handlers[meth], handler{pat: pat, h: h}) +} + +// ServeHTTP dispatches the request to the first handler whose pattern matches to r.Method and r.Path. +func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { + path := r.URL.Path + if !strings.HasPrefix(path, "/") { + OtherErrorHandler(w, r, http.StatusText(http.StatusBadRequest), http.StatusBadRequest) + return + } + + components := strings.Split(path[1:], "/") + l := len(components) + var verb string + if idx := strings.LastIndex(components[l-1], ":"); idx == 0 { + OtherErrorHandler(w, r, http.StatusText(http.StatusNotFound), http.StatusNotFound) + return + } else if idx > 0 { + c := components[l-1] + components[l-1], verb = c[:idx], c[idx+1:] + } + + if override := r.Header.Get("X-HTTP-Method-Override"); override != "" && isPathLengthFallback(r) { + r.Method = strings.ToUpper(override) + if err := r.ParseForm(); err != nil { + OtherErrorHandler(w, r, err.Error(), http.StatusBadRequest) + return + } + } + for _, h := range s.handlers[r.Method] { + pathParams, err := h.pat.Match(components, verb) + if err != nil { + continue + } + h.h(w, r, pathParams) + return + } + + // lookup other methods to handle fallback from GET to POST and + // to determine if it is MethodNotAllowed or NotFound. + for m, handlers := range s.handlers { + if m == r.Method { + continue + } + for _, h := range handlers { + pathParams, err := h.pat.Match(components, verb) + if err != nil { + continue + } + // X-HTTP-Method-Override is optional. Always allow fallback to POST. + if isPathLengthFallback(r) { + if err := r.ParseForm(); err != nil { + OtherErrorHandler(w, r, err.Error(), http.StatusBadRequest) + return + } + h.h(w, r, pathParams) + return + } + OtherErrorHandler(w, r, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed) + return + } + } + OtherErrorHandler(w, r, http.StatusText(http.StatusNotFound), http.StatusNotFound) +} + +// GetForwardResponseOptions returns the ForwardResponseOptions associated with this ServeMux. +func (s *ServeMux) GetForwardResponseOptions() []func(context.Context, http.ResponseWriter, proto.Message) error { + return s.forwardResponseOptions +} + +func isPathLengthFallback(r *http.Request) bool { + return r.Method == "POST" && r.Header.Get("Content-Type") == "application/x-www-form-urlencoded" +} + +type handler struct { + pat Pattern + h HandlerFunc +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/mux_test.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/mux_test.go new file mode 100644 index 0000000..bb90a73 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/mux_test.go @@ -0,0 +1,213 @@ +package runtime_test + +import ( + "bytes" + "fmt" + "net/http" + "net/http/httptest" + "testing" + + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" +) + +func TestMuxServeHTTP(t *testing.T) { + type stubPattern struct { + method string + ops []int + pool []string + verb string + } + for _, spec := range []struct { + patterns []stubPattern + + reqMethod string + reqPath string + headers map[string]string + + respStatus int + respContent string + }{ + { + patterns: nil, + reqMethod: "GET", + reqPath: "/", + respStatus: http.StatusNotFound, + }, + { + patterns: []stubPattern{ + { + method: "GET", + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"foo"}, + }, + }, + reqMethod: "GET", + reqPath: "/foo", + respStatus: http.StatusOK, + respContent: "GET /foo", + }, + { + patterns: []stubPattern{ + { + method: "GET", + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"foo"}, + }, + }, + reqMethod: "GET", + reqPath: "/bar", + respStatus: http.StatusNotFound, + }, + { + patterns: []stubPattern{ + { + method: "GET", + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"foo"}, + }, + { + method: "GET", + ops: []int{int(utilities.OpPush), 0}, + }, + }, + reqMethod: "GET", + reqPath: "/foo", + respStatus: http.StatusOK, + respContent: "GET /foo", + }, + { + patterns: []stubPattern{ + { + method: "GET", + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"foo"}, + }, + { + method: "POST", + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"foo"}, + }, + }, + reqMethod: "POST", + reqPath: "/foo", + respStatus: http.StatusOK, + respContent: "POST /foo", + }, + { + patterns: []stubPattern{ + { + method: "GET", + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"foo"}, + }, + }, + reqMethod: "DELETE", + reqPath: "/foo", + respStatus: http.StatusMethodNotAllowed, + }, + { + patterns: []stubPattern{ + { + method: "GET", + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"foo"}, + }, + }, + reqMethod: "POST", + reqPath: "/foo", + headers: map[string]string{ + "Content-Type": "application/x-www-form-urlencoded", + }, + respStatus: http.StatusOK, + respContent: "GET /foo", + }, + { + patterns: []stubPattern{ + { + method: "GET", + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"foo"}, + }, + { + method: "POST", + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"foo"}, + }, + }, + reqMethod: "POST", + reqPath: "/foo", + headers: map[string]string{ + "Content-Type": "application/x-www-form-urlencoded", + "X-HTTP-Method-Override": "GET", + }, + respStatus: http.StatusOK, + respContent: "GET /foo", + }, + { + patterns: []stubPattern{ + { + method: "GET", + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"foo"}, + }, + }, + reqMethod: "POST", + reqPath: "/foo", + headers: map[string]string{ + "Content-Type": "application/json", + }, + respStatus: http.StatusMethodNotAllowed, + }, + { + patterns: []stubPattern{ + { + method: "POST", + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"foo"}, + verb: "bar", + }, + }, + reqMethod: "POST", + reqPath: "/foo:bar", + headers: map[string]string{ + "Content-Type": "application/json", + }, + respStatus: http.StatusOK, + respContent: "POST /foo:bar", + }, + } { + mux := runtime.NewServeMux() + for _, p := range spec.patterns { + func(p stubPattern) { + pat, err := runtime.NewPattern(1, p.ops, p.pool, p.verb) + if err != nil { + t.Fatalf("runtime.NewPattern(1, %#v, %#v, %q) failed with %v; want success", p.ops, p.pool, p.verb, err) + } + mux.Handle(p.method, pat, func(w http.ResponseWriter, r *http.Request, pathParams map[string]string) { + fmt.Fprintf(w, "%s %s", p.method, pat.String()) + }) + }(p) + } + + url := fmt.Sprintf("http://host.example%s", spec.reqPath) + r, err := http.NewRequest(spec.reqMethod, url, bytes.NewReader(nil)) + if err != nil { + t.Fatalf("http.NewRequest(%q, %q, nil) failed with %v; want success", spec.reqMethod, url, err) + } + for name, value := range spec.headers { + r.Header.Set(name, value) + } + w := httptest.NewRecorder() + mux.ServeHTTP(w, r) + + if got, want := w.Code, spec.respStatus; got != want { + t.Errorf("w.Code = %d; want %d; patterns=%v; req=%v", got, want, spec.patterns, r) + } + if spec.respContent != "" { + if got, want := w.Body.String(), spec.respContent; got != want { + t.Errorf("w.Body = %q; want %q; patterns=%v; req=%v", got, want, spec.patterns, r) + } + } + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/pattern.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/pattern.go new file mode 100644 index 0000000..8a9ec2c --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/pattern.go @@ -0,0 +1,227 @@ +package runtime + +import ( + "errors" + "fmt" + "strings" + + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc/grpclog" +) + +var ( + // ErrNotMatch indicates that the given HTTP request path does not match to the pattern. + ErrNotMatch = errors.New("not match to the path pattern") + // ErrInvalidPattern indicates that the given definition of Pattern is not valid. + ErrInvalidPattern = errors.New("invalid pattern") +) + +type op struct { + code utilities.OpCode + operand int +} + +// Pattern is a template pattern of http request paths defined in github.com/googleapis/googleapis/google/api/http.proto. +type Pattern struct { + // ops is a list of operations + ops []op + // pool is a constant pool indexed by the operands or vars. + pool []string + // vars is a list of variables names to be bound by this pattern + vars []string + // stacksize is the max depth of the stack + stacksize int + // tailLen is the length of the fixed-size segments after a deep wildcard + tailLen int + // verb is the VERB part of the path pattern. It is empty if the pattern does not have VERB part. + verb string +} + +// NewPattern returns a new Pattern from the given definition values. +// "ops" is a sequence of op codes. "pool" is a constant pool. +// "verb" is the verb part of the pattern. It is empty if the pattern does not have the part. +// "version" must be 1 for now. +// It returns an error if the given definition is invalid. +func NewPattern(version int, ops []int, pool []string, verb string) (Pattern, error) { + if version != 1 { + grpclog.Printf("unsupported version: %d", version) + return Pattern{}, ErrInvalidPattern + } + + l := len(ops) + if l%2 != 0 { + grpclog.Printf("odd number of ops codes: %d", l) + return Pattern{}, ErrInvalidPattern + } + + var ( + typedOps []op + stack, maxstack int + tailLen int + pushMSeen bool + vars []string + ) + for i := 0; i < l; i += 2 { + op := op{code: utilities.OpCode(ops[i]), operand: ops[i+1]} + switch op.code { + case utilities.OpNop: + continue + case utilities.OpPush: + if pushMSeen { + tailLen++ + } + stack++ + case utilities.OpPushM: + if pushMSeen { + grpclog.Printf("pushM appears twice") + return Pattern{}, ErrInvalidPattern + } + pushMSeen = true + stack++ + case utilities.OpLitPush: + if op.operand < 0 || len(pool) <= op.operand { + grpclog.Printf("negative literal index: %d", op.operand) + return Pattern{}, ErrInvalidPattern + } + if pushMSeen { + tailLen++ + } + stack++ + case utilities.OpConcatN: + if op.operand <= 0 { + grpclog.Printf("negative concat size: %d", op.operand) + return Pattern{}, ErrInvalidPattern + } + stack -= op.operand + if stack < 0 { + grpclog.Print("stack underflow") + return Pattern{}, ErrInvalidPattern + } + stack++ + case utilities.OpCapture: + if op.operand < 0 || len(pool) <= op.operand { + grpclog.Printf("variable name index out of bound: %d", op.operand) + return Pattern{}, ErrInvalidPattern + } + v := pool[op.operand] + op.operand = len(vars) + vars = append(vars, v) + stack-- + if stack < 0 { + grpclog.Printf("stack underflow") + return Pattern{}, ErrInvalidPattern + } + default: + grpclog.Printf("invalid opcode: %d", op.code) + return Pattern{}, ErrInvalidPattern + } + + if maxstack < stack { + maxstack = stack + } + typedOps = append(typedOps, op) + } + return Pattern{ + ops: typedOps, + pool: pool, + vars: vars, + stacksize: maxstack, + tailLen: tailLen, + verb: verb, + }, nil +} + +// MustPattern is a helper function which makes it easier to call NewPattern in variable initialization. +func MustPattern(p Pattern, err error) Pattern { + if err != nil { + grpclog.Fatalf("Pattern initialization failed: %v", err) + } + return p +} + +// Match examines components if it matches to the Pattern. +// If it matches, the function returns a mapping from field paths to their captured values. +// If otherwise, the function returns an error. +func (p Pattern) Match(components []string, verb string) (map[string]string, error) { + if p.verb != verb { + return nil, ErrNotMatch + } + + var pos int + stack := make([]string, 0, p.stacksize) + captured := make([]string, len(p.vars)) + l := len(components) + for _, op := range p.ops { + switch op.code { + case utilities.OpNop: + continue + case utilities.OpPush, utilities.OpLitPush: + if pos >= l { + return nil, ErrNotMatch + } + c := components[pos] + if op.code == utilities.OpLitPush { + if lit := p.pool[op.operand]; c != lit { + return nil, ErrNotMatch + } + } + stack = append(stack, c) + pos++ + case utilities.OpPushM: + end := len(components) + if end < pos+p.tailLen { + return nil, ErrNotMatch + } + end -= p.tailLen + stack = append(stack, strings.Join(components[pos:end], "/")) + pos = end + case utilities.OpConcatN: + n := op.operand + l := len(stack) - n + stack = append(stack[:l], strings.Join(stack[l:], "/")) + case utilities.OpCapture: + n := len(stack) - 1 + captured[op.operand] = stack[n] + stack = stack[:n] + } + } + if pos < l { + return nil, ErrNotMatch + } + bindings := make(map[string]string) + for i, val := range captured { + bindings[p.vars[i]] = val + } + return bindings, nil +} + +// Verb returns the verb part of the Pattern. +func (p Pattern) Verb() string { return p.verb } + +func (p Pattern) String() string { + var stack []string + for _, op := range p.ops { + switch op.code { + case utilities.OpNop: + continue + case utilities.OpPush: + stack = append(stack, "*") + case utilities.OpLitPush: + stack = append(stack, p.pool[op.operand]) + case utilities.OpPushM: + stack = append(stack, "**") + case utilities.OpConcatN: + n := op.operand + l := len(stack) - n + stack = append(stack[:l], strings.Join(stack[l:], "/")) + case utilities.OpCapture: + n := len(stack) - 1 + stack[n] = fmt.Sprintf("{%s=%s}", p.vars[op.operand], stack[n]) + } + } + segs := strings.Join(stack, "/") + if p.verb != "" { + return fmt.Sprintf("/%s:%s", segs, p.verb) + } + return "/" + segs +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/pattern_test.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/pattern_test.go new file mode 100644 index 0000000..8f5a664 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/pattern_test.go @@ -0,0 +1,590 @@ +package runtime + +import ( + "fmt" + "reflect" + "strings" + "testing" + + "github.com/grpc-ecosystem/grpc-gateway/utilities" +) + +const ( + validVersion = 1 + anything = 0 +) + +func TestNewPattern(t *testing.T) { + for _, spec := range []struct { + ops []int + pool []string + verb string + + stackSizeWant, tailLenWant int + }{ + {}, + { + ops: []int{int(utilities.OpNop), anything}, + stackSizeWant: 0, + tailLenWant: 0, + }, + { + ops: []int{int(utilities.OpPush), anything}, + stackSizeWant: 1, + tailLenWant: 0, + }, + { + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"abc"}, + stackSizeWant: 1, + tailLenWant: 0, + }, + { + ops: []int{int(utilities.OpPushM), anything}, + stackSizeWant: 1, + tailLenWant: 0, + }, + { + ops: []int{ + int(utilities.OpPush), anything, + int(utilities.OpConcatN), 1, + }, + stackSizeWant: 1, + tailLenWant: 0, + }, + { + ops: []int{ + int(utilities.OpPush), anything, + int(utilities.OpConcatN), 1, + int(utilities.OpCapture), 0, + }, + pool: []string{"abc"}, + stackSizeWant: 1, + tailLenWant: 0, + }, + { + ops: []int{ + int(utilities.OpPush), anything, + int(utilities.OpLitPush), 0, + int(utilities.OpLitPush), 1, + int(utilities.OpPushM), anything, + int(utilities.OpConcatN), 2, + int(utilities.OpCapture), 2, + }, + pool: []string{"lit1", "lit2", "var1"}, + stackSizeWant: 4, + tailLenWant: 0, + }, + { + ops: []int{ + int(utilities.OpPushM), anything, + int(utilities.OpConcatN), 1, + int(utilities.OpCapture), 2, + int(utilities.OpLitPush), 0, + int(utilities.OpLitPush), 1, + }, + pool: []string{"lit1", "lit2", "var1"}, + stackSizeWant: 2, + tailLenWant: 2, + }, + { + ops: []int{ + int(utilities.OpLitPush), 0, + int(utilities.OpLitPush), 1, + int(utilities.OpPushM), anything, + int(utilities.OpLitPush), 2, + int(utilities.OpConcatN), 3, + int(utilities.OpLitPush), 3, + int(utilities.OpCapture), 4, + }, + pool: []string{"lit1", "lit2", "lit3", "lit4", "var1"}, + stackSizeWant: 4, + tailLenWant: 2, + }, + { + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"abc"}, + verb: "LOCK", + stackSizeWant: 1, + tailLenWant: 0, + }, + } { + pat, err := NewPattern(validVersion, spec.ops, spec.pool, spec.verb) + if err != nil { + t.Errorf("NewPattern(%d, %v, %q, %q) failed with %v; want success", validVersion, spec.ops, spec.pool, spec.verb, err) + continue + } + if got, want := pat.stacksize, spec.stackSizeWant; got != want { + t.Errorf("pat.stacksize = %d; want %d", got, want) + } + if got, want := pat.tailLen, spec.tailLenWant; got != want { + t.Errorf("pat.stacksize = %d; want %d", got, want) + } + } +} + +func TestNewPatternWithWrongOp(t *testing.T) { + for _, spec := range []struct { + ops []int + pool []string + verb string + }{ + { + // op code out of bound + ops: []int{-1, anything}, + }, + { + // op code out of bound + ops: []int{int(utilities.OpEnd), 0}, + }, + { + // odd number of items + ops: []int{int(utilities.OpPush)}, + }, + { + // negative index + ops: []int{int(utilities.OpLitPush), -1}, + pool: []string{"abc"}, + }, + { + // index out of bound + ops: []int{int(utilities.OpLitPush), 1}, + pool: []string{"abc"}, + }, + { + // negative # of segments + ops: []int{int(utilities.OpConcatN), -1}, + pool: []string{"abc"}, + }, + { + // negative index + ops: []int{int(utilities.OpCapture), -1}, + pool: []string{"abc"}, + }, + { + // index out of bound + ops: []int{int(utilities.OpCapture), 1}, + pool: []string{"abc"}, + }, + { + // pushM appears twice + ops: []int{ + int(utilities.OpPushM), anything, + int(utilities.OpLitPush), 0, + int(utilities.OpPushM), anything, + }, + pool: []string{"abc"}, + }, + } { + _, err := NewPattern(validVersion, spec.ops, spec.pool, spec.verb) + if err == nil { + t.Errorf("NewPattern(%d, %v, %q, %q) succeeded; want failure with %v", validVersion, spec.ops, spec.pool, spec.verb, ErrInvalidPattern) + continue + } + if err != ErrInvalidPattern { + t.Errorf("NewPattern(%d, %v, %q, %q) failed with %v; want failure with %v", validVersion, spec.ops, spec.pool, spec.verb, err, ErrInvalidPattern) + continue + } + } +} + +func TestNewPatternWithStackUnderflow(t *testing.T) { + for _, spec := range []struct { + ops []int + pool []string + verb string + }{ + { + ops: []int{int(utilities.OpConcatN), 1}, + }, + { + ops: []int{int(utilities.OpCapture), 0}, + pool: []string{"abc"}, + }, + } { + _, err := NewPattern(validVersion, spec.ops, spec.pool, spec.verb) + if err == nil { + t.Errorf("NewPattern(%d, %v, %q, %q) succeeded; want failure with %v", validVersion, spec.ops, spec.pool, spec.verb, ErrInvalidPattern) + continue + } + if err != ErrInvalidPattern { + t.Errorf("NewPattern(%d, %v, %q, %q) failed with %v; want failure with %v", validVersion, spec.ops, spec.pool, spec.verb, err, ErrInvalidPattern) + continue + } + } +} + +func TestMatch(t *testing.T) { + for _, spec := range []struct { + ops []int + pool []string + verb string + + match []string + notMatch []string + }{ + { + match: []string{""}, + notMatch: []string{"example"}, + }, + { + ops: []int{int(utilities.OpNop), anything}, + match: []string{""}, + notMatch: []string{"example", "path/to/example"}, + }, + { + ops: []int{int(utilities.OpPush), anything}, + match: []string{"abc", "def"}, + notMatch: []string{"", "abc/def"}, + }, + { + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"v1"}, + match: []string{"v1"}, + notMatch: []string{"", "v2"}, + }, + { + ops: []int{int(utilities.OpPushM), anything}, + match: []string{"", "abc", "abc/def", "abc/def/ghi"}, + }, + { + ops: []int{ + int(utilities.OpPushM), anything, + int(utilities.OpLitPush), 0, + }, + pool: []string{"tail"}, + match: []string{"tail", "abc/tail", "abc/def/tail"}, + notMatch: []string{ + "", "abc", "abc/def", + "tail/extra", "abc/tail/extra", "abc/def/tail/extra", + }, + }, + { + ops: []int{ + int(utilities.OpLitPush), 0, + int(utilities.OpLitPush), 1, + int(utilities.OpPush), anything, + int(utilities.OpConcatN), 1, + int(utilities.OpCapture), 2, + }, + pool: []string{"v1", "bucket", "name"}, + match: []string{"v1/bucket/my-bucket", "v1/bucket/our-bucket"}, + notMatch: []string{ + "", + "v1", + "v1/bucket", + "v2/bucket/my-bucket", + "v1/pubsub/my-topic", + }, + }, + { + ops: []int{ + int(utilities.OpLitPush), 0, + int(utilities.OpLitPush), 1, + int(utilities.OpPushM), anything, + int(utilities.OpConcatN), 2, + int(utilities.OpCapture), 2, + }, + pool: []string{"v1", "o", "name"}, + match: []string{ + "v1/o", + "v1/o/my-bucket", + "v1/o/our-bucket", + "v1/o/my-bucket/dir", + "v1/o/my-bucket/dir/dir2", + "v1/o/my-bucket/dir/dir2/obj", + }, + notMatch: []string{ + "", + "v1", + "v2/o/my-bucket", + "v1/b/my-bucket", + }, + }, + { + ops: []int{ + int(utilities.OpLitPush), 0, + int(utilities.OpLitPush), 1, + int(utilities.OpPush), anything, + int(utilities.OpConcatN), 2, + int(utilities.OpCapture), 2, + int(utilities.OpLitPush), 3, + int(utilities.OpPush), anything, + int(utilities.OpConcatN), 1, + int(utilities.OpCapture), 4, + }, + pool: []string{"v2", "b", "name", "o", "oname"}, + match: []string{ + "v2/b/my-bucket/o/obj", + "v2/b/our-bucket/o/obj", + "v2/b/my-bucket/o/dir", + }, + notMatch: []string{ + "", + "v2", + "v2/b", + "v2/b/my-bucket", + "v2/b/my-bucket/o", + }, + }, + { + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"v1"}, + verb: "LOCK", + match: []string{"v1:LOCK"}, + notMatch: []string{"v1", "LOCK"}, + }, + } { + pat, err := NewPattern(validVersion, spec.ops, spec.pool, spec.verb) + if err != nil { + t.Errorf("NewPattern(%d, %v, %q, %q) failed with %v; want success", validVersion, spec.ops, spec.pool, spec.verb, err) + continue + } + + for _, path := range spec.match { + _, err = pat.Match(segments(path)) + if err != nil { + t.Errorf("pat.Match(%q) failed with %v; want success; pattern = (%v, %q)", path, err, spec.ops, spec.pool) + } + } + + for _, path := range spec.notMatch { + _, err = pat.Match(segments(path)) + if err == nil { + t.Errorf("pat.Match(%q) succeeded; want failure with %v; pattern = (%v, %q)", path, ErrNotMatch, spec.ops, spec.pool) + continue + } + if err != ErrNotMatch { + t.Errorf("pat.Match(%q) failed with %v; want failure with %v; pattern = (%v, %q)", spec.notMatch, err, ErrNotMatch, spec.ops, spec.pool) + } + } + } +} + +func TestMatchWithBinding(t *testing.T) { + for _, spec := range []struct { + ops []int + pool []string + path string + verb string + + want map[string]string + }{ + { + want: make(map[string]string), + }, + { + ops: []int{int(utilities.OpNop), anything}, + want: make(map[string]string), + }, + { + ops: []int{int(utilities.OpPush), anything}, + path: "abc", + want: make(map[string]string), + }, + { + ops: []int{int(utilities.OpPush), anything}, + verb: "LOCK", + path: "abc:LOCK", + want: make(map[string]string), + }, + { + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"endpoint"}, + path: "endpoint", + want: make(map[string]string), + }, + { + ops: []int{int(utilities.OpPushM), anything}, + path: "abc/def/ghi", + want: make(map[string]string), + }, + { + ops: []int{ + int(utilities.OpLitPush), 0, + int(utilities.OpLitPush), 1, + int(utilities.OpPush), anything, + int(utilities.OpConcatN), 1, + int(utilities.OpCapture), 2, + }, + pool: []string{"v1", "bucket", "name"}, + path: "v1/bucket/my-bucket", + want: map[string]string{ + "name": "my-bucket", + }, + }, + { + ops: []int{ + int(utilities.OpLitPush), 0, + int(utilities.OpLitPush), 1, + int(utilities.OpPush), anything, + int(utilities.OpConcatN), 1, + int(utilities.OpCapture), 2, + }, + pool: []string{"v1", "bucket", "name"}, + verb: "LOCK", + path: "v1/bucket/my-bucket:LOCK", + want: map[string]string{ + "name": "my-bucket", + }, + }, + { + ops: []int{ + int(utilities.OpLitPush), 0, + int(utilities.OpLitPush), 1, + int(utilities.OpPushM), anything, + int(utilities.OpConcatN), 2, + int(utilities.OpCapture), 2, + }, + pool: []string{"v1", "o", "name"}, + path: "v1/o/my-bucket/dir/dir2/obj", + want: map[string]string{ + "name": "o/my-bucket/dir/dir2/obj", + }, + }, + { + ops: []int{ + int(utilities.OpLitPush), 0, + int(utilities.OpLitPush), 1, + int(utilities.OpPushM), anything, + int(utilities.OpLitPush), 2, + int(utilities.OpConcatN), 3, + int(utilities.OpCapture), 4, + int(utilities.OpLitPush), 3, + }, + pool: []string{"v1", "o", ".ext", "tail", "name"}, + path: "v1/o/my-bucket/dir/dir2/obj/.ext/tail", + want: map[string]string{ + "name": "o/my-bucket/dir/dir2/obj/.ext", + }, + }, + { + ops: []int{ + int(utilities.OpLitPush), 0, + int(utilities.OpLitPush), 1, + int(utilities.OpPush), anything, + int(utilities.OpConcatN), 2, + int(utilities.OpCapture), 2, + int(utilities.OpLitPush), 3, + int(utilities.OpPush), anything, + int(utilities.OpConcatN), 1, + int(utilities.OpCapture), 4, + }, + pool: []string{"v2", "b", "name", "o", "oname"}, + path: "v2/b/my-bucket/o/obj", + want: map[string]string{ + "name": "b/my-bucket", + "oname": "obj", + }, + }, + } { + pat, err := NewPattern(validVersion, spec.ops, spec.pool, spec.verb) + if err != nil { + t.Errorf("NewPattern(%d, %v, %q, %q) failed with %v; want success", validVersion, spec.ops, spec.pool, spec.verb, err) + continue + } + + got, err := pat.Match(segments(spec.path)) + if err != nil { + t.Errorf("pat.Match(%q) failed with %v; want success; pattern = (%v, %q)", spec.path, err, spec.ops, spec.pool) + } + if !reflect.DeepEqual(got, spec.want) { + t.Errorf("pat.Match(%q) = %q; want %q; pattern = (%v, %q)", spec.path, got, spec.want, spec.ops, spec.pool) + } + } +} + +func segments(path string) (components []string, verb string) { + if path == "" { + return nil, "" + } + components = strings.Split(path, "/") + l := len(components) + c := components[l-1] + if idx := strings.LastIndex(c, ":"); idx >= 0 { + components[l-1], verb = c[:idx], c[idx+1:] + } + return components, verb +} + +func TestPatternString(t *testing.T) { + for _, spec := range []struct { + ops []int + pool []string + + want string + }{ + { + want: "/", + }, + { + ops: []int{int(utilities.OpNop), anything}, + want: "/", + }, + { + ops: []int{int(utilities.OpPush), anything}, + want: "/*", + }, + { + ops: []int{int(utilities.OpLitPush), 0}, + pool: []string{"endpoint"}, + want: "/endpoint", + }, + { + ops: []int{int(utilities.OpPushM), anything}, + want: "/**", + }, + { + ops: []int{ + int(utilities.OpPush), anything, + int(utilities.OpConcatN), 1, + }, + want: "/*", + }, + { + ops: []int{ + int(utilities.OpPush), anything, + int(utilities.OpConcatN), 1, + int(utilities.OpCapture), 0, + }, + pool: []string{"name"}, + want: "/{name=*}", + }, + { + ops: []int{ + int(utilities.OpLitPush), 0, + int(utilities.OpLitPush), 1, + int(utilities.OpPush), anything, + int(utilities.OpConcatN), 2, + int(utilities.OpCapture), 2, + int(utilities.OpLitPush), 3, + int(utilities.OpPushM), anything, + int(utilities.OpLitPush), 4, + int(utilities.OpConcatN), 3, + int(utilities.OpCapture), 6, + int(utilities.OpLitPush), 5, + }, + pool: []string{"v1", "buckets", "bucket_name", "objects", ".ext", "tail", "name"}, + want: "/v1/{bucket_name=buckets/*}/{name=objects/**/.ext}/tail", + }, + } { + p, err := NewPattern(validVersion, spec.ops, spec.pool, "") + if err != nil { + t.Errorf("NewPattern(%d, %v, %q, %q) failed with %v; want success", validVersion, spec.ops, spec.pool, "", err) + continue + } + if got, want := p.String(), spec.want; got != want { + t.Errorf("%#v.String() = %q; want %q", p, got, want) + } + + verb := "LOCK" + p, err = NewPattern(validVersion, spec.ops, spec.pool, verb) + if err != nil { + t.Errorf("NewPattern(%d, %v, %q, %q) failed with %v; want success", validVersion, spec.ops, spec.pool, verb, err) + continue + } + if got, want := p.String(), fmt.Sprintf("%s:%s", spec.want, verb); got != want { + t.Errorf("%#v.String() = %q; want %q", p, got, want) + } + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/proto2_convert.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/proto2_convert.go new file mode 100644 index 0000000..a3151e2 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/proto2_convert.go @@ -0,0 +1,80 @@ +package runtime + +import ( + "github.com/golang/protobuf/proto" +) + +// StringP returns a pointer to a string whose pointee is same as the given string value. +func StringP(val string) (*string, error) { + return proto.String(val), nil +} + +// BoolP parses the given string representation of a boolean value, +// and returns a pointer to a bool whose value is same as the parsed value. +func BoolP(val string) (*bool, error) { + b, err := Bool(val) + if err != nil { + return nil, err + } + return proto.Bool(b), nil +} + +// Float64P parses the given string representation of a floating point number, +// and returns a pointer to a float64 whose value is same as the parsed number. +func Float64P(val string) (*float64, error) { + f, err := Float64(val) + if err != nil { + return nil, err + } + return proto.Float64(f), nil +} + +// Float32P parses the given string representation of a floating point number, +// and returns a pointer to a float32 whose value is same as the parsed number. +func Float32P(val string) (*float32, error) { + f, err := Float32(val) + if err != nil { + return nil, err + } + return proto.Float32(f), nil +} + +// Int64P parses the given string representation of an integer +// and returns a pointer to a int64 whose value is same as the parsed integer. +func Int64P(val string) (*int64, error) { + i, err := Int64(val) + if err != nil { + return nil, err + } + return proto.Int64(i), nil +} + +// Int32P parses the given string representation of an integer +// and returns a pointer to a int32 whose value is same as the parsed integer. +func Int32P(val string) (*int32, error) { + i, err := Int32(val) + if err != nil { + return nil, err + } + return proto.Int32(i), err +} + +// Uint64P parses the given string representation of an integer +// and returns a pointer to a uint64 whose value is same as the parsed integer. +func Uint64P(val string) (*uint64, error) { + i, err := Uint64(val) + if err != nil { + return nil, err + } + return proto.Uint64(i), err +} + +// Uint32P parses the given string representation of an integer +// and returns a pointer to a uint32 whose value is same as the parsed integer. +func Uint32P(val string) (*uint32, error) { + i, err := Uint32(val) + if err != nil { + return nil, err + } + return proto.Uint32(i), err +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/query.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/query.go new file mode 100644 index 0000000..4b03121 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/query.go @@ -0,0 +1,237 @@ +package runtime + +import ( + "fmt" + "net/url" + "reflect" + "strconv" + "strings" + "time" + + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc/grpclog" +) + +// PopulateQueryParameters populates "values" into "msg". +// A value is ignored if its key starts with one of the elements in "filter". +func PopulateQueryParameters(msg proto.Message, values url.Values, filter *utilities.DoubleArray) error { + for key, values := range values { + fieldPath := strings.Split(key, ".") + if filter.HasCommonPrefix(fieldPath) { + continue + } + if err := populateFieldValueFromPath(msg, fieldPath, values); err != nil { + return err + } + } + return nil +} + +// PopulateFieldFromPath sets a value in a nested Protobuf structure. +// It instantiates missing protobuf fields as it goes. +func PopulateFieldFromPath(msg proto.Message, fieldPathString string, value string) error { + fieldPath := strings.Split(fieldPathString, ".") + return populateFieldValueFromPath(msg, fieldPath, []string{value}) +} + +func populateFieldValueFromPath(msg proto.Message, fieldPath []string, values []string) error { + m := reflect.ValueOf(msg) + if m.Kind() != reflect.Ptr { + return fmt.Errorf("unexpected type %T: %v", msg, msg) + } + var props *proto.Properties + m = m.Elem() + for i, fieldName := range fieldPath { + isLast := i == len(fieldPath)-1 + if !isLast && m.Kind() != reflect.Struct { + return fmt.Errorf("non-aggregate type in the mid of path: %s", strings.Join(fieldPath, ".")) + } + var f reflect.Value + var err error + f, props, err = fieldByProtoName(m, fieldName) + if err != nil { + return err + } else if !f.IsValid() { + grpclog.Printf("field not found in %T: %s", msg, strings.Join(fieldPath, ".")) + return nil + } + + switch f.Kind() { + case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, reflect.String, reflect.Uint32, reflect.Uint64: + if !isLast { + return fmt.Errorf("unexpected nested field %s in %s", fieldPath[i+1], strings.Join(fieldPath[:i+1], ".")) + } + m = f + case reflect.Slice: + // TODO(yugui) Support []byte + if !isLast { + return fmt.Errorf("unexpected repeated field in %s", strings.Join(fieldPath, ".")) + } + return populateRepeatedField(f, values, props) + case reflect.Ptr: + if f.IsNil() { + m = reflect.New(f.Type().Elem()) + f.Set(m.Convert(f.Type())) + } + m = f.Elem() + continue + case reflect.Struct: + m = f + continue + default: + return fmt.Errorf("unexpected type %s in %T", f.Type(), msg) + } + } + switch len(values) { + case 0: + return fmt.Errorf("no value of field: %s", strings.Join(fieldPath, ".")) + case 1: + default: + grpclog.Printf("too many field values: %s", strings.Join(fieldPath, ".")) + } + return populateField(m, values[0], props) +} + +// fieldByProtoName looks up a field whose corresponding protobuf field name is "name". +// "m" must be a struct value. It returns zero reflect.Value if no such field found. +func fieldByProtoName(m reflect.Value, name string) (reflect.Value, *proto.Properties, error) { + props := proto.GetProperties(m.Type()) + + // look up field name in oneof map + if op, ok := props.OneofTypes[name]; ok { + v := reflect.New(op.Type.Elem()) + field := m.Field(op.Field) + if !field.IsNil() { + return reflect.Value{}, nil, fmt.Errorf("field already set for %s oneof", props.Prop[op.Field].OrigName) + } + field.Set(v) + return v.Elem().Field(0), op.Prop, nil + } + + for _, p := range props.Prop { + if p.OrigName == name { + return m.FieldByName(p.Name), p, nil + } + } + return reflect.Value{}, nil, nil +} + +func populateRepeatedField(f reflect.Value, values []string, props *proto.Properties) error { + elemType := f.Type().Elem() + + // is the destination field a slice of an enumeration type? + if enumValMap := proto.EnumValueMap(props.Enum); enumValMap != nil { + return populateFieldEnumRepeated(f, values, enumValMap) + } + + conv, ok := convFromType[elemType.Kind()] + if !ok { + return fmt.Errorf("unsupported field type %s", elemType) + } + f.Set(reflect.MakeSlice(f.Type(), len(values), len(values)).Convert(f.Type())) + for i, v := range values { + result := conv.Call([]reflect.Value{reflect.ValueOf(v)}) + if err := result[1].Interface(); err != nil { + return err.(error) + } + f.Index(i).Set(result[0].Convert(f.Index(i).Type())) + } + return nil +} + +func populateField(f reflect.Value, value string, props *proto.Properties) error { + // Handle well known type + type wkt interface { + XXX_WellKnownType() string + } + if wkt, ok := f.Addr().Interface().(wkt); ok { + switch wkt.XXX_WellKnownType() { + case "Timestamp": + if value == "null" { + f.Field(0).SetInt(0) + f.Field(1).SetInt(0) + return nil + } + + t, err := time.Parse(time.RFC3339Nano, value) + if err != nil { + return fmt.Errorf("bad Timestamp: %v", err) + } + f.Field(0).SetInt(int64(t.Unix())) + f.Field(1).SetInt(int64(t.Nanosecond())) + return nil + } + } + + // is the destination field an enumeration type? + if enumValMap := proto.EnumValueMap(props.Enum); enumValMap != nil { + return populateFieldEnum(f, value, enumValMap) + } + + conv, ok := convFromType[f.Kind()] + if !ok { + return fmt.Errorf("unsupported field type %T", f) + } + result := conv.Call([]reflect.Value{reflect.ValueOf(value)}) + if err := result[1].Interface(); err != nil { + return err.(error) + } + f.Set(result[0].Convert(f.Type())) + return nil +} + +func convertEnum(value string, t reflect.Type, enumValMap map[string]int32) (reflect.Value, error) { + // see if it's an enumeration string + if enumVal, ok := enumValMap[value]; ok { + return reflect.ValueOf(enumVal).Convert(t), nil + } + + // check for an integer that matches an enumeration value + eVal, err := strconv.Atoi(value) + if err != nil { + return reflect.Value{}, fmt.Errorf("%s is not a valid %s", value, t) + } + for _, v := range enumValMap { + if v == int32(eVal) { + return reflect.ValueOf(eVal).Convert(t), nil + } + } + return reflect.Value{}, fmt.Errorf("%s is not a valid %s", value, t) +} + +func populateFieldEnum(f reflect.Value, value string, enumValMap map[string]int32) error { + cval, err := convertEnum(value, f.Type(), enumValMap) + if err != nil { + return err + } + f.Set(cval) + return nil +} + +func populateFieldEnumRepeated(f reflect.Value, values []string, enumValMap map[string]int32) error { + elemType := f.Type().Elem() + f.Set(reflect.MakeSlice(f.Type(), len(values), len(values)).Convert(f.Type())) + for i, v := range values { + result, err := convertEnum(v, elemType, enumValMap) + if err != nil { + return err + } + f.Index(i).Set(result) + } + return nil +} + +var ( + convFromType = map[reflect.Kind]reflect.Value{ + reflect.String: reflect.ValueOf(String), + reflect.Bool: reflect.ValueOf(Bool), + reflect.Float64: reflect.ValueOf(Float64), + reflect.Float32: reflect.ValueOf(Float32), + reflect.Int64: reflect.ValueOf(Int64), + reflect.Int32: reflect.ValueOf(Int32), + reflect.Uint64: reflect.ValueOf(Uint64), + reflect.Uint32: reflect.ValueOf(Uint32), + // TODO(yugui) Support []byte + } +) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/query_test.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/query_test.go new file mode 100644 index 0000000..07262fa --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/query_test.go @@ -0,0 +1,614 @@ +package runtime_test + +import ( + "errors" + "fmt" + "net/url" + "reflect" + "testing" + + "time" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "github.com/golang/protobuf/ptypes/timestamp" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" +) + +func TestPopulateParameters(t *testing.T) { + timeT := time.Date(2016, time.December, 15, 12, 23, 32, 49, time.UTC) + timeStr := timeT.Format(time.RFC3339Nano) + timePb, err := ptypes.TimestampProto(timeT) + if err != nil { + t.Fatalf("Couldn't setup timestamp in Protobuf format: %v", err) + } + + for _, spec := range []struct { + values url.Values + filter *utilities.DoubleArray + want proto.Message + wanterr error + }{ + { + values: url.Values{ + "float_value": {"1.5"}, + "double_value": {"2.5"}, + "int64_value": {"-1"}, + "int32_value": {"-2"}, + "uint64_value": {"3"}, + "uint32_value": {"4"}, + "bool_value": {"true"}, + "string_value": {"str"}, + "repeated_value": {"a", "b", "c"}, + "enum_value": {"1"}, + "repeated_enum": {"1", "2", "0"}, + "timestamp_value": {timeStr}, + }, + filter: utilities.NewDoubleArray(nil), + want: &proto3Message{ + FloatValue: 1.5, + DoubleValue: 2.5, + Int64Value: -1, + Int32Value: -2, + Uint64Value: 3, + Uint32Value: 4, + BoolValue: true, + StringValue: "str", + RepeatedValue: []string{"a", "b", "c"}, + EnumValue: EnumValue_Y, + RepeatedEnum: []EnumValue{EnumValue_Y, EnumValue_Z, EnumValue_X}, + TimestampValue: timePb, + }, + }, + { + values: url.Values{ + "enum_value": {"EnumValue_Z"}, + "repeated_enum": {"EnumValue_X", "2", "0"}, + }, + filter: utilities.NewDoubleArray(nil), + want: &proto3Message{ + EnumValue: EnumValue_Z, + RepeatedEnum: []EnumValue{EnumValue_X, EnumValue_Z, EnumValue_X}, + }, + }, + { + values: url.Values{ + "float_value": {"1.5"}, + "double_value": {"2.5"}, + "int64_value": {"-1"}, + "int32_value": {"-2"}, + "uint64_value": {"3"}, + "uint32_value": {"4"}, + "bool_value": {"true"}, + "string_value": {"str"}, + "repeated_value": {"a", "b", "c"}, + "enum_value": {"1"}, + "repeated_enum": {"1", "2", "0"}, + }, + filter: utilities.NewDoubleArray(nil), + want: &proto2Message{ + FloatValue: proto.Float32(1.5), + DoubleValue: proto.Float64(2.5), + Int64Value: proto.Int64(-1), + Int32Value: proto.Int32(-2), + Uint64Value: proto.Uint64(3), + Uint32Value: proto.Uint32(4), + BoolValue: proto.Bool(true), + StringValue: proto.String("str"), + RepeatedValue: []string{"a", "b", "c"}, + EnumValue: EnumValue_Y, + RepeatedEnum: []EnumValue{EnumValue_Y, EnumValue_Z, EnumValue_X}, + }, + }, + { + values: url.Values{ + "nested.nested.nested.repeated_value": {"a", "b", "c"}, + "nested.nested.nested.string_value": {"s"}, + "nested.nested.string_value": {"t"}, + "nested.string_value": {"u"}, + "nested_non_null.string_value": {"v"}, + }, + filter: utilities.NewDoubleArray(nil), + want: &proto3Message{ + Nested: &proto2Message{ + Nested: &proto3Message{ + Nested: &proto2Message{ + RepeatedValue: []string{"a", "b", "c"}, + StringValue: proto.String("s"), + }, + StringValue: "t", + }, + StringValue: proto.String("u"), + }, + NestedNonNull: proto2Message{ + StringValue: proto.String("v"), + }, + }, + }, + { + values: url.Values{ + "uint64_value": {"1", "2", "3", "4", "5"}, + }, + filter: utilities.NewDoubleArray(nil), + want: &proto3Message{ + Uint64Value: 1, + }, + }, + { + values: url.Values{ + "oneof_string_value": {"foobar"}, + }, + filter: utilities.NewDoubleArray(nil), + want: &proto3Message{ + OneofValue: &proto3Message_OneofStringValue{"foobar"}, + }, + }, + { + values: url.Values{ + "oneof_bool_value": {"true"}, + }, + filter: utilities.NewDoubleArray(nil), + want: &proto3Message{ + OneofValue: &proto3Message_OneofBoolValue{true}, + }, + }, + { + // Don't allow setting a oneof more than once + values: url.Values{ + "oneof_bool_value": {"true"}, + "oneof_string_value": {"foobar"}, + }, + filter: utilities.NewDoubleArray(nil), + want: &proto3Message{}, + wanterr: errors.New("field already set for oneof_value oneof"), + }, + } { + msg := proto.Clone(spec.want) + msg.Reset() + err := runtime.PopulateQueryParameters(msg, spec.values, spec.filter) + if spec.wanterr != nil { + if !reflect.DeepEqual(err, spec.wanterr) { + t.Errorf("runtime.PopulateQueryParameters(msg, %v, %v) failed with %v; want error %v", spec.values, spec.filter, err, spec.wanterr) + } + continue + } + + if err != nil { + t.Errorf("runtime.PopulateQueryParameters(msg, %v, %v) failed with %v; want success", spec.values, spec.filter, err) + continue + } + if got, want := msg, spec.want; !proto.Equal(got, want) { + t.Errorf("runtime.PopulateQueryParameters(msg, %v, %v = %v; want %v", spec.values, spec.filter, got, want) + } + } +} + +func TestPopulateParametersWithFilters(t *testing.T) { + for _, spec := range []struct { + values url.Values + filter *utilities.DoubleArray + want proto.Message + }{ + { + values: url.Values{ + "bool_value": {"true"}, + "string_value": {"str"}, + "repeated_value": {"a", "b", "c"}, + }, + filter: utilities.NewDoubleArray([][]string{ + {"bool_value"}, {"repeated_value"}, + }), + want: &proto3Message{ + StringValue: "str", + }, + }, + { + values: url.Values{ + "nested.nested.bool_value": {"true"}, + "nested.nested.string_value": {"str"}, + "nested.string_value": {"str"}, + "string_value": {"str"}, + }, + filter: utilities.NewDoubleArray([][]string{ + {"nested"}, + }), + want: &proto3Message{ + StringValue: "str", + }, + }, + { + values: url.Values{ + "nested.nested.bool_value": {"true"}, + "nested.nested.string_value": {"str"}, + "nested.string_value": {"str"}, + "string_value": {"str"}, + }, + filter: utilities.NewDoubleArray([][]string{ + {"nested", "nested"}, + }), + want: &proto3Message{ + Nested: &proto2Message{ + StringValue: proto.String("str"), + }, + StringValue: "str", + }, + }, + { + values: url.Values{ + "nested.nested.bool_value": {"true"}, + "nested.nested.string_value": {"str"}, + "nested.string_value": {"str"}, + "string_value": {"str"}, + }, + filter: utilities.NewDoubleArray([][]string{ + {"nested", "nested", "string_value"}, + }), + want: &proto3Message{ + Nested: &proto2Message{ + StringValue: proto.String("str"), + Nested: &proto3Message{ + BoolValue: true, + }, + }, + StringValue: "str", + }, + }, + } { + msg := proto.Clone(spec.want) + msg.Reset() + err := runtime.PopulateQueryParameters(msg, spec.values, spec.filter) + if err != nil { + t.Errorf("runtime.PoplateQueryParameters(msg, %v, %v) failed with %v; want success", spec.values, spec.filter, err) + continue + } + if got, want := msg, spec.want; !proto.Equal(got, want) { + t.Errorf("runtime.PopulateQueryParameters(msg, %v, %v = %v; want %v", spec.values, spec.filter, got, want) + } + } +} + +func TestPopulateQueryParametersWithInvalidNestedParameters(t *testing.T) { + for _, spec := range []struct { + msg proto.Message + values url.Values + filter *utilities.DoubleArray + }{ + { + msg: &proto3Message{}, + values: url.Values{ + "float_value.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + { + msg: &proto3Message{}, + values: url.Values{ + "double_value.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + { + msg: &proto3Message{}, + values: url.Values{ + "int64_value.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + { + msg: &proto3Message{}, + values: url.Values{ + "int32_value.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + { + msg: &proto3Message{}, + values: url.Values{ + "uint64_value.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + { + msg: &proto3Message{}, + values: url.Values{ + "uint32_value.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + { + msg: &proto3Message{}, + values: url.Values{ + "bool_value.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + { + msg: &proto3Message{}, + values: url.Values{ + "string_value.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + { + msg: &proto3Message{}, + values: url.Values{ + "repeated_value.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + { + msg: &proto3Message{}, + values: url.Values{ + "enum_value.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + { + msg: &proto3Message{}, + values: url.Values{ + "enum_value.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + { + msg: &proto3Message{}, + values: url.Values{ + "repeated_enum.nested": {"test"}, + }, + filter: utilities.NewDoubleArray(nil), + }, + } { + spec.msg.Reset() + err := runtime.PopulateQueryParameters(spec.msg, spec.values, spec.filter) + if err == nil { + t.Errorf("runtime.PopulateQueryParameters(msg, %v, %v) did not fail; want error", spec.values, spec.filter) + } + } +} + +type proto3Message struct { + Nested *proto2Message `protobuf:"bytes,1,opt,name=nested" json:"nested,omitempty"` + NestedNonNull proto2Message `protobuf:"bytes,15,opt,name=nested_non_null" json:"nested_non_null,omitempty"` + FloatValue float32 `protobuf:"fixed32,2,opt,name=float_value" json:"float_value,omitempty"` + DoubleValue float64 `protobuf:"fixed64,3,opt,name=double_value" json:"double_value,omitempty"` + Int64Value int64 `protobuf:"varint,4,opt,name=int64_value" json:"int64_value,omitempty"` + Int32Value int32 `protobuf:"varint,5,opt,name=int32_value" json:"int32_value,omitempty"` + Uint64Value uint64 `protobuf:"varint,6,opt,name=uint64_value" json:"uint64_value,omitempty"` + Uint32Value uint32 `protobuf:"varint,7,opt,name=uint32_value" json:"uint32_value,omitempty"` + BoolValue bool `protobuf:"varint,8,opt,name=bool_value" json:"bool_value,omitempty"` + StringValue string `protobuf:"bytes,9,opt,name=string_value" json:"string_value,omitempty"` + RepeatedValue []string `protobuf:"bytes,10,rep,name=repeated_value" json:"repeated_value,omitempty"` + EnumValue EnumValue `protobuf:"varint,11,opt,name=enum_value,json=enumValue,enum=runtime_test_api.EnumValue" json:"enum_value,omitempty"` + RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeated_enum,enum=runtime_test_api.EnumValue" json:"repeated_enum,omitempty"` + TimestampValue *timestamp.Timestamp `protobuf:"bytes,16,opt,name=timestamp_value" json:"timestamp_value,omitempty"` + OneofValue proto3Message_OneofValue `protobuf_oneof:"oneof_value"` +} + +func (m *proto3Message) Reset() { *m = proto3Message{} } +func (m *proto3Message) String() string { return proto.CompactTextString(m) } +func (*proto3Message) ProtoMessage() {} + +func (m *proto3Message) GetNested() *proto2Message { + if m != nil { + return m.Nested + } + return nil +} + +type proto3Message_OneofValue interface { + proto3Message_OneofValue() +} + +type proto3Message_OneofBoolValue struct { + OneofBoolValue bool `protobuf:"varint,13,opt,name=oneof_bool_value,json=oneofBoolValue,oneof"` +} +type proto3Message_OneofStringValue struct { + OneofStringValue string `protobuf:"bytes,14,opt,name=oneof_string_value,json=oneofStringValue,oneof"` +} + +func (*proto3Message_OneofBoolValue) proto3Message_OneofValue() {} +func (*proto3Message_OneofStringValue) proto3Message_OneofValue() {} + +func (m *proto3Message) GetOneofValue() proto3Message_OneofValue { + if m != nil { + return m.OneofValue + } + return nil +} + +func (m *proto3Message) GetOneofBoolValue() bool { + if x, ok := m.GetOneofValue().(*proto3Message_OneofBoolValue); ok { + return x.OneofBoolValue + } + return false +} + +func (m *proto3Message) GetOneofStringValue() string { + if x, ok := m.GetOneofValue().(*proto3Message_OneofStringValue); ok { + return x.OneofStringValue + } + return "" +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*proto3Message) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _proto3Message_OneofMarshaler, _proto3Message_OneofUnmarshaler, _proto3Message_OneofSizer, []interface{}{ + (*proto3Message_OneofBoolValue)(nil), + (*proto3Message_OneofStringValue)(nil), + } +} + +func _proto3Message_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*proto3Message) + // oneof_value + switch x := m.OneofValue.(type) { + case *proto3Message_OneofBoolValue: + t := uint64(0) + if x.OneofBoolValue { + t = 1 + } + b.EncodeVarint(13<<3 | proto.WireVarint) + b.EncodeVarint(t) + case *proto3Message_OneofStringValue: + b.EncodeVarint(14<<3 | proto.WireBytes) + b.EncodeStringBytes(x.OneofStringValue) + case nil: + default: + return fmt.Errorf("proto3Message.OneofValue has unexpected type %T", x) + } + return nil +} + +func _proto3Message_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*proto3Message) + switch tag { + case 14: // oneof_value.oneof_bool_value + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.OneofValue = &proto3Message_OneofBoolValue{x != 0} + return true, err + case 15: // oneof_value.oneof_string_value + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.OneofValue = &proto3Message_OneofStringValue{x} + return true, err + default: + return false, nil + } +} + +func _proto3Message_OneofSizer(msg proto.Message) (n int) { + m := msg.(*proto3Message) + // oneof_value + switch x := m.OneofValue.(type) { + case *proto3Message_OneofBoolValue: + n += proto.SizeVarint(14<<3 | proto.WireVarint) + n += 1 + case *proto3Message_OneofStringValue: + n += proto.SizeVarint(15<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.OneofStringValue))) + n += len(x.OneofStringValue) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type proto2Message struct { + Nested *proto3Message `protobuf:"bytes,1,opt,name=nested" json:"nested,omitempty"` + FloatValue *float32 `protobuf:"fixed32,2,opt,name=float_value" json:"float_value,omitempty"` + DoubleValue *float64 `protobuf:"fixed64,3,opt,name=double_value" json:"double_value,omitempty"` + Int64Value *int64 `protobuf:"varint,4,opt,name=int64_value" json:"int64_value,omitempty"` + Int32Value *int32 `protobuf:"varint,5,opt,name=int32_value" json:"int32_value,omitempty"` + Uint64Value *uint64 `protobuf:"varint,6,opt,name=uint64_value" json:"uint64_value,omitempty"` + Uint32Value *uint32 `protobuf:"varint,7,opt,name=uint32_value" json:"uint32_value,omitempty"` + BoolValue *bool `protobuf:"varint,8,opt,name=bool_value" json:"bool_value,omitempty"` + StringValue *string `protobuf:"bytes,9,opt,name=string_value" json:"string_value,omitempty"` + RepeatedValue []string `protobuf:"bytes,10,rep,name=repeated_value" json:"repeated_value,omitempty"` + EnumValue EnumValue `protobuf:"varint,11,opt,name=enum_value,json=enumValue,enum=runtime_test_api.EnumValue" json:"enum_value,omitempty"` + RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeated_enum,enum=runtime_test_api.EnumValue" json:"repeated_enum,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *proto2Message) Reset() { *m = proto2Message{} } +func (m *proto2Message) String() string { return proto.CompactTextString(m) } +func (*proto2Message) ProtoMessage() {} + +func (m *proto2Message) GetNested() *proto3Message { + if m != nil { + return m.Nested + } + return nil +} + +func (m *proto2Message) GetFloatValue() float32 { + if m != nil && m.FloatValue != nil { + return *m.FloatValue + } + return 0 +} + +func (m *proto2Message) GetDoubleValue() float64 { + if m != nil && m.DoubleValue != nil { + return *m.DoubleValue + } + return 0 +} + +func (m *proto2Message) GetInt64Value() int64 { + if m != nil && m.Int64Value != nil { + return *m.Int64Value + } + return 0 +} + +func (m *proto2Message) GetInt32Value() int32 { + if m != nil && m.Int32Value != nil { + return *m.Int32Value + } + return 0 +} + +func (m *proto2Message) GetUint64Value() uint64 { + if m != nil && m.Uint64Value != nil { + return *m.Uint64Value + } + return 0 +} + +func (m *proto2Message) GetUint32Value() uint32 { + if m != nil && m.Uint32Value != nil { + return *m.Uint32Value + } + return 0 +} + +func (m *proto2Message) GetBoolValue() bool { + if m != nil && m.BoolValue != nil { + return *m.BoolValue + } + return false +} + +func (m *proto2Message) GetStringValue() string { + if m != nil && m.StringValue != nil { + return *m.StringValue + } + return "" +} + +func (m *proto2Message) GetRepeatedValue() []string { + if m != nil { + return m.RepeatedValue + } + return nil +} + +type EnumValue int32 + +const ( + EnumValue_X EnumValue = 0 + EnumValue_Y EnumValue = 1 + EnumValue_Z EnumValue = 2 +) + +var EnumValue_name = map[int32]string{ + 0: "EnumValue_X", + 1: "EnumValue_Y", + 2: "EnumValue_Z", +} +var EnumValue_value = map[string]int32{ + "EnumValue_X": 0, + "EnumValue_Y": 1, + "EnumValue_Z": 2, +} + +func init() { + proto.RegisterEnum("runtime_test_api.EnumValue", EnumValue_name, EnumValue_value) +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/LICENSE b/vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/README.grpc-gateway b/vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/README.grpc-gateway new file mode 100644 index 0000000..cd723e5 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/README.grpc-gateway @@ -0,0 +1,22 @@ +Google APIs +============ + +Project: Google APIs +URL: https://github.com/google/googleapis +Revision: a9fb190cdb78ed9bb2d6bb3fb5b9ef46effa5df3 +License: Apache License 2.0 + + +Imported Files +--------------- + +- google/api/annotations.proto +- google/api/http.proto + + +Generated Files +---------------- + +They are generated from the .proto files by protoc-gen-go. +- google/api/annotations.pb.go +- google/api/http.pb.go diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api/annotations.proto b/vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api/annotations.proto new file mode 100644 index 0000000..85c361b --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api/annotations.proto @@ -0,0 +1,31 @@ +// Copyright (c) 2015, Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api; + +import "google/api/http.proto"; +import "google/protobuf/descriptor.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; +option java_multiple_files = true; +option java_outer_classname = "AnnotationsProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +extend google.protobuf.MethodOptions { + // See `HttpRule`. + HttpRule http = 72295728; +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api/http.proto b/vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api/http.proto new file mode 100644 index 0000000..5f8538a --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api/http.proto @@ -0,0 +1,291 @@ +// Copyright 2016 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; +option java_multiple_files = true; +option java_outer_classname = "HttpProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// Defines the HTTP configuration for a service. It contains a list of +// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method +// to one or more HTTP REST API methods. +message Http { + // A list of HTTP configuration rules that apply to individual API methods. + // + // **NOTE:** All service configuration rules follow "last one wins" order. + repeated HttpRule rules = 1; +} + +// `HttpRule` defines the mapping of an RPC method to one or more HTTP +// REST APIs. The mapping determines what portions of the request +// message are populated from the path, query parameters, or body of +// the HTTP request. The mapping is typically specified as an +// `google.api.http` annotation, see "google/api/annotations.proto" +// for details. +// +// The mapping consists of a field specifying the path template and +// method kind. The path template can refer to fields in the request +// message, as in the example below which describes a REST GET +// operation on a resource collection of messages: +// +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; +// } +// } +// message GetMessageRequest { +// message SubMessage { +// string subfield = 1; +// } +// string message_id = 1; // mapped to the URL +// SubMessage sub = 2; // `sub.subfield` is url-mapped +// } +// message Message { +// string text = 1; // content of the resource +// } +// +// The same http annotation can alternatively be expressed inside the +// `GRPC API Configuration` YAML file. +// +// http: +// rules: +// - selector: .Messaging.GetMessage +// get: /v1/messages/{message_id}/{sub.subfield} +// +// This definition enables an automatic, bidrectional mapping of HTTP +// JSON to RPC. Example: +// +// HTTP | RPC +// -----|----- +// `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` +// +// In general, not only fields but also field paths can be referenced +// from a path pattern. Fields mapped to the path pattern cannot be +// repeated and must have a primitive (non-message) type. +// +// Any fields in the request message which are not bound by the path +// pattern automatically become (optional) HTTP query +// parameters. Assume the following definition of the request message: +// +// +// message GetMessageRequest { +// message SubMessage { +// string subfield = 1; +// } +// string message_id = 1; // mapped to the URL +// int64 revision = 2; // becomes a parameter +// SubMessage sub = 3; // `sub.subfield` becomes a parameter +// } +// +// +// This enables a HTTP JSON to RPC mapping as below: +// +// HTTP | RPC +// -----|----- +// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` +// +// Note that fields which are mapped to HTTP parameters must have a +// primitive type or a repeated primitive type. Message types are not +// allowed. In the case of a repeated type, the parameter can be +// repeated in the URL, as in `...?param=A¶m=B`. +// +// For HTTP method kinds which allow a request body, the `body` field +// specifies the mapping. Consider a REST update method on the +// message resource collection: +// +// +// service Messaging { +// rpc UpdateMessage(UpdateMessageRequest) returns (Message) { +// option (google.api.http) = { +// put: "/v1/messages/{message_id}" +// body: "message" +// }; +// } +// } +// message UpdateMessageRequest { +// string message_id = 1; // mapped to the URL +// Message message = 2; // mapped to the body +// } +// +// +// The following HTTP JSON to RPC mapping is enabled, where the +// representation of the JSON in the request body is determined by +// protos JSON encoding: +// +// HTTP | RPC +// -----|----- +// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` +// +// The special name `*` can be used in the body mapping to define that +// every field not bound by the path template should be mapped to the +// request body. This enables the following alternative definition of +// the update method: +// +// service Messaging { +// rpc UpdateMessage(Message) returns (Message) { +// option (google.api.http) = { +// put: "/v1/messages/{message_id}" +// body: "*" +// }; +// } +// } +// message Message { +// string message_id = 1; +// string text = 2; +// } +// +// +// The following HTTP JSON to RPC mapping is enabled: +// +// HTTP | RPC +// -----|----- +// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` +// +// Note that when using `*` in the body mapping, it is not possible to +// have HTTP parameters, as all fields not bound by the path end in +// the body. This makes this option more rarely used in practice of +// defining REST APIs. The common usage of `*` is in custom methods +// which don't use the URL at all for transferring data. +// +// It is possible to define multiple HTTP methods for one RPC by using +// the `additional_bindings` option. Example: +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http) = { +// get: "/v1/messages/{message_id}" +// additional_bindings { +// get: "/v1/users/{user_id}/messages/{message_id}" +// } +// }; +// } +// } +// message GetMessageRequest { +// string message_id = 1; +// string user_id = 2; +// } +// +// +// This enables the following two alternative HTTP JSON to RPC +// mappings: +// +// HTTP | RPC +// -----|----- +// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` +// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` +// +// # Rules for HTTP mapping +// +// The rules for mapping HTTP path, query parameters, and body fields +// to the request message are as follows: +// +// 1. The `body` field specifies either `*` or a field path, or is +// omitted. If omitted, it assumes there is no HTTP body. +// 2. Leaf fields (recursive expansion of nested messages in the +// request) can be classified into three types: +// (a) Matched in the URL template. +// (b) Covered by body (if body is `*`, everything except (a) fields; +// else everything under the body field) +// (c) All other fields. +// 3. URL query parameters found in the HTTP request are mapped to (c) fields. +// 4. Any body sent with an HTTP request can contain only (b) fields. +// +// The syntax of the path template is as follows: +// +// Template = "/" Segments [ Verb ] ; +// Segments = Segment { "/" Segment } ; +// Segment = "*" | "**" | LITERAL | Variable ; +// Variable = "{" FieldPath [ "=" Segments ] "}" ; +// FieldPath = IDENT { "." IDENT } ; +// Verb = ":" LITERAL ; +// +// The syntax `*` matches a single path segment. It follows the semantics of +// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String +// Expansion. +// +// The syntax `**` matches zero or more path segments. It follows the semantics +// of [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.3 Reserved +// Expansion. NOTE: it must be the last segment in the path except the Verb. +// +// The syntax `LITERAL` matches literal text in the URL path. +// +// The syntax `Variable` matches the entire path as specified by its template; +// this nested template must not contain further variables. If a variable +// matches a single path segment, its template may be omitted, e.g. `{var}` +// is equivalent to `{var=*}`. +// +// NOTE: the field paths in variables and in the `body` must not refer to +// repeated fields or map fields. +// +// Use CustomHttpPattern to specify any HTTP method that is not included in the +// `pattern` field, such as HEAD, or "*" to leave the HTTP method unspecified for +// a given URL path rule. The wild-card rule is useful for services that provide +// content to Web (HTML) clients. +message HttpRule { + // Selects methods to which this rule applies. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + string selector = 1; + + // Determines the URL pattern is matched by this rules. This pattern can be + // used with any of the {get|put|post|delete|patch} methods. A custom method + // can be defined using the 'custom' field. + oneof pattern { + // Used for listing and getting information about resources. + string get = 2; + + // Used for updating a resource. + string put = 3; + + // Used for creating a resource. + string post = 4; + + // Used for deleting a resource. + string delete = 5; + + // Used for updating a resource. + string patch = 6; + + // Custom pattern is used for defining custom verbs. + CustomHttpPattern custom = 8; + } + + // The name of the request field whose value is mapped to the HTTP body, or + // `*` for mapping all fields not captured by the path pattern to the HTTP + // body. NOTE: the referred field must not be a repeated field and must be + // present at the top-level of request message type. + string body = 7; + + // Additional HTTP bindings for the selector. Nested bindings must + // not contain an `additional_bindings` field themselves (that is, + // the nesting may only be one level deep). + repeated HttpRule additional_bindings = 11; +} + +// A custom pattern is used for defining custom HTTP verb. +message CustomHttpPattern { + // The name of this custom HTTP verb. + string kind = 1; + + // The path matched by this custom verb. + string path = 2; +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/doc.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/doc.go new file mode 100644 index 0000000..cf79a4d --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/doc.go @@ -0,0 +1,2 @@ +// Package utilities provides members for internal use in grpc-gateway. +package utilities diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/pattern.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/pattern.go new file mode 100644 index 0000000..28ad946 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/pattern.go @@ -0,0 +1,22 @@ +package utilities + +// An OpCode is a opcode of compiled path patterns. +type OpCode int + +// These constants are the valid values of OpCode. +const ( + // OpNop does nothing + OpNop = OpCode(iota) + // OpPush pushes a component to stack + OpPush + // OpLitPush pushes a component to stack if it matches to the literal + OpLitPush + // OpPushM concatenates the remaining components and pushes it to stack + OpPushM + // OpConcatN pops N items from stack, concatenates them and pushes it back to stack + OpConcatN + // OpCapture pops an item and binds it to the variable + OpCapture + // OpEnd is the least postive invalid opcode. + OpEnd +) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/trie.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/trie.go new file mode 100644 index 0000000..c2b7b30 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/trie.go @@ -0,0 +1,177 @@ +package utilities + +import ( + "sort" +) + +// DoubleArray is a Double Array implementation of trie on sequences of strings. +type DoubleArray struct { + // Encoding keeps an encoding from string to int + Encoding map[string]int + // Base is the base array of Double Array + Base []int + // Check is the check array of Double Array + Check []int +} + +// NewDoubleArray builds a DoubleArray from a set of sequences of strings. +func NewDoubleArray(seqs [][]string) *DoubleArray { + da := &DoubleArray{Encoding: make(map[string]int)} + if len(seqs) == 0 { + return da + } + + encoded := registerTokens(da, seqs) + sort.Sort(byLex(encoded)) + + root := node{row: -1, col: -1, left: 0, right: len(encoded)} + addSeqs(da, encoded, 0, root) + + for i := len(da.Base); i > 0; i-- { + if da.Check[i-1] != 0 { + da.Base = da.Base[:i] + da.Check = da.Check[:i] + break + } + } + return da +} + +func registerTokens(da *DoubleArray, seqs [][]string) [][]int { + var result [][]int + for _, seq := range seqs { + var encoded []int + for _, token := range seq { + if _, ok := da.Encoding[token]; !ok { + da.Encoding[token] = len(da.Encoding) + } + encoded = append(encoded, da.Encoding[token]) + } + result = append(result, encoded) + } + for i := range result { + result[i] = append(result[i], len(da.Encoding)) + } + return result +} + +type node struct { + row, col int + left, right int +} + +func (n node) value(seqs [][]int) int { + return seqs[n.row][n.col] +} + +func (n node) children(seqs [][]int) []*node { + var result []*node + lastVal := int(-1) + last := new(node) + for i := n.left; i < n.right; i++ { + if lastVal == seqs[i][n.col+1] { + continue + } + last.right = i + last = &node{ + row: i, + col: n.col + 1, + left: i, + } + result = append(result, last) + } + last.right = n.right + return result +} + +func addSeqs(da *DoubleArray, seqs [][]int, pos int, n node) { + ensureSize(da, pos) + + children := n.children(seqs) + var i int + for i = 1; ; i++ { + ok := func() bool { + for _, child := range children { + code := child.value(seqs) + j := i + code + ensureSize(da, j) + if da.Check[j] != 0 { + return false + } + } + return true + }() + if ok { + break + } + } + da.Base[pos] = i + for _, child := range children { + code := child.value(seqs) + j := i + code + da.Check[j] = pos + 1 + } + terminator := len(da.Encoding) + for _, child := range children { + code := child.value(seqs) + if code == terminator { + continue + } + j := i + code + addSeqs(da, seqs, j, *child) + } +} + +func ensureSize(da *DoubleArray, i int) { + for i >= len(da.Base) { + da.Base = append(da.Base, make([]int, len(da.Base)+1)...) + da.Check = append(da.Check, make([]int, len(da.Check)+1)...) + } +} + +type byLex [][]int + +func (l byLex) Len() int { return len(l) } +func (l byLex) Swap(i, j int) { l[i], l[j] = l[j], l[i] } +func (l byLex) Less(i, j int) bool { + si := l[i] + sj := l[j] + var k int + for k = 0; k < len(si) && k < len(sj); k++ { + if si[k] < sj[k] { + return true + } + if si[k] > sj[k] { + return false + } + } + if k < len(sj) { + return true + } + return false +} + +// HasCommonPrefix determines if any sequence in the DoubleArray is a prefix of the given sequence. +func (da *DoubleArray) HasCommonPrefix(seq []string) bool { + if len(da.Base) == 0 { + return false + } + + var i int + for _, t := range seq { + code, ok := da.Encoding[t] + if !ok { + break + } + j := da.Base[i] + code + if len(da.Check) <= j || da.Check[j] != i+1 { + break + } + i = j + } + j := da.Base[i] + len(da.Encoding) + if len(da.Check) <= j || da.Check[j] != i+1 { + return false + } + return true +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/trie_test.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/trie_test.go new file mode 100644 index 0000000..0178aa8 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/trie_test.go @@ -0,0 +1,372 @@ +package utilities_test + +import ( + "reflect" + "testing" + + "github.com/grpc-ecosystem/grpc-gateway/utilities" +) + +func TestMaxCommonPrefix(t *testing.T) { + for _, spec := range []struct { + da utilities.DoubleArray + tokens []string + want bool + }{ + { + da: utilities.DoubleArray{}, + tokens: nil, + want: false, + }, + { + da: utilities.DoubleArray{}, + tokens: []string{"foo"}, + want: false, + }, + { + da: utilities.DoubleArray{ + Encoding: map[string]int{ + "foo": 0, + }, + Base: []int{1, 1, 0}, + Check: []int{0, 1, 2}, + }, + tokens: nil, + want: false, + }, + { + da: utilities.DoubleArray{ + Encoding: map[string]int{ + "foo": 0, + }, + Base: []int{1, 1, 0}, + Check: []int{0, 1, 2}, + }, + tokens: []string{"foo"}, + want: true, + }, + { + da: utilities.DoubleArray{ + Encoding: map[string]int{ + "foo": 0, + }, + Base: []int{1, 1, 0}, + Check: []int{0, 1, 2}, + }, + tokens: []string{"bar"}, + want: false, + }, + { + // foo|bar + da: utilities.DoubleArray{ + Encoding: map[string]int{ + "foo": 0, + "bar": 1, + }, + Base: []int{1, 1, 2, 0, 0}, + Check: []int{0, 1, 1, 2, 3}, + // 0: ^ + // 1: ^foo + // 2: ^bar + // 3: ^foo$ + // 4: ^bar$ + }, + tokens: []string{"foo"}, + want: true, + }, + { + // foo|bar + da: utilities.DoubleArray{ + Encoding: map[string]int{ + "foo": 0, + "bar": 1, + }, + Base: []int{1, 1, 2, 0, 0}, + Check: []int{0, 1, 1, 2, 3}, + // 0: ^ + // 1: ^foo + // 2: ^bar + // 3: ^foo$ + // 4: ^bar$ + }, + tokens: []string{"bar"}, + want: true, + }, + { + // foo|bar + da: utilities.DoubleArray{ + Encoding: map[string]int{ + "foo": 0, + "bar": 1, + }, + Base: []int{1, 1, 2, 0, 0}, + Check: []int{0, 1, 1, 2, 3}, + // 0: ^ + // 1: ^foo + // 2: ^bar + // 3: ^foo$ + // 4: ^bar$ + }, + tokens: []string{"something-else"}, + want: false, + }, + { + // foo|bar + da: utilities.DoubleArray{ + Encoding: map[string]int{ + "foo": 0, + "bar": 1, + }, + Base: []int{1, 1, 2, 0, 0}, + Check: []int{0, 1, 1, 2, 3}, + // 0: ^ + // 1: ^foo + // 2: ^bar + // 3: ^foo$ + // 4: ^bar$ + }, + tokens: []string{"foo", "bar"}, + want: true, + }, + { + // foo|foo\.bar|bar + da: utilities.DoubleArray{ + Encoding: map[string]int{ + "foo": 0, + "bar": 1, + }, + Base: []int{1, 3, 1, 0, 4, 0, 0}, + Check: []int{0, 1, 1, 3, 2, 2, 5}, + // 0: ^ + // 1: ^foo + // 2: ^bar + // 3: ^bar$ + // 4: ^foo.bar + // 5: ^foo$ + // 6: ^foo.bar$ + }, + tokens: []string{"foo"}, + want: true, + }, + { + // foo|foo\.bar|bar + da: utilities.DoubleArray{ + Encoding: map[string]int{ + "foo": 0, + "bar": 1, + }, + Base: []int{1, 3, 1, 0, 4, 0, 0}, + Check: []int{0, 1, 1, 3, 2, 2, 5}, + // 0: ^ + // 1: ^foo + // 2: ^bar + // 3: ^bar$ + // 4: ^foo.bar + // 5: ^foo$ + // 6: ^foo.bar$ + }, + tokens: []string{"foo", "bar"}, + want: true, + }, + { + // foo|foo\.bar|bar + da: utilities.DoubleArray{ + Encoding: map[string]int{ + "foo": 0, + "bar": 1, + }, + Base: []int{1, 3, 1, 0, 4, 0, 0}, + Check: []int{0, 1, 1, 3, 2, 2, 5}, + // 0: ^ + // 1: ^foo + // 2: ^bar + // 3: ^bar$ + // 4: ^foo.bar + // 5: ^foo$ + // 6: ^foo.bar$ + }, + tokens: []string{"bar"}, + want: true, + }, + { + // foo|foo\.bar|bar + da: utilities.DoubleArray{ + Encoding: map[string]int{ + "foo": 0, + "bar": 1, + }, + Base: []int{1, 3, 1, 0, 4, 0, 0}, + Check: []int{0, 1, 1, 3, 2, 2, 5}, + // 0: ^ + // 1: ^foo + // 2: ^bar + // 3: ^bar$ + // 4: ^foo.bar + // 5: ^foo$ + // 6: ^foo.bar$ + }, + tokens: []string{"something-else"}, + want: false, + }, + { + // foo|foo\.bar|bar + da: utilities.DoubleArray{ + Encoding: map[string]int{ + "foo": 0, + "bar": 1, + }, + Base: []int{1, 3, 1, 0, 4, 0, 0}, + Check: []int{0, 1, 1, 3, 2, 2, 5}, + // 0: ^ + // 1: ^foo + // 2: ^bar + // 3: ^bar$ + // 4: ^foo.bar + // 5: ^foo$ + // 6: ^foo.bar$ + }, + tokens: []string{"foo", "bar", "baz"}, + want: true, + }, + } { + got := spec.da.HasCommonPrefix(spec.tokens) + if got != spec.want { + t.Errorf("%#v.HasCommonPrefix(%v) = %v; want %v", spec.da, spec.tokens, got, spec.want) + } + } +} + +func TestAdd(t *testing.T) { + for _, spec := range []struct { + tokens [][]string + want utilities.DoubleArray + }{ + { + want: utilities.DoubleArray{ + Encoding: make(map[string]int), + }, + }, + { + tokens: [][]string{{"foo"}}, + want: utilities.DoubleArray{ + Encoding: map[string]int{"foo": 0}, + Base: []int{1, 1, 0}, + Check: []int{0, 1, 2}, + // 0: ^ + // 1: ^foo + // 2: ^foo$ + }, + }, + { + tokens: [][]string{{"foo"}, {"bar"}}, + want: utilities.DoubleArray{ + Encoding: map[string]int{ + "foo": 0, + "bar": 1, + }, + Base: []int{1, 1, 2, 0, 0}, + Check: []int{0, 1, 1, 2, 3}, + // 0: ^ + // 1: ^foo + // 2: ^bar + // 3: ^foo$ + // 4: ^bar$ + }, + }, + { + tokens: [][]string{{"foo", "bar"}, {"foo", "baz"}}, + want: utilities.DoubleArray{ + Encoding: map[string]int{ + "foo": 0, + "bar": 1, + "baz": 2, + }, + Base: []int{1, 1, 1, 2, 0, 0}, + Check: []int{0, 1, 2, 2, 3, 4}, + // 0: ^ + // 1: ^foo + // 2: ^foo.bar + // 3: ^foo.baz + // 4: ^foo.bar$ + // 5: ^foo.baz$ + }, + }, + { + tokens: [][]string{{"foo", "bar"}, {"foo", "baz"}, {"qux"}}, + want: utilities.DoubleArray{ + Encoding: map[string]int{ + "foo": 0, + "bar": 1, + "baz": 2, + "qux": 3, + }, + Base: []int{1, 1, 1, 2, 3, 0, 0, 0}, + Check: []int{0, 1, 2, 2, 1, 3, 4, 5}, + // 0: ^ + // 1: ^foo + // 2: ^foo.bar + // 3: ^foo.baz + // 4: ^qux + // 5: ^foo.bar$ + // 6: ^foo.baz$ + // 7: ^qux$ + }, + }, + { + tokens: [][]string{ + {"foo", "bar"}, + {"foo", "baz", "bar"}, + {"qux", "foo"}, + }, + want: utilities.DoubleArray{ + Encoding: map[string]int{ + "foo": 0, + "bar": 1, + "baz": 2, + "qux": 3, + }, + Base: []int{1, 1, 1, 5, 8, 0, 3, 0, 5, 0}, + Check: []int{0, 1, 2, 2, 1, 3, 4, 7, 5, 9}, + // 0: ^ + // 1: ^foo + // 2: ^foo.bar + // 3: ^foo.baz + // 4: ^qux + // 5: ^foo.bar$ + // 6: ^foo.baz.bar + // 7: ^foo.baz.bar$ + // 8: ^qux.foo + // 9: ^qux.foo$ + }, + }, + } { + da := utilities.NewDoubleArray(spec.tokens) + if got, want := da.Encoding, spec.want.Encoding; !reflect.DeepEqual(got, want) { + t.Errorf("da.Encoding = %v; want %v; tokens = %#v", got, want, spec.tokens) + } + if got, want := da.Base, spec.want.Base; !compareArray(got, want) { + t.Errorf("da.Base = %v; want %v; tokens = %#v", got, want, spec.tokens) + } + if got, want := da.Check, spec.want.Check; !compareArray(got, want) { + t.Errorf("da.Check = %v; want %v; tokens = %#v", got, want, spec.tokens) + } + } +} + +func compareArray(got, want []int) bool { + var i int + for i = 0; i < len(got) && i < len(want); i++ { + if got[i] != want[i] { + return false + } + } + if i < len(want) { + return false + } + for ; i < len(got); i++ { + if got[i] != 0 { + return false + } + } + return true +} diff --git a/vendor/github.com/imdario/mergo/.travis.yml b/vendor/github.com/imdario/mergo/.travis.yml new file mode 100644 index 0000000..9d91c63 --- /dev/null +++ b/vendor/github.com/imdario/mergo/.travis.yml @@ -0,0 +1,2 @@ +language: go +install: go get -t diff --git a/vendor/github.com/imdario/mergo/LICENSE b/vendor/github.com/imdario/mergo/LICENSE new file mode 100644 index 0000000..6866802 --- /dev/null +++ b/vendor/github.com/imdario/mergo/LICENSE @@ -0,0 +1,28 @@ +Copyright (c) 2013 Dario Castañé. All rights reserved. +Copyright (c) 2012 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/imdario/mergo/README.md b/vendor/github.com/imdario/mergo/README.md new file mode 100644 index 0000000..f4769cd --- /dev/null +++ b/vendor/github.com/imdario/mergo/README.md @@ -0,0 +1,128 @@ +# Mergo + +A helper to merge structs and maps in Golang. Useful for configuration default values, avoiding messy if-statements. + +Also a lovely [comune](http://en.wikipedia.org/wiki/Mergo) (municipality) in the Province of Ancona in the Italian region Marche. + +![Mergo dall'alto](http://www.comune.mergo.an.it/Siti/Mergo/Immagini/Foto/mergo_dall_alto.jpg) + +## Status + +It is ready for production use. It works fine after extensive use in the wild. + +[![Build Status][1]][2] +[![GoDoc][3]][4] +[![GoCard][5]][6] + +[1]: https://travis-ci.org/imdario/mergo.png +[2]: https://travis-ci.org/imdario/mergo +[3]: https://godoc.org/github.com/imdario/mergo?status.svg +[4]: https://godoc.org/github.com/imdario/mergo +[5]: https://goreportcard.com/badge/imdario/mergo +[6]: https://goreportcard.com/report/github.com/imdario/mergo + +### Important note + +Mergo is intended to assign **only** zero value fields on destination with source value. Since April 6th it works like this. Before it didn't work properly, causing some random overwrites. After some issues and PRs I found it didn't merge as I designed it. Thanks to [imdario/mergo#8](https://github.com/imdario/mergo/pull/8) overwriting functions were added and the wrong behavior was clearly detected. + +If you were using Mergo **before** April 6th 2015, please check your project works as intended after updating your local copy with ```go get -u github.com/imdario/mergo```. I apologize for any issue caused by its previous behavior and any future bug that Mergo could cause (I hope it won't!) in existing projects after the change (release 0.2.0). + +### Mergo in the wild + +- [docker/docker](https://github.com/docker/docker/) +- [GoogleCloudPlatform/kubernetes](https://github.com/GoogleCloudPlatform/kubernetes) +- [imdario/zas](https://github.com/imdario/zas) +- [soniah/dnsmadeeasy](https://github.com/soniah/dnsmadeeasy) +- [EagerIO/Stout](https://github.com/EagerIO/Stout) +- [lynndylanhurley/defsynth-api](https://github.com/lynndylanhurley/defsynth-api) +- [russross/canvasassignments](https://github.com/russross/canvasassignments) +- [rdegges/cryptly-api](https://github.com/rdegges/cryptly-api) +- [casualjim/exeggutor](https://github.com/casualjim/exeggutor) +- [divshot/gitling](https://github.com/divshot/gitling) +- [RWJMurphy/gorl](https://github.com/RWJMurphy/gorl) +- [andrerocker/deploy42](https://github.com/andrerocker/deploy42) +- [elwinar/rambler](https://github.com/elwinar/rambler) +- [tmaiaroto/gopartman](https://github.com/tmaiaroto/gopartman) +- [jfbus/impressionist](https://github.com/jfbus/impressionist) +- [Jmeyering/zealot](https://github.com/Jmeyering/zealot) +- [godep-migrator/rigger-host](https://github.com/godep-migrator/rigger-host) +- [Dronevery/MultiwaySwitch-Go](https://github.com/Dronevery/MultiwaySwitch-Go) +- [thoas/picfit](https://github.com/thoas/picfit) +- [mantasmatelis/whooplist-server](https://github.com/mantasmatelis/whooplist-server) +- [jnuthong/item_search](https://github.com/jnuthong/item_search) + +## Installation + + go get github.com/imdario/mergo + + // use in your .go code + import ( + "github.com/imdario/mergo" + ) + +## Usage + +You can only merge same-type structs with exported fields initialized as zero value of their type and same-types maps. Mergo won't merge unexported (private) fields but will do recursively any exported one. Also maps will be merged recursively except for structs inside maps (because they are not addressable using Go reflection). + + if err := mergo.Merge(&dst, src); err != nil { + // ... + } + +Additionally, you can map a map[string]interface{} to a struct (and otherwise, from struct to map), following the same restrictions as in Merge(). Keys are capitalized to find each corresponding exported field. + + if err := mergo.Map(&dst, srcMap); err != nil { + // ... + } + +Warning: if you map a struct to map, it won't do it recursively. Don't expect Mergo to map struct members of your struct as map[string]interface{}. They will be just assigned as values. + +More information and examples in [godoc documentation](http://godoc.org/github.com/imdario/mergo). + +### Nice example + +```go +package main + +import ( + "fmt" + "github.com/imdario/mergo" +) + +type Foo struct { + A string + B int64 +} + +func main() { + src := Foo{ + A: "one", + } + + dest := Foo{ + A: "two", + B: 2, + } + + mergo.Merge(&dest, src) + + fmt.Println(dest) + // Will print + // {two 2} +} +``` + +Note: if test are failing due missing package, please execute: + + go get gopkg.in/yaml.v1 + +## Contact me + +If I can help you, you have an idea or you are using Mergo in your projects, don't hesitate to drop me a line (or a pull request): [@im_dario](https://twitter.com/im_dario) + +## About + +Written by [Dario Castañé](http://dario.im). + +## License + +[BSD 3-Clause](http://opensource.org/licenses/BSD-3-Clause) license, as [Go language](http://golang.org/LICENSE). diff --git a/vendor/github.com/imdario/mergo/doc.go b/vendor/github.com/imdario/mergo/doc.go new file mode 100644 index 0000000..6e9aa7b --- /dev/null +++ b/vendor/github.com/imdario/mergo/doc.go @@ -0,0 +1,44 @@ +// Copyright 2013 Dario Castañé. All rights reserved. +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/* +Package mergo merges same-type structs and maps by setting default values in zero-value fields. + +Mergo won't merge unexported (private) fields but will do recursively any exported one. It also won't merge structs inside maps (because they are not addressable using Go reflection). + +Usage + +From my own work-in-progress project: + + type networkConfig struct { + Protocol string + Address string + ServerType string `json: "server_type"` + Port uint16 + } + + type FssnConfig struct { + Network networkConfig + } + + var fssnDefault = FssnConfig { + networkConfig { + "tcp", + "127.0.0.1", + "http", + 31560, + }, + } + + // Inside a function [...] + + if err := mergo.Merge(&config, fssnDefault); err != nil { + log.Fatal(err) + } + + // More code [...] + +*/ +package mergo diff --git a/vendor/github.com/imdario/mergo/issue17_test.go b/vendor/github.com/imdario/mergo/issue17_test.go new file mode 100644 index 0000000..0ee96f3 --- /dev/null +++ b/vendor/github.com/imdario/mergo/issue17_test.go @@ -0,0 +1,25 @@ +package mergo + +import ( + "encoding/json" + "testing" +) + +var ( + request = `{"timestamp":null, "name": "foo"}` + maprequest = map[string]interface{}{ + "timestamp": nil, + "name": "foo", + "newStuff": "foo", + } +) + +func TestIssue17MergeWithOverwrite(t *testing.T) { + var something map[string]interface{} + if err := json.Unmarshal([]byte(request), &something); err != nil { + t.Errorf("Error while Unmarshalling maprequest %s", err) + } + if err := MergeWithOverwrite(&something, maprequest); err != nil { + t.Errorf("Error while merging %s", err) + } +} diff --git a/vendor/github.com/imdario/mergo/map.go b/vendor/github.com/imdario/mergo/map.go new file mode 100644 index 0000000..8e8c4ba --- /dev/null +++ b/vendor/github.com/imdario/mergo/map.go @@ -0,0 +1,156 @@ +// Copyright 2014 Dario Castañé. All rights reserved. +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Based on src/pkg/reflect/deepequal.go from official +// golang's stdlib. + +package mergo + +import ( + "fmt" + "reflect" + "unicode" + "unicode/utf8" +) + +func changeInitialCase(s string, mapper func(rune) rune) string { + if s == "" { + return s + } + r, n := utf8.DecodeRuneInString(s) + return string(mapper(r)) + s[n:] +} + +func isExported(field reflect.StructField) bool { + r, _ := utf8.DecodeRuneInString(field.Name) + return r >= 'A' && r <= 'Z' +} + +// Traverses recursively both values, assigning src's fields values to dst. +// The map argument tracks comparisons that have already been seen, which allows +// short circuiting on recursive types. +func deepMap(dst, src reflect.Value, visited map[uintptr]*visit, depth int, overwrite bool) (err error) { + if dst.CanAddr() { + addr := dst.UnsafeAddr() + h := 17 * addr + seen := visited[h] + typ := dst.Type() + for p := seen; p != nil; p = p.next { + if p.ptr == addr && p.typ == typ { + return nil + } + } + // Remember, remember... + visited[h] = &visit{addr, typ, seen} + } + zeroValue := reflect.Value{} + switch dst.Kind() { + case reflect.Map: + dstMap := dst.Interface().(map[string]interface{}) + for i, n := 0, src.NumField(); i < n; i++ { + srcType := src.Type() + field := srcType.Field(i) + if !isExported(field) { + continue + } + fieldName := field.Name + fieldName = changeInitialCase(fieldName, unicode.ToLower) + if v, ok := dstMap[fieldName]; !ok || (isEmptyValue(reflect.ValueOf(v)) || overwrite) { + dstMap[fieldName] = src.Field(i).Interface() + } + } + case reflect.Struct: + srcMap := src.Interface().(map[string]interface{}) + for key := range srcMap { + srcValue := srcMap[key] + fieldName := changeInitialCase(key, unicode.ToUpper) + dstElement := dst.FieldByName(fieldName) + if dstElement == zeroValue { + // We discard it because the field doesn't exist. + continue + } + srcElement := reflect.ValueOf(srcValue) + dstKind := dstElement.Kind() + srcKind := srcElement.Kind() + if srcKind == reflect.Ptr && dstKind != reflect.Ptr { + srcElement = srcElement.Elem() + srcKind = reflect.TypeOf(srcElement.Interface()).Kind() + } else if dstKind == reflect.Ptr { + // Can this work? I guess it can't. + if srcKind != reflect.Ptr && srcElement.CanAddr() { + srcPtr := srcElement.Addr() + srcElement = reflect.ValueOf(srcPtr) + srcKind = reflect.Ptr + } + } + if !srcElement.IsValid() { + continue + } + if srcKind == dstKind { + if err = deepMerge(dstElement, srcElement, visited, depth+1, overwrite); err != nil { + return + } + } else { + if srcKind == reflect.Map { + if err = deepMap(dstElement, srcElement, visited, depth+1, overwrite); err != nil { + return + } + } else { + return fmt.Errorf("type mismatch on %s field: found %v, expected %v", fieldName, srcKind, dstKind) + } + } + } + } + return +} + +// Map sets fields' values in dst from src. +// src can be a map with string keys or a struct. dst must be the opposite: +// if src is a map, dst must be a valid pointer to struct. If src is a struct, +// dst must be map[string]interface{}. +// It won't merge unexported (private) fields and will do recursively +// any exported field. +// If dst is a map, keys will be src fields' names in lower camel case. +// Missing key in src that doesn't match a field in dst will be skipped. This +// doesn't apply if dst is a map. +// This is separated method from Merge because it is cleaner and it keeps sane +// semantics: merging equal types, mapping different (restricted) types. +func Map(dst, src interface{}) error { + return _map(dst, src, false) +} + +// MapWithOverwrite will do the same as Map except that non-empty dst attributes will be overriden by +// non-empty src attribute values. +func MapWithOverwrite(dst, src interface{}) error { + return _map(dst, src, true) +} + +func _map(dst, src interface{}, overwrite bool) error { + var ( + vDst, vSrc reflect.Value + err error + ) + if vDst, vSrc, err = resolveValues(dst, src); err != nil { + return err + } + // To be friction-less, we redirect equal-type arguments + // to deepMerge. Only because arguments can be anything. + if vSrc.Kind() == vDst.Kind() { + return deepMerge(vDst, vSrc, make(map[uintptr]*visit), 0, overwrite) + } + switch vSrc.Kind() { + case reflect.Struct: + if vDst.Kind() != reflect.Map { + return ErrExpectedMapAsDestination + } + case reflect.Map: + if vDst.Kind() != reflect.Struct { + return ErrExpectedStructAsDestination + } + default: + return ErrNotSupported + } + return deepMap(vDst, vSrc, make(map[uintptr]*visit), 0, overwrite) +} diff --git a/vendor/github.com/imdario/mergo/merge.go b/vendor/github.com/imdario/mergo/merge.go new file mode 100644 index 0000000..11e55b1 --- /dev/null +++ b/vendor/github.com/imdario/mergo/merge.go @@ -0,0 +1,123 @@ +// Copyright 2013 Dario Castañé. All rights reserved. +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Based on src/pkg/reflect/deepequal.go from official +// golang's stdlib. + +package mergo + +import ( + "reflect" +) + +// Traverses recursively both values, assigning src's fields values to dst. +// The map argument tracks comparisons that have already been seen, which allows +// short circuiting on recursive types. +func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, overwrite bool) (err error) { + if !src.IsValid() { + return + } + if dst.CanAddr() { + addr := dst.UnsafeAddr() + h := 17 * addr + seen := visited[h] + typ := dst.Type() + for p := seen; p != nil; p = p.next { + if p.ptr == addr && p.typ == typ { + return nil + } + } + // Remember, remember... + visited[h] = &visit{addr, typ, seen} + } + switch dst.Kind() { + case reflect.Struct: + for i, n := 0, dst.NumField(); i < n; i++ { + if err = deepMerge(dst.Field(i), src.Field(i), visited, depth+1, overwrite); err != nil { + return + } + } + case reflect.Map: + for _, key := range src.MapKeys() { + srcElement := src.MapIndex(key) + if !srcElement.IsValid() { + continue + } + dstElement := dst.MapIndex(key) + switch srcElement.Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.Interface, reflect.Slice: + if srcElement.IsNil() { + continue + } + fallthrough + default: + if !srcElement.CanInterface() { + continue + } + switch reflect.TypeOf(srcElement.Interface()).Kind() { + case reflect.Struct: + fallthrough + case reflect.Ptr: + fallthrough + case reflect.Map: + if err = deepMerge(dstElement, srcElement, visited, depth+1, overwrite); err != nil { + return + } + } + } + if !isEmptyValue(srcElement) && (overwrite || (!dstElement.IsValid() || isEmptyValue(dst))) { + if dst.IsNil() { + dst.Set(reflect.MakeMap(dst.Type())) + } + dst.SetMapIndex(key, srcElement) + } + } + case reflect.Ptr: + fallthrough + case reflect.Interface: + if src.IsNil() { + break + } else if dst.IsNil() { + if dst.CanSet() && (overwrite || isEmptyValue(dst)) { + dst.Set(src) + } + } else if err = deepMerge(dst.Elem(), src.Elem(), visited, depth+1, overwrite); err != nil { + return + } + default: + if dst.CanSet() && !isEmptyValue(src) && (overwrite || isEmptyValue(dst)) { + dst.Set(src) + } + } + return +} + +// Merge will fill any empty for value type attributes on the dst struct using corresponding +// src attributes if they themselves are not empty. dst and src must be valid same-type structs +// and dst must be a pointer to struct. +// It won't merge unexported (private) fields and will do recursively any exported field. +func Merge(dst, src interface{}) error { + return merge(dst, src, false) +} + +// MergeWithOverwrite will do the same as Merge except that non-empty dst attributes will be overriden by +// non-empty src attribute values. +func MergeWithOverwrite(dst, src interface{}) error { + return merge(dst, src, true) +} + +func merge(dst, src interface{}, overwrite bool) error { + var ( + vDst, vSrc reflect.Value + err error + ) + if vDst, vSrc, err = resolveValues(dst, src); err != nil { + return err + } + if vDst.Type() != vSrc.Type() { + return ErrDifferentArgumentsTypes + } + return deepMerge(vDst, vSrc, make(map[uintptr]*visit), 0, overwrite) +} diff --git a/vendor/github.com/imdario/mergo/mergo.go b/vendor/github.com/imdario/mergo/mergo.go new file mode 100644 index 0000000..f8a0991 --- /dev/null +++ b/vendor/github.com/imdario/mergo/mergo.go @@ -0,0 +1,90 @@ +// Copyright 2013 Dario Castañé. All rights reserved. +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Based on src/pkg/reflect/deepequal.go from official +// golang's stdlib. + +package mergo + +import ( + "errors" + "reflect" +) + +// Errors reported by Mergo when it finds invalid arguments. +var ( + ErrNilArguments = errors.New("src and dst must not be nil") + ErrDifferentArgumentsTypes = errors.New("src and dst must be of same type") + ErrNotSupported = errors.New("only structs and maps are supported") + ErrExpectedMapAsDestination = errors.New("dst was expected to be a map") + ErrExpectedStructAsDestination = errors.New("dst was expected to be a struct") +) + +// During deepMerge, must keep track of checks that are +// in progress. The comparison algorithm assumes that all +// checks in progress are true when it reencounters them. +// Visited are stored in a map indexed by 17 * a1 + a2; +type visit struct { + ptr uintptr + typ reflect.Type + next *visit +} + +// From src/pkg/encoding/json. +func isEmptyValue(v reflect.Value) bool { + switch v.Kind() { + case reflect.Array, reflect.Map, reflect.Slice, reflect.String: + return v.Len() == 0 + case reflect.Bool: + return !v.Bool() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.Interface, reflect.Ptr: + return v.IsNil() + } + return false +} + +func resolveValues(dst, src interface{}) (vDst, vSrc reflect.Value, err error) { + if dst == nil || src == nil { + err = ErrNilArguments + return + } + vDst = reflect.ValueOf(dst).Elem() + if vDst.Kind() != reflect.Struct && vDst.Kind() != reflect.Map { + err = ErrNotSupported + return + } + vSrc = reflect.ValueOf(src) + // We check if vSrc is a pointer to dereference it. + if vSrc.Kind() == reflect.Ptr { + vSrc = vSrc.Elem() + } + return +} + +// Traverses recursively both values, assigning src's fields values to dst. +// The map argument tracks comparisons that have already been seen, which allows +// short circuiting on recursive types. +func deeper(dst, src reflect.Value, visited map[uintptr]*visit, depth int) (err error) { + if dst.CanAddr() { + addr := dst.UnsafeAddr() + h := 17 * addr + seen := visited[h] + typ := dst.Type() + for p := seen; p != nil; p = p.next { + if p.ptr == addr && p.typ == typ { + return nil + } + } + // Remember, remember... + visited[h] = &visit{addr, typ, seen} + } + return // TODO refactor +} diff --git a/vendor/github.com/imdario/mergo/mergo_test.go b/vendor/github.com/imdario/mergo/mergo_test.go new file mode 100644 index 0000000..dd2651b --- /dev/null +++ b/vendor/github.com/imdario/mergo/mergo_test.go @@ -0,0 +1,525 @@ +// Copyright 2013 Dario Castañé. All rights reserved. +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package mergo + +import ( + "io/ioutil" + "reflect" + "testing" + "time" + + "gopkg.in/yaml.v1" +) + +type simpleTest struct { + Value int +} + +type complexTest struct { + St simpleTest + sz int + ID string +} + +type moreComplextText struct { + Ct complexTest + St simpleTest + Nt simpleTest +} + +type pointerTest struct { + C *simpleTest +} + +type sliceTest struct { + S []int +} + +func TestKb(t *testing.T) { + type testStruct struct { + Name string + KeyValue map[string]interface{} + } + + akv := make(map[string]interface{}) + akv["Key1"] = "not value 1" + akv["Key2"] = "value2" + a := testStruct{} + a.Name = "A" + a.KeyValue = akv + + bkv := make(map[string]interface{}) + bkv["Key1"] = "value1" + bkv["Key3"] = "value3" + b := testStruct{} + b.Name = "B" + b.KeyValue = bkv + + ekv := make(map[string]interface{}) + ekv["Key1"] = "value1" + ekv["Key2"] = "value2" + ekv["Key3"] = "value3" + expected := testStruct{} + expected.Name = "B" + expected.KeyValue = ekv + + Merge(&b, a) + + if !reflect.DeepEqual(b, expected) { + t.Errorf("Actual: %#v did not match \nExpected: %#v", b, expected) + } +} + +func TestNil(t *testing.T) { + if err := Merge(nil, nil); err != ErrNilArguments { + t.Fail() + } +} + +func TestDifferentTypes(t *testing.T) { + a := simpleTest{42} + b := 42 + if err := Merge(&a, b); err != ErrDifferentArgumentsTypes { + t.Fail() + } +} + +func TestSimpleStruct(t *testing.T) { + a := simpleTest{} + b := simpleTest{42} + if err := Merge(&a, b); err != nil { + t.FailNow() + } + if a.Value != 42 { + t.Fatalf("b not merged in properly: a.Value(%d) != b.Value(%d)", a.Value, b.Value) + } + if !reflect.DeepEqual(a, b) { + t.FailNow() + } +} + +func TestComplexStruct(t *testing.T) { + a := complexTest{} + a.ID = "athing" + b := complexTest{simpleTest{42}, 1, "bthing"} + if err := Merge(&a, b); err != nil { + t.FailNow() + } + if a.St.Value != 42 { + t.Fatalf("b not merged in properly: a.St.Value(%d) != b.St.Value(%d)", a.St.Value, b.St.Value) + } + if a.sz == 1 { + t.Fatalf("a's private field sz not preserved from merge: a.sz(%d) == b.sz(%d)", a.sz, b.sz) + } + if a.ID == b.ID { + t.Fatalf("a's field ID merged unexpectedly: a.ID(%s) == b.ID(%s)", a.ID, b.ID) + } +} + +func TestComplexStructWithOverwrite(t *testing.T) { + a := complexTest{simpleTest{1}, 1, "do-not-overwrite-with-empty-value"} + b := complexTest{simpleTest{42}, 2, ""} + + expect := complexTest{simpleTest{42}, 1, "do-not-overwrite-with-empty-value"} + if err := MergeWithOverwrite(&a, b); err != nil { + t.FailNow() + } + + if !reflect.DeepEqual(a, expect) { + t.Fatalf("Test failed:\ngot :\n%#v\n\nwant :\n%#v\n\n", a, expect) + } +} + +func TestPointerStruct(t *testing.T) { + s1 := simpleTest{} + s2 := simpleTest{19} + a := pointerTest{&s1} + b := pointerTest{&s2} + if err := Merge(&a, b); err != nil { + t.FailNow() + } + if a.C.Value != b.C.Value { + t.Fatalf("b not merged in properly: a.C.Value(%d) != b.C.Value(%d)", a.C.Value, b.C.Value) + } +} + +type embeddingStruct struct { + embeddedStruct +} + +type embeddedStruct struct { + A string +} + +func TestEmbeddedStruct(t *testing.T) { + tests := []struct { + src embeddingStruct + dst embeddingStruct + expected embeddingStruct + }{ + { + src: embeddingStruct{ + embeddedStruct{"foo"}, + }, + dst: embeddingStruct{ + embeddedStruct{""}, + }, + expected: embeddingStruct{ + embeddedStruct{"foo"}, + }, + }, + { + src: embeddingStruct{ + embeddedStruct{""}, + }, + dst: embeddingStruct{ + embeddedStruct{"bar"}, + }, + expected: embeddingStruct{ + embeddedStruct{"bar"}, + }, + }, + { + src: embeddingStruct{ + embeddedStruct{"foo"}, + }, + dst: embeddingStruct{ + embeddedStruct{"bar"}, + }, + expected: embeddingStruct{ + embeddedStruct{"bar"}, + }, + }, + } + + for _, test := range tests { + err := Merge(&test.dst, test.src) + if err != nil { + t.Errorf("unexpected error: %v", err) + continue + } + if !reflect.DeepEqual(test.dst, test.expected) { + t.Errorf("unexpected output\nexpected:\n%+v\nsaw:\n%+v\n", test.expected, test.dst) + } + } +} + +func TestPointerStructNil(t *testing.T) { + a := pointerTest{nil} + b := pointerTest{&simpleTest{19}} + if err := Merge(&a, b); err != nil { + t.FailNow() + } + if a.C.Value != b.C.Value { + t.Fatalf("b not merged in a properly: a.C.Value(%d) != b.C.Value(%d)", a.C.Value, b.C.Value) + } +} + +func TestSliceStruct(t *testing.T) { + a := sliceTest{} + b := sliceTest{[]int{1, 2, 3}} + if err := Merge(&a, b); err != nil { + t.FailNow() + } + if len(b.S) != 3 { + t.FailNow() + } + if len(a.S) != len(b.S) { + t.Fatalf("b not merged in a proper way %d != %d", len(a.S), len(b.S)) + } + + a = sliceTest{[]int{1}} + b = sliceTest{[]int{1, 2, 3}} + if err := Merge(&a, b); err != nil { + t.FailNow() + } + if len(a.S) != 1 { + t.FailNow() + } + if len(a.S) == len(b.S) { + t.Fatalf("b merged unexpectedly %d != %d", len(a.S), len(b.S)) + } +} + +func TestMapsWithOverwrite(t *testing.T) { + m := map[string]simpleTest{ + "a": {}, // overwritten by 16 + "b": {42}, // not overwritten by empty value + "c": {13}, // overwritten by 12 + "d": {61}, + } + n := map[string]simpleTest{ + "a": {16}, + "b": {}, + "c": {12}, + "e": {14}, + } + expect := map[string]simpleTest{ + "a": {16}, + "b": {}, + "c": {12}, + "d": {61}, + "e": {14}, + } + + if err := MergeWithOverwrite(&m, n); err != nil { + t.Fatalf(err.Error()) + } + + if !reflect.DeepEqual(m, expect) { + t.Fatalf("Test failed:\ngot :\n%#v\n\nwant :\n%#v\n\n", m, expect) + } +} + +func TestMaps(t *testing.T) { + m := map[string]simpleTest{ + "a": {}, + "b": {42}, + "c": {13}, + "d": {61}, + } + n := map[string]simpleTest{ + "a": {16}, + "b": {}, + "c": {12}, + "e": {14}, + } + expect := map[string]simpleTest{ + "a": {0}, + "b": {42}, + "c": {13}, + "d": {61}, + "e": {14}, + } + + if err := Merge(&m, n); err != nil { + t.Fatalf(err.Error()) + } + + if !reflect.DeepEqual(m, expect) { + t.Fatalf("Test failed:\ngot :\n%#v\n\nwant :\n%#v\n\n", m, expect) + } + if m["a"].Value != 0 { + t.Fatalf(`n merged in m because I solved non-addressable map values TODO: m["a"].Value(%d) != n["a"].Value(%d)`, m["a"].Value, n["a"].Value) + } + if m["b"].Value != 42 { + t.Fatalf(`n wrongly merged in m: m["b"].Value(%d) != n["b"].Value(%d)`, m["b"].Value, n["b"].Value) + } + if m["c"].Value != 13 { + t.Fatalf(`n overwritten in m: m["c"].Value(%d) != n["c"].Value(%d)`, m["c"].Value, n["c"].Value) + } +} + +func TestYAMLMaps(t *testing.T) { + thing := loadYAML("testdata/thing.yml") + license := loadYAML("testdata/license.yml") + ft := thing["fields"].(map[interface{}]interface{}) + fl := license["fields"].(map[interface{}]interface{}) + expectedLength := len(ft) + len(fl) + if err := Merge(&license, thing); err != nil { + t.Fatal(err.Error()) + } + currentLength := len(license["fields"].(map[interface{}]interface{})) + if currentLength != expectedLength { + t.Fatalf(`thing not merged in license properly, license must have %d elements instead of %d`, expectedLength, currentLength) + } + fields := license["fields"].(map[interface{}]interface{}) + if _, ok := fields["id"]; !ok { + t.Fatalf(`thing not merged in license properly, license must have a new id field from thing`) + } +} + +func TestTwoPointerValues(t *testing.T) { + a := &simpleTest{} + b := &simpleTest{42} + if err := Merge(a, b); err != nil { + t.Fatalf(`Boom. You crossed the streams: %s`, err) + } +} + +func TestMap(t *testing.T) { + a := complexTest{} + a.ID = "athing" + c := moreComplextText{a, simpleTest{}, simpleTest{}} + b := map[string]interface{}{ + "ct": map[string]interface{}{ + "st": map[string]interface{}{ + "value": 42, + }, + "sz": 1, + "id": "bthing", + }, + "st": &simpleTest{144}, // Mapping a reference + "zt": simpleTest{299}, // Mapping a missing field (zt doesn't exist) + "nt": simpleTest{3}, + } + if err := Map(&c, b); err != nil { + t.FailNow() + } + m := b["ct"].(map[string]interface{}) + n := m["st"].(map[string]interface{}) + o := b["st"].(*simpleTest) + p := b["nt"].(simpleTest) + if c.Ct.St.Value != 42 { + t.Fatalf("b not merged in properly: c.Ct.St.Value(%d) != b.Ct.St.Value(%d)", c.Ct.St.Value, n["value"]) + } + if c.St.Value != 144 { + t.Fatalf("b not merged in properly: c.St.Value(%d) != b.St.Value(%d)", c.St.Value, o.Value) + } + if c.Nt.Value != 3 { + t.Fatalf("b not merged in properly: c.Nt.Value(%d) != b.Nt.Value(%d)", c.St.Value, p.Value) + } + if c.Ct.sz == 1 { + t.Fatalf("a's private field sz not preserved from merge: c.Ct.sz(%d) == b.Ct.sz(%d)", c.Ct.sz, m["sz"]) + } + if c.Ct.ID == m["id"] { + t.Fatalf("a's field ID merged unexpectedly: c.Ct.ID(%s) == b.Ct.ID(%s)", c.Ct.ID, m["id"]) + } +} + +func TestSimpleMap(t *testing.T) { + a := simpleTest{} + b := map[string]interface{}{ + "value": 42, + } + if err := Map(&a, b); err != nil { + t.FailNow() + } + if a.Value != 42 { + t.Fatalf("b not merged in properly: a.Value(%d) != b.Value(%v)", a.Value, b["value"]) + } +} + +type pointerMapTest struct { + A int + hidden int + B *simpleTest +} + +func TestBackAndForth(t *testing.T) { + pt := pointerMapTest{42, 1, &simpleTest{66}} + m := make(map[string]interface{}) + if err := Map(&m, pt); err != nil { + t.FailNow() + } + var ( + v interface{} + ok bool + ) + if v, ok = m["a"]; v.(int) != pt.A || !ok { + t.Fatalf("pt not merged in properly: m[`a`](%d) != pt.A(%d)", v, pt.A) + } + if v, ok = m["b"]; !ok { + t.Fatalf("pt not merged in properly: B is missing in m") + } + var st *simpleTest + if st = v.(*simpleTest); st.Value != 66 { + t.Fatalf("something went wrong while mapping pt on m, B wasn't copied") + } + bpt := pointerMapTest{} + if err := Map(&bpt, m); err != nil { + t.Fatal(err) + } + if bpt.A != pt.A { + t.Fatalf("pt not merged in properly: bpt.A(%d) != pt.A(%d)", bpt.A, pt.A) + } + if bpt.hidden == pt.hidden { + t.Fatalf("pt unexpectedly merged: bpt.hidden(%d) == pt.hidden(%d)", bpt.hidden, pt.hidden) + } + if bpt.B.Value != pt.B.Value { + t.Fatalf("pt not merged in properly: bpt.B.Value(%d) != pt.B.Value(%d)", bpt.B.Value, pt.B.Value) + } +} + +type structWithTimePointer struct { + Birth *time.Time +} + +func TestTime(t *testing.T) { + now := time.Now() + dataStruct := structWithTimePointer{ + Birth: &now, + } + dataMap := map[string]interface{}{ + "Birth": &now, + } + b := structWithTimePointer{} + if err := Merge(&b, dataStruct); err != nil { + t.FailNow() + } + if b.Birth.IsZero() { + t.Fatalf("time.Time not merged in properly: b.Birth(%v) != dataStruct['Birth'](%v)", b.Birth, dataStruct.Birth) + } + if b.Birth != dataStruct.Birth { + t.Fatalf("time.Time not merged in properly: b.Birth(%v) != dataStruct['Birth'](%v)", b.Birth, dataStruct.Birth) + } + b = structWithTimePointer{} + if err := Map(&b, dataMap); err != nil { + t.FailNow() + } + if b.Birth.IsZero() { + t.Fatalf("time.Time not merged in properly: b.Birth(%v) != dataMap['Birth'](%v)", b.Birth, dataMap["Birth"]) + } +} + +type simpleNested struct { + A int +} + +type structWithNestedPtrValueMap struct { + NestedPtrValue map[string]*simpleNested +} + +func TestNestedPtrValueInMap(t *testing.T) { + src := &structWithNestedPtrValueMap{ + NestedPtrValue: map[string]*simpleNested{ + "x": { + A: 1, + }, + }, + } + dst := &structWithNestedPtrValueMap{ + NestedPtrValue: map[string]*simpleNested{ + "x": {}, + }, + } + if err := Map(dst, src); err != nil { + t.FailNow() + } + if dst.NestedPtrValue["x"].A == 0 { + t.Fatalf("Nested Ptr value not merged in properly: dst.NestedPtrValue[\"x\"].A(%v) != src.NestedPtrValue[\"x\"].A(%v)", dst.NestedPtrValue["x"].A, src.NestedPtrValue["x"].A) + } +} + +func loadYAML(path string) (m map[string]interface{}) { + m = make(map[string]interface{}) + raw, _ := ioutil.ReadFile(path) + _ = yaml.Unmarshal(raw, &m) + return +} + +type structWithMap struct { + m map[string]structWithUnexportedProperty +} + +type structWithUnexportedProperty struct { + s string +} + +func TestUnexportedProperty(t *testing.T) { + a := structWithMap{map[string]structWithUnexportedProperty{ + "key": structWithUnexportedProperty{"hello"}, + }} + b := structWithMap{map[string]structWithUnexportedProperty{ + "key": structWithUnexportedProperty{"hi"}, + }} + defer func() { + if r := recover(); r != nil { + t.Errorf("Should not have panicked") + } + }() + Merge(&a, b) +} diff --git a/vendor/github.com/imdario/mergo/testdata/license.yml b/vendor/github.com/imdario/mergo/testdata/license.yml new file mode 100644 index 0000000..62fdb61 --- /dev/null +++ b/vendor/github.com/imdario/mergo/testdata/license.yml @@ -0,0 +1,3 @@ +import: ../../../../fossene/db/schema/thing.yml +fields: + site: string diff --git a/vendor/github.com/imdario/mergo/testdata/thing.yml b/vendor/github.com/imdario/mergo/testdata/thing.yml new file mode 100644 index 0000000..c28eab0 --- /dev/null +++ b/vendor/github.com/imdario/mergo/testdata/thing.yml @@ -0,0 +1,5 @@ +fields: + id: int + name: string + parent: ref "datu:thing" + status: enum(draft, public, private) diff --git a/vendor/golang.org/x/crypto/acme/acme.go b/vendor/golang.org/x/crypto/acme/acme.go index 8619508..a7b6ce4 100644 --- a/vendor/golang.org/x/crypto/acme/acme.go +++ b/vendor/golang.org/x/crypto/acme/acme.go @@ -15,6 +15,7 @@ package acme import ( "bytes" + "context" "crypto" "crypto/ecdsa" "crypto/elliptic" @@ -36,9 +37,6 @@ import ( "strings" "sync" "time" - - "golang.org/x/net/context" - "golang.org/x/net/context/ctxhttp" ) // LetsEncryptURL is the Directory endpoint of Let's Encrypt CA. @@ -133,7 +131,7 @@ func (c *Client) Discover(ctx context.Context) (Directory, error) { if dirURL == "" { dirURL = LetsEncryptURL } - res, err := ctxhttp.Get(ctx, c.HTTPClient, dirURL) + res, err := c.get(ctx, dirURL) if err != nil { return Directory{}, err } @@ -154,7 +152,7 @@ func (c *Client) Discover(ctx context.Context) (Directory, error) { CAA []string `json:"caa-identities"` } } - if json.NewDecoder(res.Body).Decode(&v); err != nil { + if err := json.NewDecoder(res.Body).Decode(&v); err != nil { return Directory{}, err } c.dir = &Directory{ @@ -200,7 +198,7 @@ func (c *Client) CreateCert(ctx context.Context, csr []byte, exp time.Duration, req.NotAfter = now.Add(exp).Format(time.RFC3339) } - res, err := c.postJWS(ctx, c.Key, c.dir.CertURL, req) + res, err := c.retryPostJWS(ctx, c.Key, c.dir.CertURL, req) if err != nil { return nil, "", err } @@ -216,7 +214,7 @@ func (c *Client) CreateCert(ctx context.Context, csr []byte, exp time.Duration, return cert, curl, err } // slurp issued cert and CA chain, if requested - cert, err := responseCert(ctx, c.HTTPClient, res, bundle) + cert, err := c.responseCert(ctx, res, bundle) return cert, curl, err } @@ -231,13 +229,13 @@ func (c *Client) CreateCert(ctx context.Context, csr []byte, exp time.Duration, // and has expected features. func (c *Client) FetchCert(ctx context.Context, url string, bundle bool) ([][]byte, error) { for { - res, err := ctxhttp.Get(ctx, c.HTTPClient, url) + res, err := c.get(ctx, url) if err != nil { return nil, err } defer res.Body.Close() if res.StatusCode == http.StatusOK { - return responseCert(ctx, c.HTTPClient, res, bundle) + return c.responseCert(ctx, res, bundle) } if res.StatusCode > 299 { return nil, responseError(res) @@ -275,7 +273,7 @@ func (c *Client) RevokeCert(ctx context.Context, key crypto.Signer, cert []byte, if key == nil { key = c.Key } - res, err := c.postJWS(ctx, key, c.dir.RevokeURL, body) + res, err := c.retryPostJWS(ctx, key, c.dir.RevokeURL, body) if err != nil { return err } @@ -363,7 +361,7 @@ func (c *Client) Authorize(ctx context.Context, domain string) (*Authorization, Resource: "new-authz", Identifier: authzID{Type: "dns", Value: domain}, } - res, err := c.postJWS(ctx, c.Key, c.dir.AuthzURL, req) + res, err := c.retryPostJWS(ctx, c.Key, c.dir.AuthzURL, req) if err != nil { return nil, err } @@ -387,7 +385,7 @@ func (c *Client) Authorize(ctx context.Context, domain string) (*Authorization, // If a caller needs to poll an authorization until its status is final, // see the WaitAuthorization method. func (c *Client) GetAuthorization(ctx context.Context, url string) (*Authorization, error) { - res, err := ctxhttp.Get(ctx, c.HTTPClient, url) + res, err := c.get(ctx, url) if err != nil { return nil, err } @@ -421,7 +419,7 @@ func (c *Client) RevokeAuthorization(ctx context.Context, url string) error { Status: "deactivated", Delete: true, } - res, err := c.postJWS(ctx, c.Key, url, req) + res, err := c.retryPostJWS(ctx, c.Key, url, req) if err != nil { return err } @@ -438,25 +436,11 @@ func (c *Client) RevokeAuthorization(ctx context.Context, url string) error { // // It returns a non-nil Authorization only if its Status is StatusValid. // In all other cases WaitAuthorization returns an error. -// If the Status is StatusInvalid, the returned error is ErrAuthorizationFailed. +// If the Status is StatusInvalid, the returned error is of type *AuthorizationError. func (c *Client) WaitAuthorization(ctx context.Context, url string) (*Authorization, error) { - var count int - sleep := func(v string, inc int) error { - count += inc - d := backoff(count, 10*time.Second) - d = retryAfter(v, d) - wakeup := time.NewTimer(d) - defer wakeup.Stop() - select { - case <-ctx.Done(): - return ctx.Err() - case <-wakeup.C: - return nil - } - } - + sleep := sleeper(ctx) for { - res, err := ctxhttp.Get(ctx, c.HTTPClient, url) + res, err := c.get(ctx, url) if err != nil { return nil, err } @@ -481,7 +465,7 @@ func (c *Client) WaitAuthorization(ctx context.Context, url string) (*Authorizat return raw.authorization(url), nil } if raw.Status == StatusInvalid { - return nil, ErrAuthorizationFailed + return nil, raw.error(url) } if err := sleep(retry, 0); err != nil { return nil, err @@ -493,7 +477,7 @@ func (c *Client) WaitAuthorization(ctx context.Context, url string) (*Authorizat // // A client typically polls a challenge status using this method. func (c *Client) GetChallenge(ctx context.Context, url string) (*Challenge, error) { - res, err := ctxhttp.Get(ctx, c.HTTPClient, url) + res, err := c.get(ctx, url) if err != nil { return nil, err } @@ -527,7 +511,7 @@ func (c *Client) Accept(ctx context.Context, chal *Challenge) (*Challenge, error Type: chal.Type, Auth: auth, } - res, err := c.postJWS(ctx, c.Key, chal.URI, req) + res, err := c.retryPostJWS(ctx, c.Key, chal.URI, req) if err != nil { return nil, err } @@ -660,7 +644,7 @@ func (c *Client) doReg(ctx context.Context, url string, typ string, acct *Accoun req.Contact = acct.Contact req.Agreement = acct.AgreedTerms } - res, err := c.postJWS(ctx, c.Key, url, req) + res, err := c.retryPostJWS(ctx, c.Key, url, req) if err != nil { return nil, err } @@ -697,6 +681,40 @@ func (c *Client) doReg(ctx context.Context, url string, typ string, acct *Accoun }, nil } +// retryPostJWS will retry calls to postJWS if there is a badNonce error, +// clearing the stored nonces after each error. +// If the response was 4XX-5XX, then responseError is called on the body, +// the body is closed, and the error returned. +func (c *Client) retryPostJWS(ctx context.Context, key crypto.Signer, url string, body interface{}) (*http.Response, error) { + sleep := sleeper(ctx) + for { + res, err := c.postJWS(ctx, key, url, body) + if err != nil { + return nil, err + } + // handle errors 4XX-5XX with responseError + if res.StatusCode >= 400 && res.StatusCode <= 599 { + err := responseError(res) + res.Body.Close() + // according to spec badNonce is urn:ietf:params:acme:error:badNonce + // however, acme servers in the wild return their version of the error + // https://tools.ietf.org/html/draft-ietf-acme-acme-02#section-5.4 + if ae, ok := err.(*Error); ok && strings.HasSuffix(strings.ToLower(ae.ProblemType), ":badnonce") { + // clear any nonces that we might've stored that might now be + // considered bad + c.clearNonces() + retry := res.Header.Get("retry-after") + if err := sleep(retry, 1); err != nil { + return nil, err + } + continue + } + return nil, err + } + return res, nil + } +} + // postJWS signs the body with the given key and POSTs it to the provided url. // The body argument must be JSON-serializable. func (c *Client) postJWS(ctx context.Context, key crypto.Signer, url string, body interface{}) (*http.Response, error) { @@ -708,7 +726,7 @@ func (c *Client) postJWS(ctx context.Context, key crypto.Signer, url string, bod if err != nil { return nil, err } - res, err := ctxhttp.Post(ctx, c.HTTPClient, url, "application/jose+json", bytes.NewReader(b)) + res, err := c.post(ctx, url, "application/jose+json", bytes.NewReader(b)) if err != nil { return nil, err } @@ -722,7 +740,7 @@ func (c *Client) popNonce(ctx context.Context, url string) (string, error) { c.noncesMu.Lock() defer c.noncesMu.Unlock() if len(c.nonces) == 0 { - return fetchNonce(ctx, c.HTTPClient, url) + return c.fetchNonce(ctx, url) } var nonce string for nonce = range c.nonces { @@ -732,6 +750,13 @@ func (c *Client) popNonce(ctx context.Context, url string) (string, error) { return nonce, nil } +// clearNonces clears any stored nonces +func (c *Client) clearNonces() { + c.noncesMu.Lock() + defer c.noncesMu.Unlock() + c.nonces = make(map[string]struct{}) +} + // addNonce stores a nonce value found in h (if any) for future use. func (c *Client) addNonce(h http.Header) { v := nonceFromHeader(h) @@ -749,8 +774,58 @@ func (c *Client) addNonce(h http.Header) { c.nonces[v] = struct{}{} } -func fetchNonce(ctx context.Context, client *http.Client, url string) (string, error) { - resp, err := ctxhttp.Head(ctx, client, url) +func (c *Client) httpClient() *http.Client { + if c.HTTPClient != nil { + return c.HTTPClient + } + return http.DefaultClient +} + +func (c *Client) get(ctx context.Context, urlStr string) (*http.Response, error) { + req, err := http.NewRequest("GET", urlStr, nil) + if err != nil { + return nil, err + } + return c.do(ctx, req) +} + +func (c *Client) head(ctx context.Context, urlStr string) (*http.Response, error) { + req, err := http.NewRequest("HEAD", urlStr, nil) + if err != nil { + return nil, err + } + return c.do(ctx, req) +} + +func (c *Client) post(ctx context.Context, urlStr, contentType string, body io.Reader) (*http.Response, error) { + req, err := http.NewRequest("POST", urlStr, body) + if err != nil { + return nil, err + } + req.Header.Set("Content-Type", contentType) + return c.do(ctx, req) +} + +func (c *Client) do(ctx context.Context, req *http.Request) (*http.Response, error) { + res, err := c.httpClient().Do(req.WithContext(ctx)) + if err != nil { + select { + case <-ctx.Done(): + // Prefer the unadorned context error. + // (The acme package had tests assuming this, previously from ctxhttp's + // behavior, predating net/http supporting contexts natively) + // TODO(bradfitz): reconsider this in the future. But for now this + // requires no test updates. + return nil, ctx.Err() + default: + return nil, err + } + } + return res, nil +} + +func (c *Client) fetchNonce(ctx context.Context, url string) (string, error) { + resp, err := c.head(ctx, url) if err != nil { return "", err } @@ -769,7 +844,7 @@ func nonceFromHeader(h http.Header) string { return h.Get("Replay-Nonce") } -func responseCert(ctx context.Context, client *http.Client, res *http.Response, bundle bool) ([][]byte, error) { +func (c *Client) responseCert(ctx context.Context, res *http.Response, bundle bool) ([][]byte, error) { b, err := ioutil.ReadAll(io.LimitReader(res.Body, maxCertSize+1)) if err != nil { return nil, fmt.Errorf("acme: response stream: %v", err) @@ -793,7 +868,7 @@ func responseCert(ctx context.Context, client *http.Client, res *http.Response, return nil, errors.New("acme: rel=up link is too large") } for _, url := range up { - cc, err := chainCert(ctx, client, url, 0) + cc, err := c.chainCert(ctx, url, 0) if err != nil { return nil, err } @@ -807,14 +882,8 @@ func responseError(resp *http.Response) error { // don't care if ReadAll returns an error: // json.Unmarshal will fail in that case anyway b, _ := ioutil.ReadAll(resp.Body) - e := struct { - Status int - Type string - Detail string - }{ - Status: resp.StatusCode, - } - if err := json.Unmarshal(b, &e); err != nil { + e := &wireError{Status: resp.StatusCode} + if err := json.Unmarshal(b, e); err != nil { // this is not a regular error response: // populate detail with anything we received, // e.Status will already contain HTTP response code value @@ -823,12 +892,7 @@ func responseError(resp *http.Response) error { e.Detail = resp.Status } } - return &Error{ - StatusCode: e.Status, - ProblemType: e.Type, - Detail: e.Detail, - Header: resp.Header, - } + return e.error(resp.Header) } // chainCert fetches CA certificate chain recursively by following "up" links. @@ -836,12 +900,12 @@ func responseError(resp *http.Response) error { // if the recursion level reaches maxChainLen. // // First chainCert call starts with depth of 0. -func chainCert(ctx context.Context, client *http.Client, url string, depth int) ([][]byte, error) { +func (c *Client) chainCert(ctx context.Context, url string, depth int) ([][]byte, error) { if depth >= maxChainLen { return nil, errors.New("acme: certificate chain is too deep") } - res, err := ctxhttp.Get(ctx, client, url) + res, err := c.get(ctx, url) if err != nil { return nil, err } @@ -863,7 +927,7 @@ func chainCert(ctx context.Context, client *http.Client, url string, depth int) return nil, errors.New("acme: certificate chain is too large") } for _, up := range uplink { - cc, err := chainCert(ctx, client, up, depth+1) + cc, err := c.chainCert(ctx, up, depth+1) if err != nil { return nil, err } @@ -893,6 +957,28 @@ func linkHeader(h http.Header, rel string) []string { return links } +// sleeper returns a function that accepts the Retry-After HTTP header value +// and an increment that's used with backoff to increasingly sleep on +// consecutive calls until the context is done. If the Retry-After header +// cannot be parsed, then backoff is used with a maximum sleep time of 10 +// seconds. +func sleeper(ctx context.Context) func(ra string, inc int) error { + var count int + return func(ra string, inc int) error { + count += inc + d := backoff(count, 10*time.Second) + d = retryAfter(ra, d) + wakeup := time.NewTimer(d) + defer wakeup.Stop() + select { + case <-ctx.Done(): + return ctx.Err() + case <-wakeup.C: + return nil + } + } +} + // retryAfter parses a Retry-After HTTP header value, // trying to convert v into an int (seconds) or use http.ParseTime otherwise. // It returns d if v cannot be parsed. @@ -974,7 +1060,8 @@ func tlsChallengeCert(san []string, opt []CertOption) (tls.Certificate, error) { NotBefore: time.Now(), NotAfter: time.Now().Add(24 * time.Hour), BasicConstraintsValid: true, - KeyUsage: x509.KeyUsageKeyEncipherment, + KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, } } tmpl.DNSNames = san diff --git a/vendor/golang.org/x/crypto/acme/acme_test.go b/vendor/golang.org/x/crypto/acme/acme_test.go index 1205dbb..a4d276d 100644 --- a/vendor/golang.org/x/crypto/acme/acme_test.go +++ b/vendor/golang.org/x/crypto/acme/acme_test.go @@ -6,6 +6,7 @@ package acme import ( "bytes" + "context" "crypto/rand" "crypto/rsa" "crypto/tls" @@ -23,8 +24,6 @@ import ( "strings" "testing" "time" - - "golang.org/x/net/context" ) // Decodes a JWS-encoded request and unmarshals the decoded JSON into a provided @@ -544,6 +543,9 @@ func TestWaitAuthorizationInvalid(t *testing.T) { if err == nil { t.Error("err is nil") } + if _, ok := err.(*AuthorizationError); !ok { + t.Errorf("err is %T; want *AuthorizationError", err) + } } } @@ -981,7 +983,8 @@ func TestNonce_fetch(t *testing.T) { defer ts.Close() for ; i < len(tests); i++ { test := tests[i] - n, err := fetchNonce(context.Background(), http.DefaultClient, ts.URL) + c := &Client{} + n, err := c.fetchNonce(context.Background(), ts.URL) if n != test.nonce { t.Errorf("%d: n=%q; want %q", i, n, test.nonce) } @@ -999,7 +1002,8 @@ func TestNonce_fetchError(t *testing.T) { w.WriteHeader(http.StatusTooManyRequests) })) defer ts.Close() - _, err := fetchNonce(context.Background(), http.DefaultClient, ts.URL) + c := &Client{} + _, err := c.fetchNonce(context.Background(), ts.URL) e, ok := err.(*Error) if !ok { t.Fatalf("err is %T; want *Error", err) @@ -1064,6 +1068,44 @@ func TestNonce_postJWS(t *testing.T) { } } +func TestRetryPostJWS(t *testing.T) { + var count int + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + count++ + w.Header().Set("replay-nonce", fmt.Sprintf("nonce%d", count)) + if r.Method == "HEAD" { + // We expect the client to do 2 head requests to fetch + // nonces, one to start and another after getting badNonce + return + } + + head, err := decodeJWSHead(r) + if err != nil { + t.Errorf("decodeJWSHead: %v", err) + } else if head.Nonce == "" { + t.Error("head.Nonce is empty") + } else if head.Nonce == "nonce1" { + // return a badNonce error to force the call to retry + w.WriteHeader(http.StatusBadRequest) + w.Write([]byte(`{"type":"urn:ietf:params:acme:error:badNonce"}`)) + return + } + // Make client.Authorize happy; we're not testing its result. + w.WriteHeader(http.StatusCreated) + w.Write([]byte(`{"status":"valid"}`)) + })) + defer ts.Close() + + client := Client{Key: testKey, dir: &Directory{AuthzURL: ts.URL}} + // This call will fail with badNonce, causing a retry + if _, err := client.Authorize(context.Background(), "example.com"); err != nil { + t.Errorf("client.Authorize 1: %v", err) + } + if count != 4 { + t.Errorf("total requests count: %d; want 4", count) + } +} + func TestLinkHeader(t *testing.T) { h := http.Header{"Link": { `;rel="next"`, diff --git a/vendor/golang.org/x/crypto/acme/autocert/autocert.go b/vendor/golang.org/x/crypto/acme/autocert/autocert.go index 4b15816..a478eff 100644 --- a/vendor/golang.org/x/crypto/acme/autocert/autocert.go +++ b/vendor/golang.org/x/crypto/acme/autocert/autocert.go @@ -10,6 +10,7 @@ package autocert import ( "bytes" + "context" "crypto" "crypto/ecdsa" "crypto/elliptic" @@ -30,9 +31,14 @@ import ( "time" "golang.org/x/crypto/acme" - "golang.org/x/net/context" ) +// createCertRetryAfter is how much time to wait before removing a failed state +// entry due to an unsuccessful createCert call. +// This is a variable instead of a const for testing. +// TODO: Consider making it configurable or an exp backoff? +var createCertRetryAfter = time.Minute + // pseudoRand is safe for concurrent use. var pseudoRand *lockedMathRand @@ -41,8 +47,9 @@ func init() { pseudoRand = &lockedMathRand{rnd: mathrand.New(src)} } -// AcceptTOS always returns true to indicate the acceptance of a CA Terms of Service -// during account registration. +// AcceptTOS is a Manager.Prompt function that always returns true to +// indicate acceptance of the CA's Terms of Service during account +// registration. func AcceptTOS(tosURL string) bool { return true } // HostPolicy specifies which host names the Manager is allowed to respond to. @@ -76,18 +83,6 @@ func defaultHostPolicy(context.Context, string) error { // It obtains and refreshes certificates automatically, // as well as providing them to a TLS server via tls.Config. // -// A simple usage example: -// -// m := autocert.Manager{ -// Prompt: autocert.AcceptTOS, -// HostPolicy: autocert.HostWhitelist("example.org"), -// } -// s := &http.Server{ -// Addr: ":https", -// TLSConfig: &tls.Config{GetCertificate: m.GetCertificate}, -// } -// s.ListenAndServeTLS("", "") -// // To preserve issued certificates and improve overall performance, // use a cache implementation of Cache. For instance, DirCache. type Manager struct { @@ -123,7 +118,7 @@ type Manager struct { // RenewBefore optionally specifies how early certificates should // be renewed before they expire. // - // If zero, they're renewed 1 week before expiration. + // If zero, they're renewed 30 days before expiration. RenewBefore time.Duration // Client is used to perform low-level operations, such as account registration @@ -173,10 +168,23 @@ type Manager struct { // The error is propagated back to the caller of GetCertificate and is user-visible. // This does not affect cached certs. See HostPolicy field description for more details. func (m *Manager) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error) { + if m.Prompt == nil { + return nil, errors.New("acme/autocert: Manager.Prompt not set") + } + name := hello.ServerName if name == "" { return nil, errors.New("acme/autocert: missing server name") } + if !strings.Contains(strings.Trim(name, "."), ".") { + return nil, errors.New("acme/autocert: server name component count invalid") + } + if strings.ContainsAny(name, `/\`) { + return nil, errors.New("acme/autocert: server name contains invalid character") + } + + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + defer cancel() // check whether this is a token cert requested for TLS-SNI challenge if strings.HasSuffix(name, ".acme.invalid") { @@ -185,7 +193,7 @@ func (m *Manager) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, if cert := m.tokenCert[name]; cert != nil { return cert, nil } - if cert, err := m.cacheGet(name); err == nil { + if cert, err := m.cacheGet(ctx, name); err == nil { return cert, nil } // TODO: cache error results? @@ -194,7 +202,7 @@ func (m *Manager) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, // regular domain name = strings.TrimSuffix(name, ".") // golang.org/issue/18114 - cert, err := m.cert(name) + cert, err := m.cert(ctx, name) if err == nil { return cert, nil } @@ -203,7 +211,6 @@ func (m *Manager) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, } // first-time - ctx := context.Background() // TODO: use a deadline? if err := m.hostPolicy()(ctx, name); err != nil { return nil, err } @@ -211,14 +218,14 @@ func (m *Manager) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, if err != nil { return nil, err } - m.cachePut(name, cert) + m.cachePut(ctx, name, cert) return cert, nil } // cert returns an existing certificate either from m.state or cache. // If a certificate is found in cache but not in m.state, the latter will be filled // with the cached value. -func (m *Manager) cert(name string) (*tls.Certificate, error) { +func (m *Manager) cert(ctx context.Context, name string) (*tls.Certificate, error) { m.stateMu.Lock() if s, ok := m.state[name]; ok { m.stateMu.Unlock() @@ -227,7 +234,7 @@ func (m *Manager) cert(name string) (*tls.Certificate, error) { return s.tlscert() } defer m.stateMu.Unlock() - cert, err := m.cacheGet(name) + cert, err := m.cacheGet(ctx, name) if err != nil { return nil, err } @@ -249,12 +256,11 @@ func (m *Manager) cert(name string) (*tls.Certificate, error) { } // cacheGet always returns a valid certificate, or an error otherwise. -func (m *Manager) cacheGet(domain string) (*tls.Certificate, error) { +// If a cached certficate exists but is not valid, ErrCacheMiss is returned. +func (m *Manager) cacheGet(ctx context.Context, domain string) (*tls.Certificate, error) { if m.Cache == nil { return nil, ErrCacheMiss } - // TODO: might want to define a cache timeout on m - ctx := context.Background() data, err := m.Cache.Get(ctx, domain) if err != nil { return nil, err @@ -263,7 +269,7 @@ func (m *Manager) cacheGet(domain string) (*tls.Certificate, error) { // private priv, pub := pem.Decode(data) if priv == nil || !strings.Contains(priv.Type, "PRIVATE") { - return nil, errors.New("acme/autocert: no private key found in cache") + return nil, ErrCacheMiss } privKey, err := parsePrivateKey(priv.Bytes) if err != nil { @@ -281,13 +287,14 @@ func (m *Manager) cacheGet(domain string) (*tls.Certificate, error) { pubDER = append(pubDER, b.Bytes) } if len(pub) > 0 { - return nil, errors.New("acme/autocert: invalid public key") + // Leftover content not consumed by pem.Decode. Corrupt. Ignore. + return nil, ErrCacheMiss } // verify and create TLS cert leaf, err := validCert(domain, pubDER, privKey) if err != nil { - return nil, err + return nil, ErrCacheMiss } tlscert := &tls.Certificate{ Certificate: pubDER, @@ -297,7 +304,7 @@ func (m *Manager) cacheGet(domain string) (*tls.Certificate, error) { return tlscert, nil } -func (m *Manager) cachePut(domain string, tlscert *tls.Certificate) error { +func (m *Manager) cachePut(ctx context.Context, domain string, tlscert *tls.Certificate) error { if m.Cache == nil { return nil } @@ -329,8 +336,6 @@ func (m *Manager) cachePut(domain string, tlscert *tls.Certificate) error { } } - // TODO: might want to define a cache timeout on m - ctx := context.Background() return m.Cache.Put(ctx, domain, buf.Bytes()) } @@ -370,6 +375,23 @@ func (m *Manager) createCert(ctx context.Context, domain string) (*tls.Certifica der, leaf, err := m.authorizedCert(ctx, state.key, domain) if err != nil { + // Remove the failed state after some time, + // making the manager call createCert again on the following TLS hello. + time.AfterFunc(createCertRetryAfter, func() { + defer testDidRemoveState(domain) + m.stateMu.Lock() + defer m.stateMu.Unlock() + // Verify the state hasn't changed and it's still invalid + // before deleting. + s, ok := m.state[domain] + if !ok { + return + } + if _, err := validCert(domain, s.cert, s.key); err == nil { + return + } + delete(m.state, domain) + }) return nil, err } state.cert = der @@ -418,7 +440,6 @@ func (m *Manager) certState(domain string) (*certState, error) { // authorizedCert starts domain ownership verification process and requests a new cert upon success. // The key argument is the certificate private key. func (m *Manager) authorizedCert(ctx context.Context, key crypto.Signer, domain string) (der [][]byte, leaf *x509.Certificate, err error) { - // TODO: make m.verify retry or retry m.verify calls here if err := m.verify(ctx, domain); err != nil { return nil, nil, err } @@ -494,7 +515,7 @@ func (m *Manager) verify(ctx context.Context, domain string) error { if err != nil { return err } - m.putTokenCert(name, &cert) + m.putTokenCert(ctx, name, &cert) defer func() { // verification has ended at this point // don't need token cert anymore @@ -512,14 +533,14 @@ func (m *Manager) verify(ctx context.Context, domain string) error { // putTokenCert stores the cert under the named key in both m.tokenCert map // and m.Cache. -func (m *Manager) putTokenCert(name string, cert *tls.Certificate) { +func (m *Manager) putTokenCert(ctx context.Context, name string, cert *tls.Certificate) { m.tokenCertMu.Lock() defer m.tokenCertMu.Unlock() if m.tokenCert == nil { m.tokenCert = make(map[string]*tls.Certificate) } m.tokenCert[name] = cert - m.cachePut(name, cert) + m.cachePut(ctx, name, cert) } // deleteTokenCert removes the token certificate for the specified domain name @@ -644,10 +665,10 @@ func (m *Manager) hostPolicy() HostPolicy { } func (m *Manager) renewBefore() time.Duration { - if m.RenewBefore > maxRandRenew { + if m.RenewBefore > renewJitter { return m.RenewBefore } - return 7 * 24 * time.Hour // 1 week + return 720 * time.Hour // 30 days } // certState is ready when its mutex is unlocked for reading. @@ -789,5 +810,10 @@ func (r *lockedMathRand) int63n(max int64) int64 { return n } -// for easier testing -var timeNow = time.Now +// For easier testing. +var ( + timeNow = time.Now + + // Called when a state is removed. + testDidRemoveState = func(domain string) {} +) diff --git a/vendor/golang.org/x/crypto/acme/autocert/autocert_test.go b/vendor/golang.org/x/crypto/acme/autocert/autocert_test.go index 7afb213..0352e34 100644 --- a/vendor/golang.org/x/crypto/acme/autocert/autocert_test.go +++ b/vendor/golang.org/x/crypto/acme/autocert/autocert_test.go @@ -5,6 +5,7 @@ package autocert import ( + "context" "crypto" "crypto/ecdsa" "crypto/elliptic" @@ -27,7 +28,6 @@ import ( "time" "golang.org/x/crypto/acme" - "golang.org/x/net/context" ) var discoTmpl = template.Must(template.New("disco").Parse(`{ @@ -150,7 +150,7 @@ func TestGetCertificate_ForceRSA(t *testing.T) { hello := &tls.ClientHelloInfo{ServerName: "example.org"} testGetCertificate(t, man, "example.org", hello) - cert, err := man.cacheGet("example.org") + cert, err := man.cacheGet(context.Background(), "example.org") if err != nil { t.Fatalf("man.cacheGet: %v", err) } @@ -159,9 +159,110 @@ func TestGetCertificate_ForceRSA(t *testing.T) { } } -// tests man.GetCertificate flow using the provided hello argument. +func TestGetCertificate_nilPrompt(t *testing.T) { + man := &Manager{} + defer man.stopRenew() + url, finish := startACMEServerStub(t, man, "example.org") + defer finish() + key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatal(err) + } + man.Client = &acme.Client{ + Key: key, + DirectoryURL: url, + } + hello := &tls.ClientHelloInfo{ServerName: "example.org"} + if _, err := man.GetCertificate(hello); err == nil { + t.Error("got certificate for example.org; wanted error") + } +} + +func TestGetCertificate_expiredCache(t *testing.T) { + // Make an expired cert and cache it. + pk, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatal(err) + } + tmpl := &x509.Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{CommonName: "example.org"}, + NotAfter: time.Now(), + } + pub, err := x509.CreateCertificate(rand.Reader, tmpl, tmpl, &pk.PublicKey, pk) + if err != nil { + t.Fatal(err) + } + tlscert := &tls.Certificate{ + Certificate: [][]byte{pub}, + PrivateKey: pk, + } + + man := &Manager{Prompt: AcceptTOS, Cache: newMemCache()} + defer man.stopRenew() + if err := man.cachePut(context.Background(), "example.org", tlscert); err != nil { + t.Fatalf("man.cachePut: %v", err) + } + + // The expired cached cert should trigger a new cert issuance + // and return without an error. + hello := &tls.ClientHelloInfo{ServerName: "example.org"} + testGetCertificate(t, man, "example.org", hello) +} + +func TestGetCertificate_failedAttempt(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusBadRequest) + })) + defer ts.Close() + + const example = "example.org" + d := createCertRetryAfter + f := testDidRemoveState + defer func() { + createCertRetryAfter = d + testDidRemoveState = f + }() + createCertRetryAfter = 0 + done := make(chan struct{}) + testDidRemoveState = func(domain string) { + if domain != example { + t.Errorf("testDidRemoveState: domain = %q; want %q", domain, example) + } + close(done) + } + + key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatal(err) + } + man := &Manager{ + Prompt: AcceptTOS, + Client: &acme.Client{ + Key: key, + DirectoryURL: ts.URL, + }, + } + defer man.stopRenew() + hello := &tls.ClientHelloInfo{ServerName: example} + if _, err := man.GetCertificate(hello); err == nil { + t.Error("GetCertificate: err is nil") + } + select { + case <-time.After(5 * time.Second): + t.Errorf("took too long to remove the %q state", example) + case <-done: + man.stateMu.Lock() + defer man.stateMu.Unlock() + if v, exist := man.state[example]; exist { + t.Errorf("state exists for %q: %+v", example, v) + } + } +} + +// startACMEServerStub runs an ACME server // The domain argument is the expected domain name of a certificate request. -func testGetCertificate(t *testing.T, man *Manager, domain string, hello *tls.ClientHelloInfo) { +func startACMEServerStub(t *testing.T, man *Manager, domain string) (url string, finish func()) { // echo token-02 | shasum -a 256 // then divide result in 2 parts separated by dot tokenCertName := "4e8eb87631187e9ff2153b56b13a4dec.13a35d002e485d60ff37354b32f665d9.token.acme.invalid" @@ -187,7 +288,7 @@ func testGetCertificate(t *testing.T, man *Manager, domain string, hello *tls.Cl // discovery case "/": if err := discoTmpl.Execute(w, ca.URL); err != nil { - t.Fatalf("discoTmpl: %v", err) + t.Errorf("discoTmpl: %v", err) } // client key registration case "/new-reg": @@ -197,7 +298,7 @@ func testGetCertificate(t *testing.T, man *Manager, domain string, hello *tls.Cl w.Header().Set("location", ca.URL+"/authz/1") w.WriteHeader(http.StatusCreated) if err := authzTmpl.Execute(w, ca.URL); err != nil { - t.Fatalf("authzTmpl: %v", err) + t.Errorf("authzTmpl: %v", err) } // accept tls-sni-02 challenge case "/challenge/2": @@ -215,14 +316,14 @@ func testGetCertificate(t *testing.T, man *Manager, domain string, hello *tls.Cl b, _ := base64.RawURLEncoding.DecodeString(req.CSR) csr, err := x509.ParseCertificateRequest(b) if err != nil { - t.Fatalf("new-cert: CSR: %v", err) + t.Errorf("new-cert: CSR: %v", err) } if csr.Subject.CommonName != domain { t.Errorf("CommonName in CSR = %q; want %q", csr.Subject.CommonName, domain) } der, err := dummyCert(csr.PublicKey, domain) if err != nil { - t.Fatalf("new-cert: dummyCert: %v", err) + t.Errorf("new-cert: dummyCert: %v", err) } chainUp := fmt.Sprintf("<%s/ca-cert>; rel=up", ca.URL) w.Header().Set("link", chainUp) @@ -232,14 +333,51 @@ func testGetCertificate(t *testing.T, man *Manager, domain string, hello *tls.Cl case "/ca-cert": der, err := dummyCert(nil, "ca") if err != nil { - t.Fatalf("ca-cert: dummyCert: %v", err) + t.Errorf("ca-cert: dummyCert: %v", err) } w.Write(der) default: t.Errorf("unrecognized r.URL.Path: %s", r.URL.Path) } })) - defer ca.Close() + finish = func() { + ca.Close() + + // make sure token cert was removed + cancel := make(chan struct{}) + done := make(chan struct{}) + go func() { + defer close(done) + tick := time.NewTicker(100 * time.Millisecond) + defer tick.Stop() + for { + hello := &tls.ClientHelloInfo{ServerName: tokenCertName} + if _, err := man.GetCertificate(hello); err != nil { + return + } + select { + case <-tick.C: + case <-cancel: + return + } + } + }() + select { + case <-done: + case <-time.After(5 * time.Second): + close(cancel) + t.Error("token cert was not removed") + <-done + } + } + return ca.URL, finish +} + +// tests man.GetCertificate flow using the provided hello argument. +// The domain argument is the expected domain name of a certificate request. +func testGetCertificate(t *testing.T, man *Manager, domain string, hello *tls.ClientHelloInfo) { + url, finish := startACMEServerStub(t, man, domain) + defer finish() // use EC key to run faster on 386 key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) @@ -248,7 +386,7 @@ func testGetCertificate(t *testing.T, man *Manager, domain string, hello *tls.Cl } man.Client = &acme.Client{ Key: key, - DirectoryURL: ca.URL, + DirectoryURL: url, } // simulate tls.Config.GetCertificate @@ -279,23 +417,6 @@ func testGetCertificate(t *testing.T, man *Manager, domain string, hello *tls.Cl t.Errorf("cert.DNSNames = %v; want %q", cert.DNSNames, domain) } - // make sure token cert was removed - done = make(chan struct{}) - go func() { - for { - hello := &tls.ClientHelloInfo{ServerName: tokenCertName} - if _, err := man.GetCertificate(hello); err != nil { - break - } - time.Sleep(100 * time.Millisecond) - } - close(done) - }() - select { - case <-time.After(5 * time.Second): - t.Error("token cert was not removed") - case <-done: - } } func TestAccountKeyCache(t *testing.T) { @@ -335,10 +456,11 @@ func TestCache(t *testing.T) { man := &Manager{Cache: newMemCache()} defer man.stopRenew() - if err := man.cachePut("example.org", tlscert); err != nil { + ctx := context.Background() + if err := man.cachePut(ctx, "example.org", tlscert); err != nil { t.Fatalf("man.cachePut: %v", err) } - res, err := man.cacheGet("example.org") + res, err := man.cacheGet(ctx, "example.org") if err != nil { t.Fatalf("man.cacheGet: %v", err) } @@ -438,3 +560,47 @@ func TestValidCert(t *testing.T) { } } } + +type cacheGetFunc func(ctx context.Context, key string) ([]byte, error) + +func (f cacheGetFunc) Get(ctx context.Context, key string) ([]byte, error) { + return f(ctx, key) +} + +func (f cacheGetFunc) Put(ctx context.Context, key string, data []byte) error { + return fmt.Errorf("unsupported Put of %q = %q", key, data) +} + +func (f cacheGetFunc) Delete(ctx context.Context, key string) error { + return fmt.Errorf("unsupported Delete of %q", key) +} + +func TestManagerGetCertificateBogusSNI(t *testing.T) { + m := Manager{ + Prompt: AcceptTOS, + Cache: cacheGetFunc(func(ctx context.Context, key string) ([]byte, error) { + return nil, fmt.Errorf("cache.Get of %s", key) + }), + } + tests := []struct { + name string + wantErr string + }{ + {"foo.com", "cache.Get of foo.com"}, + {"foo.com.", "cache.Get of foo.com"}, + {`a\b.com`, "acme/autocert: server name contains invalid character"}, + {`a/b.com`, "acme/autocert: server name contains invalid character"}, + {"", "acme/autocert: missing server name"}, + {"foo", "acme/autocert: server name component count invalid"}, + {".foo", "acme/autocert: server name component count invalid"}, + {"foo.", "acme/autocert: server name component count invalid"}, + {"fo.o", "cache.Get of fo.o"}, + } + for _, tt := range tests { + _, err := m.GetCertificate(&tls.ClientHelloInfo{ServerName: tt.name}) + got := fmt.Sprint(err) + if got != tt.wantErr { + t.Errorf("GetCertificate(SNI = %q) = %q; want %q", tt.name, got, tt.wantErr) + } + } +} diff --git a/vendor/golang.org/x/crypto/acme/autocert/cache.go b/vendor/golang.org/x/crypto/acme/autocert/cache.go index 9b184aa..61a5fd2 100644 --- a/vendor/golang.org/x/crypto/acme/autocert/cache.go +++ b/vendor/golang.org/x/crypto/acme/autocert/cache.go @@ -5,12 +5,11 @@ package autocert import ( + "context" "errors" "io/ioutil" "os" "path/filepath" - - "golang.org/x/net/context" ) // ErrCacheMiss is returned when a certificate is not found in cache. @@ -78,12 +77,13 @@ func (d DirCache) Put(ctx context.Context, name string, data []byte) error { if tmp, err = d.writeTempFile(name, data); err != nil { return } - // prevent overwriting the file if the context was cancelled - if ctx.Err() != nil { - return // no need to set err + select { + case <-ctx.Done(): + // Don't overwrite the file if the context was canceled. + default: + newName := filepath.Join(string(d), name) + err = os.Rename(tmp, newName) } - name = filepath.Join(string(d), name) - err = os.Rename(tmp, name) }() select { case <-ctx.Done(): diff --git a/vendor/golang.org/x/crypto/acme/autocert/cache_test.go b/vendor/golang.org/x/crypto/acme/autocert/cache_test.go index ad6d4a4..6e1b88d 100644 --- a/vendor/golang.org/x/crypto/acme/autocert/cache_test.go +++ b/vendor/golang.org/x/crypto/acme/autocert/cache_test.go @@ -5,13 +5,12 @@ package autocert import ( + "context" "io/ioutil" "os" "path/filepath" "reflect" "testing" - - "golang.org/x/net/context" ) // make sure DirCache satisfies Cache interface diff --git a/vendor/golang.org/x/crypto/acme/autocert/example_test.go b/vendor/golang.org/x/crypto/acme/autocert/example_test.go new file mode 100644 index 0000000..c6267b8 --- /dev/null +++ b/vendor/golang.org/x/crypto/acme/autocert/example_test.go @@ -0,0 +1,34 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package autocert_test + +import ( + "crypto/tls" + "fmt" + "log" + "net/http" + + "golang.org/x/crypto/acme/autocert" +) + +func ExampleNewListener() { + mux := http.NewServeMux() + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + fmt.Fprintf(w, "Hello, TLS user! Your config: %+v", r.TLS) + }) + log.Fatal(http.Serve(autocert.NewListener("example.com"), mux)) +} + +func ExampleManager() { + m := autocert.Manager{ + Prompt: autocert.AcceptTOS, + HostPolicy: autocert.HostWhitelist("example.org"), + } + s := &http.Server{ + Addr: ":https", + TLSConfig: &tls.Config{GetCertificate: m.GetCertificate}, + } + s.ListenAndServeTLS("", "") +} diff --git a/vendor/golang.org/x/crypto/acme/autocert/listener.go b/vendor/golang.org/x/crypto/acme/autocert/listener.go new file mode 100644 index 0000000..d4c93d2 --- /dev/null +++ b/vendor/golang.org/x/crypto/acme/autocert/listener.go @@ -0,0 +1,153 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package autocert + +import ( + "crypto/tls" + "log" + "net" + "os" + "path/filepath" + "runtime" + "time" +) + +// NewListener returns a net.Listener that listens on the standard TLS +// port (443) on all interfaces and returns *tls.Conn connections with +// LetsEncrypt certificates for the provided domain or domains. +// +// It enables one-line HTTPS servers: +// +// log.Fatal(http.Serve(autocert.NewListener("example.com"), handler)) +// +// NewListener is a convenience function for a common configuration. +// More complex or custom configurations can use the autocert.Manager +// type instead. +// +// Use of this function implies acceptance of the LetsEncrypt Terms of +// Service. If domains is not empty, the provided domains are passed +// to HostWhitelist. If domains is empty, the listener will do +// LetsEncrypt challenges for any requested domain, which is not +// recommended. +// +// Certificates are cached in a "golang-autocert" directory under an +// operating system-specific cache or temp directory. This may not +// be suitable for servers spanning multiple machines. +// +// The returned Listener also enables TCP keep-alives on the accepted +// connections. The returned *tls.Conn are returned before their TLS +// handshake has completed. +func NewListener(domains ...string) net.Listener { + m := &Manager{ + Prompt: AcceptTOS, + } + if len(domains) > 0 { + m.HostPolicy = HostWhitelist(domains...) + } + dir := cacheDir() + if err := os.MkdirAll(dir, 0700); err != nil { + log.Printf("warning: autocert.NewListener not using a cache: %v", err) + } else { + m.Cache = DirCache(dir) + } + return m.Listener() +} + +// Listener listens on the standard TLS port (443) on all interfaces +// and returns a net.Listener returning *tls.Conn connections. +// +// The returned Listener also enables TCP keep-alives on the accepted +// connections. The returned *tls.Conn are returned before their TLS +// handshake has completed. +// +// Unlike NewListener, it is the caller's responsibility to initialize +// the Manager m's Prompt, Cache, HostPolicy, and other desired options. +func (m *Manager) Listener() net.Listener { + ln := &listener{ + m: m, + conf: &tls.Config{ + GetCertificate: m.GetCertificate, // bonus: panic on nil m + }, + } + ln.tcpListener, ln.tcpListenErr = net.Listen("tcp", ":443") + return ln +} + +type listener struct { + m *Manager + conf *tls.Config + + tcpListener net.Listener + tcpListenErr error +} + +func (ln *listener) Accept() (net.Conn, error) { + if ln.tcpListenErr != nil { + return nil, ln.tcpListenErr + } + conn, err := ln.tcpListener.Accept() + if err != nil { + return nil, err + } + tcpConn := conn.(*net.TCPConn) + + // Because Listener is a convenience function, help out with + // this too. This is not possible for the caller to set once + // we return a *tcp.Conn wrapping an inaccessible net.Conn. + // If callers don't want this, they can do things the manual + // way and tweak as needed. But this is what net/http does + // itself, so copy that. If net/http changes, we can change + // here too. + tcpConn.SetKeepAlive(true) + tcpConn.SetKeepAlivePeriod(3 * time.Minute) + + return tls.Server(tcpConn, ln.conf), nil +} + +func (ln *listener) Addr() net.Addr { + if ln.tcpListener != nil { + return ln.tcpListener.Addr() + } + // net.Listen failed. Return something non-nil in case callers + // call Addr before Accept: + return &net.TCPAddr{IP: net.IP{0, 0, 0, 0}, Port: 443} +} + +func (ln *listener) Close() error { + if ln.tcpListenErr != nil { + return ln.tcpListenErr + } + return ln.tcpListener.Close() +} + +func homeDir() string { + if runtime.GOOS == "windows" { + return os.Getenv("HOMEDRIVE") + os.Getenv("HOMEPATH") + } + if h := os.Getenv("HOME"); h != "" { + return h + } + return "/" +} + +func cacheDir() string { + const base = "golang-autocert" + switch runtime.GOOS { + case "darwin": + return filepath.Join(homeDir(), "Library", "Caches", base) + case "windows": + for _, ev := range []string{"APPDATA", "CSIDL_APPDATA", "TEMP", "TMP"} { + if v := os.Getenv(ev); v != "" { + return filepath.Join(v, base) + } + } + // Worst case: + return filepath.Join(homeDir(), base) + } + if xdg := os.Getenv("XDG_CACHE_HOME"); xdg != "" { + return filepath.Join(xdg, base) + } + return filepath.Join(homeDir(), ".cache", base) +} diff --git a/vendor/golang.org/x/crypto/acme/autocert/renewal.go b/vendor/golang.org/x/crypto/acme/autocert/renewal.go index 1a5018c..6c5da2b 100644 --- a/vendor/golang.org/x/crypto/acme/autocert/renewal.go +++ b/vendor/golang.org/x/crypto/acme/autocert/renewal.go @@ -5,15 +5,14 @@ package autocert import ( + "context" "crypto" "sync" "time" - - "golang.org/x/net/context" ) -// maxRandRenew is a maximum deviation from Manager.RenewBefore. -const maxRandRenew = time.Hour +// renewJitter is the maximum deviation from Manager.RenewBefore. +const renewJitter = time.Hour // domainRenewal tracks the state used by the periodic timers // renewing a single domain's cert. @@ -65,7 +64,7 @@ func (dr *domainRenewal) renew() { // TODO: rotate dr.key at some point? next, err := dr.do(ctx) if err != nil { - next = maxRandRenew / 2 + next = renewJitter / 2 next += time.Duration(pseudoRand.int63n(int64(next))) } dr.timer = time.AfterFunc(next, dr.renew) @@ -83,9 +82,9 @@ func (dr *domainRenewal) renew() { func (dr *domainRenewal) do(ctx context.Context) (time.Duration, error) { // a race is likely unavoidable in a distributed environment // but we try nonetheless - if tlscert, err := dr.m.cacheGet(dr.domain); err == nil { + if tlscert, err := dr.m.cacheGet(ctx, dr.domain); err == nil { next := dr.next(tlscert.Leaf.NotAfter) - if next > dr.m.renewBefore()+maxRandRenew { + if next > dr.m.renewBefore()+renewJitter { return next, nil } } @@ -103,7 +102,7 @@ func (dr *domainRenewal) do(ctx context.Context) (time.Duration, error) { if err != nil { return 0, err } - dr.m.cachePut(dr.domain, tlscert) + dr.m.cachePut(ctx, dr.domain, tlscert) dr.m.stateMu.Lock() defer dr.m.stateMu.Unlock() // m.state is guaranteed to be non-nil at this point @@ -114,7 +113,7 @@ func (dr *domainRenewal) do(ctx context.Context) (time.Duration, error) { func (dr *domainRenewal) next(expiry time.Time) time.Duration { d := expiry.Sub(timeNow()) - dr.m.renewBefore() // add a bit of randomness to renew deadline - n := pseudoRand.int63n(int64(maxRandRenew)) + n := pseudoRand.int63n(int64(renewJitter)) d -= time.Duration(n) if d < 0 { return 0 diff --git a/vendor/golang.org/x/crypto/acme/autocert/renewal_test.go b/vendor/golang.org/x/crypto/acme/autocert/renewal_test.go index 10c811a..f232619 100644 --- a/vendor/golang.org/x/crypto/acme/autocert/renewal_test.go +++ b/vendor/golang.org/x/crypto/acme/autocert/renewal_test.go @@ -5,6 +5,7 @@ package autocert import ( + "context" "crypto/ecdsa" "crypto/elliptic" "crypto/rand" @@ -31,7 +32,7 @@ func TestRenewalNext(t *testing.T) { expiry time.Time min, max time.Duration }{ - {now.Add(90 * 24 * time.Hour), 83*24*time.Hour - maxRandRenew, 83 * 24 * time.Hour}, + {now.Add(90 * 24 * time.Hour), 83*24*time.Hour - renewJitter, 83 * 24 * time.Hour}, {now.Add(time.Hour), 0, 1}, {now, 0, 1}, {now.Add(-time.Hour), 0, 1}, @@ -127,7 +128,7 @@ func TestRenewFromCache(t *testing.T) { t.Fatal(err) } tlscert := &tls.Certificate{PrivateKey: key, Certificate: [][]byte{cert}} - if err := man.cachePut(domain, tlscert); err != nil { + if err := man.cachePut(context.Background(), domain, tlscert); err != nil { t.Fatal(err) } @@ -151,7 +152,7 @@ func TestRenewFromCache(t *testing.T) { // ensure the new cert is cached after := time.Now().Add(future) - tlscert, err := man.cacheGet(domain) + tlscert, err := man.cacheGet(context.Background(), domain) if err != nil { t.Fatalf("man.cacheGet: %v", err) } diff --git a/vendor/golang.org/x/crypto/acme/jws.go b/vendor/golang.org/x/crypto/acme/jws.go index 49ba313..6cbca25 100644 --- a/vendor/golang.org/x/crypto/acme/jws.go +++ b/vendor/golang.org/x/crypto/acme/jws.go @@ -134,7 +134,7 @@ func jwsHasher(key crypto.Signer) (string, crypto.Hash) { return "ES256", crypto.SHA256 case "P-384": return "ES384", crypto.SHA384 - case "P-512": + case "P-521": return "ES512", crypto.SHA512 } } diff --git a/vendor/golang.org/x/crypto/acme/jws_test.go b/vendor/golang.org/x/crypto/acme/jws_test.go index 1def873..0ff0fb5 100644 --- a/vendor/golang.org/x/crypto/acme/jws_test.go +++ b/vendor/golang.org/x/crypto/acme/jws_test.go @@ -12,11 +12,13 @@ import ( "encoding/base64" "encoding/json" "encoding/pem" + "fmt" "math/big" "testing" ) -const testKeyPEM = ` +const ( + testKeyPEM = ` -----BEGIN RSA PRIVATE KEY----- MIIEowIBAAKCAQEA4xgZ3eRPkwoRvy7qeRUbmMDe0V+xH9eWLdu0iheeLlrmD2mq WXfP9IeSKApbn34g8TuAS9g5zhq8ELQ3kmjr+KV86GAMgI6VAcGlq3QrzpTCf/30 @@ -46,10 +48,9 @@ EQeIP6dZtv8IMgtGIb91QX9pXvP0aznzQKwYIA8nZgoENCPfiMTPiEDT9e/0lObO -----END RSA PRIVATE KEY----- ` -// This thumbprint is for the testKey defined above. -const testKeyThumbprint = "6nicxzh6WETQlrvdchkz-U3e3DOQZ4heJKU63rfqMqQ" + // This thumbprint is for the testKey defined above. + testKeyThumbprint = "6nicxzh6WETQlrvdchkz-U3e3DOQZ4heJKU63rfqMqQ" -const ( // openssl ecparam -name secp256k1 -genkey -noout testKeyECPEM = ` -----BEGIN EC PRIVATE KEY----- @@ -58,39 +59,78 @@ AwEHoUQDQgAE5lhEug5xK4xBDZ2nAbaxLtaLiv85bxJ7ePd1dkO23HThqIrvawF5 QAaS/RNouybCiRhRjI3EaxLkQwgrCw0gqQ== -----END EC PRIVATE KEY----- ` - // 1. opnessl ec -in key.pem -noout -text + // openssl ecparam -name secp384r1 -genkey -noout + testKeyEC384PEM = ` +-----BEGIN EC PRIVATE KEY----- +MIGkAgEBBDAQ4lNtXRORWr1bgKR1CGysr9AJ9SyEk4jiVnlUWWUChmSNL+i9SLSD +Oe/naPqXJ6CgBwYFK4EEACKhZANiAAQzKtj+Ms0vHoTX5dzv3/L5YMXOWuI5UKRj +JigpahYCqXD2BA1j0E/2xt5vlPf+gm0PL+UHSQsCokGnIGuaHCsJAp3ry0gHQEke +WYXapUUFdvaK1R2/2hn5O+eiQM8YzCg= +-----END EC PRIVATE KEY----- +` + // openssl ecparam -name secp521r1 -genkey -noout + testKeyEC512PEM = ` +-----BEGIN EC PRIVATE KEY----- +MIHcAgEBBEIBSNZKFcWzXzB/aJClAb305ibalKgtDA7+70eEkdPt28/3LZMM935Z +KqYHh/COcxuu3Kt8azRAUz3gyr4zZKhlKUSgBwYFK4EEACOhgYkDgYYABAHUNKbx +7JwC7H6pa2sV0tERWhHhB3JmW+OP6SUgMWryvIKajlx73eS24dy4QPGrWO9/ABsD +FqcRSkNVTXnIv6+0mAF25knqIBIg5Q8M9BnOu9GGAchcwt3O7RDHmqewnJJDrbjd +GGnm6rb+NnWR9DIopM0nKNkToWoF/hzopxu4Ae/GsQ== +-----END EC PRIVATE KEY----- +` + // 1. openssl ec -in key.pem -noout -text // 2. remove first byte, 04 (the header); the rest is X and Y - // 3. covert each with: echo | xxd -r -p | base64 | tr -d '=' | tr '/+' '_-' - testKeyECPubX = "5lhEug5xK4xBDZ2nAbaxLtaLiv85bxJ7ePd1dkO23HQ" - testKeyECPubY = "4aiK72sBeUAGkv0TaLsmwokYUYyNxGsS5EMIKwsNIKk" + // 3. convert each with: echo | xxd -r -p | base64 -w 100 | tr -d '=' | tr '/+' '_-' + testKeyECPubX = "5lhEug5xK4xBDZ2nAbaxLtaLiv85bxJ7ePd1dkO23HQ" + testKeyECPubY = "4aiK72sBeUAGkv0TaLsmwokYUYyNxGsS5EMIKwsNIKk" + testKeyEC384PubX = "MyrY_jLNLx6E1-Xc79_y-WDFzlriOVCkYyYoKWoWAqlw9gQNY9BP9sbeb5T3_oJt" + testKeyEC384PubY = "Dy_lB0kLAqJBpyBrmhwrCQKd68tIB0BJHlmF2qVFBXb2itUdv9oZ-TvnokDPGMwo" + testKeyEC512PubX = "AdQ0pvHsnALsfqlraxXS0RFaEeEHcmZb44_pJSAxavK8gpqOXHvd5Lbh3LhA8atY738AGwMWpxFKQ1VNeci_r7SY" + testKeyEC512PubY = "AXbmSeogEiDlDwz0Gc670YYByFzC3c7tEMeap7CckkOtuN0Yaebqtv42dZH0MiikzSco2ROhagX-HOinG7gB78ax" + // echo -n '{"crv":"P-256","kty":"EC","x":"","y":""}' | \ // openssl dgst -binary -sha256 | base64 | tr -d '=' | tr '/+' '_-' testKeyECThumbprint = "zedj-Bd1Zshp8KLePv2MB-lJ_Hagp7wAwdkA0NUTniU" ) var ( - testKey *rsa.PrivateKey - testKeyEC *ecdsa.PrivateKey + testKey *rsa.PrivateKey + testKeyEC *ecdsa.PrivateKey + testKeyEC384 *ecdsa.PrivateKey + testKeyEC512 *ecdsa.PrivateKey ) func init() { - d, _ := pem.Decode([]byte(testKeyPEM)) - if d == nil { - panic("no block found in testKeyPEM") - } - var err error - testKey, err = x509.ParsePKCS1PrivateKey(d.Bytes) - if err != nil { - panic(err.Error()) - } + testKey = parseRSA(testKeyPEM, "testKeyPEM") + testKeyEC = parseEC(testKeyECPEM, "testKeyECPEM") + testKeyEC384 = parseEC(testKeyEC384PEM, "testKeyEC384PEM") + testKeyEC512 = parseEC(testKeyEC512PEM, "testKeyEC512PEM") +} - if d, _ = pem.Decode([]byte(testKeyECPEM)); d == nil { - panic("no block found in testKeyECPEM") +func decodePEM(s, name string) []byte { + d, _ := pem.Decode([]byte(s)) + if d == nil { + panic("no block found in " + name) } - testKeyEC, err = x509.ParseECPrivateKey(d.Bytes) + return d.Bytes +} + +func parseRSA(s, name string) *rsa.PrivateKey { + b := decodePEM(s, name) + k, err := x509.ParsePKCS1PrivateKey(b) if err != nil { - panic(err.Error()) + panic(fmt.Sprintf("%s: %v", name, err)) } + return k +} + +func parseEC(s, name string) *ecdsa.PrivateKey { + b := decodePEM(s, name) + k, err := x509.ParseECPrivateKey(b) + if err != nil { + panic(fmt.Sprintf("%s: %v", name, err)) + } + return k } func TestJWSEncodeJSON(t *testing.T) { @@ -141,50 +181,63 @@ func TestJWSEncodeJSON(t *testing.T) { } func TestJWSEncodeJSONEC(t *testing.T) { - claims := struct{ Msg string }{"Hello JWS"} + tt := []struct { + key *ecdsa.PrivateKey + x, y string + alg, crv string + }{ + {testKeyEC, testKeyECPubX, testKeyECPubY, "ES256", "P-256"}, + {testKeyEC384, testKeyEC384PubX, testKeyEC384PubY, "ES384", "P-384"}, + {testKeyEC512, testKeyEC512PubX, testKeyEC512PubY, "ES512", "P-521"}, + } + for i, test := range tt { + claims := struct{ Msg string }{"Hello JWS"} + b, err := jwsEncodeJSON(claims, test.key, "nonce") + if err != nil { + t.Errorf("%d: %v", i, err) + continue + } + var jws struct{ Protected, Payload, Signature string } + if err := json.Unmarshal(b, &jws); err != nil { + t.Errorf("%d: %v", i, err) + continue + } - b, err := jwsEncodeJSON(claims, testKeyEC, "nonce") - if err != nil { - t.Fatal(err) - } - var jws struct{ Protected, Payload, Signature string } - if err := json.Unmarshal(b, &jws); err != nil { - t.Fatal(err) - } - - if b, err = base64.RawURLEncoding.DecodeString(jws.Protected); err != nil { - t.Fatalf("jws.Protected: %v", err) - } - var head struct { - Alg string - Nonce string - JWK struct { - Crv string - Kty string - X string - Y string - } `json:"jwk"` - } - if err := json.Unmarshal(b, &head); err != nil { - t.Fatalf("jws.Protected: %v", err) - } - if head.Alg != "ES256" { - t.Errorf("head.Alg = %q; want ES256", head.Alg) - } - if head.Nonce != "nonce" { - t.Errorf("head.Nonce = %q; want nonce", head.Nonce) - } - if head.JWK.Crv != "P-256" { - t.Errorf("head.JWK.Crv = %q; want P-256", head.JWK.Crv) - } - if head.JWK.Kty != "EC" { - t.Errorf("head.JWK.Kty = %q; want EC", head.JWK.Kty) - } - if head.JWK.X != testKeyECPubX { - t.Errorf("head.JWK.X = %q; want %q", head.JWK.X, testKeyECPubX) - } - if head.JWK.Y != testKeyECPubY { - t.Errorf("head.JWK.Y = %q; want %q", head.JWK.Y, testKeyECPubY) + b, err = base64.RawURLEncoding.DecodeString(jws.Protected) + if err != nil { + t.Errorf("%d: jws.Protected: %v", i, err) + } + var head struct { + Alg string + Nonce string + JWK struct { + Crv string + Kty string + X string + Y string + } `json:"jwk"` + } + if err := json.Unmarshal(b, &head); err != nil { + t.Errorf("%d: jws.Protected: %v", i, err) + } + if head.Alg != test.alg { + t.Errorf("%d: head.Alg = %q; want %q", i, head.Alg, test.alg) + } + if head.Nonce != "nonce" { + t.Errorf("%d: head.Nonce = %q; want nonce", i, head.Nonce) + } + if head.JWK.Crv != test.crv { + t.Errorf("%d: head.JWK.Crv = %q; want %q", i, head.JWK.Crv, test.crv) + } + if head.JWK.Kty != "EC" { + t.Errorf("%d: head.JWK.Kty = %q; want EC", i, head.JWK.Kty) + } + if head.JWK.X != test.x { + t.Errorf("%d: head.JWK.X = %q; want %q", i, head.JWK.X, test.x) + } + if head.JWK.Y != test.y { + t.Errorf("%d: head.JWK.Y = %q; want %q", i, head.JWK.Y, test.y) + } } } diff --git a/vendor/golang.org/x/crypto/acme/types.go b/vendor/golang.org/x/crypto/acme/types.go index 0513b2e..ab4de0b 100644 --- a/vendor/golang.org/x/crypto/acme/types.go +++ b/vendor/golang.org/x/crypto/acme/types.go @@ -1,9 +1,15 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + package acme import ( "errors" "fmt" "net/http" + "strings" + "time" ) // ACME server response statuses used to describe Authorization and Challenge states. @@ -33,14 +39,8 @@ const ( CRLReasonAACompromise CRLReasonCode = 10 ) -var ( - // ErrAuthorizationFailed indicates that an authorization for an identifier - // did not succeed. - ErrAuthorizationFailed = errors.New("acme: identifier authorization failed") - - // ErrUnsupportedKey is returned when an unsupported key type is encountered. - ErrUnsupportedKey = errors.New("acme: unknown key type; only RSA and ECDSA are supported") -) +// ErrUnsupportedKey is returned when an unsupported key type is encountered. +var ErrUnsupportedKey = errors.New("acme: unknown key type; only RSA and ECDSA are supported") // Error is an ACME error, defined in Problem Details for HTTP APIs doc // http://tools.ietf.org/html/draft-ietf-appsawg-http-problem. @@ -53,6 +53,7 @@ type Error struct { // Detail is a human-readable explanation specific to this occurrence of the problem. Detail string // Header is the original server error response headers. + // It may be nil. Header http.Header } @@ -60,6 +61,50 @@ func (e *Error) Error() string { return fmt.Sprintf("%d %s: %s", e.StatusCode, e.ProblemType, e.Detail) } +// AuthorizationError indicates that an authorization for an identifier +// did not succeed. +// It contains all errors from Challenge items of the failed Authorization. +type AuthorizationError struct { + // URI uniquely identifies the failed Authorization. + URI string + + // Identifier is an AuthzID.Value of the failed Authorization. + Identifier string + + // Errors is a collection of non-nil error values of Challenge items + // of the failed Authorization. + Errors []error +} + +func (a *AuthorizationError) Error() string { + e := make([]string, len(a.Errors)) + for i, err := range a.Errors { + e[i] = err.Error() + } + return fmt.Sprintf("acme: authorization error for %s: %s", a.Identifier, strings.Join(e, "; ")) +} + +// RateLimit reports whether err represents a rate limit error and +// any Retry-After duration returned by the server. +// +// See the following for more details on rate limiting: +// https://tools.ietf.org/html/draft-ietf-acme-acme-05#section-5.6 +func RateLimit(err error) (time.Duration, bool) { + e, ok := err.(*Error) + if !ok { + return 0, false + } + // Some CA implementations may return incorrect values. + // Use case-insensitive comparison. + if !strings.HasSuffix(strings.ToLower(e.ProblemType), ":ratelimited") { + return 0, false + } + if e.Header == nil { + return 0, true + } + return retryAfter(e.Header.Get("Retry-After"), 0), true +} + // Account is a user account. It is associated with a private key. type Account struct { // URI is the account unique ID, which is also a URL used to retrieve @@ -118,6 +163,8 @@ type Directory struct { } // Challenge encodes a returned CA challenge. +// Its Error field may be non-nil if the challenge is part of an Authorization +// with StatusInvalid. type Challenge struct { // Type is the challenge type, e.g. "http-01", "tls-sni-02", "dns-01". Type string @@ -130,6 +177,11 @@ type Challenge struct { // Status identifies the status of this challenge. Status string + + // Error indicates the reason for an authorization failure + // when this challenge was used. + // The type of a non-nil value is *Error. + Error error } // Authorization encodes an authorization response. @@ -187,12 +239,26 @@ func (z *wireAuthz) authorization(uri string) *Authorization { return a } +func (z *wireAuthz) error(uri string) *AuthorizationError { + err := &AuthorizationError{ + URI: uri, + Identifier: z.Identifier.Value, + } + for _, raw := range z.Challenges { + if raw.Error != nil { + err.Errors = append(err.Errors, raw.Error.error(nil)) + } + } + return err +} + // wireChallenge is ACME JSON challenge representation. type wireChallenge struct { URI string `json:"uri"` Type string Token string Status string + Error *wireError } func (c *wireChallenge) challenge() *Challenge { @@ -205,5 +271,25 @@ func (c *wireChallenge) challenge() *Challenge { if v.Status == "" { v.Status = StatusPending } + if c.Error != nil { + v.Error = c.Error.error(nil) + } return v } + +// wireError is a subset of fields of the Problem Details object +// as described in https://tools.ietf.org/html/rfc7807#section-3.1. +type wireError struct { + Status int + Type string + Detail string +} + +func (e *wireError) error(h http.Header) *Error { + return &Error{ + StatusCode: e.Status, + ProblemType: e.Type, + Detail: e.Detail, + Header: h, + } +} diff --git a/vendor/golang.org/x/crypto/acme/types_test.go b/vendor/golang.org/x/crypto/acme/types_test.go new file mode 100644 index 0000000..a7553e6 --- /dev/null +++ b/vendor/golang.org/x/crypto/acme/types_test.go @@ -0,0 +1,63 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package acme + +import ( + "errors" + "net/http" + "testing" + "time" +) + +func TestRateLimit(t *testing.T) { + now := time.Date(2017, 04, 27, 10, 0, 0, 0, time.UTC) + f := timeNow + defer func() { timeNow = f }() + timeNow = func() time.Time { return now } + + h120, hTime := http.Header{}, http.Header{} + h120.Set("Retry-After", "120") + hTime.Set("Retry-After", "Tue Apr 27 11:00:00 2017") + + err1 := &Error{ + ProblemType: "urn:ietf:params:acme:error:nolimit", + Header: h120, + } + err2 := &Error{ + ProblemType: "urn:ietf:params:acme:error:rateLimited", + Header: h120, + } + err3 := &Error{ + ProblemType: "urn:ietf:params:acme:error:rateLimited", + Header: nil, + } + err4 := &Error{ + ProblemType: "urn:ietf:params:acme:error:rateLimited", + Header: hTime, + } + + tt := []struct { + err error + res time.Duration + ok bool + }{ + {nil, 0, false}, + {errors.New("dummy"), 0, false}, + {err1, 0, false}, + {err2, 2 * time.Minute, true}, + {err3, 0, true}, + {err4, time.Hour, true}, + } + for i, test := range tt { + res, ok := RateLimit(test.err) + if ok != test.ok { + t.Errorf("%d: RateLimit(%+v): ok = %v; want %v", i, test.err, ok, test.ok) + continue + } + if res != test.res { + t.Errorf("%d: RateLimit(%+v) = %v; want %v", i, test.err, res, test.res) + } + } +} diff --git a/vendor/golang.org/x/crypto/blake2b/blake2b.go b/vendor/golang.org/x/crypto/blake2b/blake2b.go index fa9e48e..ce62241 100644 --- a/vendor/golang.org/x/crypto/blake2b/blake2b.go +++ b/vendor/golang.org/x/crypto/blake2b/blake2b.go @@ -4,7 +4,7 @@ // Package blake2b implements the BLAKE2b hash algorithm as // defined in RFC 7693. -package blake2b +package blake2b // import "golang.org/x/crypto/blake2b" import ( "encoding/binary" diff --git a/vendor/golang.org/x/crypto/blake2b/blake2b_test.go b/vendor/golang.org/x/crypto/blake2b/blake2b_test.go index a38fceb..7954346 100644 --- a/vendor/golang.org/x/crypto/blake2b/blake2b_test.go +++ b/vendor/golang.org/x/crypto/blake2b/blake2b_test.go @@ -22,7 +22,7 @@ func fromHex(s string) []byte { func TestHashes(t *testing.T) { defer func(sse4, avx, avx2 bool) { - useSSE4, useAVX, useAVX2 = sse4, useAVX, avx2 + useSSE4, useAVX, useAVX2 = sse4, avx, avx2 }(useSSE4, useAVX, useAVX2) if useAVX2 { diff --git a/vendor/golang.org/x/crypto/blake2s/blake2s.go b/vendor/golang.org/x/crypto/blake2s/blake2s.go index 394c121..7e3fc4f 100644 --- a/vendor/golang.org/x/crypto/blake2s/blake2s.go +++ b/vendor/golang.org/x/crypto/blake2s/blake2s.go @@ -4,7 +4,7 @@ // Package blake2s implements the BLAKE2s hash algorithm as // defined in RFC 7693. -package blake2s +package blake2s // import "golang.org/x/crypto/blake2s" import ( "encoding/binary" diff --git a/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305.go b/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305.go index eb6739a..3f0dcb9 100644 --- a/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305.go +++ b/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305.go @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. // Package chacha20poly1305 implements the ChaCha20-Poly1305 AEAD as specified in RFC 7539. -package chacha20poly1305 +package chacha20poly1305 // import "golang.org/x/crypto/chacha20poly1305" import ( "crypto/cipher" diff --git a/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.go b/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.go index 4755033..7cd7ad8 100644 --- a/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.go +++ b/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.go @@ -14,13 +14,60 @@ func chacha20Poly1305Open(dst []byte, key []uint32, src, ad []byte) bool //go:noescape func chacha20Poly1305Seal(dst []byte, key []uint32, src, ad []byte) -//go:noescape -func haveSSSE3() bool +// cpuid is implemented in chacha20poly1305_amd64.s. +func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) -var canUseASM bool +// xgetbv with ecx = 0 is implemented in chacha20poly1305_amd64.s. +func xgetbv() (eax, edx uint32) + +var ( + useASM bool + useAVX2 bool +) func init() { - canUseASM = haveSSSE3() + detectCPUFeatures() +} + +// detectCPUFeatures is used to detect if cpu instructions +// used by the functions implemented in assembler in +// chacha20poly1305_amd64.s are supported. +func detectCPUFeatures() { + maxID, _, _, _ := cpuid(0, 0) + if maxID < 1 { + return + } + + _, _, ecx1, _ := cpuid(1, 0) + + haveSSSE3 := isSet(9, ecx1) + useASM = haveSSSE3 + + haveOSXSAVE := isSet(27, ecx1) + + osSupportsAVX := false + // For XGETBV, OSXSAVE bit is required and sufficient. + if haveOSXSAVE { + eax, _ := xgetbv() + // Check if XMM and YMM registers have OS support. + osSupportsAVX = isSet(1, eax) && isSet(2, eax) + } + haveAVX := isSet(28, ecx1) && osSupportsAVX + + if maxID < 7 { + return + } + + _, ebx7, _, _ := cpuid(7, 0) + haveAVX2 := isSet(5, ebx7) && haveAVX + haveBMI2 := isSet(8, ebx7) + + useAVX2 = haveAVX2 && haveBMI2 +} + +// isSet checks if bit at bitpos is set in value. +func isSet(bitpos uint, value uint32) bool { + return value&(1< 2 { + if err == nil { + t.Fatalf("client: got no error, want %s", expectedErr) + } else if err.Error() != expectedErr.Error() { + t.Fatalf("client: got %s, want %s", err, expectedErr) + } + } else { + if err != nil { + t.Fatalf("client: got %s, want no error", err) + } + } + } +} + +// Test if authentication attempts are correctly limited on server +// when more public keys are provided then MaxAuthTries +func TestClientAuthMaxAuthTriesPublicKey(t *testing.T) { + signers := []Signer{} + for i := 0; i < 6; i++ { + signers = append(signers, testSigners["dsa"]) + } + + validConfig := &ClientConfig{ + User: "testuser", + Auth: []AuthMethod{ + PublicKeys(append([]Signer{testSigners["rsa"]}, signers...)...), + }, + HostKeyCallback: InsecureIgnoreHostKey(), + } + if err := tryAuth(t, validConfig); err != nil { + t.Fatalf("unable to dial remote side: %s", err) + } + + expectedErr := fmt.Errorf("ssh: handshake failed: %v", &disconnectMsg{ + Reason: 2, + Message: "too many authentication failures", + }) + invalidConfig := &ClientConfig{ + User: "testuser", + Auth: []AuthMethod{ + PublicKeys(append(signers, testSigners["rsa"])...), + }, + HostKeyCallback: InsecureIgnoreHostKey(), + } + if err := tryAuth(t, invalidConfig); err == nil { + t.Fatalf("client: got no error, want %s", expectedErr) + } else if err.Error() != expectedErr.Error() { + t.Fatalf("client: got %s, want %s", err, expectedErr) + } +} diff --git a/vendor/golang.org/x/crypto/ssh/client_test.go b/vendor/golang.org/x/crypto/ssh/client_test.go index bc5e985..ccf5607 100644 --- a/vendor/golang.org/x/crypto/ssh/client_test.go +++ b/vendor/golang.org/x/crypto/ssh/client_test.go @@ -72,7 +72,7 @@ func TestHostKeyCheck(t *testing.T) { _, _, _, err = NewClientConn(c2, "", &clientConf) if err != nil { if tt.wantError == "" || !strings.Contains(err.Error(), tt.wantError) { - t.Errorf("%s: got error %q, missing %q", err.Error(), tt.wantError) + t.Errorf("%s: got error %q, missing %q", tt.name, err.Error(), tt.wantError) } } else if tt.wantError != "" { t.Errorf("%s: succeeded, but want error string %q", tt.name, tt.wantError) diff --git a/vendor/golang.org/x/crypto/ssh/common.go b/vendor/golang.org/x/crypto/ssh/common.go index aa5535e..dc39e4d 100644 --- a/vendor/golang.org/x/crypto/ssh/common.go +++ b/vendor/golang.org/x/crypto/ssh/common.go @@ -9,6 +9,7 @@ import ( "crypto/rand" "fmt" "io" + "math" "sync" _ "crypto/sha1" @@ -186,7 +187,7 @@ type Config struct { // The maximum number of bytes sent or received after which a // new key is negotiated. It must be at least 256. If - // unspecified, 1 gigabyte is used. + // unspecified, a size suitable for the chosen cipher is used. RekeyThreshold uint64 // The allowed key exchanges algorithms. If unspecified then a @@ -230,11 +231,12 @@ func (c *Config) SetDefaults() { } if c.RekeyThreshold == 0 { - // RFC 4253, section 9 suggests rekeying after 1G. - c.RekeyThreshold = 1 << 30 - } - if c.RekeyThreshold < minRekeyThreshold { + // cipher specific default + } else if c.RekeyThreshold < minRekeyThreshold { c.RekeyThreshold = minRekeyThreshold + } else if c.RekeyThreshold >= math.MaxInt64 { + // Avoid weirdness if somebody uses -1 as a threshold. + c.RekeyThreshold = math.MaxInt64 } } diff --git a/vendor/golang.org/x/crypto/ssh/handshake.go b/vendor/golang.org/x/crypto/ssh/handshake.go index b9a2071..932ce83 100644 --- a/vendor/golang.org/x/crypto/ssh/handshake.go +++ b/vendor/golang.org/x/crypto/ssh/handshake.go @@ -107,6 +107,8 @@ func newHandshakeTransport(conn keyingTransport, config *Config, clientVersion, config: config, } + t.resetReadThresholds() + t.resetWriteThresholds() // We always start with a mandatory key exchange. t.requestKex <- struct{}{} @@ -237,6 +239,17 @@ func (t *handshakeTransport) requestKeyExchange() { } } +func (t *handshakeTransport) resetWriteThresholds() { + t.writePacketsLeft = packetRekeyThreshold + if t.config.RekeyThreshold > 0 { + t.writeBytesLeft = int64(t.config.RekeyThreshold) + } else if t.algorithms != nil { + t.writeBytesLeft = t.algorithms.w.rekeyBytes() + } else { + t.writeBytesLeft = 1 << 30 + } +} + func (t *handshakeTransport) kexLoop() { write: @@ -285,12 +298,8 @@ write: t.writeError = err t.sentInitPacket = nil t.sentInitMsg = nil - t.writePacketsLeft = packetRekeyThreshold - if t.config.RekeyThreshold > 0 { - t.writeBytesLeft = int64(t.config.RekeyThreshold) - } else if t.algorithms != nil { - t.writeBytesLeft = t.algorithms.w.rekeyBytes() - } + + t.resetWriteThresholds() // we have completed the key exchange. Since the // reader is still blocked, it is safe to clear out @@ -344,6 +353,17 @@ write: // key exchange itself. const packetRekeyThreshold = (1 << 31) +func (t *handshakeTransport) resetReadThresholds() { + t.readPacketsLeft = packetRekeyThreshold + if t.config.RekeyThreshold > 0 { + t.readBytesLeft = int64(t.config.RekeyThreshold) + } else if t.algorithms != nil { + t.readBytesLeft = t.algorithms.r.rekeyBytes() + } else { + t.readBytesLeft = 1 << 30 + } +} + func (t *handshakeTransport) readOnePacket(first bool) ([]byte, error) { p, err := t.conn.readPacket() if err != nil { @@ -391,12 +411,7 @@ func (t *handshakeTransport) readOnePacket(first bool) ([]byte, error) { return nil, err } - t.readPacketsLeft = packetRekeyThreshold - if t.config.RekeyThreshold > 0 { - t.readBytesLeft = int64(t.config.RekeyThreshold) - } else { - t.readBytesLeft = t.algorithms.r.rekeyBytes() - } + t.resetReadThresholds() // By default, a key exchange is hidden from higher layers by // translating it into msgIgnore. diff --git a/vendor/golang.org/x/crypto/ssh/handshake_test.go b/vendor/golang.org/x/crypto/ssh/handshake_test.go index 77d1aac..91d4935 100644 --- a/vendor/golang.org/x/crypto/ssh/handshake_test.go +++ b/vendor/golang.org/x/crypto/ssh/handshake_test.go @@ -40,9 +40,12 @@ func (t *testChecker) Check(dialAddr string, addr net.Addr, key PublicKey) error // therefore is buffered (net.Pipe deadlocks if both sides start with // a write.) func netPipe() (net.Conn, net.Conn, error) { - listener, err := net.Listen("tcp", ":0") + listener, err := net.Listen("tcp", "127.0.0.1:0") if err != nil { - return nil, nil, err + listener, err = net.Listen("tcp", "[::1]:0") + if err != nil { + return nil, nil, err + } } defer listener.Close() c1, err := net.Dial("tcp", listener.Addr().String()) @@ -526,3 +529,31 @@ func TestDisconnect(t *testing.T) { t.Errorf("readPacket 3 succeeded") } } + +func TestHandshakeRekeyDefault(t *testing.T) { + clientConf := &ClientConfig{ + Config: Config{ + Ciphers: []string{"aes128-ctr"}, + }, + HostKeyCallback: InsecureIgnoreHostKey(), + } + trC, trS, err := handshakePair(clientConf, "addr", false) + if err != nil { + t.Fatalf("handshakePair: %v", err) + } + defer trC.Close() + defer trS.Close() + + trC.writePacket([]byte{msgRequestSuccess, 0, 0}) + trC.Close() + + rgb := (1024 + trC.readBytesLeft) >> 30 + wgb := (1024 + trC.writeBytesLeft) >> 30 + + if rgb != 64 { + t.Errorf("got rekey after %dG read, want 64G", rgb) + } + if wgb != 64 { + t.Errorf("got rekey after %dG write, want 64G", wgb) + } +} diff --git a/vendor/golang.org/x/crypto/ssh/keys.go b/vendor/golang.org/x/crypto/ssh/keys.go index f38de98..cf68532 100644 --- a/vendor/golang.org/x/crypto/ssh/keys.go +++ b/vendor/golang.org/x/crypto/ssh/keys.go @@ -824,7 +824,7 @@ func ParseDSAPrivateKey(der []byte) (*dsa.PrivateKey, error) { // Implemented based on the documentation at // https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key -func parseOpenSSHPrivateKey(key []byte) (*ed25519.PrivateKey, error) { +func parseOpenSSHPrivateKey(key []byte) (crypto.PrivateKey, error) { magic := append([]byte("openssh-key-v1"), 0) if !bytes.Equal(magic, key[0:len(magic)]) { return nil, errors.New("ssh: invalid openssh private key format") @@ -844,14 +844,15 @@ func parseOpenSSHPrivateKey(key []byte) (*ed25519.PrivateKey, error) { return nil, err } + if w.KdfName != "none" || w.CipherName != "none" { + return nil, errors.New("ssh: cannot decode encrypted private keys") + } + pk1 := struct { Check1 uint32 Check2 uint32 Keytype string - Pub []byte - Priv []byte - Comment string - Pad []byte `ssh:"rest"` + Rest []byte `ssh:"rest"` }{} if err := Unmarshal(w.PrivKeyBlock, &pk1); err != nil { @@ -862,24 +863,75 @@ func parseOpenSSHPrivateKey(key []byte) (*ed25519.PrivateKey, error) { return nil, errors.New("ssh: checkint mismatch") } - // we only handle ed25519 keys currently - if pk1.Keytype != KeyAlgoED25519 { + // we only handle ed25519 and rsa keys currently + switch pk1.Keytype { + case KeyAlgoRSA: + // https://github.com/openssh/openssh-portable/blob/master/sshkey.c#L2760-L2773 + key := struct { + N *big.Int + E *big.Int + D *big.Int + Iqmp *big.Int + P *big.Int + Q *big.Int + Comment string + Pad []byte `ssh:"rest"` + }{} + + if err := Unmarshal(pk1.Rest, &key); err != nil { + return nil, err + } + + for i, b := range key.Pad { + if int(b) != i+1 { + return nil, errors.New("ssh: padding not as expected") + } + } + + pk := &rsa.PrivateKey{ + PublicKey: rsa.PublicKey{ + N: key.N, + E: int(key.E.Int64()), + }, + D: key.D, + Primes: []*big.Int{key.P, key.Q}, + } + + if err := pk.Validate(); err != nil { + return nil, err + } + + pk.Precompute() + + return pk, nil + case KeyAlgoED25519: + key := struct { + Pub []byte + Priv []byte + Comment string + Pad []byte `ssh:"rest"` + }{} + + if err := Unmarshal(pk1.Rest, &key); err != nil { + return nil, err + } + + if len(key.Priv) != ed25519.PrivateKeySize { + return nil, errors.New("ssh: private key unexpected length") + } + + for i, b := range key.Pad { + if int(b) != i+1 { + return nil, errors.New("ssh: padding not as expected") + } + } + + pk := ed25519.PrivateKey(make([]byte, ed25519.PrivateKeySize)) + copy(pk, key.Priv) + return &pk, nil + default: return nil, errors.New("ssh: unhandled key type") } - - for i, b := range pk1.Pad { - if int(b) != i+1 { - return nil, errors.New("ssh: padding not as expected") - } - } - - if len(pk1.Priv) != ed25519.PrivateKeySize { - return nil, errors.New("ssh: private key unexpected length") - } - - pk := ed25519.PrivateKey(make([]byte, ed25519.PrivateKeySize)) - copy(pk, pk1.Priv) - return &pk, nil } // FingerprintLegacyMD5 returns the user presentation of the key's diff --git a/vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go b/vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go new file mode 100644 index 0000000..ea92b29 --- /dev/null +++ b/vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go @@ -0,0 +1,546 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package knownhosts implements a parser for the OpenSSH +// known_hosts host key database. +package knownhosts + +import ( + "bufio" + "bytes" + "crypto/hmac" + "crypto/rand" + "crypto/sha1" + "encoding/base64" + "errors" + "fmt" + "io" + "net" + "os" + "strings" + + "golang.org/x/crypto/ssh" +) + +// See the sshd manpage +// (http://man.openbsd.org/sshd#SSH_KNOWN_HOSTS_FILE_FORMAT) for +// background. + +type addr struct{ host, port string } + +func (a *addr) String() string { + h := a.host + if strings.Contains(h, ":") { + h = "[" + h + "]" + } + return h + ":" + a.port +} + +type matcher interface { + match([]addr) bool +} + +type hostPattern struct { + negate bool + addr addr +} + +func (p *hostPattern) String() string { + n := "" + if p.negate { + n = "!" + } + + return n + p.addr.String() +} + +type hostPatterns []hostPattern + +func (ps hostPatterns) match(addrs []addr) bool { + matched := false + for _, p := range ps { + for _, a := range addrs { + m := p.match(a) + if !m { + continue + } + if p.negate { + return false + } + matched = true + } + } + return matched +} + +// See +// https://android.googlesource.com/platform/external/openssh/+/ab28f5495c85297e7a597c1ba62e996416da7c7e/addrmatch.c +// The matching of * has no regard for separators, unlike filesystem globs +func wildcardMatch(pat []byte, str []byte) bool { + for { + if len(pat) == 0 { + return len(str) == 0 + } + if len(str) == 0 { + return false + } + + if pat[0] == '*' { + if len(pat) == 1 { + return true + } + + for j := range str { + if wildcardMatch(pat[1:], str[j:]) { + return true + } + } + return false + } + + if pat[0] == '?' || pat[0] == str[0] { + pat = pat[1:] + str = str[1:] + } else { + return false + } + } +} + +func (l *hostPattern) match(a addr) bool { + return wildcardMatch([]byte(l.addr.host), []byte(a.host)) && l.addr.port == a.port +} + +type keyDBLine struct { + cert bool + matcher matcher + knownKey KnownKey +} + +func serialize(k ssh.PublicKey) string { + return k.Type() + " " + base64.StdEncoding.EncodeToString(k.Marshal()) +} + +func (l *keyDBLine) match(addrs []addr) bool { + return l.matcher.match(addrs) +} + +type hostKeyDB struct { + // Serialized version of revoked keys + revoked map[string]*KnownKey + lines []keyDBLine +} + +func newHostKeyDB() *hostKeyDB { + db := &hostKeyDB{ + revoked: make(map[string]*KnownKey), + } + + return db +} + +func keyEq(a, b ssh.PublicKey) bool { + return bytes.Equal(a.Marshal(), b.Marshal()) +} + +// IsAuthorityForHost can be used as a callback in ssh.CertChecker +func (db *hostKeyDB) IsHostAuthority(remote ssh.PublicKey, address string) bool { + h, p, err := net.SplitHostPort(address) + if err != nil { + return false + } + a := addr{host: h, port: p} + + for _, l := range db.lines { + if l.cert && keyEq(l.knownKey.Key, remote) && l.match([]addr{a}) { + return true + } + } + return false +} + +// IsRevoked can be used as a callback in ssh.CertChecker +func (db *hostKeyDB) IsRevoked(key *ssh.Certificate) bool { + _, ok := db.revoked[string(key.Marshal())] + return ok +} + +const markerCert = "@cert-authority" +const markerRevoked = "@revoked" + +func nextWord(line []byte) (string, []byte) { + i := bytes.IndexAny(line, "\t ") + if i == -1 { + return string(line), nil + } + + return string(line[:i]), bytes.TrimSpace(line[i:]) +} + +func parseLine(line []byte) (marker, host string, key ssh.PublicKey, err error) { + if w, next := nextWord(line); w == markerCert || w == markerRevoked { + marker = w + line = next + } + + host, line = nextWord(line) + if len(line) == 0 { + return "", "", nil, errors.New("knownhosts: missing host pattern") + } + + // ignore the keytype as it's in the key blob anyway. + _, line = nextWord(line) + if len(line) == 0 { + return "", "", nil, errors.New("knownhosts: missing key type pattern") + } + + keyBlob, _ := nextWord(line) + + keyBytes, err := base64.StdEncoding.DecodeString(keyBlob) + if err != nil { + return "", "", nil, err + } + key, err = ssh.ParsePublicKey(keyBytes) + if err != nil { + return "", "", nil, err + } + + return marker, host, key, nil +} + +func (db *hostKeyDB) parseLine(line []byte, filename string, linenum int) error { + marker, pattern, key, err := parseLine(line) + if err != nil { + return err + } + + if marker == markerRevoked { + db.revoked[string(key.Marshal())] = &KnownKey{ + Key: key, + Filename: filename, + Line: linenum, + } + + return nil + } + + entry := keyDBLine{ + cert: marker == markerCert, + knownKey: KnownKey{ + Filename: filename, + Line: linenum, + Key: key, + }, + } + + if pattern[0] == '|' { + entry.matcher, err = newHashedHost(pattern) + } else { + entry.matcher, err = newHostnameMatcher(pattern) + } + + if err != nil { + return err + } + + db.lines = append(db.lines, entry) + return nil +} + +func newHostnameMatcher(pattern string) (matcher, error) { + var hps hostPatterns + for _, p := range strings.Split(pattern, ",") { + if len(p) == 0 { + continue + } + + var a addr + var negate bool + if p[0] == '!' { + negate = true + p = p[1:] + } + + if len(p) == 0 { + return nil, errors.New("knownhosts: negation without following hostname") + } + + var err error + if p[0] == '[' { + a.host, a.port, err = net.SplitHostPort(p) + if err != nil { + return nil, err + } + } else { + a.host, a.port, err = net.SplitHostPort(p) + if err != nil { + a.host = p + a.port = "22" + } + } + hps = append(hps, hostPattern{ + negate: negate, + addr: a, + }) + } + return hps, nil +} + +// KnownKey represents a key declared in a known_hosts file. +type KnownKey struct { + Key ssh.PublicKey + Filename string + Line int +} + +func (k *KnownKey) String() string { + return fmt.Sprintf("%s:%d: %s", k.Filename, k.Line, serialize(k.Key)) +} + +// KeyError is returned if we did not find the key in the host key +// database, or there was a mismatch. Typically, in batch +// applications, this should be interpreted as failure. Interactive +// applications can offer an interactive prompt to the user. +type KeyError struct { + // Want holds the accepted host keys. For each key algorithm, + // there can be one hostkey. If Want is empty, the host is + // unknown. If Want is non-empty, there was a mismatch, which + // can signify a MITM attack. + Want []KnownKey +} + +func (u *KeyError) Error() string { + if len(u.Want) == 0 { + return "knownhosts: key is unknown" + } + return "knownhosts: key mismatch" +} + +// RevokedError is returned if we found a key that was revoked. +type RevokedError struct { + Revoked KnownKey +} + +func (r *RevokedError) Error() string { + return "knownhosts: key is revoked" +} + +// check checks a key against the host database. This should not be +// used for verifying certificates. +func (db *hostKeyDB) check(address string, remote net.Addr, remoteKey ssh.PublicKey) error { + if revoked := db.revoked[string(remoteKey.Marshal())]; revoked != nil { + return &RevokedError{Revoked: *revoked} + } + + host, port, err := net.SplitHostPort(remote.String()) + if err != nil { + return fmt.Errorf("knownhosts: SplitHostPort(%s): %v", remote, err) + } + + addrs := []addr{ + {host, port}, + } + + if address != "" { + host, port, err := net.SplitHostPort(address) + if err != nil { + return fmt.Errorf("knownhosts: SplitHostPort(%s): %v", address, err) + } + + addrs = append(addrs, addr{host, port}) + } + + return db.checkAddrs(addrs, remoteKey) +} + +// checkAddrs checks if we can find the given public key for any of +// the given addresses. If we only find an entry for the IP address, +// or only the hostname, then this still succeeds. +func (db *hostKeyDB) checkAddrs(addrs []addr, remoteKey ssh.PublicKey) error { + // TODO(hanwen): are these the right semantics? What if there + // is just a key for the IP address, but not for the + // hostname? + + // Algorithm => key. + knownKeys := map[string]KnownKey{} + for _, l := range db.lines { + if l.match(addrs) { + typ := l.knownKey.Key.Type() + if _, ok := knownKeys[typ]; !ok { + knownKeys[typ] = l.knownKey + } + } + } + + keyErr := &KeyError{} + for _, v := range knownKeys { + keyErr.Want = append(keyErr.Want, v) + } + + // Unknown remote host. + if len(knownKeys) == 0 { + return keyErr + } + + // If the remote host starts using a different, unknown key type, we + // also interpret that as a mismatch. + if known, ok := knownKeys[remoteKey.Type()]; !ok || !keyEq(known.Key, remoteKey) { + return keyErr + } + + return nil +} + +// The Read function parses file contents. +func (db *hostKeyDB) Read(r io.Reader, filename string) error { + scanner := bufio.NewScanner(r) + + lineNum := 0 + for scanner.Scan() { + lineNum++ + line := scanner.Bytes() + line = bytes.TrimSpace(line) + if len(line) == 0 || line[0] == '#' { + continue + } + + if err := db.parseLine(line, filename, lineNum); err != nil { + return fmt.Errorf("knownhosts: %s:%d: %v", filename, lineNum, err) + } + } + return scanner.Err() +} + +// New creates a host key callback from the given OpenSSH host key +// files. The returned callback is for use in +// ssh.ClientConfig.HostKeyCallback. Hashed hostnames are not supported. +func New(files ...string) (ssh.HostKeyCallback, error) { + db := newHostKeyDB() + for _, fn := range files { + f, err := os.Open(fn) + if err != nil { + return nil, err + } + defer f.Close() + if err := db.Read(f, fn); err != nil { + return nil, err + } + } + + var certChecker ssh.CertChecker + certChecker.IsHostAuthority = db.IsHostAuthority + certChecker.IsRevoked = db.IsRevoked + certChecker.HostKeyFallback = db.check + + return certChecker.CheckHostKey, nil +} + +// Normalize normalizes an address into the form used in known_hosts +func Normalize(address string) string { + host, port, err := net.SplitHostPort(address) + if err != nil { + host = address + port = "22" + } + entry := host + if port != "22" { + entry = "[" + entry + "]:" + port + } else if strings.Contains(host, ":") && !strings.HasPrefix(host, "[") { + entry = "[" + entry + "]" + } + return entry +} + +// Line returns a line to add append to the known_hosts files. +func Line(addresses []string, key ssh.PublicKey) string { + var trimmed []string + for _, a := range addresses { + trimmed = append(trimmed, Normalize(a)) + } + + return strings.Join(trimmed, ",") + " " + serialize(key) +} + +// HashHostname hashes the given hostname. The hostname is not +// normalized before hashing. +func HashHostname(hostname string) string { + // TODO(hanwen): check if we can safely normalize this always. + salt := make([]byte, sha1.Size) + + _, err := rand.Read(salt) + if err != nil { + panic(fmt.Sprintf("crypto/rand failure %v", err)) + } + + hash := hashHost(hostname, salt) + return encodeHash(sha1HashType, salt, hash) +} + +func decodeHash(encoded string) (hashType string, salt, hash []byte, err error) { + if len(encoded) == 0 || encoded[0] != '|' { + err = errors.New("knownhosts: hashed host must start with '|'") + return + } + components := strings.Split(encoded, "|") + if len(components) != 4 { + err = fmt.Errorf("knownhosts: got %d components, want 3", len(components)) + return + } + + hashType = components[1] + if salt, err = base64.StdEncoding.DecodeString(components[2]); err != nil { + return + } + if hash, err = base64.StdEncoding.DecodeString(components[3]); err != nil { + return + } + return +} + +func encodeHash(typ string, salt []byte, hash []byte) string { + return strings.Join([]string{"", + typ, + base64.StdEncoding.EncodeToString(salt), + base64.StdEncoding.EncodeToString(hash), + }, "|") +} + +// See https://android.googlesource.com/platform/external/openssh/+/ab28f5495c85297e7a597c1ba62e996416da7c7e/hostfile.c#120 +func hashHost(hostname string, salt []byte) []byte { + mac := hmac.New(sha1.New, salt) + mac.Write([]byte(hostname)) + return mac.Sum(nil) +} + +type hashedHost struct { + salt []byte + hash []byte +} + +const sha1HashType = "1" + +func newHashedHost(encoded string) (*hashedHost, error) { + typ, salt, hash, err := decodeHash(encoded) + if err != nil { + return nil, err + } + + // The type field seems for future algorithm agility, but it's + // actually hardcoded in openssh currently, see + // https://android.googlesource.com/platform/external/openssh/+/ab28f5495c85297e7a597c1ba62e996416da7c7e/hostfile.c#120 + if typ != sha1HashType { + return nil, fmt.Errorf("knownhosts: got hash type %s, must be '1'", typ) + } + + return &hashedHost{salt: salt, hash: hash}, nil +} + +func (h *hashedHost) match(addrs []addr) bool { + for _, a := range addrs { + if bytes.Equal(hashHost(Normalize(a.String()), h.salt), h.hash) { + return true + } + } + return false +} diff --git a/vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts_test.go b/vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts_test.go new file mode 100644 index 0000000..be7cc0e --- /dev/null +++ b/vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts_test.go @@ -0,0 +1,329 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package knownhosts + +import ( + "bytes" + "fmt" + "net" + "reflect" + "testing" + + "golang.org/x/crypto/ssh" +) + +const edKeyStr = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGBAarftlLeoyf+v+nVchEZII/vna2PCV8FaX4vsF5BX" +const alternateEdKeyStr = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIXffBYeYL+WVzVru8npl5JHt2cjlr4ornFTWzoij9sx" +const ecKeyStr = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNLCu01+wpXe3xB5olXCN4SqU2rQu0qjSRKJO4Bg+JRCPU+ENcgdA5srTU8xYDz/GEa4dzK5ldPw4J/gZgSXCMs=" + +var ecKey, alternateEdKey, edKey ssh.PublicKey +var testAddr = &net.TCPAddr{ + IP: net.IP{198, 41, 30, 196}, + Port: 22, +} + +var testAddr6 = &net.TCPAddr{ + IP: net.IP{198, 41, 30, 196, + 1, 2, 3, 4, + 1, 2, 3, 4, + 1, 2, 3, 4, + }, + Port: 22, +} + +func init() { + var err error + ecKey, _, _, _, err = ssh.ParseAuthorizedKey([]byte(ecKeyStr)) + if err != nil { + panic(err) + } + edKey, _, _, _, err = ssh.ParseAuthorizedKey([]byte(edKeyStr)) + if err != nil { + panic(err) + } + alternateEdKey, _, _, _, err = ssh.ParseAuthorizedKey([]byte(alternateEdKeyStr)) + if err != nil { + panic(err) + } +} + +func testDB(t *testing.T, s string) *hostKeyDB { + db := newHostKeyDB() + if err := db.Read(bytes.NewBufferString(s), "testdb"); err != nil { + t.Fatalf("Read: %v", err) + } + + return db +} + +func TestRevoked(t *testing.T) { + db := testDB(t, "\n\n@revoked * "+edKeyStr+"\n") + want := &RevokedError{ + Revoked: KnownKey{ + Key: edKey, + Filename: "testdb", + Line: 3, + }, + } + if err := db.check("", &net.TCPAddr{ + Port: 42, + }, edKey); err == nil { + t.Fatal("no error for revoked key") + } else if !reflect.DeepEqual(want, err) { + t.Fatalf("got %#v, want %#v", want, err) + } +} + +func TestHostAuthority(t *testing.T) { + for _, m := range []struct { + authorityFor string + address string + + good bool + }{ + {authorityFor: "localhost", address: "localhost:22", good: true}, + {authorityFor: "localhost", address: "localhost", good: false}, + {authorityFor: "localhost", address: "localhost:1234", good: false}, + {authorityFor: "[localhost]:1234", address: "localhost:1234", good: true}, + {authorityFor: "[localhost]:1234", address: "localhost:22", good: false}, + {authorityFor: "[localhost]:1234", address: "localhost", good: false}, + } { + db := testDB(t, `@cert-authority `+m.authorityFor+` `+edKeyStr) + if ok := db.IsHostAuthority(db.lines[0].knownKey.Key, m.address); ok != m.good { + t.Errorf("IsHostAuthority: authority %s, address %s, wanted good = %v, got good = %v", + m.authorityFor, m.address, m.good, ok) + } + } +} + +func TestBracket(t *testing.T) { + db := testDB(t, `[git.eclipse.org]:29418,[198.41.30.196]:29418 `+edKeyStr) + + if err := db.check("git.eclipse.org:29418", &net.TCPAddr{ + IP: net.IP{198, 41, 30, 196}, + Port: 29418, + }, edKey); err != nil { + t.Errorf("got error %v, want none", err) + } + + if err := db.check("git.eclipse.org:29419", &net.TCPAddr{ + Port: 42, + }, edKey); err == nil { + t.Fatalf("no error for unknown address") + } else if ke, ok := err.(*KeyError); !ok { + t.Fatalf("got type %T, want *KeyError", err) + } else if len(ke.Want) > 0 { + t.Fatalf("got Want %v, want []", ke.Want) + } +} + +func TestNewKeyType(t *testing.T) { + str := fmt.Sprintf("%s %s", testAddr, edKeyStr) + db := testDB(t, str) + if err := db.check("", testAddr, ecKey); err == nil { + t.Fatalf("no error for unknown address") + } else if ke, ok := err.(*KeyError); !ok { + t.Fatalf("got type %T, want *KeyError", err) + } else if len(ke.Want) == 0 { + t.Fatalf("got empty KeyError.Want") + } +} + +func TestSameKeyType(t *testing.T) { + str := fmt.Sprintf("%s %s", testAddr, edKeyStr) + db := testDB(t, str) + if err := db.check("", testAddr, alternateEdKey); err == nil { + t.Fatalf("no error for unknown address") + } else if ke, ok := err.(*KeyError); !ok { + t.Fatalf("got type %T, want *KeyError", err) + } else if len(ke.Want) == 0 { + t.Fatalf("got empty KeyError.Want") + } else if got, want := ke.Want[0].Key.Marshal(), edKey.Marshal(); !bytes.Equal(got, want) { + t.Fatalf("got key %q, want %q", got, want) + } +} + +func TestIPAddress(t *testing.T) { + str := fmt.Sprintf("%s %s", testAddr, edKeyStr) + db := testDB(t, str) + if err := db.check("", testAddr, edKey); err != nil { + t.Errorf("got error %q, want none", err) + } +} + +func TestIPv6Address(t *testing.T) { + str := fmt.Sprintf("%s %s", testAddr6, edKeyStr) + db := testDB(t, str) + + if err := db.check("", testAddr6, edKey); err != nil { + t.Errorf("got error %q, want none", err) + } +} + +func TestBasic(t *testing.T) { + str := fmt.Sprintf("#comment\n\nserver.org,%s %s\notherhost %s", testAddr, edKeyStr, ecKeyStr) + db := testDB(t, str) + if err := db.check("server.org:22", testAddr, edKey); err != nil { + t.Errorf("got error %q, want none", err) + } + + want := KnownKey{ + Key: edKey, + Filename: "testdb", + Line: 3, + } + if err := db.check("server.org:22", testAddr, ecKey); err == nil { + t.Errorf("succeeded, want KeyError") + } else if ke, ok := err.(*KeyError); !ok { + t.Errorf("got %T, want *KeyError", err) + } else if len(ke.Want) != 1 { + t.Errorf("got %v, want 1 entry", ke) + } else if !reflect.DeepEqual(ke.Want[0], want) { + t.Errorf("got %v, want %v", ke.Want[0], want) + } +} + +func TestNegate(t *testing.T) { + str := fmt.Sprintf("%s,!server.org %s", testAddr, edKeyStr) + db := testDB(t, str) + if err := db.check("server.org:22", testAddr, ecKey); err == nil { + t.Errorf("succeeded") + } else if ke, ok := err.(*KeyError); !ok { + t.Errorf("got error type %T, want *KeyError", err) + } else if len(ke.Want) != 0 { + t.Errorf("got expected keys %d (first of type %s), want []", len(ke.Want), ke.Want[0].Key.Type()) + } +} + +func TestWildcard(t *testing.T) { + str := fmt.Sprintf("server*.domain %s", edKeyStr) + db := testDB(t, str) + + want := &KeyError{ + Want: []KnownKey{{ + Filename: "testdb", + Line: 1, + Key: edKey, + }}, + } + + got := db.check("server.domain:22", &net.TCPAddr{}, ecKey) + if !reflect.DeepEqual(got, want) { + t.Errorf("got %s, want %s", got, want) + } +} + +func TestLine(t *testing.T) { + for in, want := range map[string]string{ + "server.org": "server.org " + edKeyStr, + "server.org:22": "server.org " + edKeyStr, + "server.org:23": "[server.org]:23 " + edKeyStr, + "[c629:1ec4:102:304:102:304:102:304]:22": "[c629:1ec4:102:304:102:304:102:304] " + edKeyStr, + "[c629:1ec4:102:304:102:304:102:304]:23": "[c629:1ec4:102:304:102:304:102:304]:23 " + edKeyStr, + } { + if got := Line([]string{in}, edKey); got != want { + t.Errorf("Line(%q) = %q, want %q", in, got, want) + } + } +} + +func TestWildcardMatch(t *testing.T) { + for _, c := range []struct { + pat, str string + want bool + }{ + {"a?b", "abb", true}, + {"ab", "abc", false}, + {"abc", "ab", false}, + {"a*b", "axxxb", true}, + {"a*b", "axbxb", true}, + {"a*b", "axbxbc", false}, + {"a*?", "axbxc", true}, + {"a*b*", "axxbxxxxxx", true}, + {"a*b*c", "axxbxxxxxxc", true}, + {"a*b*?", "axxbxxxxxxc", true}, + {"a*b*z", "axxbxxbxxxz", true}, + {"a*b*z", "axxbxxzxxxz", true}, + {"a*b*z", "axxbxxzxxx", false}, + } { + got := wildcardMatch([]byte(c.pat), []byte(c.str)) + if got != c.want { + t.Errorf("wildcardMatch(%q, %q) = %v, want %v", c.pat, c.str, got, c.want) + } + + } +} + +// TODO(hanwen): test coverage for certificates. + +const testHostname = "hostname" + +// generated with keygen -H -f +const encodedTestHostnameHash = "|1|IHXZvQMvTcZTUU29+2vXFgx8Frs=|UGccIWfRVDwilMBnA3WJoRAC75Y=" + +func TestHostHash(t *testing.T) { + testHostHash(t, testHostname, encodedTestHostnameHash) +} + +func TestHashList(t *testing.T) { + encoded := HashHostname(testHostname) + testHostHash(t, testHostname, encoded) +} + +func testHostHash(t *testing.T, hostname, encoded string) { + typ, salt, hash, err := decodeHash(encoded) + if err != nil { + t.Fatalf("decodeHash: %v", err) + } + + if got := encodeHash(typ, salt, hash); got != encoded { + t.Errorf("got encoding %s want %s", got, encoded) + } + + if typ != sha1HashType { + t.Fatalf("got hash type %q, want %q", typ, sha1HashType) + } + + got := hashHost(hostname, salt) + if !bytes.Equal(got, hash) { + t.Errorf("got hash %x want %x", got, hash) + } +} + +func TestNormalize(t *testing.T) { + for in, want := range map[string]string{ + "127.0.0.1:22": "127.0.0.1", + "[127.0.0.1]:22": "127.0.0.1", + "[127.0.0.1]:23": "[127.0.0.1]:23", + "127.0.0.1:23": "[127.0.0.1]:23", + "[a.b.c]:22": "a.b.c", + "[abcd:abcd:abcd:abcd]": "[abcd:abcd:abcd:abcd]", + "[abcd:abcd:abcd:abcd]:22": "[abcd:abcd:abcd:abcd]", + "[abcd:abcd:abcd:abcd]:23": "[abcd:abcd:abcd:abcd]:23", + } { + got := Normalize(in) + if got != want { + t.Errorf("Normalize(%q) = %q, want %q", in, got, want) + } + } +} + +func TestHashedHostkeyCheck(t *testing.T) { + str := fmt.Sprintf("%s %s", HashHostname(testHostname), edKeyStr) + db := testDB(t, str) + if err := db.check(testHostname+":22", testAddr, edKey); err != nil { + t.Errorf("check(%s): %v", testHostname, err) + } + want := &KeyError{ + Want: []KnownKey{{ + Filename: "testdb", + Line: 1, + Key: edKey, + }}, + } + if got := db.check(testHostname+":22", testAddr, alternateEdKey); !reflect.DeepEqual(got, want) { + t.Errorf("got error %v, want %v", got, want) + } +} diff --git a/vendor/golang.org/x/crypto/ssh/server.go b/vendor/golang.org/x/crypto/ssh/server.go index 77c84d1..23b41d9 100644 --- a/vendor/golang.org/x/crypto/ssh/server.go +++ b/vendor/golang.org/x/crypto/ssh/server.go @@ -45,6 +45,12 @@ type ServerConfig struct { // authenticating. NoClientAuth bool + // MaxAuthTries specifies the maximum number of authentication attempts + // permitted per connection. If set to a negative number, the number of + // attempts are unlimited. If set to zero, the number of attempts are limited + // to 6. + MaxAuthTries int + // PasswordCallback, if non-nil, is called when a user // attempts to authenticate using a password. PasswordCallback func(conn ConnMetadata, password []byte) (*Permissions, error) @@ -143,6 +149,10 @@ type ServerConn struct { func NewServerConn(c net.Conn, config *ServerConfig) (*ServerConn, <-chan NewChannel, <-chan *Request, error) { fullConf := *config fullConf.SetDefaults() + if fullConf.MaxAuthTries == 0 { + fullConf.MaxAuthTries = 6 + } + s := &connection{ sshConn: sshConn{conn: c}, } @@ -267,8 +277,23 @@ func (s *connection) serverAuthenticate(config *ServerConfig) (*Permissions, err var cache pubKeyCache var perms *Permissions + authFailures := 0 + userAuthLoop: for { + if authFailures >= config.MaxAuthTries && config.MaxAuthTries > 0 { + discMsg := &disconnectMsg{ + Reason: 2, + Message: "too many authentication failures", + } + + if err := s.transport.writePacket(Marshal(discMsg)); err != nil { + return nil, err + } + + return nil, discMsg + } + var userAuthReq userAuthRequestMsg if packet, err := s.transport.readPacket(); err != nil { return nil, err @@ -289,6 +314,11 @@ userAuthLoop: if config.NoClientAuth { authErr = nil } + + // allow initial attempt of 'none' without penalty + if authFailures == 0 { + authFailures-- + } case "password": if config.PasswordCallback == nil { authErr = errors.New("ssh: password auth not configured") @@ -360,6 +390,7 @@ userAuthLoop: if isQuery { // The client can query if the given public key // would be okay. + if len(payload) > 0 { return nil, parseError(msgUserAuthRequest) } @@ -409,6 +440,8 @@ userAuthLoop: break userAuthLoop } + authFailures++ + var failureMsg userAuthFailureMsg if config.PasswordCallback != nil { failureMsg.Methods = append(failureMsg.Methods, "password") diff --git a/vendor/golang.org/x/crypto/ssh/streamlocal.go b/vendor/golang.org/x/crypto/ssh/streamlocal.go new file mode 100644 index 0000000..a2dccc6 --- /dev/null +++ b/vendor/golang.org/x/crypto/ssh/streamlocal.go @@ -0,0 +1,115 @@ +package ssh + +import ( + "errors" + "io" + "net" +) + +// streamLocalChannelOpenDirectMsg is a struct used for SSH_MSG_CHANNEL_OPEN message +// with "direct-streamlocal@openssh.com" string. +// +// See openssh-portable/PROTOCOL, section 2.4. connection: Unix domain socket forwarding +// https://github.com/openssh/openssh-portable/blob/master/PROTOCOL#L235 +type streamLocalChannelOpenDirectMsg struct { + socketPath string + reserved0 string + reserved1 uint32 +} + +// forwardedStreamLocalPayload is a struct used for SSH_MSG_CHANNEL_OPEN message +// with "forwarded-streamlocal@openssh.com" string. +type forwardedStreamLocalPayload struct { + SocketPath string + Reserved0 string +} + +// streamLocalChannelForwardMsg is a struct used for SSH2_MSG_GLOBAL_REQUEST message +// with "streamlocal-forward@openssh.com"/"cancel-streamlocal-forward@openssh.com" string. +type streamLocalChannelForwardMsg struct { + socketPath string +} + +// ListenUnix is similar to ListenTCP but uses a Unix domain socket. +func (c *Client) ListenUnix(socketPath string) (net.Listener, error) { + m := streamLocalChannelForwardMsg{ + socketPath, + } + // send message + ok, _, err := c.SendRequest("streamlocal-forward@openssh.com", true, Marshal(&m)) + if err != nil { + return nil, err + } + if !ok { + return nil, errors.New("ssh: streamlocal-forward@openssh.com request denied by peer") + } + ch := c.forwards.add(&net.UnixAddr{Name: socketPath, Net: "unix"}) + + return &unixListener{socketPath, c, ch}, nil +} + +func (c *Client) dialStreamLocal(socketPath string) (Channel, error) { + msg := streamLocalChannelOpenDirectMsg{ + socketPath: socketPath, + } + ch, in, err := c.OpenChannel("direct-streamlocal@openssh.com", Marshal(&msg)) + if err != nil { + return nil, err + } + go DiscardRequests(in) + return ch, err +} + +type unixListener struct { + socketPath string + + conn *Client + in <-chan forward +} + +// Accept waits for and returns the next connection to the listener. +func (l *unixListener) Accept() (net.Conn, error) { + s, ok := <-l.in + if !ok { + return nil, io.EOF + } + ch, incoming, err := s.newCh.Accept() + if err != nil { + return nil, err + } + go DiscardRequests(incoming) + + return &chanConn{ + Channel: ch, + laddr: &net.UnixAddr{ + Name: l.socketPath, + Net: "unix", + }, + raddr: &net.UnixAddr{ + Name: "@", + Net: "unix", + }, + }, nil +} + +// Close closes the listener. +func (l *unixListener) Close() error { + // this also closes the listener. + l.conn.forwards.remove(&net.UnixAddr{Name: l.socketPath, Net: "unix"}) + m := streamLocalChannelForwardMsg{ + l.socketPath, + } + ok, _, err := l.conn.SendRequest("cancel-streamlocal-forward@openssh.com", true, Marshal(&m)) + if err == nil && !ok { + err = errors.New("ssh: cancel-streamlocal-forward@openssh.com failed") + } + return err +} + +// Addr returns the listener's network address. +func (l *unixListener) Addr() net.Addr { + return &net.UnixAddr{ + Name: l.socketPath, + Net: "unix", + } +} diff --git a/vendor/golang.org/x/crypto/ssh/tcpip.go b/vendor/golang.org/x/crypto/ssh/tcpip.go index 6151241..acf1717 100644 --- a/vendor/golang.org/x/crypto/ssh/tcpip.go +++ b/vendor/golang.org/x/crypto/ssh/tcpip.go @@ -20,12 +20,20 @@ import ( // addr. Incoming connections will be available by calling Accept on // the returned net.Listener. The listener must be serviced, or the // SSH connection may hang. +// N must be "tcp", "tcp4", "tcp6", or "unix". func (c *Client) Listen(n, addr string) (net.Listener, error) { - laddr, err := net.ResolveTCPAddr(n, addr) - if err != nil { - return nil, err + switch n { + case "tcp", "tcp4", "tcp6": + laddr, err := net.ResolveTCPAddr(n, addr) + if err != nil { + return nil, err + } + return c.ListenTCP(laddr) + case "unix": + return c.ListenUnix(addr) + default: + return nil, fmt.Errorf("ssh: unsupported protocol: %s", n) } - return c.ListenTCP(laddr) } // Automatic port allocation is broken with OpenSSH before 6.0. See @@ -116,7 +124,7 @@ func (c *Client) ListenTCP(laddr *net.TCPAddr) (net.Listener, error) { } // Register this forward, using the port number we obtained. - ch := c.forwards.add(*laddr) + ch := c.forwards.add(laddr) return &tcpListener{laddr, c, ch}, nil } @@ -131,7 +139,7 @@ type forwardList struct { // forwardEntry represents an established mapping of a laddr on a // remote ssh server to a channel connected to a tcpListener. type forwardEntry struct { - laddr net.TCPAddr + laddr net.Addr c chan forward } @@ -139,16 +147,16 @@ type forwardEntry struct { // arguments to add/remove/lookup should be address as specified in // the original forward-request. type forward struct { - newCh NewChannel // the ssh client channel underlying this forward - raddr *net.TCPAddr // the raddr of the incoming connection + newCh NewChannel // the ssh client channel underlying this forward + raddr net.Addr // the raddr of the incoming connection } -func (l *forwardList) add(addr net.TCPAddr) chan forward { +func (l *forwardList) add(addr net.Addr) chan forward { l.Lock() defer l.Unlock() f := forwardEntry{ - addr, - make(chan forward, 1), + laddr: addr, + c: make(chan forward, 1), } l.entries = append(l.entries, f) return f.c @@ -176,44 +184,69 @@ func parseTCPAddr(addr string, port uint32) (*net.TCPAddr, error) { func (l *forwardList) handleChannels(in <-chan NewChannel) { for ch := range in { - var payload forwardedTCPPayload - if err := Unmarshal(ch.ExtraData(), &payload); err != nil { - ch.Reject(ConnectionFailed, "could not parse forwarded-tcpip payload: "+err.Error()) - continue - } + var ( + laddr net.Addr + raddr net.Addr + err error + ) + switch channelType := ch.ChannelType(); channelType { + case "forwarded-tcpip": + var payload forwardedTCPPayload + if err = Unmarshal(ch.ExtraData(), &payload); err != nil { + ch.Reject(ConnectionFailed, "could not parse forwarded-tcpip payload: "+err.Error()) + continue + } - // RFC 4254 section 7.2 specifies that incoming - // addresses should list the address, in string - // format. It is implied that this should be an IP - // address, as it would be impossible to connect to it - // otherwise. - laddr, err := parseTCPAddr(payload.Addr, payload.Port) - if err != nil { - ch.Reject(ConnectionFailed, err.Error()) - continue - } - raddr, err := parseTCPAddr(payload.OriginAddr, payload.OriginPort) - if err != nil { - ch.Reject(ConnectionFailed, err.Error()) - continue - } + // RFC 4254 section 7.2 specifies that incoming + // addresses should list the address, in string + // format. It is implied that this should be an IP + // address, as it would be impossible to connect to it + // otherwise. + laddr, err = parseTCPAddr(payload.Addr, payload.Port) + if err != nil { + ch.Reject(ConnectionFailed, err.Error()) + continue + } + raddr, err = parseTCPAddr(payload.OriginAddr, payload.OriginPort) + if err != nil { + ch.Reject(ConnectionFailed, err.Error()) + continue + } - if ok := l.forward(*laddr, *raddr, ch); !ok { + case "forwarded-streamlocal@openssh.com": + var payload forwardedStreamLocalPayload + if err = Unmarshal(ch.ExtraData(), &payload); err != nil { + ch.Reject(ConnectionFailed, "could not parse forwarded-streamlocal@openssh.com payload: "+err.Error()) + continue + } + laddr = &net.UnixAddr{ + Name: payload.SocketPath, + Net: "unix", + } + raddr = &net.UnixAddr{ + Name: "@", + Net: "unix", + } + default: + panic(fmt.Errorf("ssh: unknown channel type %s", channelType)) + } + if ok := l.forward(laddr, raddr, ch); !ok { // Section 7.2, implementations MUST reject spurious incoming // connections. ch.Reject(Prohibited, "no forward for address") continue } + } } // remove removes the forward entry, and the channel feeding its // listener. -func (l *forwardList) remove(addr net.TCPAddr) { +func (l *forwardList) remove(addr net.Addr) { l.Lock() defer l.Unlock() for i, f := range l.entries { - if addr.IP.Equal(f.laddr.IP) && addr.Port == f.laddr.Port { + if addr.Network() == f.laddr.Network() && addr.String() == f.laddr.String() { l.entries = append(l.entries[:i], l.entries[i+1:]...) close(f.c) return @@ -231,12 +264,12 @@ func (l *forwardList) closeAll() { l.entries = nil } -func (l *forwardList) forward(laddr, raddr net.TCPAddr, ch NewChannel) bool { +func (l *forwardList) forward(laddr, raddr net.Addr, ch NewChannel) bool { l.Lock() defer l.Unlock() for _, f := range l.entries { - if laddr.IP.Equal(f.laddr.IP) && laddr.Port == f.laddr.Port { - f.c <- forward{ch, &raddr} + if laddr.Network() == f.laddr.Network() && laddr.String() == f.laddr.String() { + f.c <- forward{newCh: ch, raddr: raddr} return true } } @@ -262,7 +295,7 @@ func (l *tcpListener) Accept() (net.Conn, error) { } go DiscardRequests(incoming) - return &tcpChanConn{ + return &chanConn{ Channel: ch, laddr: l.laddr, raddr: s.raddr, @@ -277,7 +310,7 @@ func (l *tcpListener) Close() error { } // this also closes the listener. - l.conn.forwards.remove(*l.laddr) + l.conn.forwards.remove(l.laddr) ok, _, err := l.conn.SendRequest("cancel-tcpip-forward", true, Marshal(&m)) if err == nil && !ok { err = errors.New("ssh: cancel-tcpip-forward failed") @@ -293,29 +326,52 @@ func (l *tcpListener) Addr() net.Addr { // Dial initiates a connection to the addr from the remote host. // The resulting connection has a zero LocalAddr() and RemoteAddr(). func (c *Client) Dial(n, addr string) (net.Conn, error) { - // Parse the address into host and numeric port. - host, portString, err := net.SplitHostPort(addr) - if err != nil { - return nil, err + var ch Channel + switch n { + case "tcp", "tcp4", "tcp6": + // Parse the address into host and numeric port. + host, portString, err := net.SplitHostPort(addr) + if err != nil { + return nil, err + } + port, err := strconv.ParseUint(portString, 10, 16) + if err != nil { + return nil, err + } + ch, err = c.dial(net.IPv4zero.String(), 0, host, int(port)) + if err != nil { + return nil, err + } + // Use a zero address for local and remote address. + zeroAddr := &net.TCPAddr{ + IP: net.IPv4zero, + Port: 0, + } + return &chanConn{ + Channel: ch, + laddr: zeroAddr, + raddr: zeroAddr, + }, nil + case "unix": + var err error + ch, err = c.dialStreamLocal(addr) + if err != nil { + return nil, err + } + return &chanConn{ + Channel: ch, + laddr: &net.UnixAddr{ + Name: "@", + Net: "unix", + }, + raddr: &net.UnixAddr{ + Name: addr, + Net: "unix", + }, + }, nil + default: + return nil, fmt.Errorf("ssh: unsupported protocol: %s", n) } - port, err := strconv.ParseUint(portString, 10, 16) - if err != nil { - return nil, err - } - // Use a zero address for local and remote address. - zeroAddr := &net.TCPAddr{ - IP: net.IPv4zero, - Port: 0, - } - ch, err := c.dial(net.IPv4zero.String(), 0, host, int(port)) - if err != nil { - return nil, err - } - return &tcpChanConn{ - Channel: ch, - laddr: zeroAddr, - raddr: zeroAddr, - }, nil } // DialTCP connects to the remote address raddr on the network net, @@ -332,7 +388,7 @@ func (c *Client) DialTCP(n string, laddr, raddr *net.TCPAddr) (net.Conn, error) if err != nil { return nil, err } - return &tcpChanConn{ + return &chanConn{ Channel: ch, laddr: laddr, raddr: raddr, @@ -366,26 +422,26 @@ type tcpChan struct { Channel // the backing channel } -// tcpChanConn fulfills the net.Conn interface without +// chanConn fulfills the net.Conn interface without // the tcpChan having to hold laddr or raddr directly. -type tcpChanConn struct { +type chanConn struct { Channel laddr, raddr net.Addr } // LocalAddr returns the local network address. -func (t *tcpChanConn) LocalAddr() net.Addr { +func (t *chanConn) LocalAddr() net.Addr { return t.laddr } // RemoteAddr returns the remote network address. -func (t *tcpChanConn) RemoteAddr() net.Addr { +func (t *chanConn) RemoteAddr() net.Addr { return t.raddr } // SetDeadline sets the read and write deadlines associated // with the connection. -func (t *tcpChanConn) SetDeadline(deadline time.Time) error { +func (t *chanConn) SetDeadline(deadline time.Time) error { if err := t.SetReadDeadline(deadline); err != nil { return err } @@ -396,12 +452,14 @@ func (t *tcpChanConn) SetDeadline(deadline time.Time) error { // A zero value for t means Read will not time out. // After the deadline, the error from Read will implement net.Error // with Timeout() == true. -func (t *tcpChanConn) SetReadDeadline(deadline time.Time) error { +func (t *chanConn) SetReadDeadline(deadline time.Time) error { + // for compatibility with previous version, + // the error message contains "tcpChan" return errors.New("ssh: tcpChan: deadline not supported") } // SetWriteDeadline exists to satisfy the net.Conn interface // but is not implemented by this type. It always returns an error. -func (t *tcpChanConn) SetWriteDeadline(deadline time.Time) error { +func (t *chanConn) SetWriteDeadline(deadline time.Time) error { return errors.New("ssh: tcpChan: deadline not supported") } diff --git a/vendor/golang.org/x/crypto/ssh/terminal/util_solaris.go b/vendor/golang.org/x/crypto/ssh/terminal/util_solaris.go index 07eb5ed..a2e1b57 100644 --- a/vendor/golang.org/x/crypto/ssh/terminal/util_solaris.go +++ b/vendor/golang.org/x/crypto/ssh/terminal/util_solaris.go @@ -14,14 +14,12 @@ import ( // State contains the state of a terminal. type State struct { - termios syscall.Termios + state *unix.Termios } // IsTerminal returns true if the given file descriptor is a terminal. func IsTerminal(fd int) bool { - // see: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/gen/common/isatty.c - var termio unix.Termio - err := unix.IoctlSetTermio(fd, unix.TCGETA, &termio) + _, err := unix.IoctlGetTermio(fd, unix.TCGETA) return err == nil } @@ -71,3 +69,60 @@ func ReadPassword(fd int) ([]byte, error) { return ret, nil } + +// MakeRaw puts the terminal connected to the given file descriptor into raw +// mode and returns the previous state of the terminal so that it can be +// restored. +// see http://cr.illumos.org/~webrev/andy_js/1060/ +func MakeRaw(fd int) (*State, error) { + oldTermiosPtr, err := unix.IoctlGetTermios(fd, unix.TCGETS) + if err != nil { + return nil, err + } + oldTermios := *oldTermiosPtr + + newTermios := oldTermios + newTermios.Iflag &^= syscall.IGNBRK | syscall.BRKINT | syscall.PARMRK | syscall.ISTRIP | syscall.INLCR | syscall.IGNCR | syscall.ICRNL | syscall.IXON + newTermios.Oflag &^= syscall.OPOST + newTermios.Lflag &^= syscall.ECHO | syscall.ECHONL | syscall.ICANON | syscall.ISIG | syscall.IEXTEN + newTermios.Cflag &^= syscall.CSIZE | syscall.PARENB + newTermios.Cflag |= syscall.CS8 + newTermios.Cc[unix.VMIN] = 1 + newTermios.Cc[unix.VTIME] = 0 + + if err := unix.IoctlSetTermios(fd, unix.TCSETS, &newTermios); err != nil { + return nil, err + } + + return &State{ + state: oldTermiosPtr, + }, nil +} + +// Restore restores the terminal connected to the given file descriptor to a +// previous state. +func Restore(fd int, oldState *State) error { + return unix.IoctlSetTermios(fd, unix.TCSETS, oldState.state) +} + +// GetState returns the current state of a terminal which may be useful to +// restore the terminal after a signal. +func GetState(fd int) (*State, error) { + oldTermiosPtr, err := unix.IoctlGetTermios(fd, unix.TCGETS) + if err != nil { + return nil, err + } + + return &State{ + state: oldTermiosPtr, + }, nil +} + +// GetSize returns the dimensions of the given terminal. +func GetSize(fd int) (width, height int, err error) { + ws, err := unix.IoctlGetWinsize(fd, unix.TIOCGWINSZ) + if err != nil { + return 0, 0, err + } + return int(ws.Col), int(ws.Row), nil +} diff --git a/vendor/golang.org/x/crypto/ssh/test/dial_unix_test.go b/vendor/golang.org/x/crypto/ssh/test/dial_unix_test.go new file mode 100644 index 0000000..091e48c --- /dev/null +++ b/vendor/golang.org/x/crypto/ssh/test/dial_unix_test.go @@ -0,0 +1,128 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !windows + +package test + +// direct-tcpip and direct-streamlocal functional tests + +import ( + "fmt" + "io" + "io/ioutil" + "net" + "strings" + "testing" +) + +type dialTester interface { + TestServerConn(t *testing.T, c net.Conn) + TestClientConn(t *testing.T, c net.Conn) +} + +func testDial(t *testing.T, n, listenAddr string, x dialTester) { + server := newServer(t) + defer server.Shutdown() + sshConn := server.Dial(clientConfig()) + defer sshConn.Close() + + l, err := net.Listen(n, listenAddr) + if err != nil { + t.Fatalf("Listen: %v", err) + } + defer l.Close() + + testData := fmt.Sprintf("hello from %s, %s", n, listenAddr) + go func() { + for { + c, err := l.Accept() + if err != nil { + break + } + x.TestServerConn(t, c) + + io.WriteString(c, testData) + c.Close() + } + }() + + conn, err := sshConn.Dial(n, l.Addr().String()) + if err != nil { + t.Fatalf("Dial: %v", err) + } + x.TestClientConn(t, conn) + defer conn.Close() + b, err := ioutil.ReadAll(conn) + if err != nil { + t.Fatalf("ReadAll: %v", err) + } + t.Logf("got %q", string(b)) + if string(b) != testData { + t.Fatalf("expected %q, got %q", testData, string(b)) + } +} + +type tcpDialTester struct { + listenAddr string +} + +func (x *tcpDialTester) TestServerConn(t *testing.T, c net.Conn) { + host := strings.Split(x.listenAddr, ":")[0] + prefix := host + ":" + if !strings.HasPrefix(c.LocalAddr().String(), prefix) { + t.Fatalf("expected to start with %q, got %q", prefix, c.LocalAddr().String()) + } + if !strings.HasPrefix(c.RemoteAddr().String(), prefix) { + t.Fatalf("expected to start with %q, got %q", prefix, c.RemoteAddr().String()) + } +} + +func (x *tcpDialTester) TestClientConn(t *testing.T, c net.Conn) { + // we use zero addresses. see *Client.Dial. + if c.LocalAddr().String() != "0.0.0.0:0" { + t.Fatalf("expected \"0.0.0.0:0\", got %q", c.LocalAddr().String()) + } + if c.RemoteAddr().String() != "0.0.0.0:0" { + t.Fatalf("expected \"0.0.0.0:0\", got %q", c.RemoteAddr().String()) + } +} + +func TestDialTCP(t *testing.T) { + x := &tcpDialTester{ + listenAddr: "127.0.0.1:0", + } + testDial(t, "tcp", x.listenAddr, x) +} + +type unixDialTester struct { + listenAddr string +} + +func (x *unixDialTester) TestServerConn(t *testing.T, c net.Conn) { + if c.LocalAddr().String() != x.listenAddr { + t.Fatalf("expected %q, got %q", x.listenAddr, c.LocalAddr().String()) + } + if c.RemoteAddr().String() != "@" { + t.Fatalf("expected \"@\", got %q", c.RemoteAddr().String()) + } +} + +func (x *unixDialTester) TestClientConn(t *testing.T, c net.Conn) { + if c.RemoteAddr().String() != x.listenAddr { + t.Fatalf("expected %q, got %q", x.listenAddr, c.RemoteAddr().String()) + } + if c.LocalAddr().String() != "@" { + t.Fatalf("expected \"@\", got %q", c.LocalAddr().String()) + } +} + +func TestDialUnix(t *testing.T) { + addr, cleanup := newTempSocket(t) + defer cleanup() + x := &unixDialTester{ + listenAddr: addr, + } + testDial(t, "unix", x.listenAddr, x) +} diff --git a/vendor/golang.org/x/crypto/ssh/test/forward_unix_test.go b/vendor/golang.org/x/crypto/ssh/test/forward_unix_test.go index 877a88c..ea81937 100644 --- a/vendor/golang.org/x/crypto/ssh/test/forward_unix_test.go +++ b/vendor/golang.org/x/crypto/ssh/test/forward_unix_test.go @@ -16,13 +16,17 @@ import ( "time" ) -func TestPortForward(t *testing.T) { +type closeWriter interface { + CloseWrite() error +} + +func testPortForward(t *testing.T, n, listenAddr string) { server := newServer(t) defer server.Shutdown() conn := server.Dial(clientConfig()) defer conn.Close() - sshListener, err := conn.Listen("tcp", "localhost:0") + sshListener, err := conn.Listen(n, listenAddr) if err != nil { t.Fatal(err) } @@ -41,14 +45,14 @@ func TestPortForward(t *testing.T) { }() forwardedAddr := sshListener.Addr().String() - tcpConn, err := net.Dial("tcp", forwardedAddr) + netConn, err := net.Dial(n, forwardedAddr) if err != nil { - t.Fatalf("TCP dial failed: %v", err) + t.Fatalf("net dial failed: %v", err) } readChan := make(chan []byte) go func() { - data, _ := ioutil.ReadAll(tcpConn) + data, _ := ioutil.ReadAll(netConn) readChan <- data }() @@ -62,14 +66,14 @@ func TestPortForward(t *testing.T) { for len(sent) < 1000*1000 { // Send random sized chunks m := rand.Intn(len(data)) - n, err := tcpConn.Write(data[:m]) + n, err := netConn.Write(data[:m]) if err != nil { break } sent = append(sent, data[:n]...) } - if err := tcpConn.(*net.TCPConn).CloseWrite(); err != nil { - t.Errorf("tcpConn.CloseWrite: %v", err) + if err := netConn.(closeWriter).CloseWrite(); err != nil { + t.Errorf("netConn.CloseWrite: %v", err) } read := <-readChan @@ -86,19 +90,29 @@ func TestPortForward(t *testing.T) { } // Check that the forward disappeared. - tcpConn, err = net.Dial("tcp", forwardedAddr) + netConn, err = net.Dial(n, forwardedAddr) if err == nil { - tcpConn.Close() + netConn.Close() t.Errorf("still listening to %s after closing", forwardedAddr) } } -func TestAcceptClose(t *testing.T) { +func TestPortForwardTCP(t *testing.T) { + testPortForward(t, "tcp", "localhost:0") +} + +func TestPortForwardUnix(t *testing.T) { + addr, cleanup := newTempSocket(t) + defer cleanup() + testPortForward(t, "unix", addr) +} + +func testAcceptClose(t *testing.T, n, listenAddr string) { server := newServer(t) defer server.Shutdown() conn := server.Dial(clientConfig()) - sshListener, err := conn.Listen("tcp", "localhost:0") + sshListener, err := conn.Listen(n, listenAddr) if err != nil { t.Fatal(err) } @@ -124,13 +138,23 @@ func TestAcceptClose(t *testing.T) { } } +func TestAcceptCloseTCP(t *testing.T) { + testAcceptClose(t, "tcp", "localhost:0") +} + +func TestAcceptCloseUnix(t *testing.T) { + addr, cleanup := newTempSocket(t) + defer cleanup() + testAcceptClose(t, "unix", addr) +} + // Check that listeners exit if the underlying client transport dies. -func TestPortForwardConnectionClose(t *testing.T) { +func testPortForwardConnectionClose(t *testing.T, n, listenAddr string) { server := newServer(t) defer server.Shutdown() conn := server.Dial(clientConfig()) - sshListener, err := conn.Listen("tcp", "localhost:0") + sshListener, err := conn.Listen(n, listenAddr) if err != nil { t.Fatal(err) } @@ -158,3 +182,13 @@ func TestPortForwardConnectionClose(t *testing.T) { t.Logf("quit as expected (error %v)", err) } } + +func TestPortForwardConnectionCloseTCP(t *testing.T) { + testPortForwardConnectionClose(t, "tcp", "localhost:0") +} + +func TestPortForwardConnectionCloseUnix(t *testing.T) { + addr, cleanup := newTempSocket(t) + defer cleanup() + testPortForwardConnectionClose(t, "unix", addr) +} diff --git a/vendor/golang.org/x/crypto/ssh/test/tcpip_test.go b/vendor/golang.org/x/crypto/ssh/test/tcpip_test.go deleted file mode 100644 index a2eb935..0000000 --- a/vendor/golang.org/x/crypto/ssh/test/tcpip_test.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !windows - -package test - -// direct-tcpip functional tests - -import ( - "io" - "net" - "testing" -) - -func TestDial(t *testing.T) { - server := newServer(t) - defer server.Shutdown() - sshConn := server.Dial(clientConfig()) - defer sshConn.Close() - - l, err := net.Listen("tcp", "127.0.0.1:0") - if err != nil { - t.Fatalf("Listen: %v", err) - } - defer l.Close() - - go func() { - for { - c, err := l.Accept() - if err != nil { - break - } - - io.WriteString(c, c.RemoteAddr().String()) - c.Close() - } - }() - - conn, err := sshConn.Dial("tcp", l.Addr().String()) - if err != nil { - t.Fatalf("Dial: %v", err) - } - defer conn.Close() -} diff --git a/vendor/golang.org/x/crypto/ssh/test/test_unix_test.go b/vendor/golang.org/x/crypto/ssh/test/test_unix_test.go index 3bfd881..dd9ff40 100644 --- a/vendor/golang.org/x/crypto/ssh/test/test_unix_test.go +++ b/vendor/golang.org/x/crypto/ssh/test/test_unix_test.go @@ -266,3 +266,13 @@ func newServer(t *testing.T) *server { }, } } + +func newTempSocket(t *testing.T) (string, func()) { + dir, err := ioutil.TempDir("", "socket") + if err != nil { + t.Fatal(err) + } + deferFunc := func() { os.RemoveAll(dir) } + addr := filepath.Join(dir, "sock") + return addr, deferFunc +} diff --git a/vendor/golang.org/x/crypto/ssh/testdata/keys.go b/vendor/golang.org/x/crypto/ssh/testdata/keys.go index 736dad9..0be2e7e 100644 --- a/vendor/golang.org/x/crypto/ssh/testdata/keys.go +++ b/vendor/golang.org/x/crypto/ssh/testdata/keys.go @@ -48,6 +48,22 @@ AAAEAaYmXltfW6nhRo3iWGglRB48lYq0z0Q3I3KyrdutEr6j7d/uFLuDlRbBc4ZVOsx+Gb HKuOrPtLHFvHsjWPwO+/AAAAE2dhcnRvbm1AZ2FydG9ubS14cHMBAg== -----END OPENSSH PRIVATE KEY----- `), + "rsa-openssh-format": []byte(`-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAlwAAAAdzc2gtcn +NhAAAAAwEAAQAAAIEAwa48yfWFi3uIdqzuf9X7C2Zxfea/Iaaw0zIwHudpF8U92WVIiC5l +oEuW1+OaVi3UWfIEjWMV1tHGysrHOwtwc34BPCJqJknUQO/KtDTBTJ4Pryhw1bWPC999Lz +a+yrCTdNQYBzoROXKExZgPFh9pTMi5wqpHDuOQ2qZFIEI3lT0AAAIQWL0H31i9B98AAAAH +c3NoLXJzYQAAAIEAwa48yfWFi3uIdqzuf9X7C2Zxfea/Iaaw0zIwHudpF8U92WVIiC5loE +uW1+OaVi3UWfIEjWMV1tHGysrHOwtwc34BPCJqJknUQO/KtDTBTJ4Pryhw1bWPC999Lza+ +yrCTdNQYBzoROXKExZgPFh9pTMi5wqpHDuOQ2qZFIEI3lT0AAAADAQABAAAAgCThyTGsT4 +IARDxVMhWl6eiB2ZrgFgWSeJm/NOqtppWgOebsIqPMMg4UVuVFsl422/lE3RkPhVkjGXgE +pWvZAdCnmLmApK8wK12vF334lZhZT7t3Z9EzJps88PWEHo7kguf285HcnUM7FlFeissJdk +kXly34y7/3X/a6Tclm+iABAAAAQE0xR/KxZ39slwfMv64Rz7WKk1PPskaryI29aHE3mKHk +pY2QA+P3QlrKxT/VWUMjHUbNNdYfJm48xu0SGNMRdKMAAABBAORh2NP/06JUV3J9W/2Hju +X1ViJuqqcQnJPVzpgSL826EC2xwOECTqoY8uvFpUdD7CtpksIxNVqRIhuNOlz0lqEAAABB +ANkaHTTaPojClO0dKJ/Zjs7pWOCGliebBYprQ/Y4r9QLBkC/XaWMS26gFIrjgC7D2Rv+rZ +wSD0v0RcmkITP1ZR0AAAAYcHF1ZXJuYUBMdWNreUh5ZHJvLmxvY2FsAQID +-----END OPENSSH PRIVATE KEY-----`), "user": []byte(`-----BEGIN EC PRIVATE KEY----- MHcCAQEEILYCAeq8f7V4vSSypRw7pxy8yz3V5W4qg8kSC3zJhqpQoAoGCCqGSM49 AwEHoUQDQgAEYcO2xNKiRUYOLEHM7VYAp57HNyKbOdYtHD83Z4hzNPVC4tM5mdGD diff --git a/vendor/golang.org/x/net/bpf/instructions.go b/vendor/golang.org/x/net/bpf/instructions.go index 3b4fd08..0bb4082 100644 --- a/vendor/golang.org/x/net/bpf/instructions.go +++ b/vendor/golang.org/x/net/bpf/instructions.go @@ -198,18 +198,6 @@ func (a LoadConstant) Assemble() (RawInstruction, error) { return assembleLoad(a.Dst, 4, opAddrModeImmediate, a.Val) } -// String returns the the instruction in assembler notation. -func (a LoadConstant) String() string { - switch a.Dst { - case RegA: - return fmt.Sprintf("ld #%d", a.Val) - case RegX: - return fmt.Sprintf("ldx #%d", a.Val) - default: - return fmt.Sprintf("unknown instruction: %#v", a) - } -} - // LoadScratch loads scratch[N] into register Dst. type LoadScratch struct { Dst Register @@ -224,18 +212,6 @@ func (a LoadScratch) Assemble() (RawInstruction, error) { return assembleLoad(a.Dst, 4, opAddrModeScratch, uint32(a.N)) } -// String returns the the instruction in assembler notation. -func (a LoadScratch) String() string { - switch a.Dst { - case RegA: - return fmt.Sprintf("ld M[%d]", a.N) - case RegX: - return fmt.Sprintf("ldx M[%d]", a.N) - default: - return fmt.Sprintf("unknown instruction: %#v", a) - } -} - // LoadAbsolute loads packet[Off:Off+Size] as an integer value into // register A. type LoadAbsolute struct { @@ -248,23 +224,6 @@ func (a LoadAbsolute) Assemble() (RawInstruction, error) { return assembleLoad(RegA, a.Size, opAddrModeAbsolute, a.Off) } -// String returns the the instruction in assembler notation. -func (a LoadAbsolute) String() string { - switch a.Size { - case 1: // byte - return fmt.Sprintf("ldb [%d]", a.Off) - case 2: // half word - return fmt.Sprintf("ldh [%d]", a.Off) - case 4: // word - if a.Off > extOffset+0xffffffff { - return LoadExtension{Num: Extension(a.Off + 0x1000)}.String() - } - return fmt.Sprintf("ld [%d]", a.Off) - default: - return fmt.Sprintf("unknown instruction: %#v", a) - } -} - // LoadIndirect loads packet[X+Off:X+Off+Size] as an integer value // into register A. type LoadIndirect struct { @@ -277,20 +236,6 @@ func (a LoadIndirect) Assemble() (RawInstruction, error) { return assembleLoad(RegA, a.Size, opAddrModeIndirect, a.Off) } -// String returns the the instruction in assembler notation. -func (a LoadIndirect) String() string { - switch a.Size { - case 1: // byte - return fmt.Sprintf("ldb [x + %d]", a.Off) - case 2: // half word - return fmt.Sprintf("ldh [x + %d]", a.Off) - case 4: // word - return fmt.Sprintf("ld [x + %d]", a.Off) - default: - return fmt.Sprintf("unknown instruction: %#v", a) - } -} - // LoadMemShift multiplies the first 4 bits of the byte at packet[Off] // by 4 and stores the result in register X. // @@ -306,11 +251,6 @@ func (a LoadMemShift) Assemble() (RawInstruction, error) { return assembleLoad(RegX, 1, opAddrModeMemShift, a.Off) } -// String returns the the instruction in assembler notation. -func (a LoadMemShift) String() string { - return fmt.Sprintf("ldx 4*([%d]&0xf)", a.Off) -} - // LoadExtension invokes a linux-specific extension and stores the // result in register A. type LoadExtension struct { @@ -325,46 +265,6 @@ func (a LoadExtension) Assemble() (RawInstruction, error) { return assembleLoad(RegA, 4, opAddrModeAbsolute, uint32(extOffset+a.Num)) } -// String returns the the instruction in assembler notation. -func (a LoadExtension) String() string { - switch a.Num { - case ExtLen: - return "ld #len" - case ExtProto: - return "ld #proto" - case ExtType: - return "ld #type" - case ExtPayloadOffset: - return "ld #poff" - case ExtInterfaceIndex: - return "ld #ifidx" - case ExtNetlinkAttr: - return "ld #nla" - case ExtNetlinkAttrNested: - return "ld #nlan" - case ExtMark: - return "ld #mark" - case ExtQueue: - return "ld #queue" - case ExtLinkLayerType: - return "ld #hatype" - case ExtRXHash: - return "ld #rxhash" - case ExtCPUID: - return "ld #cpu" - case ExtVLANTag: - return "ld #vlan_tci" - case ExtVLANTagPresent: - return "ld #vlan_avail" - case ExtVLANProto: - return "ld #vlan_tpid" - case ExtRand: - return "ld #rand" - default: - return fmt.Sprintf("unknown instruction: %#v", a) - } -} - // StoreScratch stores register Src into scratch[N]. type StoreScratch struct { Src Register @@ -392,18 +292,6 @@ func (a StoreScratch) Assemble() (RawInstruction, error) { }, nil } -// String returns the the instruction in assembler notation. -func (a StoreScratch) String() string { - switch a.Src { - case RegA: - return fmt.Sprintf("st M[%d]", a.N) - case RegX: - return fmt.Sprintf("stx M[%d]", a.N) - default: - return fmt.Sprintf("unknown instruction: %#v", a) - } -} - // ALUOpConstant executes A = A Val. type ALUOpConstant struct { Op ALUOp @@ -418,34 +306,6 @@ func (a ALUOpConstant) Assemble() (RawInstruction, error) { }, nil } -// String returns the the instruction in assembler notation. -func (a ALUOpConstant) String() string { - switch a.Op { - case ALUOpAdd: - return fmt.Sprintf("add #%d", a.Val) - case ALUOpSub: - return fmt.Sprintf("sub #%d", a.Val) - case ALUOpMul: - return fmt.Sprintf("mul #%d", a.Val) - case ALUOpDiv: - return fmt.Sprintf("div #%d", a.Val) - case ALUOpMod: - return fmt.Sprintf("mod #%d", a.Val) - case ALUOpAnd: - return fmt.Sprintf("and #%d", a.Val) - case ALUOpOr: - return fmt.Sprintf("or #%d", a.Val) - case ALUOpXor: - return fmt.Sprintf("xor #%d", a.Val) - case ALUOpShiftLeft: - return fmt.Sprintf("lsh #%d", a.Val) - case ALUOpShiftRight: - return fmt.Sprintf("rsh #%d", a.Val) - default: - return fmt.Sprintf("unknown instruction: %#v", a) - } -} - // ALUOpX executes A = A X type ALUOpX struct { Op ALUOp @@ -458,34 +318,6 @@ func (a ALUOpX) Assemble() (RawInstruction, error) { }, nil } -// String returns the the instruction in assembler notation. -func (a ALUOpX) String() string { - switch a.Op { - case ALUOpAdd: - return "add x" - case ALUOpSub: - return "sub x" - case ALUOpMul: - return "mul x" - case ALUOpDiv: - return "div x" - case ALUOpMod: - return "mod x" - case ALUOpAnd: - return "and x" - case ALUOpOr: - return "or x" - case ALUOpXor: - return "xor x" - case ALUOpShiftLeft: - return "lsh x" - case ALUOpShiftRight: - return "rsh x" - default: - return fmt.Sprintf("unknown instruction: %#v", a) - } -} - // NegateA executes A = -A. type NegateA struct{} @@ -496,11 +328,6 @@ func (a NegateA) Assemble() (RawInstruction, error) { }, nil } -// String returns the the instruction in assembler notation. -func (a NegateA) String() string { - return fmt.Sprintf("neg") -} - // Jump skips the following Skip instructions in the program. type Jump struct { Skip uint32 @@ -514,11 +341,6 @@ func (a Jump) Assemble() (RawInstruction, error) { }, nil } -// String returns the the instruction in assembler notation. -func (a Jump) String() string { - return fmt.Sprintf("ja %d", a.Skip) -} - // JumpIf skips the following Skip instructions in the program if A // Val is true. type JumpIf struct { @@ -566,51 +388,6 @@ func (a JumpIf) Assemble() (RawInstruction, error) { }, nil } -// String returns the the instruction in assembler notation. -func (a JumpIf) String() string { - switch a.Cond { - // K == A - case JumpEqual: - return conditionalJump(a, "jeq", "jneq") - // K != A - case JumpNotEqual: - return fmt.Sprintf("jneq #%d,%d", a.Val, a.SkipTrue) - // K > A - case JumpGreaterThan: - return conditionalJump(a, "jgt", "jle") - // K < A - case JumpLessThan: - return fmt.Sprintf("jlt #%d,%d", a.Val, a.SkipTrue) - // K >= A - case JumpGreaterOrEqual: - return conditionalJump(a, "jge", "jlt") - // K <= A - case JumpLessOrEqual: - return fmt.Sprintf("jle #%d,%d", a.Val, a.SkipTrue) - // K & A != 0 - case JumpBitsSet: - if a.SkipFalse > 0 { - return fmt.Sprintf("jset #%d,%d,%d", a.Val, a.SkipTrue, a.SkipFalse) - } - return fmt.Sprintf("jset #%d,%d", a.Val, a.SkipTrue) - // K & A == 0, there is no assembler instruction for JumpBitNotSet, use JumpBitSet and invert skips - case JumpBitsNotSet: - return JumpIf{Cond: JumpBitsSet, SkipTrue: a.SkipFalse, SkipFalse: a.SkipTrue, Val: a.Val}.String() - default: - return fmt.Sprintf("unknown instruction: %#v", a) - } -} - -func conditionalJump(inst JumpIf, positiveJump, negativeJump string) string { - if inst.SkipTrue > 0 { - if inst.SkipFalse > 0 { - return fmt.Sprintf("%s #%d,%d,%d", positiveJump, inst.Val, inst.SkipTrue, inst.SkipFalse) - } - return fmt.Sprintf("%s #%d,%d", positiveJump, inst.Val, inst.SkipTrue) - } - return fmt.Sprintf("%s #%d,%d", negativeJump, inst.Val, inst.SkipFalse) -} - // RetA exits the BPF program, returning the value of register A. type RetA struct{} @@ -621,11 +398,6 @@ func (a RetA) Assemble() (RawInstruction, error) { }, nil } -// String returns the the instruction in assembler notation. -func (a RetA) String() string { - return fmt.Sprintf("ret a") -} - // RetConstant exits the BPF program, returning a constant value. type RetConstant struct { Val uint32 @@ -639,11 +411,6 @@ func (a RetConstant) Assemble() (RawInstruction, error) { }, nil } -// String returns the the instruction in assembler notation. -func (a RetConstant) String() string { - return fmt.Sprintf("ret #%d", a.Val) -} - // TXA copies the value of register X to register A. type TXA struct{} @@ -654,11 +421,6 @@ func (a TXA) Assemble() (RawInstruction, error) { }, nil } -// String returns the the instruction in assembler notation. -func (a TXA) String() string { - return fmt.Sprintf("txa") -} - // TAX copies the value of register A to register X. type TAX struct{} @@ -669,11 +431,6 @@ func (a TAX) Assemble() (RawInstruction, error) { }, nil } -// String returns the the instruction in assembler notation. -func (a TAX) String() string { - return fmt.Sprintf("tax") -} - func assembleLoad(dst Register, loadSize int, mode uint16, k uint32) (RawInstruction, error) { var ( cls uint16 diff --git a/vendor/golang.org/x/net/bpf/instructions_test.go b/vendor/golang.org/x/net/bpf/instructions_test.go index dde474a..8a01815 100644 --- a/vendor/golang.org/x/net/bpf/instructions_test.go +++ b/vendor/golang.org/x/net/bpf/instructions_test.go @@ -5,7 +5,6 @@ package bpf import ( - "fmt" "io/ioutil" "reflect" "strconv" @@ -173,353 +172,3 @@ func TestAsmDisasm(t *testing.T) { } } } - -type InvalidInstruction struct{} - -func (a InvalidInstruction) Assemble() (RawInstruction, error) { - return RawInstruction{}, fmt.Errorf("Invalid Instruction") -} - -func (a InvalidInstruction) String() string { - return fmt.Sprintf("unknown instruction: %#v", a) -} - -func TestString(t *testing.T) { - testCases := []struct { - instruction Instruction - assembler string - }{ - { - instruction: LoadConstant{Dst: RegA, Val: 42}, - assembler: "ld #42", - }, - { - instruction: LoadConstant{Dst: RegX, Val: 42}, - assembler: "ldx #42", - }, - { - instruction: LoadConstant{Dst: 0xffff, Val: 42}, - assembler: "unknown instruction: bpf.LoadConstant{Dst:0xffff, Val:0x2a}", - }, - { - instruction: LoadScratch{Dst: RegA, N: 3}, - assembler: "ld M[3]", - }, - { - instruction: LoadScratch{Dst: RegX, N: 3}, - assembler: "ldx M[3]", - }, - { - instruction: LoadScratch{Dst: 0xffff, N: 3}, - assembler: "unknown instruction: bpf.LoadScratch{Dst:0xffff, N:3}", - }, - { - instruction: LoadAbsolute{Off: 42, Size: 1}, - assembler: "ldb [42]", - }, - { - instruction: LoadAbsolute{Off: 42, Size: 2}, - assembler: "ldh [42]", - }, - { - instruction: LoadAbsolute{Off: 42, Size: 4}, - assembler: "ld [42]", - }, - { - instruction: LoadAbsolute{Off: 42, Size: -1}, - assembler: "unknown instruction: bpf.LoadAbsolute{Off:0x2a, Size:-1}", - }, - { - instruction: LoadIndirect{Off: 42, Size: 1}, - assembler: "ldb [x + 42]", - }, - { - instruction: LoadIndirect{Off: 42, Size: 2}, - assembler: "ldh [x + 42]", - }, - { - instruction: LoadIndirect{Off: 42, Size: 4}, - assembler: "ld [x + 42]", - }, - { - instruction: LoadIndirect{Off: 42, Size: -1}, - assembler: "unknown instruction: bpf.LoadIndirect{Off:0x2a, Size:-1}", - }, - { - instruction: LoadMemShift{Off: 42}, - assembler: "ldx 4*([42]&0xf)", - }, - { - instruction: LoadExtension{Num: ExtLen}, - assembler: "ld #len", - }, - { - instruction: LoadExtension{Num: ExtProto}, - assembler: "ld #proto", - }, - { - instruction: LoadExtension{Num: ExtType}, - assembler: "ld #type", - }, - { - instruction: LoadExtension{Num: ExtPayloadOffset}, - assembler: "ld #poff", - }, - { - instruction: LoadExtension{Num: ExtInterfaceIndex}, - assembler: "ld #ifidx", - }, - { - instruction: LoadExtension{Num: ExtNetlinkAttr}, - assembler: "ld #nla", - }, - { - instruction: LoadExtension{Num: ExtNetlinkAttrNested}, - assembler: "ld #nlan", - }, - { - instruction: LoadExtension{Num: ExtMark}, - assembler: "ld #mark", - }, - { - instruction: LoadExtension{Num: ExtQueue}, - assembler: "ld #queue", - }, - { - instruction: LoadExtension{Num: ExtLinkLayerType}, - assembler: "ld #hatype", - }, - { - instruction: LoadExtension{Num: ExtRXHash}, - assembler: "ld #rxhash", - }, - { - instruction: LoadExtension{Num: ExtCPUID}, - assembler: "ld #cpu", - }, - { - instruction: LoadExtension{Num: ExtVLANTag}, - assembler: "ld #vlan_tci", - }, - { - instruction: LoadExtension{Num: ExtVLANTagPresent}, - assembler: "ld #vlan_avail", - }, - { - instruction: LoadExtension{Num: ExtVLANProto}, - assembler: "ld #vlan_tpid", - }, - { - instruction: LoadExtension{Num: ExtRand}, - assembler: "ld #rand", - }, - { - instruction: LoadAbsolute{Off: 0xfffff038, Size: 4}, - assembler: "ld #rand", - }, - { - instruction: LoadExtension{Num: 0xfff}, - assembler: "unknown instruction: bpf.LoadExtension{Num:4095}", - }, - { - instruction: StoreScratch{Src: RegA, N: 3}, - assembler: "st M[3]", - }, - { - instruction: StoreScratch{Src: RegX, N: 3}, - assembler: "stx M[3]", - }, - { - instruction: StoreScratch{Src: 0xffff, N: 3}, - assembler: "unknown instruction: bpf.StoreScratch{Src:0xffff, N:3}", - }, - { - instruction: ALUOpConstant{Op: ALUOpAdd, Val: 42}, - assembler: "add #42", - }, - { - instruction: ALUOpConstant{Op: ALUOpSub, Val: 42}, - assembler: "sub #42", - }, - { - instruction: ALUOpConstant{Op: ALUOpMul, Val: 42}, - assembler: "mul #42", - }, - { - instruction: ALUOpConstant{Op: ALUOpDiv, Val: 42}, - assembler: "div #42", - }, - { - instruction: ALUOpConstant{Op: ALUOpOr, Val: 42}, - assembler: "or #42", - }, - { - instruction: ALUOpConstant{Op: ALUOpAnd, Val: 42}, - assembler: "and #42", - }, - { - instruction: ALUOpConstant{Op: ALUOpShiftLeft, Val: 42}, - assembler: "lsh #42", - }, - { - instruction: ALUOpConstant{Op: ALUOpShiftRight, Val: 42}, - assembler: "rsh #42", - }, - { - instruction: ALUOpConstant{Op: ALUOpMod, Val: 42}, - assembler: "mod #42", - }, - { - instruction: ALUOpConstant{Op: ALUOpXor, Val: 42}, - assembler: "xor #42", - }, - { - instruction: ALUOpConstant{Op: 0xffff, Val: 42}, - assembler: "unknown instruction: bpf.ALUOpConstant{Op:0xffff, Val:0x2a}", - }, - { - instruction: ALUOpX{Op: ALUOpAdd}, - assembler: "add x", - }, - { - instruction: ALUOpX{Op: ALUOpSub}, - assembler: "sub x", - }, - { - instruction: ALUOpX{Op: ALUOpMul}, - assembler: "mul x", - }, - { - instruction: ALUOpX{Op: ALUOpDiv}, - assembler: "div x", - }, - { - instruction: ALUOpX{Op: ALUOpOr}, - assembler: "or x", - }, - { - instruction: ALUOpX{Op: ALUOpAnd}, - assembler: "and x", - }, - { - instruction: ALUOpX{Op: ALUOpShiftLeft}, - assembler: "lsh x", - }, - { - instruction: ALUOpX{Op: ALUOpShiftRight}, - assembler: "rsh x", - }, - { - instruction: ALUOpX{Op: ALUOpMod}, - assembler: "mod x", - }, - { - instruction: ALUOpX{Op: ALUOpXor}, - assembler: "xor x", - }, - { - instruction: ALUOpX{Op: 0xffff}, - assembler: "unknown instruction: bpf.ALUOpX{Op:0xffff}", - }, - { - instruction: NegateA{}, - assembler: "neg", - }, - { - instruction: Jump{Skip: 10}, - assembler: "ja 10", - }, - { - instruction: JumpIf{Cond: JumpEqual, Val: 42, SkipTrue: 8, SkipFalse: 9}, - assembler: "jeq #42,8,9", - }, - { - instruction: JumpIf{Cond: JumpEqual, Val: 42, SkipTrue: 8}, - assembler: "jeq #42,8", - }, - { - instruction: JumpIf{Cond: JumpEqual, Val: 42, SkipFalse: 8}, - assembler: "jneq #42,8", - }, - { - instruction: JumpIf{Cond: JumpNotEqual, Val: 42, SkipTrue: 8}, - assembler: "jneq #42,8", - }, - { - instruction: JumpIf{Cond: JumpLessThan, Val: 42, SkipTrue: 7}, - assembler: "jlt #42,7", - }, - { - instruction: JumpIf{Cond: JumpLessOrEqual, Val: 42, SkipTrue: 6}, - assembler: "jle #42,6", - }, - { - instruction: JumpIf{Cond: JumpGreaterThan, Val: 42, SkipTrue: 4, SkipFalse: 5}, - assembler: "jgt #42,4,5", - }, - { - instruction: JumpIf{Cond: JumpGreaterThan, Val: 42, SkipTrue: 4}, - assembler: "jgt #42,4", - }, - { - instruction: JumpIf{Cond: JumpGreaterOrEqual, Val: 42, SkipTrue: 3, SkipFalse: 4}, - assembler: "jge #42,3,4", - }, - { - instruction: JumpIf{Cond: JumpGreaterOrEqual, Val: 42, SkipTrue: 3}, - assembler: "jge #42,3", - }, - { - instruction: JumpIf{Cond: JumpBitsSet, Val: 42, SkipTrue: 2, SkipFalse: 3}, - assembler: "jset #42,2,3", - }, - { - instruction: JumpIf{Cond: JumpBitsSet, Val: 42, SkipTrue: 2}, - assembler: "jset #42,2", - }, - { - instruction: JumpIf{Cond: JumpBitsNotSet, Val: 42, SkipTrue: 2, SkipFalse: 3}, - assembler: "jset #42,3,2", - }, - { - instruction: JumpIf{Cond: JumpBitsNotSet, Val: 42, SkipTrue: 2}, - assembler: "jset #42,0,2", - }, - { - instruction: JumpIf{Cond: 0xffff, Val: 42, SkipTrue: 1, SkipFalse: 2}, - assembler: "unknown instruction: bpf.JumpIf{Cond:0xffff, Val:0x2a, SkipTrue:0x1, SkipFalse:0x2}", - }, - { - instruction: TAX{}, - assembler: "tax", - }, - { - instruction: TXA{}, - assembler: "txa", - }, - { - instruction: RetA{}, - assembler: "ret a", - }, - { - instruction: RetConstant{Val: 42}, - assembler: "ret #42", - }, - // Invalid instruction - { - instruction: InvalidInstruction{}, - assembler: "unknown instruction: bpf.InvalidInstruction{}", - }, - } - - for _, testCase := range testCases { - if input, ok := testCase.instruction.(fmt.Stringer); ok { - got := input.String() - if got != testCase.assembler { - t.Errorf("String did not return expected assembler notation, expected: %s, got: %s", testCase.assembler, got) - } - } else { - t.Errorf("Instruction %#v is not a fmt.Stringer", testCase.instruction) - } - } -} diff --git a/vendor/golang.org/x/net/bpf/vm_bpf_test.go b/vendor/golang.org/x/net/bpf/vm_bpf_test.go index 76dd970..4263623 100644 --- a/vendor/golang.org/x/net/bpf/vm_bpf_test.go +++ b/vendor/golang.org/x/net/bpf/vm_bpf_test.go @@ -33,7 +33,7 @@ func canUseOSVM() bool { } // All BPF tests against both the Go VM and OS VM are assumed to -// be used with a UDP socket. As a result, the entire contents +// be used with a UDP socket. As a result, the entire contents // of a UDP datagram is sent through the BPF program, but only // the body after the UDP header will ever be returned in output. @@ -85,7 +85,7 @@ func (mvm *multiVirtualMachine) Run(in []byte) (int, error) { } // All tests have a UDP header as part of input, because the OS VM - // packets always will. For the Go VM, this output is trimmed before + // packets always will. For the Go VM, this output is trimmed before // being sent back to tests. goOut, goErr := mvm.goVM.Run(in) if goOut >= udpHeaderLen { @@ -149,9 +149,6 @@ func testOSVM(t *testing.T, filter []bpf.Instruction) (virtualMachine, func()) { p := ipv4.NewPacketConn(l) if err = p.SetBPF(prog); err != nil { - if err.Error() == "operation not supported" { // TODO: gross. remove once 19051 fixed. - t.Skip("Skipping until Issue 19051 is fixed.") - } t.Fatalf("failed to attach BPF program to listener: %v", err) } diff --git a/vendor/golang.org/x/net/context/context.go b/vendor/golang.org/x/net/context/context.go index f143ed6..134654c 100644 --- a/vendor/golang.org/x/net/context/context.go +++ b/vendor/golang.org/x/net/context/context.go @@ -7,7 +7,7 @@ // and between processes. // // Incoming requests to a server should create a Context, and outgoing calls to -// servers should accept a Context. The chain of function calls between must +// servers should accept a Context. The chain of function calls between must // propagate the Context, optionally replacing it with a modified copy created // using WithDeadline, WithTimeout, WithCancel, or WithValue. // @@ -16,14 +16,14 @@ // propagation: // // Do not store Contexts inside a struct type; instead, pass a Context -// explicitly to each function that needs it. The Context should be the first +// explicitly to each function that needs it. The Context should be the first // parameter, typically named ctx: // // func DoSomething(ctx context.Context, arg Arg) error { // // ... use ctx ... // } // -// Do not pass a nil Context, even if a function permits it. Pass context.TODO +// Do not pass a nil Context, even if a function permits it. Pass context.TODO // if you are unsure about which Context to use. // // Use context Values only for request-scoped data that transits processes and @@ -44,13 +44,13 @@ import "time" // Context's methods may be called by multiple goroutines simultaneously. type Context interface { // Deadline returns the time when work done on behalf of this context - // should be canceled. Deadline returns ok==false when no deadline is - // set. Successive calls to Deadline return the same results. + // should be canceled. Deadline returns ok==false when no deadline is + // set. Successive calls to Deadline return the same results. Deadline() (deadline time.Time, ok bool) // Done returns a channel that's closed when work done on behalf of this - // context should be canceled. Done may return nil if this context can - // never be canceled. Successive calls to Done return the same value. + // context should be canceled. Done may return nil if this context can + // never be canceled. Successive calls to Done return the same value. // // WithCancel arranges for Done to be closed when cancel is called; // WithDeadline arranges for Done to be closed when the deadline @@ -79,24 +79,24 @@ type Context interface { // a Done channel for cancelation. Done() <-chan struct{} - // Err returns a non-nil error value after Done is closed. Err returns + // Err returns a non-nil error value after Done is closed. Err returns // Canceled if the context was canceled or DeadlineExceeded if the - // context's deadline passed. No other values for Err are defined. + // context's deadline passed. No other values for Err are defined. // After Done is closed, successive calls to Err return the same value. Err() error // Value returns the value associated with this context for key, or nil - // if no value is associated with key. Successive calls to Value with + // if no value is associated with key. Successive calls to Value with // the same key returns the same result. // // Use context values only for request-scoped data that transits // processes and API boundaries, not for passing optional parameters to // functions. // - // A key identifies a specific value in a Context. Functions that wish + // A key identifies a specific value in a Context. Functions that wish // to store values in Context typically allocate a key in a global // variable then use that key as the argument to context.WithValue and - // Context.Value. A key can be any type that supports equality; + // Context.Value. A key can be any type that supports equality; // packages should define keys as an unexported type to avoid // collisions. // @@ -115,7 +115,7 @@ type Context interface { // // This prevents collisions with keys defined in other packages. // type key int // - // // userKey is the key for user.User values in Contexts. It is + // // userKey is the key for user.User values in Contexts. It is // // unexported; clients use user.NewContext and user.FromContext // // instead of using this key directly. // var userKey key = 0 @@ -134,14 +134,14 @@ type Context interface { } // Background returns a non-nil, empty Context. It is never canceled, has no -// values, and has no deadline. It is typically used by the main function, +// values, and has no deadline. It is typically used by the main function, // initialization, and tests, and as the top-level Context for incoming // requests. func Background() Context { return background } -// TODO returns a non-nil, empty Context. Code should use context.TODO when +// TODO returns a non-nil, empty Context. Code should use context.TODO when // it's unclear which Context to use or it is not yet available (because the // surrounding function has not yet been extended to accept a Context // parameter). TODO is recognized by static analysis tools that determine diff --git a/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_17_test.go b/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_17_test.go index 72411b1..9f0f90f 100644 --- a/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_17_test.go +++ b/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_17_test.go @@ -19,7 +19,6 @@ func TestGo17Context(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { io.WriteString(w, "ok") })) - defer ts.Close() ctx := context.Background() resp, err := Get(ctx, http.DefaultClient, ts.URL) if resp == nil || err != nil { diff --git a/vendor/golang.org/x/net/context/go17.go b/vendor/golang.org/x/net/context/go17.go index d20f52b..f8cda19 100644 --- a/vendor/golang.org/x/net/context/go17.go +++ b/vendor/golang.org/x/net/context/go17.go @@ -35,8 +35,8 @@ func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { } // WithDeadline returns a copy of the parent context with the deadline adjusted -// to be no later than d. If the parent's deadline is already earlier than d, -// WithDeadline(parent, d) is semantically equivalent to parent. The returned +// to be no later than d. If the parent's deadline is already earlier than d, +// WithDeadline(parent, d) is semantically equivalent to parent. The returned // context's Done channel is closed when the deadline expires, when the returned // cancel function is called, or when the parent context's Done channel is // closed, whichever happens first. diff --git a/vendor/golang.org/x/net/context/pre_go17.go b/vendor/golang.org/x/net/context/pre_go17.go index 0f35592..5a30aca 100644 --- a/vendor/golang.org/x/net/context/pre_go17.go +++ b/vendor/golang.org/x/net/context/pre_go17.go @@ -13,7 +13,7 @@ import ( "time" ) -// An emptyCtx is never canceled, has no values, and has no deadline. It is not +// An emptyCtx is never canceled, has no values, and has no deadline. It is not // struct{}, since vars of this type must have distinct addresses. type emptyCtx int @@ -104,7 +104,7 @@ func propagateCancel(parent Context, child canceler) { } // parentCancelCtx follows a chain of parent references until it finds a -// *cancelCtx. This function understands how each of the concrete types in this +// *cancelCtx. This function understands how each of the concrete types in this // package represents its parent. func parentCancelCtx(parent Context) (*cancelCtx, bool) { for { @@ -134,14 +134,14 @@ func removeChild(parent Context, child canceler) { p.mu.Unlock() } -// A canceler is a context type that can be canceled directly. The +// A canceler is a context type that can be canceled directly. The // implementations are *cancelCtx and *timerCtx. type canceler interface { cancel(removeFromParent bool, err error) Done() <-chan struct{} } -// A cancelCtx can be canceled. When canceled, it also cancels any children +// A cancelCtx can be canceled. When canceled, it also cancels any children // that implement canceler. type cancelCtx struct { Context @@ -193,8 +193,8 @@ func (c *cancelCtx) cancel(removeFromParent bool, err error) { } // WithDeadline returns a copy of the parent context with the deadline adjusted -// to be no later than d. If the parent's deadline is already earlier than d, -// WithDeadline(parent, d) is semantically equivalent to parent. The returned +// to be no later than d. If the parent's deadline is already earlier than d, +// WithDeadline(parent, d) is semantically equivalent to parent. The returned // context's Done channel is closed when the deadline expires, when the returned // cancel function is called, or when the parent context's Done channel is // closed, whichever happens first. @@ -226,8 +226,8 @@ func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) { return c, func() { c.cancel(true, Canceled) } } -// A timerCtx carries a timer and a deadline. It embeds a cancelCtx to -// implement Done and Err. It implements cancel by stopping its timer then +// A timerCtx carries a timer and a deadline. It embeds a cancelCtx to +// implement Done and Err. It implements cancel by stopping its timer then // delegating to cancelCtx.cancel. type timerCtx struct { *cancelCtx @@ -281,7 +281,7 @@ func WithValue(parent Context, key interface{}, val interface{}) Context { return &valueCtx{parent, key, val} } -// A valueCtx carries a key-value pair. It implements Value for that key and +// A valueCtx carries a key-value pair. It implements Value for that key and // delegates all other calls to the embedded Context. type valueCtx struct { Context diff --git a/vendor/golang.org/x/net/dns/dnsmessage/message.go b/vendor/golang.org/x/net/dns/dnsmessage/message.go deleted file mode 100644 index da43b0b..0000000 --- a/vendor/golang.org/x/net/dns/dnsmessage/message.go +++ /dev/null @@ -1,1418 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package dnsmessage provides a mostly RFC 1035 compliant implementation of -// DNS message packing and unpacking. -// -// This implementation is designed to minimize heap allocations and avoid -// unnecessary packing and unpacking as much as possible. -package dnsmessage - -import ( - "errors" -) - -// Packet formats - -// A Type is a type of DNS request and response. -type Type uint16 - -// A Class is a type of network. -type Class uint16 - -// An OpCode is a DNS operation code. -type OpCode uint16 - -// An RCode is a DNS response status code. -type RCode uint16 - -// Wire constants. -const ( - // ResourceHeader.Type and Question.Type - TypeA Type = 1 - TypeNS Type = 2 - TypeCNAME Type = 5 - TypeSOA Type = 6 - TypePTR Type = 12 - TypeMX Type = 15 - TypeTXT Type = 16 - TypeAAAA Type = 28 - TypeSRV Type = 33 - - // Question.Type - TypeWKS Type = 11 - TypeHINFO Type = 13 - TypeMINFO Type = 14 - TypeAXFR Type = 252 - TypeALL Type = 255 - - // ResourceHeader.Class and Question.Class - ClassINET Class = 1 - ClassCSNET Class = 2 - ClassCHAOS Class = 3 - ClassHESIOD Class = 4 - - // Question.Class - ClassANY Class = 255 - - // Message.Rcode - RCodeSuccess RCode = 0 - RCodeFormatError RCode = 1 - RCodeServerFailure RCode = 2 - RCodeNameError RCode = 3 - RCodeNotImplemented RCode = 4 - RCodeRefused RCode = 5 -) - -var ( - // ErrNotStarted indicates that the prerequisite information isn't - // available yet because the previous records haven't been appropriately - // parsed or skipped. - ErrNotStarted = errors.New("parsing of this type isn't available yet") - - // ErrSectionDone indicated that all records in the section have been - // parsed. - ErrSectionDone = errors.New("parsing of this section has completed") - - errBaseLen = errors.New("insufficient data for base length type") - errCalcLen = errors.New("insufficient data for calculated length type") - errReserved = errors.New("segment prefix is reserved") - errTooManyPtr = errors.New("too many pointers (>10)") - errInvalidPtr = errors.New("invalid pointer") - errResourceLen = errors.New("insufficient data for resource body length") - errSegTooLong = errors.New("segment length too long") - errZeroSegLen = errors.New("zero length segment") - errResTooLong = errors.New("resource length too long") - errTooManyQuestions = errors.New("too many Questions to pack (>65535)") - errTooManyAnswers = errors.New("too many Answers to pack (>65535)") - errTooManyAuthorities = errors.New("too many Authorities to pack (>65535)") - errTooManyAdditionals = errors.New("too many Additionals to pack (>65535)") -) - -type nestedError struct { - // s is the current level's error message. - s string - - // err is the nested error. - err error -} - -// nestedError implements error.Error. -func (e *nestedError) Error() string { - return e.s + ": " + e.err.Error() -} - -// Header is a representation of a DNS message header. -type Header struct { - ID uint16 - Response bool - OpCode OpCode - Authoritative bool - Truncated bool - RecursionDesired bool - RecursionAvailable bool - RCode RCode -} - -func (m *Header) pack() (id uint16, bits uint16) { - id = m.ID - bits = uint16(m.OpCode)<<11 | uint16(m.RCode) - if m.RecursionAvailable { - bits |= headerBitRA - } - if m.RecursionDesired { - bits |= headerBitRD - } - if m.Truncated { - bits |= headerBitTC - } - if m.Authoritative { - bits |= headerBitAA - } - if m.Response { - bits |= headerBitQR - } - return -} - -// Message is a representation of a DNS message. -type Message struct { - Header - Questions []Question - Answers []Resource - Authorities []Resource - Additionals []Resource -} - -type section uint8 - -const ( - sectionHeader section = iota - sectionQuestions - sectionAnswers - sectionAuthorities - sectionAdditionals - sectionDone - - headerBitQR = 1 << 15 // query/response (response=1) - headerBitAA = 1 << 10 // authoritative - headerBitTC = 1 << 9 // truncated - headerBitRD = 1 << 8 // recursion desired - headerBitRA = 1 << 7 // recursion available -) - -var sectionNames = map[section]string{ - sectionHeader: "header", - sectionQuestions: "Question", - sectionAnswers: "Answer", - sectionAuthorities: "Authority", - sectionAdditionals: "Additional", -} - -// header is the wire format for a DNS message header. -type header struct { - id uint16 - bits uint16 - questions uint16 - answers uint16 - authorities uint16 - additionals uint16 -} - -func (h *header) count(sec section) uint16 { - switch sec { - case sectionQuestions: - return h.questions - case sectionAnswers: - return h.answers - case sectionAuthorities: - return h.authorities - case sectionAdditionals: - return h.additionals - } - return 0 -} - -func (h *header) pack(msg []byte) []byte { - msg = packUint16(msg, h.id) - msg = packUint16(msg, h.bits) - msg = packUint16(msg, h.questions) - msg = packUint16(msg, h.answers) - msg = packUint16(msg, h.authorities) - return packUint16(msg, h.additionals) -} - -func (h *header) unpack(msg []byte, off int) (int, error) { - newOff := off - var err error - if h.id, newOff, err = unpackUint16(msg, newOff); err != nil { - return off, &nestedError{"id", err} - } - if h.bits, newOff, err = unpackUint16(msg, newOff); err != nil { - return off, &nestedError{"bits", err} - } - if h.questions, newOff, err = unpackUint16(msg, newOff); err != nil { - return off, &nestedError{"questions", err} - } - if h.answers, newOff, err = unpackUint16(msg, newOff); err != nil { - return off, &nestedError{"answers", err} - } - if h.authorities, newOff, err = unpackUint16(msg, newOff); err != nil { - return off, &nestedError{"authorities", err} - } - if h.additionals, newOff, err = unpackUint16(msg, newOff); err != nil { - return off, &nestedError{"additionals", err} - } - return newOff, nil -} - -func (h *header) header() Header { - return Header{ - ID: h.id, - Response: (h.bits & headerBitQR) != 0, - OpCode: OpCode(h.bits>>11) & 0xF, - Authoritative: (h.bits & headerBitAA) != 0, - Truncated: (h.bits & headerBitTC) != 0, - RecursionDesired: (h.bits & headerBitRD) != 0, - RecursionAvailable: (h.bits & headerBitRA) != 0, - RCode: RCode(h.bits & 0xF), - } -} - -// A Resource is a DNS resource record. -type Resource interface { - // Header return's the Resource's ResourceHeader. - Header() *ResourceHeader - - // pack packs a Resource except for its header. - pack(msg []byte, compression map[string]int) ([]byte, error) - - // realType returns the actual type of the Resource. This is used to - // fill in the header Type field. - realType() Type -} - -func packResource(msg []byte, resource Resource, compression map[string]int) ([]byte, error) { - oldMsg := msg - resource.Header().Type = resource.realType() - msg, length, err := resource.Header().pack(msg, compression) - if err != nil { - return msg, &nestedError{"ResourceHeader", err} - } - preLen := len(msg) - msg, err = resource.pack(msg, compression) - if err != nil { - return msg, &nestedError{"content", err} - } - conLen := len(msg) - preLen - if conLen > int(^uint16(0)) { - return oldMsg, errResTooLong - } - // Fill in the length now that we know how long the content is. - packUint16(length[:0], uint16(conLen)) - resource.Header().Length = uint16(conLen) - return msg, nil -} - -// A Parser allows incrementally parsing a DNS message. -// -// When parsing is started, the Header is parsed. Next, each Question can be -// either parsed or skipped. Alternatively, all Questions can be skipped at -// once. When all Questions have been parsed, attempting to parse Questions -// will return (nil, nil) and attempting to skip Questions will return -// (true, nil). After all Questions have been either parsed or skipped, all -// Answers, Authorities and Additionals can be either parsed or skipped in the -// same way, and each type of Resource must be fully parsed or skipped before -// proceeding to the next type of Resource. -// -// Note that there is no requirement to fully skip or parse the message. -type Parser struct { - msg []byte - header header - - section section - off int - index int - resHeaderValid bool - resHeader ResourceHeader -} - -// Start parses the header and enables the parsing of Questions. -func (p *Parser) Start(msg []byte) (Header, error) { - if p.msg != nil { - *p = Parser{} - } - p.msg = msg - var err error - if p.off, err = p.header.unpack(msg, 0); err != nil { - return Header{}, &nestedError{"unpacking header", err} - } - p.section = sectionQuestions - return p.header.header(), nil -} - -func (p *Parser) checkAdvance(sec section) error { - if p.section < sec { - return ErrNotStarted - } - if p.section > sec { - return ErrSectionDone - } - p.resHeaderValid = false - if p.index == int(p.header.count(sec)) { - p.index = 0 - p.section++ - return ErrSectionDone - } - return nil -} - -func (p *Parser) resource(sec section) (Resource, error) { - var r Resource - hdr, err := p.resourceHeader(sec) - if err != nil { - return r, err - } - p.resHeaderValid = false - r, p.off, err = unpackResource(p.msg, p.off, hdr) - if err != nil { - return nil, &nestedError{"unpacking " + sectionNames[sec], err} - } - p.index++ - return r, nil -} - -func (p *Parser) resourceHeader(sec section) (ResourceHeader, error) { - if p.resHeaderValid { - return p.resHeader, nil - } - if err := p.checkAdvance(sec); err != nil { - return ResourceHeader{}, err - } - var hdr ResourceHeader - off, err := hdr.unpack(p.msg, p.off) - if err != nil { - return ResourceHeader{}, err - } - p.resHeaderValid = true - p.resHeader = hdr - p.off = off - return hdr, nil -} - -func (p *Parser) skipResource(sec section) error { - if p.resHeaderValid { - newOff := p.off + int(p.resHeader.Length) - if newOff > len(p.msg) { - return errResourceLen - } - p.off = newOff - p.resHeaderValid = false - p.index++ - return nil - } - if err := p.checkAdvance(sec); err != nil { - return err - } - var err error - p.off, err = skipResource(p.msg, p.off) - if err != nil { - return &nestedError{"skipping: " + sectionNames[sec], err} - } - p.index++ - return nil -} - -// Question parses a single Question. -func (p *Parser) Question() (Question, error) { - if err := p.checkAdvance(sectionQuestions); err != nil { - return Question{}, err - } - name, off, err := unpackName(p.msg, p.off) - if err != nil { - return Question{}, &nestedError{"unpacking Question.Name", err} - } - typ, off, err := unpackType(p.msg, off) - if err != nil { - return Question{}, &nestedError{"unpacking Question.Type", err} - } - class, off, err := unpackClass(p.msg, off) - if err != nil { - return Question{}, &nestedError{"unpacking Question.Class", err} - } - p.off = off - p.index++ - return Question{name, typ, class}, nil -} - -// AllQuestions parses all Questions. -func (p *Parser) AllQuestions() ([]Question, error) { - qs := make([]Question, 0, p.header.questions) - for { - q, err := p.Question() - if err == ErrSectionDone { - return qs, nil - } - if err != nil { - return nil, err - } - qs = append(qs, q) - } -} - -// SkipQuestion skips a single Question. -func (p *Parser) SkipQuestion() error { - if err := p.checkAdvance(sectionQuestions); err != nil { - return err - } - off, err := skipName(p.msg, p.off) - if err != nil { - return &nestedError{"skipping Question Name", err} - } - if off, err = skipType(p.msg, off); err != nil { - return &nestedError{"skipping Question Type", err} - } - if off, err = skipClass(p.msg, off); err != nil { - return &nestedError{"skipping Question Class", err} - } - p.off = off - p.index++ - return nil -} - -// SkipAllQuestions skips all Questions. -func (p *Parser) SkipAllQuestions() error { - for { - if err := p.SkipQuestion(); err == ErrSectionDone { - return nil - } else if err != nil { - return err - } - } -} - -// AnswerHeader parses a single Answer ResourceHeader. -func (p *Parser) AnswerHeader() (ResourceHeader, error) { - return p.resourceHeader(sectionAnswers) -} - -// Answer parses a single Answer Resource. -func (p *Parser) Answer() (Resource, error) { - return p.resource(sectionAnswers) -} - -// AllAnswers parses all Answer Resources. -func (p *Parser) AllAnswers() ([]Resource, error) { - as := make([]Resource, 0, p.header.answers) - for { - a, err := p.Answer() - if err == ErrSectionDone { - return as, nil - } - if err != nil { - return nil, err - } - as = append(as, a) - } -} - -// SkipAnswer skips a single Answer Resource. -func (p *Parser) SkipAnswer() error { - return p.skipResource(sectionAnswers) -} - -// SkipAllAnswers skips all Answer Resources. -func (p *Parser) SkipAllAnswers() error { - for { - if err := p.SkipAnswer(); err == ErrSectionDone { - return nil - } else if err != nil { - return err - } - } -} - -// AuthorityHeader parses a single Authority ResourceHeader. -func (p *Parser) AuthorityHeader() (ResourceHeader, error) { - return p.resourceHeader(sectionAuthorities) -} - -// Authority parses a single Authority Resource. -func (p *Parser) Authority() (Resource, error) { - return p.resource(sectionAuthorities) -} - -// AllAuthorities parses all Authority Resources. -func (p *Parser) AllAuthorities() ([]Resource, error) { - as := make([]Resource, 0, p.header.authorities) - for { - a, err := p.Authority() - if err == ErrSectionDone { - return as, nil - } - if err != nil { - return nil, err - } - as = append(as, a) - } -} - -// SkipAuthority skips a single Authority Resource. -func (p *Parser) SkipAuthority() error { - return p.skipResource(sectionAuthorities) -} - -// SkipAllAuthorities skips all Authority Resources. -func (p *Parser) SkipAllAuthorities() error { - for { - if err := p.SkipAuthority(); err == ErrSectionDone { - return nil - } else if err != nil { - return err - } - } -} - -// AdditionalHeader parses a single Additional ResourceHeader. -func (p *Parser) AdditionalHeader() (ResourceHeader, error) { - return p.resourceHeader(sectionAdditionals) -} - -// Additional parses a single Additional Resource. -func (p *Parser) Additional() (Resource, error) { - return p.resource(sectionAdditionals) -} - -// AllAdditionals parses all Additional Resources. -func (p *Parser) AllAdditionals() ([]Resource, error) { - as := make([]Resource, 0, p.header.additionals) - for { - a, err := p.Additional() - if err == ErrSectionDone { - return as, nil - } - if err != nil { - return nil, err - } - as = append(as, a) - } -} - -// SkipAdditional skips a single Additional Resource. -func (p *Parser) SkipAdditional() error { - return p.skipResource(sectionAdditionals) -} - -// SkipAllAdditionals skips all Additional Resources. -func (p *Parser) SkipAllAdditionals() error { - for { - if err := p.SkipAdditional(); err == ErrSectionDone { - return nil - } else if err != nil { - return err - } - } -} - -// Unpack parses a full Message. -func (m *Message) Unpack(msg []byte) error { - var p Parser - var err error - if m.Header, err = p.Start(msg); err != nil { - return err - } - if m.Questions, err = p.AllQuestions(); err != nil { - return err - } - if m.Answers, err = p.AllAnswers(); err != nil { - return err - } - if m.Authorities, err = p.AllAuthorities(); err != nil { - return err - } - if m.Additionals, err = p.AllAdditionals(); err != nil { - return err - } - return nil -} - -// Pack packs a full Message. -func (m *Message) Pack() ([]byte, error) { - // Validate the lengths. It is very unlikely that anyone will try to - // pack more than 65535 of any particular type, but it is possible and - // we should fail gracefully. - if len(m.Questions) > int(^uint16(0)) { - return nil, errTooManyQuestions - } - if len(m.Answers) > int(^uint16(0)) { - return nil, errTooManyAnswers - } - if len(m.Authorities) > int(^uint16(0)) { - return nil, errTooManyAuthorities - } - if len(m.Additionals) > int(^uint16(0)) { - return nil, errTooManyAdditionals - } - - var h header - h.id, h.bits = m.Header.pack() - - h.questions = uint16(len(m.Questions)) - h.answers = uint16(len(m.Answers)) - h.authorities = uint16(len(m.Authorities)) - h.additionals = uint16(len(m.Additionals)) - - // The starting capacity doesn't matter too much, but most DNS responses - // Will be <= 512 bytes as it is the limit for DNS over UDP. - msg := make([]byte, 0, 512) - - msg = h.pack(msg) - - // RFC 1035 allows (but does not require) compression for packing. RFC - // 1035 requires unpacking implementations to support compression, so - // unconditionally enabling it is fine. - // - // DNS lookups are typically done over UDP, and RFC 1035 states that UDP - // DNS packets can be a maximum of 512 bytes long. Without compression, - // many DNS response packets are over this limit, so enabling - // compression will help ensure compliance. - compression := map[string]int{} - - for _, q := range m.Questions { - var err error - msg, err = q.pack(msg, compression) - if err != nil { - return nil, &nestedError{"packing Question", err} - } - } - for _, a := range m.Answers { - var err error - msg, err = packResource(msg, a, compression) - if err != nil { - return nil, &nestedError{"packing Answer", err} - } - } - for _, a := range m.Authorities { - var err error - msg, err = packResource(msg, a, compression) - if err != nil { - return nil, &nestedError{"packing Authority", err} - } - } - for _, a := range m.Additionals { - var err error - msg, err = packResource(msg, a, compression) - if err != nil { - return nil, &nestedError{"packing Additional", err} - } - } - - return msg, nil -} - -// An ResourceHeader is the header of a DNS resource record. There are -// many types of DNS resource records, but they all share the same header. -type ResourceHeader struct { - // Name is the domain name for which this resource record pertains. - Name string - - // Type is the type of DNS resource record. - // - // This field will be set automatically during packing. - Type Type - - // Class is the class of network to which this DNS resource record - // pertains. - Class Class - - // TTL is the length of time (measured in seconds) which this resource - // record is valid for (time to live). All Resources in a set should - // have the same TTL (RFC 2181 Section 5.2). - TTL uint32 - - // Length is the length of data in the resource record after the header. - // - // This field will be set automatically during packing. - Length uint16 -} - -// Header implements Resource.Header. -func (h *ResourceHeader) Header() *ResourceHeader { - return h -} - -// pack packs all of the fields in a ResourceHeader except for the length. The -// length bytes are returned as a slice so they can be filled in after the rest -// of the Resource has been packed. -func (h *ResourceHeader) pack(oldMsg []byte, compression map[string]int) (msg []byte, length []byte, err error) { - msg = oldMsg - if msg, err = packName(msg, h.Name, compression); err != nil { - return oldMsg, nil, &nestedError{"Name", err} - } - msg = packType(msg, h.Type) - msg = packClass(msg, h.Class) - msg = packUint32(msg, h.TTL) - lenBegin := len(msg) - msg = packUint16(msg, h.Length) - return msg, msg[lenBegin:], nil -} - -func (h *ResourceHeader) unpack(msg []byte, off int) (int, error) { - newOff := off - var err error - if h.Name, newOff, err = unpackName(msg, newOff); err != nil { - return off, &nestedError{"Name", err} - } - if h.Type, newOff, err = unpackType(msg, newOff); err != nil { - return off, &nestedError{"Type", err} - } - if h.Class, newOff, err = unpackClass(msg, newOff); err != nil { - return off, &nestedError{"Class", err} - } - if h.TTL, newOff, err = unpackUint32(msg, newOff); err != nil { - return off, &nestedError{"TTL", err} - } - if h.Length, newOff, err = unpackUint16(msg, newOff); err != nil { - return off, &nestedError{"Length", err} - } - return newOff, nil -} - -func skipResource(msg []byte, off int) (int, error) { - newOff, err := skipName(msg, off) - if err != nil { - return off, &nestedError{"Name", err} - } - if newOff, err = skipType(msg, newOff); err != nil { - return off, &nestedError{"Type", err} - } - if newOff, err = skipClass(msg, newOff); err != nil { - return off, &nestedError{"Class", err} - } - if newOff, err = skipUint32(msg, newOff); err != nil { - return off, &nestedError{"TTL", err} - } - length, newOff, err := unpackUint16(msg, newOff) - if err != nil { - return off, &nestedError{"Length", err} - } - if newOff += int(length); newOff > len(msg) { - return off, errResourceLen - } - return newOff, nil -} - -func packUint16(msg []byte, field uint16) []byte { - return append(msg, byte(field>>8), byte(field)) -} - -func unpackUint16(msg []byte, off int) (uint16, int, error) { - if off+2 > len(msg) { - return 0, off, errBaseLen - } - return uint16(msg[off])<<8 | uint16(msg[off+1]), off + 2, nil -} - -func skipUint16(msg []byte, off int) (int, error) { - if off+2 > len(msg) { - return off, errBaseLen - } - return off + 2, nil -} - -func packType(msg []byte, field Type) []byte { - return packUint16(msg, uint16(field)) -} - -func unpackType(msg []byte, off int) (Type, int, error) { - t, o, err := unpackUint16(msg, off) - return Type(t), o, err -} - -func skipType(msg []byte, off int) (int, error) { - return skipUint16(msg, off) -} - -func packClass(msg []byte, field Class) []byte { - return packUint16(msg, uint16(field)) -} - -func unpackClass(msg []byte, off int) (Class, int, error) { - c, o, err := unpackUint16(msg, off) - return Class(c), o, err -} - -func skipClass(msg []byte, off int) (int, error) { - return skipUint16(msg, off) -} - -func packUint32(msg []byte, field uint32) []byte { - return append( - msg, - byte(field>>24), - byte(field>>16), - byte(field>>8), - byte(field), - ) -} - -func unpackUint32(msg []byte, off int) (uint32, int, error) { - if off+4 > len(msg) { - return 0, off, errBaseLen - } - v := uint32(msg[off])<<24 | uint32(msg[off+1])<<16 | uint32(msg[off+2])<<8 | uint32(msg[off+3]) - return v, off + 4, nil -} - -func skipUint32(msg []byte, off int) (int, error) { - if off+4 > len(msg) { - return off, errBaseLen - } - return off + 4, nil -} - -func packText(msg []byte, field string) []byte { - for len(field) > 0 { - l := len(field) - if l > 255 { - l = 255 - } - msg = append(msg, byte(l)) - msg = append(msg, field[:l]...) - field = field[l:] - } - return msg -} - -func unpackText(msg []byte, off int) (string, int, error) { - if off >= len(msg) { - return "", off, errBaseLen - } - beginOff := off + 1 - endOff := beginOff + int(msg[off]) - if endOff > len(msg) { - return "", off, errCalcLen - } - return string(msg[beginOff:endOff]), endOff, nil -} - -func skipText(msg []byte, off int) (int, error) { - if off >= len(msg) { - return off, errBaseLen - } - endOff := off + 1 + int(msg[off]) - if endOff > len(msg) { - return off, errCalcLen - } - return endOff, nil -} - -func packBytes(msg []byte, field []byte) []byte { - return append(msg, field...) -} - -func unpackBytes(msg []byte, off int, field []byte) (int, error) { - newOff := off + len(field) - if newOff > len(msg) { - return off, errBaseLen - } - copy(field, msg[off:newOff]) - return newOff, nil -} - -func skipBytes(msg []byte, off int, field []byte) (int, error) { - newOff := off + len(field) - if newOff > len(msg) { - return off, errBaseLen - } - return newOff, nil -} - -// packName packs a domain name. -// -// Domain names are a sequence of counted strings split at the dots. They end -// with a zero-length string. Compression can be used to reuse domain suffixes. -// -// The compression map will be updated with new domain suffixes. If compression -// is nil, compression will not be used. -func packName(msg []byte, name string, compression map[string]int) ([]byte, error) { - oldMsg := msg - - // Add a trailing dot to canonicalize name. - if n := len(name); n == 0 || name[n-1] != '.' { - name += "." - } - - // Allow root domain. - if name == "." { - return append(msg, 0), nil - } - - // Emit sequence of counted strings, chopping at dots. - for i, begin := 0, 0; i < len(name); i++ { - // Check for the end of the segment. - if name[i] == '.' { - // The two most significant bits have special meaning. - // It isn't allowed for segments to be long enough to - // need them. - if i-begin >= 1<<6 { - return oldMsg, errSegTooLong - } - - // Segments must have a non-zero length. - if i-begin == 0 { - return oldMsg, errZeroSegLen - } - - msg = append(msg, byte(i-begin)) - - for j := begin; j < i; j++ { - msg = append(msg, name[j]) - } - - begin = i + 1 - continue - } - - // We can only compress domain suffixes starting with a new - // segment. A pointer is two bytes with the two most significant - // bits set to 1 to indicate that it is a pointer. - if (i == 0 || name[i-1] == '.') && compression != nil { - if ptr, ok := compression[name[i:]]; ok { - // Hit. Emit a pointer instead of the rest of - // the domain. - return append(msg, byte(ptr>>8|0xC0), byte(ptr)), nil - } - - // Miss. Add the suffix to the compression table if the - // offset can be stored in the available 14 bytes. - if len(msg) <= int(^uint16(0)>>2) { - compression[name[i:]] = len(msg) - } - } - } - return append(msg, 0), nil -} - -// unpackName unpacks a domain name. -func unpackName(msg []byte, off int) (string, int, error) { - // currOff is the current working offset. - currOff := off - - // newOff is the offset where the next record will start. Pointers lead - // to data that belongs to other names and thus doesn't count towards to - // the usage of this name. - newOff := off - - // name is the domain name being unpacked. - name := make([]byte, 0, 255) - - // ptr is the number of pointers followed. - var ptr int -Loop: - for { - if currOff >= len(msg) { - return "", off, errBaseLen - } - c := int(msg[currOff]) - currOff++ - switch c & 0xC0 { - case 0x00: // String segment - if c == 0x00 { - // A zero length signals the end of the name. - break Loop - } - endOff := currOff + c - if endOff > len(msg) { - return "", off, errCalcLen - } - name = append(name, msg[currOff:endOff]...) - name = append(name, '.') - currOff = endOff - case 0xC0: // Pointer - if currOff >= len(msg) { - return "", off, errInvalidPtr - } - c1 := msg[currOff] - currOff++ - if ptr == 0 { - newOff = currOff - } - // Don't follow too many pointers, maybe there's a loop. - if ptr++; ptr > 10 { - return "", off, errTooManyPtr - } - currOff = (c^0xC0)<<8 | int(c1) - default: - // Prefixes 0x80 and 0x40 are reserved. - return "", off, errReserved - } - } - if len(name) == 0 { - name = append(name, '.') - } - if ptr == 0 { - newOff = currOff - } - return string(name), newOff, nil -} - -func skipName(msg []byte, off int) (int, error) { - // newOff is the offset where the next record will start. Pointers lead - // to data that belongs to other names and thus doesn't count towards to - // the usage of this name. - newOff := off - -Loop: - for { - if newOff >= len(msg) { - return off, errBaseLen - } - c := int(msg[newOff]) - newOff++ - switch c & 0xC0 { - case 0x00: - if c == 0x00 { - // A zero length signals the end of the name. - break Loop - } - // literal string - newOff += c - if newOff > len(msg) { - return off, errCalcLen - } - case 0xC0: - // Pointer to somewhere else in msg. - - // Pointers are two bytes. - newOff++ - - // Don't follow the pointer as the data here has ended. - break Loop - default: - // Prefixes 0x80 and 0x40 are reserved. - return off, errReserved - } - } - - return newOff, nil -} - -// A Question is a DNS query. -type Question struct { - Name string - Type Type - Class Class -} - -func (q *Question) pack(msg []byte, compression map[string]int) ([]byte, error) { - msg, err := packName(msg, q.Name, compression) - if err != nil { - return msg, &nestedError{"Name", err} - } - msg = packType(msg, q.Type) - return packClass(msg, q.Class), nil -} - -func unpackResource(msg []byte, off int, hdr ResourceHeader) (Resource, int, error) { - var ( - r Resource - err error - name string - ) - switch hdr.Type { - case TypeA: - r, err = unpackAResource(hdr, msg, off) - name = "A" - case TypeNS: - r, err = unpackNSResource(hdr, msg, off) - name = "NS" - case TypeCNAME: - r, err = unpackCNAMEResource(hdr, msg, off) - name = "CNAME" - case TypeSOA: - r, err = unpackSOAResource(hdr, msg, off) - name = "SOA" - case TypePTR: - r, err = unpackPTRResource(hdr, msg, off) - name = "PTR" - case TypeMX: - r, err = unpackMXResource(hdr, msg, off) - name = "MX" - case TypeTXT: - r, err = unpackTXTResource(hdr, msg, off) - name = "TXT" - case TypeAAAA: - r, err = unpackAAAAResource(hdr, msg, off) - name = "AAAA" - case TypeSRV: - r, err = unpackSRVResource(hdr, msg, off) - name = "SRV" - } - if err != nil { - return nil, off, &nestedError{name + " record", err} - } - if r != nil { - return r, off + int(hdr.Length), nil - } - return nil, off, errors.New("invalid resource type: " + string(hdr.Type+'0')) -} - -// A CNAMEResource is a CNAME Resource record. -type CNAMEResource struct { - ResourceHeader - - CNAME string -} - -func (r *CNAMEResource) realType() Type { - return TypeCNAME -} - -func (r *CNAMEResource) pack(msg []byte, compression map[string]int) ([]byte, error) { - return packName(msg, r.CNAME, compression) -} - -func unpackCNAMEResource(hdr ResourceHeader, msg []byte, off int) (*CNAMEResource, error) { - cname, _, err := unpackName(msg, off) - if err != nil { - return nil, err - } - return &CNAMEResource{hdr, cname}, nil -} - -// An MXResource is an MX Resource record. -type MXResource struct { - ResourceHeader - - Pref uint16 - MX string -} - -func (r *MXResource) realType() Type { - return TypeMX -} - -func (r *MXResource) pack(msg []byte, compression map[string]int) ([]byte, error) { - oldMsg := msg - msg = packUint16(msg, r.Pref) - msg, err := packName(msg, r.MX, compression) - if err != nil { - return oldMsg, &nestedError{"MXResource.MX", err} - } - return msg, nil -} - -func unpackMXResource(hdr ResourceHeader, msg []byte, off int) (*MXResource, error) { - pref, off, err := unpackUint16(msg, off) - if err != nil { - return nil, &nestedError{"Pref", err} - } - mx, _, err := unpackName(msg, off) - if err != nil { - return nil, &nestedError{"MX", err} - } - return &MXResource{hdr, pref, mx}, nil -} - -// An NSResource is an NS Resource record. -type NSResource struct { - ResourceHeader - - NS string -} - -func (r *NSResource) realType() Type { - return TypeNS -} - -func (r *NSResource) pack(msg []byte, compression map[string]int) ([]byte, error) { - return packName(msg, r.NS, compression) -} - -func unpackNSResource(hdr ResourceHeader, msg []byte, off int) (*NSResource, error) { - ns, _, err := unpackName(msg, off) - if err != nil { - return nil, err - } - return &NSResource{hdr, ns}, nil -} - -// A PTRResource is a PTR Resource record. -type PTRResource struct { - ResourceHeader - - PTR string -} - -func (r *PTRResource) realType() Type { - return TypePTR -} - -func (r *PTRResource) pack(msg []byte, compression map[string]int) ([]byte, error) { - return packName(msg, r.PTR, compression) -} - -func unpackPTRResource(hdr ResourceHeader, msg []byte, off int) (*PTRResource, error) { - ptr, _, err := unpackName(msg, off) - if err != nil { - return nil, err - } - return &PTRResource{hdr, ptr}, nil -} - -// An SOAResource is an SOA Resource record. -type SOAResource struct { - ResourceHeader - - NS string - MBox string - Serial uint32 - Refresh uint32 - Retry uint32 - Expire uint32 - - // MinTTL the is the default TTL of Resources records which did not - // contain a TTL value and the TTL of negative responses. (RFC 2308 - // Section 4) - MinTTL uint32 -} - -func (r *SOAResource) realType() Type { - return TypeSOA -} - -func (r *SOAResource) pack(msg []byte, compression map[string]int) ([]byte, error) { - oldMsg := msg - msg, err := packName(msg, r.NS, compression) - if err != nil { - return oldMsg, &nestedError{"SOAResource.NS", err} - } - msg, err = packName(msg, r.MBox, compression) - if err != nil { - return oldMsg, &nestedError{"SOAResource.MBox", err} - } - msg = packUint32(msg, r.Serial) - msg = packUint32(msg, r.Refresh) - msg = packUint32(msg, r.Retry) - msg = packUint32(msg, r.Expire) - return packUint32(msg, r.MinTTL), nil -} - -func unpackSOAResource(hdr ResourceHeader, msg []byte, off int) (*SOAResource, error) { - ns, off, err := unpackName(msg, off) - if err != nil { - return nil, &nestedError{"NS", err} - } - mbox, off, err := unpackName(msg, off) - if err != nil { - return nil, &nestedError{"MBox", err} - } - serial, off, err := unpackUint32(msg, off) - if err != nil { - return nil, &nestedError{"Serial", err} - } - refresh, off, err := unpackUint32(msg, off) - if err != nil { - return nil, &nestedError{"Refresh", err} - } - retry, off, err := unpackUint32(msg, off) - if err != nil { - return nil, &nestedError{"Retry", err} - } - expire, off, err := unpackUint32(msg, off) - if err != nil { - return nil, &nestedError{"Expire", err} - } - minTTL, _, err := unpackUint32(msg, off) - if err != nil { - return nil, &nestedError{"MinTTL", err} - } - return &SOAResource{hdr, ns, mbox, serial, refresh, retry, expire, minTTL}, nil -} - -// A TXTResource is a TXT Resource record. -type TXTResource struct { - ResourceHeader - - Txt string // Not a domain name. -} - -func (r *TXTResource) realType() Type { - return TypeTXT -} - -func (r *TXTResource) pack(msg []byte, compression map[string]int) ([]byte, error) { - return packText(msg, r.Txt), nil -} - -func unpackTXTResource(hdr ResourceHeader, msg []byte, off int) (*TXTResource, error) { - var txt string - for n := uint16(0); n < hdr.Length; { - var t string - var err error - if t, off, err = unpackText(msg, off); err != nil { - return nil, &nestedError{"text", err} - } - // Check if we got too many bytes. - if hdr.Length-n < uint16(len(t))+1 { - return nil, errCalcLen - } - n += uint16(len(t)) + 1 - txt += t - } - return &TXTResource{hdr, txt}, nil -} - -// An SRVResource is an SRV Resource record. -type SRVResource struct { - ResourceHeader - - Priority uint16 - Weight uint16 - Port uint16 - Target string // Not compressed as per RFC 2782. -} - -func (r *SRVResource) realType() Type { - return TypeSRV -} - -func (r *SRVResource) pack(msg []byte, compression map[string]int) ([]byte, error) { - oldMsg := msg - msg = packUint16(msg, r.Priority) - msg = packUint16(msg, r.Weight) - msg = packUint16(msg, r.Port) - msg, err := packName(msg, r.Target, nil) - if err != nil { - return oldMsg, &nestedError{"SRVResource.Target", err} - } - return msg, nil -} - -func unpackSRVResource(hdr ResourceHeader, msg []byte, off int) (*SRVResource, error) { - priority, off, err := unpackUint16(msg, off) - if err != nil { - return nil, &nestedError{"Priority", err} - } - weight, off, err := unpackUint16(msg, off) - if err != nil { - return nil, &nestedError{"Weight", err} - } - port, off, err := unpackUint16(msg, off) - if err != nil { - return nil, &nestedError{"Port", err} - } - target, _, err := unpackName(msg, off) - if err != nil { - return nil, &nestedError{"Target", err} - } - return &SRVResource{hdr, priority, weight, port, target}, nil -} - -// An AResource is an A Resource record. -type AResource struct { - ResourceHeader - - A [4]byte -} - -func (r *AResource) realType() Type { - return TypeA -} - -func (r *AResource) pack(msg []byte, compression map[string]int) ([]byte, error) { - return packBytes(msg, r.A[:]), nil -} - -func unpackAResource(hdr ResourceHeader, msg []byte, off int) (*AResource, error) { - var a [4]byte - if _, err := unpackBytes(msg, off, a[:]); err != nil { - return nil, err - } - return &AResource{hdr, a}, nil -} - -// An AAAAResource is an AAAA Resource record. -type AAAAResource struct { - ResourceHeader - - AAAA [16]byte -} - -func (r *AAAAResource) realType() Type { - return TypeAAAA -} - -func (r *AAAAResource) pack(msg []byte, compression map[string]int) ([]byte, error) { - return packBytes(msg, r.AAAA[:]), nil -} - -func unpackAAAAResource(hdr ResourceHeader, msg []byte, off int) (*AAAAResource, error) { - var aaaa [16]byte - if _, err := unpackBytes(msg, off, aaaa[:]); err != nil { - return nil, err - } - return &AAAAResource{hdr, aaaa}, nil -} diff --git a/vendor/golang.org/x/net/dns/dnsmessage/message_test.go b/vendor/golang.org/x/net/dns/dnsmessage/message_test.go deleted file mode 100644 index 46edd72..0000000 --- a/vendor/golang.org/x/net/dns/dnsmessage/message_test.go +++ /dev/null @@ -1,575 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package dnsmessage - -import ( - "fmt" - "net" - "reflect" - "strings" - "testing" -) - -func (m *Message) String() string { - s := fmt.Sprintf("Message: %#v\n", &m.Header) - if len(m.Questions) > 0 { - s += "-- Questions\n" - for _, q := range m.Questions { - s += fmt.Sprintf("%#v\n", q) - } - } - if len(m.Answers) > 0 { - s += "-- Answers\n" - for _, a := range m.Answers { - s += fmt.Sprintf("%#v\n", a) - } - } - if len(m.Authorities) > 0 { - s += "-- Authorities\n" - for _, ns := range m.Authorities { - s += fmt.Sprintf("%#v\n", ns) - } - } - if len(m.Additionals) > 0 { - s += "-- Additionals\n" - for _, e := range m.Additionals { - s += fmt.Sprintf("%#v\n", e) - } - } - return s -} - -func TestQuestionPackUnpack(t *testing.T) { - want := Question{ - Name: ".", - Type: TypeA, - Class: ClassINET, - } - buf, err := want.pack(make([]byte, 1, 50), map[string]int{}) - if err != nil { - t.Fatal("Packing failed:", err) - } - var p Parser - p.msg = buf - p.header.questions = 1 - p.section = sectionQuestions - p.off = 1 - got, err := p.Question() - if err != nil { - t.Fatalf("Unpacking failed: %v\n%s", err, string(buf[1:])) - } - if p.off != len(buf) { - t.Errorf("Unpacked different amount than packed: got n = %d, want = %d", p.off, len(buf)) - } - if !reflect.DeepEqual(got, want) { - t.Errorf("Got = %+v, want = %+v", got, want) - } -} - -func TestNamePackUnpack(t *testing.T) { - tests := []struct { - in string - want string - err error - }{ - {"", ".", nil}, - {".", ".", nil}, - {"google..com", "", errZeroSegLen}, - {"google.com", "google.com.", nil}, - {"google..com.", "", errZeroSegLen}, - {"google.com.", "google.com.", nil}, - {".google.com.", "", errZeroSegLen}, - {"www..google.com.", "", errZeroSegLen}, - {"www.google.com.", "www.google.com.", nil}, - } - - for _, test := range tests { - buf, err := packName(make([]byte, 0, 30), test.in, map[string]int{}) - if err != test.err { - t.Errorf("Packing of %s: got err = %v, want err = %v", test.in, err, test.err) - continue - } - if test.err != nil { - continue - } - got, n, err := unpackName(buf, 0) - if err != nil { - t.Errorf("Unpacking for %s failed: %v", test.in, err) - continue - } - if n != len(buf) { - t.Errorf( - "Unpacked different amount than packed for %s: got n = %d, want = %d", - test.in, - n, - len(buf), - ) - } - if got != test.want { - t.Errorf("Unpacking packing of %s: got = %s, want = %s", test.in, got, test.want) - } - } -} - -func TestDNSPackUnpack(t *testing.T) { - wants := []Message{ - { - Questions: []Question{ - { - Name: ".", - Type: TypeAAAA, - Class: ClassINET, - }, - }, - Answers: []Resource{}, - Authorities: []Resource{}, - Additionals: []Resource{}, - }, - largeTestMsg(), - } - for i, want := range wants { - b, err := want.Pack() - if err != nil { - t.Fatalf("%d: packing failed: %v", i, err) - } - var got Message - err = got.Unpack(b) - if err != nil { - t.Fatalf("%d: unpacking failed: %v", i, err) - } - if !reflect.DeepEqual(got, want) { - t.Errorf("%d: got = %+v, want = %+v", i, &got, &want) - } - } -} - -func TestSkipAll(t *testing.T) { - msg := largeTestMsg() - buf, err := msg.Pack() - if err != nil { - t.Fatal("Packing large test message:", err) - } - var p Parser - if _, err := p.Start(buf); err != nil { - t.Fatal(err) - } - - tests := []struct { - name string - f func() error - }{ - {"SkipAllQuestions", p.SkipAllQuestions}, - {"SkipAllAnswers", p.SkipAllAnswers}, - {"SkipAllAuthorities", p.SkipAllAuthorities}, - {"SkipAllAdditionals", p.SkipAllAdditionals}, - } - for _, test := range tests { - for i := 1; i <= 3; i++ { - if err := test.f(); err != nil { - t.Errorf("Call #%d to %s(): %v", i, test.name, err) - } - } - } -} - -func TestSkipNotStarted(t *testing.T) { - var p Parser - - tests := []struct { - name string - f func() error - }{ - {"SkipAllQuestions", p.SkipAllQuestions}, - {"SkipAllAnswers", p.SkipAllAnswers}, - {"SkipAllAuthorities", p.SkipAllAuthorities}, - {"SkipAllAdditionals", p.SkipAllAdditionals}, - } - for _, test := range tests { - if err := test.f(); err != ErrNotStarted { - t.Errorf("Got %s() = %v, want = %v", test.name, err, ErrNotStarted) - } - } -} - -func TestTooManyRecords(t *testing.T) { - const recs = int(^uint16(0)) + 1 - tests := []struct { - name string - msg Message - want error - }{ - { - "Questions", - Message{ - Questions: make([]Question, recs), - }, - errTooManyQuestions, - }, - { - "Answers", - Message{ - Answers: make([]Resource, recs), - }, - errTooManyAnswers, - }, - { - "Authorities", - Message{ - Authorities: make([]Resource, recs), - }, - errTooManyAuthorities, - }, - { - "Additionals", - Message{ - Additionals: make([]Resource, recs), - }, - errTooManyAdditionals, - }, - } - - for _, test := range tests { - if _, got := test.msg.Pack(); got != test.want { - t.Errorf("Packing %d %s: got = %v, want = %v", recs, test.name, got, test.want) - } - } -} - -func TestVeryLongTxt(t *testing.T) { - want := &TXTResource{ - ResourceHeader: ResourceHeader{ - Name: "foo.bar.example.com.", - Type: TypeTXT, - Class: ClassINET, - }, - Txt: loremIpsum, - } - buf, err := packResource(make([]byte, 0, 8000), want, map[string]int{}) - if err != nil { - t.Fatal("Packing failed:", err) - } - var hdr ResourceHeader - off, err := hdr.unpack(buf, 0) - if err != nil { - t.Fatal("Unpacking ResourceHeader failed:", err) - } - got, n, err := unpackResource(buf, off, hdr) - if err != nil { - t.Fatal("Unpacking failed:", err) - } - if n != len(buf) { - t.Errorf("Unpacked different amount than packed: got n = %d, want = %d", n, len(buf)) - } - if !reflect.DeepEqual(got, want) { - t.Errorf("Got = %+v, want = %+v", got, want) - } -} - -func ExampleHeaderSearch() { - msg := Message{ - Header: Header{Response: true, Authoritative: true}, - Questions: []Question{ - { - Name: "foo.bar.example.com.", - Type: TypeA, - Class: ClassINET, - }, - { - Name: "bar.example.com.", - Type: TypeA, - Class: ClassINET, - }, - }, - Answers: []Resource{ - &AResource{ - ResourceHeader: ResourceHeader{ - Name: "foo.bar.example.com.", - Type: TypeA, - Class: ClassINET, - }, - A: [4]byte{127, 0, 0, 1}, - }, - &AResource{ - ResourceHeader: ResourceHeader{ - Name: "bar.example.com.", - Type: TypeA, - Class: ClassINET, - }, - A: [4]byte{127, 0, 0, 2}, - }, - }, - } - - buf, err := msg.Pack() - if err != nil { - panic(err) - } - - wantName := "bar.example.com." - - var p Parser - if _, err := p.Start(buf); err != nil { - panic(err) - } - - for { - q, err := p.Question() - if err == ErrSectionDone { - break - } - if err != nil { - panic(err) - } - - if q.Name != wantName { - continue - } - - fmt.Println("Found question for name", wantName) - if err := p.SkipAllQuestions(); err != nil { - panic(err) - } - break - } - - var gotIPs []net.IP - for { - h, err := p.AnswerHeader() - if err == ErrSectionDone { - break - } - if err != nil { - panic(err) - } - - if (h.Type != TypeA && h.Type != TypeAAAA) || h.Class != ClassINET { - continue - } - - if !strings.EqualFold(h.Name, wantName) { - if err := p.SkipAnswer(); err != nil { - panic(err) - } - continue - } - a, err := p.Answer() - if err != nil { - panic(err) - } - - switch r := a.(type) { - default: - panic(fmt.Sprintf("unknown type: %T", r)) - case *AResource: - gotIPs = append(gotIPs, r.A[:]) - case *AAAAResource: - gotIPs = append(gotIPs, r.AAAA[:]) - } - } - - fmt.Printf("Found A/AAAA records for name %s: %v\n", wantName, gotIPs) - - // Output: - // Found question for name bar.example.com. - // Found A/AAAA records for name bar.example.com.: [127.0.0.2] -} - -func largeTestMsg() Message { - return Message{ - Header: Header{Response: true, Authoritative: true}, - Questions: []Question{ - { - Name: "foo.bar.example.com.", - Type: TypeA, - Class: ClassINET, - }, - }, - Answers: []Resource{ - &AResource{ - ResourceHeader: ResourceHeader{ - Name: "foo.bar.example.com.", - Type: TypeA, - Class: ClassINET, - }, - A: [4]byte{127, 0, 0, 1}, - }, - &AResource{ - ResourceHeader: ResourceHeader{ - Name: "foo.bar.example.com.", - Type: TypeA, - Class: ClassINET, - }, - A: [4]byte{127, 0, 0, 2}, - }, - }, - Authorities: []Resource{ - &NSResource{ - ResourceHeader: ResourceHeader{ - Name: "foo.bar.example.com.", - Type: TypeNS, - Class: ClassINET, - }, - NS: "ns1.example.com.", - }, - &NSResource{ - ResourceHeader: ResourceHeader{ - Name: "foo.bar.example.com.", - Type: TypeNS, - Class: ClassINET, - }, - NS: "ns2.example.com.", - }, - }, - Additionals: []Resource{ - &TXTResource{ - ResourceHeader: ResourceHeader{ - Name: "foo.bar.example.com.", - Type: TypeTXT, - Class: ClassINET, - }, - Txt: "So Long, and Thanks for All the Fish", - }, - &TXTResource{ - ResourceHeader: ResourceHeader{ - Name: "foo.bar.example.com.", - Type: TypeTXT, - Class: ClassINET, - }, - Txt: "Hamster Huey and the Gooey Kablooie", - }, - }, - } -} - -const loremIpsum = ` -Lorem ipsum dolor sit amet, nec enim antiopam id, an ullum choro -nonumes qui, pro eu debet honestatis mediocritatem. No alia enim eos, -magna signiferumque ex vis. Mei no aperiri dissentias, cu vel quas -regione. Malorum quaeque vim ut, eum cu semper aliquid invidunt, ei -nam ipsum assentior. - -Nostrum appellantur usu no, vis ex probatus adipiscing. Cu usu illum -facilis eleifend. Iusto conceptam complectitur vim id. Tale omnesque -no usu, ei oblique sadipscing vim. At nullam voluptua usu, mei laudem -reformidans et. Qui ei eros porro reformidans, ius suas veritus -torquatos ex. Mea te facer alterum consequat. - -Soleat torquatos democritum sed et, no mea congue appareat, facer -aliquam nec in. Has te ipsum tritani. At justo dicta option nec, movet -phaedrum ad nam. Ea detracto verterem liberavisse has, delectus -suscipiantur in mei. Ex nam meliore complectitur. Ut nam omnis -honestatis quaerendum, ea mea nihil affert detracto, ad vix rebum -mollis. - -Ut epicurei praesent neglegentur pri, prima fuisset intellegebat ad -vim. An habemus comprehensam usu, at enim dignissim pro. Eam reque -vivendum adipisci ea. Vel ne odio choro minimum. Sea admodum -dissentiet ex. Mundi tamquam evertitur ius cu. Homero postea iisque ut -pro, vel ne saepe senserit consetetur. - -Nulla utamur facilisis ius ea, in viderer diceret pertinax eum. Mei no -enim quodsi facilisi, ex sed aeterno appareat mediocritatem, eum -sententiae deterruisset ut. At suas timeam euismod cum, offendit -appareat interpretaris ne vix. Vel ea civibus albucius, ex vim quidam -accusata intellegebat, noluisse instructior sea id. Nec te nonumes -habemus appellantur, quis dignissim vituperata eu nam. - -At vix apeirian patrioque vituperatoribus, an usu agam assum. Debet -iisque an mea. Per eu dicant ponderum accommodare. Pri alienum -placerat senserit an, ne eum ferri abhorreant vituperatoribus. Ut mea -eligendi disputationi. Ius no tation everti impedit, ei magna quidam -mediocritatem pri. - -Legendos perpetua iracundia ne usu, no ius ullum epicurei intellegam, -ad modus epicuri lucilius eam. In unum quaerendum usu. Ne diam paulo -has, ea veri virtute sed. Alia honestatis conclusionemque mea eu, ut -iudico albucius his. - -Usu essent probatus eu, sed omnis dolor delicatissimi ex. No qui augue -dissentias dissentiet. Laudem recteque no usu, vel an velit noluisse, -an sed utinam eirmod appetere. Ne mea fuisset inimicus ocurreret. At -vis dicant abhorreant, utinam forensibus nec ne, mei te docendi -consequat. Brute inermis persecuti cum id. Ut ipsum munere propriae -usu, dicit graeco disputando id has. - -Eros dolore quaerendum nam ei. Timeam ornatus inciderint pro id. Nec -torquatos sadipscing ei, ancillae molestie per in. Malis principes duo -ea, usu liber postulant ei. - -Graece timeam voluptatibus eu eam. Alia probatus quo no, ea scripta -feugiat duo. Congue option meliore ex qui, noster invenire appellantur -ea vel. Eu exerci legendos vel. Consetetur repudiandae vim ut. Vix an -probo minimum, et nam illud falli tempor. - -Cum dico signiferumque eu. Sed ut regione maiorum, id veritus insolens -tacimates vix. Eu mel sint tamquam lucilius, duo no oporteat -tacimates. Atqui augue concludaturque vix ei, id mel utroque menandri. - -Ad oratio blandit aliquando pro. Vis et dolorum rationibus -philosophia, ad cum nulla molestie. Hinc fuisset adversarium eum et, -ne qui nisl verear saperet, vel te quaestio forensibus. Per odio -option delenit an. Alii placerat has no, in pri nihil platonem -cotidieque. Est ut elit copiosae scaevola, debet tollit maluisset sea -an. - -Te sea hinc debet pericula, liber ridens fabulas cu sed, quem mutat -accusam mea et. Elitr labitur albucius et pri, an labore feugait mel. -Velit zril melius usu ea. Ad stet putent interpretaris qui. Mel no -error volumus scripserit. In pro paulo iudico, quo ei dolorem -verterem, affert fabellas dissentiet ea vix. - -Vis quot deserunt te. Error aliquid detraxit eu usu, vis alia eruditi -salutatus cu. Est nostrud bonorum an, ei usu alii salutatus. Vel at -nisl primis, eum ex aperiri noluisse reformidans. Ad veri velit -utroque vis, ex equidem detraxit temporibus has. - -Inermis appareat usu ne. Eros placerat periculis mea ad, in dictas -pericula pro. Errem postulant at usu, ea nec amet ornatus mentitum. Ad -mazim graeco eum, vel ex percipit volutpat iudicabit, sit ne delicata -interesset. Mel sapientem prodesset abhorreant et, oblique suscipit -eam id. - -An maluisset disputando mea, vidit mnesarchum pri et. Malis insolens -inciderint no sea. Ea persius maluisset vix, ne vim appellantur -instructior, consul quidam definiebas pri id. Cum integre feugiat -pericula in, ex sed persius similique, mel ne natum dicit percipitur. - -Primis discere ne pri, errem putent definitionem at vis. Ei mel dolore -neglegentur, mei tincidunt percipitur ei. Pro ad simul integre -rationibus. Eu vel alii honestatis definitiones, mea no nonumy -reprehendunt. - -Dicta appareat legendos est cu. Eu vel congue dicunt omittam, no vix -adhuc minimum constituam, quot noluisse id mel. Eu quot sale mutat -duo, ex nisl munere invenire duo. Ne nec ullum utamur. Pro alterum -debitis nostrum no, ut vel aliquid vivendo. - -Aliquip fierent praesent quo ne, id sit audiam recusabo delicatissimi. -Usu postulant incorrupte cu. At pro dicit tibique intellegam, cibo -dolore impedit id eam, et aeque feugait assentior has. Quando sensibus -nec ex. Possit sensibus pri ad, unum mutat periculis cu vix. - -Mundi tibique vix te, duo simul partiendo qualisque id, est at vidit -sonet tempor. No per solet aeterno deseruisse. Petentium salutandi -definiebas pri cu. Munere vivendum est in. Ei justo congue eligendi -vis, modus offendit omittantur te mel. - -Integre voluptaria in qui, sit habemus tractatos constituam no. Utinam -melius conceptam est ne, quo in minimum apeirian delicata, ut ius -porro recusabo. Dicant expetenda vix no, ludus scripserit sed ex, eu -his modo nostro. Ut etiam sonet his, quodsi inciderint philosophia te -per. Nullam lobortis eu cum, vix an sonet efficiendi repudiandae. Vis -ad idque fabellas intellegebat. - -Eum commodo senserit conclusionemque ex. Sed forensibus sadipscing ut, -mei in facer delicata periculis, sea ne hinc putent cetero. Nec ne -alia corpora invenire, alia prima soleat te cum. Eleifend posidonium -nam at. - -Dolorum indoctum cu quo, ex dolor legendos recteque eam, cu pri zril -discere. Nec civibus officiis dissentiunt ex, est te liber ludus -elaboraret. Cum ea fabellas invenire. Ex vim nostrud eripuit -comprehensam, nam te inermis delectus, saepe inermis senserit. -` diff --git a/vendor/golang.org/x/net/http2/client_conn_pool.go b/vendor/golang.org/x/net/http2/client_conn_pool.go index bdf5652..b139412 100644 --- a/vendor/golang.org/x/net/http2/client_conn_pool.go +++ b/vendor/golang.org/x/net/http2/client_conn_pool.go @@ -247,7 +247,7 @@ func filterOutClientConn(in []*ClientConn, exclude *ClientConn) []*ClientConn { } // noDialClientConnPool is an implementation of http2.ClientConnPool -// which never dials. We let the HTTP/1.1 client dial and use its TLS +// which never dials. We let the HTTP/1.1 client dial and use its TLS // connection instead. type noDialClientConnPool struct{ *clientConnPool } diff --git a/vendor/golang.org/x/net/http2/databuffer.go b/vendor/golang.org/x/net/http2/databuffer.go deleted file mode 100644 index a3067f8..0000000 --- a/vendor/golang.org/x/net/http2/databuffer.go +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http2 - -import ( - "errors" - "fmt" - "sync" -) - -// Buffer chunks are allocated from a pool to reduce pressure on GC. -// The maximum wasted space per dataBuffer is 2x the largest size class, -// which happens when the dataBuffer has multiple chunks and there is -// one unread byte in both the first and last chunks. We use a few size -// classes to minimize overheads for servers that typically receive very -// small request bodies. -// -// TODO: Benchmark to determine if the pools are necessary. The GC may have -// improved enough that we can instead allocate chunks like this: -// make([]byte, max(16<<10, expectedBytesRemaining)) -var ( - dataChunkSizeClasses = []int{ - 1 << 10, - 2 << 10, - 4 << 10, - 8 << 10, - 16 << 10, - } - dataChunkPools = [...]sync.Pool{ - {New: func() interface{} { return make([]byte, 1<<10) }}, - {New: func() interface{} { return make([]byte, 2<<10) }}, - {New: func() interface{} { return make([]byte, 4<<10) }}, - {New: func() interface{} { return make([]byte, 8<<10) }}, - {New: func() interface{} { return make([]byte, 16<<10) }}, - } -) - -func getDataBufferChunk(size int64) []byte { - i := 0 - for ; i < len(dataChunkSizeClasses)-1; i++ { - if size <= int64(dataChunkSizeClasses[i]) { - break - } - } - return dataChunkPools[i].Get().([]byte) -} - -func putDataBufferChunk(p []byte) { - for i, n := range dataChunkSizeClasses { - if len(p) == n { - dataChunkPools[i].Put(p) - return - } - } - panic(fmt.Sprintf("unexpected buffer len=%v", len(p))) -} - -// dataBuffer is an io.ReadWriter backed by a list of data chunks. -// Each dataBuffer is used to read DATA frames on a single stream. -// The buffer is divided into chunks so the server can limit the -// total memory used by a single connection without limiting the -// request body size on any single stream. -type dataBuffer struct { - chunks [][]byte - r int // next byte to read is chunks[0][r] - w int // next byte to write is chunks[len(chunks)-1][w] - size int // total buffered bytes - expected int64 // we expect at least this many bytes in future Write calls (ignored if <= 0) -} - -var errReadEmpty = errors.New("read from empty dataBuffer") - -// Read copies bytes from the buffer into p. -// It is an error to read when no data is available. -func (b *dataBuffer) Read(p []byte) (int, error) { - if b.size == 0 { - return 0, errReadEmpty - } - var ntotal int - for len(p) > 0 && b.size > 0 { - readFrom := b.bytesFromFirstChunk() - n := copy(p, readFrom) - p = p[n:] - ntotal += n - b.r += n - b.size -= n - // If the first chunk has been consumed, advance to the next chunk. - if b.r == len(b.chunks[0]) { - putDataBufferChunk(b.chunks[0]) - end := len(b.chunks) - 1 - copy(b.chunks[:end], b.chunks[1:]) - b.chunks[end] = nil - b.chunks = b.chunks[:end] - b.r = 0 - } - } - return ntotal, nil -} - -func (b *dataBuffer) bytesFromFirstChunk() []byte { - if len(b.chunks) == 1 { - return b.chunks[0][b.r:b.w] - } - return b.chunks[0][b.r:] -} - -// Len returns the number of bytes of the unread portion of the buffer. -func (b *dataBuffer) Len() int { - return b.size -} - -// Write appends p to the buffer. -func (b *dataBuffer) Write(p []byte) (int, error) { - ntotal := len(p) - for len(p) > 0 { - // If the last chunk is empty, allocate a new chunk. Try to allocate - // enough to fully copy p plus any additional bytes we expect to - // receive. However, this may allocate less than len(p). - want := int64(len(p)) - if b.expected > want { - want = b.expected - } - chunk := b.lastChunkOrAlloc(want) - n := copy(chunk[b.w:], p) - p = p[n:] - b.w += n - b.size += n - b.expected -= int64(n) - } - return ntotal, nil -} - -func (b *dataBuffer) lastChunkOrAlloc(want int64) []byte { - if len(b.chunks) != 0 { - last := b.chunks[len(b.chunks)-1] - if b.w < len(last) { - return last - } - } - chunk := getDataBufferChunk(want) - b.chunks = append(b.chunks, chunk) - b.w = 0 - return chunk -} diff --git a/vendor/golang.org/x/net/http2/databuffer_test.go b/vendor/golang.org/x/net/http2/databuffer_test.go deleted file mode 100644 index ca227b5..0000000 --- a/vendor/golang.org/x/net/http2/databuffer_test.go +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http2 - -import ( - "bytes" - "fmt" - "reflect" - "testing" -) - -func fmtDataChunk(chunk []byte) string { - out := "" - var last byte - var count int - for _, c := range chunk { - if c != last { - if count > 0 { - out += fmt.Sprintf(" x %d ", count) - count = 0 - } - out += string([]byte{c}) - last = c - } - count++ - } - if count > 0 { - out += fmt.Sprintf(" x %d", count) - } - return out -} - -func fmtDataChunks(chunks [][]byte) string { - var out string - for _, chunk := range chunks { - out += fmt.Sprintf("{%q}", fmtDataChunk(chunk)) - } - return out -} - -func testDataBuffer(t *testing.T, wantBytes []byte, setup func(t *testing.T) *dataBuffer) { - // Run setup, then read the remaining bytes from the dataBuffer and check - // that they match wantBytes. We use different read sizes to check corner - // cases in Read. - for _, readSize := range []int{1, 2, 1 * 1024, 32 * 1024} { - t.Run(fmt.Sprintf("ReadSize=%d", readSize), func(t *testing.T) { - b := setup(t) - buf := make([]byte, readSize) - var gotRead bytes.Buffer - for { - n, err := b.Read(buf) - gotRead.Write(buf[:n]) - if err == errReadEmpty { - break - } - if err != nil { - t.Fatalf("error after %v bytes: %v", gotRead.Len(), err) - } - } - if got, want := gotRead.Bytes(), wantBytes; !bytes.Equal(got, want) { - t.Errorf("FinalRead=%q, want %q", fmtDataChunk(got), fmtDataChunk(want)) - } - }) - } -} - -func TestDataBufferAllocation(t *testing.T) { - writes := [][]byte{ - bytes.Repeat([]byte("a"), 1*1024-1), - []byte{'a'}, - bytes.Repeat([]byte("b"), 4*1024-1), - []byte{'b'}, - bytes.Repeat([]byte("c"), 8*1024-1), - []byte{'c'}, - bytes.Repeat([]byte("d"), 16*1024-1), - []byte{'d'}, - bytes.Repeat([]byte("e"), 32*1024), - } - var wantRead bytes.Buffer - for _, p := range writes { - wantRead.Write(p) - } - - testDataBuffer(t, wantRead.Bytes(), func(t *testing.T) *dataBuffer { - b := &dataBuffer{} - for _, p := range writes { - if n, err := b.Write(p); n != len(p) || err != nil { - t.Fatalf("Write(%q x %d)=%v,%v want %v,nil", p[:1], len(p), n, err, len(p)) - } - } - want := [][]byte{ - bytes.Repeat([]byte("a"), 1*1024), - bytes.Repeat([]byte("b"), 4*1024), - bytes.Repeat([]byte("c"), 8*1024), - bytes.Repeat([]byte("d"), 16*1024), - bytes.Repeat([]byte("e"), 16*1024), - bytes.Repeat([]byte("e"), 16*1024), - } - if !reflect.DeepEqual(b.chunks, want) { - t.Errorf("dataBuffer.chunks\ngot: %s\nwant: %s", fmtDataChunks(b.chunks), fmtDataChunks(want)) - } - return b - }) -} - -func TestDataBufferAllocationWithExpected(t *testing.T) { - writes := [][]byte{ - bytes.Repeat([]byte("a"), 1*1024), // allocates 16KB - bytes.Repeat([]byte("b"), 14*1024), - bytes.Repeat([]byte("c"), 15*1024), // allocates 16KB more - bytes.Repeat([]byte("d"), 2*1024), - bytes.Repeat([]byte("e"), 1*1024), // overflows 32KB expectation, allocates just 1KB - } - var wantRead bytes.Buffer - for _, p := range writes { - wantRead.Write(p) - } - - testDataBuffer(t, wantRead.Bytes(), func(t *testing.T) *dataBuffer { - b := &dataBuffer{expected: 32 * 1024} - for _, p := range writes { - if n, err := b.Write(p); n != len(p) || err != nil { - t.Fatalf("Write(%q x %d)=%v,%v want %v,nil", p[:1], len(p), n, err, len(p)) - } - } - want := [][]byte{ - append(bytes.Repeat([]byte("a"), 1*1024), append(bytes.Repeat([]byte("b"), 14*1024), bytes.Repeat([]byte("c"), 1*1024)...)...), - append(bytes.Repeat([]byte("c"), 14*1024), bytes.Repeat([]byte("d"), 2*1024)...), - bytes.Repeat([]byte("e"), 1*1024), - } - if !reflect.DeepEqual(b.chunks, want) { - t.Errorf("dataBuffer.chunks\ngot: %s\nwant: %s", fmtDataChunks(b.chunks), fmtDataChunks(want)) - } - return b - }) -} - -func TestDataBufferWriteAfterPartialRead(t *testing.T) { - testDataBuffer(t, []byte("cdxyz"), func(t *testing.T) *dataBuffer { - b := &dataBuffer{} - if n, err := b.Write([]byte("abcd")); n != 4 || err != nil { - t.Fatalf("Write(\"abcd\")=%v,%v want 4,nil", n, err) - } - p := make([]byte, 2) - if n, err := b.Read(p); n != 2 || err != nil || !bytes.Equal(p, []byte("ab")) { - t.Fatalf("Read()=%q,%v,%v want \"ab\",2,nil", p, n, err) - } - if n, err := b.Write([]byte("xyz")); n != 3 || err != nil { - t.Fatalf("Write(\"xyz\")=%v,%v want 3,nil", n, err) - } - return b - }) -} diff --git a/vendor/golang.org/x/net/http2/fixed_buffer.go b/vendor/golang.org/x/net/http2/fixed_buffer.go new file mode 100644 index 0000000..47da0f0 --- /dev/null +++ b/vendor/golang.org/x/net/http2/fixed_buffer.go @@ -0,0 +1,60 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package http2 + +import ( + "errors" +) + +// fixedBuffer is an io.ReadWriter backed by a fixed size buffer. +// It never allocates, but moves old data as new data is written. +type fixedBuffer struct { + buf []byte + r, w int +} + +var ( + errReadEmpty = errors.New("read from empty fixedBuffer") + errWriteFull = errors.New("write on full fixedBuffer") +) + +// Read copies bytes from the buffer into p. +// It is an error to read when no data is available. +func (b *fixedBuffer) Read(p []byte) (n int, err error) { + if b.r == b.w { + return 0, errReadEmpty + } + n = copy(p, b.buf[b.r:b.w]) + b.r += n + if b.r == b.w { + b.r = 0 + b.w = 0 + } + return n, nil +} + +// Len returns the number of bytes of the unread portion of the buffer. +func (b *fixedBuffer) Len() int { + return b.w - b.r +} + +// Write copies bytes from p into the buffer. +// It is an error to write more data than the buffer can hold. +func (b *fixedBuffer) Write(p []byte) (n int, err error) { + // Slide existing data to beginning. + if b.r > 0 && len(p) > len(b.buf)-b.w { + copy(b.buf, b.buf[b.r:b.w]) + b.w -= b.r + b.r = 0 + } + + // Write new data. + n = copy(b.buf[b.w:], p) + b.w += n + if n < len(p) { + err = errWriteFull + } + return n, err +} diff --git a/vendor/golang.org/x/net/http2/fixed_buffer_test.go b/vendor/golang.org/x/net/http2/fixed_buffer_test.go new file mode 100644 index 0000000..f5432f8 --- /dev/null +++ b/vendor/golang.org/x/net/http2/fixed_buffer_test.go @@ -0,0 +1,128 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package http2 + +import ( + "reflect" + "testing" +) + +var bufferReadTests = []struct { + buf fixedBuffer + read, wn int + werr error + wp []byte + wbuf fixedBuffer +}{ + { + fixedBuffer{[]byte{'a', 0}, 0, 1}, + 5, 1, nil, []byte{'a'}, + fixedBuffer{[]byte{'a', 0}, 0, 0}, + }, + { + fixedBuffer{[]byte{0, 'a'}, 1, 2}, + 5, 1, nil, []byte{'a'}, + fixedBuffer{[]byte{0, 'a'}, 0, 0}, + }, + { + fixedBuffer{[]byte{'a', 'b'}, 0, 2}, + 1, 1, nil, []byte{'a'}, + fixedBuffer{[]byte{'a', 'b'}, 1, 2}, + }, + { + fixedBuffer{[]byte{}, 0, 0}, + 5, 0, errReadEmpty, []byte{}, + fixedBuffer{[]byte{}, 0, 0}, + }, +} + +func TestBufferRead(t *testing.T) { + for i, tt := range bufferReadTests { + read := make([]byte, tt.read) + n, err := tt.buf.Read(read) + if n != tt.wn { + t.Errorf("#%d: wn = %d want %d", i, n, tt.wn) + continue + } + if err != tt.werr { + t.Errorf("#%d: werr = %v want %v", i, err, tt.werr) + continue + } + read = read[:n] + if !reflect.DeepEqual(read, tt.wp) { + t.Errorf("#%d: read = %+v want %+v", i, read, tt.wp) + } + if !reflect.DeepEqual(tt.buf, tt.wbuf) { + t.Errorf("#%d: buf = %+v want %+v", i, tt.buf, tt.wbuf) + } + } +} + +var bufferWriteTests = []struct { + buf fixedBuffer + write, wn int + werr error + wbuf fixedBuffer +}{ + { + buf: fixedBuffer{ + buf: []byte{}, + }, + wbuf: fixedBuffer{ + buf: []byte{}, + }, + }, + { + buf: fixedBuffer{ + buf: []byte{1, 'a'}, + }, + write: 1, + wn: 1, + wbuf: fixedBuffer{ + buf: []byte{0, 'a'}, + w: 1, + }, + }, + { + buf: fixedBuffer{ + buf: []byte{'a', 1}, + r: 1, + w: 1, + }, + write: 2, + wn: 2, + wbuf: fixedBuffer{ + buf: []byte{0, 0}, + w: 2, + }, + }, + { + buf: fixedBuffer{ + buf: []byte{}, + }, + write: 5, + werr: errWriteFull, + wbuf: fixedBuffer{ + buf: []byte{}, + }, + }, +} + +func TestBufferWrite(t *testing.T) { + for i, tt := range bufferWriteTests { + n, err := tt.buf.Write(make([]byte, tt.write)) + if n != tt.wn { + t.Errorf("#%d: wrote %d bytes; want %d", i, n, tt.wn) + continue + } + if err != tt.werr { + t.Errorf("#%d: error = %v; want %v", i, err, tt.werr) + continue + } + if !reflect.DeepEqual(tt.buf, tt.wbuf) { + t.Errorf("#%d: buf = %+v; want %+v", i, tt.buf, tt.wbuf) + } + } +} diff --git a/vendor/golang.org/x/net/http2/frame.go b/vendor/golang.org/x/net/http2/frame.go index 3b14890..358833f 100644 --- a/vendor/golang.org/x/net/http2/frame.go +++ b/vendor/golang.org/x/net/http2/frame.go @@ -122,7 +122,7 @@ var flagName = map[FrameType]map[Flags]string{ // a frameParser parses a frame given its FrameHeader and payload // bytes. The length of payload will always equal fh.Length (which // might be 0). -type frameParser func(fc *frameCache, fh FrameHeader, payload []byte) (Frame, error) +type frameParser func(fh FrameHeader, payload []byte) (Frame, error) var frameParsers = map[FrameType]frameParser{ FrameData: parseDataFrame, @@ -312,7 +312,7 @@ type Framer struct { MaxHeaderListSize uint32 // TODO: track which type of frame & with which flags was sent - // last. Then return an error (unless AllowIllegalWrites) if + // last. Then return an error (unless AllowIllegalWrites) if // we're in the middle of a header block and a // non-Continuation or Continuation on a different stream is // attempted to be written. @@ -323,8 +323,6 @@ type Framer struct { debugFramerBuf *bytes.Buffer debugReadLoggerf func(string, ...interface{}) debugWriteLoggerf func(string, ...interface{}) - - frameCache *frameCache // nil if frames aren't reused (default) } func (fr *Framer) maxHeaderListSize() uint32 { @@ -400,27 +398,6 @@ const ( maxFrameSize = 1<<24 - 1 ) -// SetReuseFrames allows the Framer to reuse Frames. -// If called on a Framer, Frames returned by calls to ReadFrame are only -// valid until the next call to ReadFrame. -func (fr *Framer) SetReuseFrames() { - if fr.frameCache != nil { - return - } - fr.frameCache = &frameCache{} -} - -type frameCache struct { - dataFrame DataFrame -} - -func (fc *frameCache) getDataFrame() *DataFrame { - if fc == nil { - return &DataFrame{} - } - return &fc.dataFrame -} - // NewFramer returns a Framer that writes frames to w and reads them from r. func NewFramer(w io.Writer, r io.Reader) *Framer { fr := &Framer{ @@ -500,7 +477,7 @@ func (fr *Framer) ReadFrame() (Frame, error) { if _, err := io.ReadFull(fr.r, payload); err != nil { return nil, err } - f, err := typeFrameParser(fh.Type)(fr.frameCache, fh, payload) + f, err := typeFrameParser(fh.Type)(fh, payload) if err != nil { if ce, ok := err.(connError); ok { return nil, fr.connError(ce.Code, ce.Reason) @@ -588,7 +565,7 @@ func (f *DataFrame) Data() []byte { return f.data } -func parseDataFrame(fc *frameCache, fh FrameHeader, payload []byte) (Frame, error) { +func parseDataFrame(fh FrameHeader, payload []byte) (Frame, error) { if fh.StreamID == 0 { // DATA frames MUST be associated with a stream. If a // DATA frame is received whose stream identifier @@ -597,9 +574,9 @@ func parseDataFrame(fc *frameCache, fh FrameHeader, payload []byte) (Frame, erro // PROTOCOL_ERROR. return nil, connError{ErrCodeProtocol, "DATA frame with stream ID 0"} } - f := fc.getDataFrame() - f.FrameHeader = fh - + f := &DataFrame{ + FrameHeader: fh, + } var padSize byte if fh.Flags.Has(FlagDataPadded) { var err error @@ -623,7 +600,6 @@ var ( errStreamID = errors.New("invalid stream ID") errDepStreamID = errors.New("invalid dependent stream ID") errPadLength = errors.New("pad length too large") - errPadBytes = errors.New("padding bytes must all be zeros unless AllowIllegalWrites is enabled") ) func validStreamIDOrZero(streamID uint32) bool { @@ -647,7 +623,6 @@ func (f *Framer) WriteData(streamID uint32, endStream bool, data []byte) error { // // If pad is nil, the padding bit is not sent. // The length of pad must not exceed 255 bytes. -// The bytes of pad must all be zero, unless f.AllowIllegalWrites is set. // // It will perform exactly one Write to the underlying Writer. // It is the caller's responsibility not to violate the maximum frame size @@ -656,18 +631,8 @@ func (f *Framer) WriteDataPadded(streamID uint32, endStream bool, data, pad []by if !validStreamID(streamID) && !f.AllowIllegalWrites { return errStreamID } - if len(pad) > 0 { - if len(pad) > 255 { - return errPadLength - } - if !f.AllowIllegalWrites { - for _, b := range pad { - if b != 0 { - // "Padding octets MUST be set to zero when sending." - return errPadBytes - } - } - } + if len(pad) > 255 { + return errPadLength } var flags Flags if endStream { @@ -695,10 +660,10 @@ type SettingsFrame struct { p []byte } -func parseSettingsFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) { +func parseSettingsFrame(fh FrameHeader, p []byte) (Frame, error) { if fh.Flags.Has(FlagSettingsAck) && fh.Length > 0 { // When this (ACK 0x1) bit is set, the payload of the - // SETTINGS frame MUST be empty. Receipt of a + // SETTINGS frame MUST be empty. Receipt of a // SETTINGS frame with the ACK flag set and a length // field value other than 0 MUST be treated as a // connection error (Section 5.4.1) of type @@ -707,7 +672,7 @@ func parseSettingsFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) } if fh.StreamID != 0 { // SETTINGS frames always apply to a connection, - // never a single stream. The stream identifier for a + // never a single stream. The stream identifier for a // SETTINGS frame MUST be zero (0x0). If an endpoint // receives a SETTINGS frame whose stream identifier // field is anything other than 0x0, the endpoint MUST @@ -797,7 +762,7 @@ type PingFrame struct { func (f *PingFrame) IsAck() bool { return f.Flags.Has(FlagPingAck) } -func parsePingFrame(_ *frameCache, fh FrameHeader, payload []byte) (Frame, error) { +func parsePingFrame(fh FrameHeader, payload []byte) (Frame, error) { if len(payload) != 8 { return nil, ConnectionError(ErrCodeFrameSize) } @@ -837,7 +802,7 @@ func (f *GoAwayFrame) DebugData() []byte { return f.debugData } -func parseGoAwayFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) { +func parseGoAwayFrame(fh FrameHeader, p []byte) (Frame, error) { if fh.StreamID != 0 { return nil, ConnectionError(ErrCodeProtocol) } @@ -877,7 +842,7 @@ func (f *UnknownFrame) Payload() []byte { return f.p } -func parseUnknownFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) { +func parseUnknownFrame(fh FrameHeader, p []byte) (Frame, error) { return &UnknownFrame{fh, p}, nil } @@ -888,7 +853,7 @@ type WindowUpdateFrame struct { Increment uint32 // never read with high bit set } -func parseWindowUpdateFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) { +func parseWindowUpdateFrame(fh FrameHeader, p []byte) (Frame, error) { if len(p) != 4 { return nil, ConnectionError(ErrCodeFrameSize) } @@ -953,12 +918,12 @@ func (f *HeadersFrame) HasPriority() bool { return f.FrameHeader.Flags.Has(FlagHeadersPriority) } -func parseHeadersFrame(_ *frameCache, fh FrameHeader, p []byte) (_ Frame, err error) { +func parseHeadersFrame(fh FrameHeader, p []byte) (_ Frame, err error) { hf := &HeadersFrame{ FrameHeader: fh, } if fh.StreamID == 0 { - // HEADERS frames MUST be associated with a stream. If a HEADERS frame + // HEADERS frames MUST be associated with a stream. If a HEADERS frame // is received whose stream identifier field is 0x0, the recipient MUST // respond with a connection error (Section 5.4.1) of type // PROTOCOL_ERROR. @@ -1080,7 +1045,7 @@ type PriorityParam struct { Exclusive bool // Weight is the stream's zero-indexed weight. It should be - // set together with StreamDep, or neither should be set. Per + // set together with StreamDep, or neither should be set. Per // the spec, "Add one to the value to obtain a weight between // 1 and 256." Weight uint8 @@ -1090,7 +1055,7 @@ func (p PriorityParam) IsZero() bool { return p == PriorityParam{} } -func parsePriorityFrame(_ *frameCache, fh FrameHeader, payload []byte) (Frame, error) { +func parsePriorityFrame(fh FrameHeader, payload []byte) (Frame, error) { if fh.StreamID == 0 { return nil, connError{ErrCodeProtocol, "PRIORITY frame with stream ID 0"} } @@ -1137,7 +1102,7 @@ type RSTStreamFrame struct { ErrCode ErrCode } -func parseRSTStreamFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) { +func parseRSTStreamFrame(fh FrameHeader, p []byte) (Frame, error) { if len(p) != 4 { return nil, ConnectionError(ErrCodeFrameSize) } @@ -1167,7 +1132,7 @@ type ContinuationFrame struct { headerFragBuf []byte } -func parseContinuationFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) { +func parseContinuationFrame(fh FrameHeader, p []byte) (Frame, error) { if fh.StreamID == 0 { return nil, connError{ErrCodeProtocol, "CONTINUATION frame with stream ID 0"} } @@ -1217,7 +1182,7 @@ func (f *PushPromiseFrame) HeadersEnded() bool { return f.FrameHeader.Flags.Has(FlagPushPromiseEndHeaders) } -func parsePushPromise(_ *frameCache, fh FrameHeader, p []byte) (_ Frame, err error) { +func parsePushPromise(fh FrameHeader, p []byte) (_ Frame, err error) { pp := &PushPromiseFrame{ FrameHeader: fh, } diff --git a/vendor/golang.org/x/net/http2/frame_test.go b/vendor/golang.org/x/net/http2/frame_test.go index 37266bc..7b1933d 100644 --- a/vendor/golang.org/x/net/http2/frame_test.go +++ b/vendor/golang.org/x/net/http2/frame_test.go @@ -141,7 +141,7 @@ func TestWriteDataPadded(t *testing.T) { streamID: 1, endStream: false, data: []byte("foo"), - pad: []byte{0, 0, 0}, + pad: []byte("bar"), wantHeader: FrameHeader{ Type: FrameData, Flags: FlagDataPadded, @@ -1096,95 +1096,6 @@ func TestMetaFrameHeader(t *testing.T) { } } -func TestSetReuseFrames(t *testing.T) { - fr, buf := testFramer() - fr.SetReuseFrames() - - // Check that DataFrames are reused. Note that - // SetReuseFrames only currently implements reuse of DataFrames. - firstDf := readAndVerifyDataFrame("ABC", 3, fr, buf, t) - - for i := 0; i < 10; i++ { - df := readAndVerifyDataFrame("XYZ", 3, fr, buf, t) - if df != firstDf { - t.Errorf("Expected Framer to return references to the same DataFrame. Have %v and %v", &df, &firstDf) - } - } - - for i := 0; i < 10; i++ { - df := readAndVerifyDataFrame("", 0, fr, buf, t) - if df != firstDf { - t.Errorf("Expected Framer to return references to the same DataFrame. Have %v and %v", &df, &firstDf) - } - } - - for i := 0; i < 10; i++ { - df := readAndVerifyDataFrame("HHH", 3, fr, buf, t) - if df != firstDf { - t.Errorf("Expected Framer to return references to the same DataFrame. Have %v and %v", &df, &firstDf) - } - } -} - -func TestSetReuseFramesMoreThanOnce(t *testing.T) { - fr, buf := testFramer() - fr.SetReuseFrames() - - firstDf := readAndVerifyDataFrame("ABC", 3, fr, buf, t) - fr.SetReuseFrames() - - for i := 0; i < 10; i++ { - df := readAndVerifyDataFrame("XYZ", 3, fr, buf, t) - // SetReuseFrames should be idempotent - fr.SetReuseFrames() - if df != firstDf { - t.Errorf("Expected Framer to return references to the same DataFrame. Have %v and %v", &df, &firstDf) - } - } -} - -func TestNoSetReuseFrames(t *testing.T) { - fr, buf := testFramer() - const numNewDataFrames = 10 - dfSoFar := make([]interface{}, numNewDataFrames) - - // Check that DataFrames are not reused if SetReuseFrames wasn't called. - // SetReuseFrames only currently implements reuse of DataFrames. - for i := 0; i < numNewDataFrames; i++ { - df := readAndVerifyDataFrame("XYZ", 3, fr, buf, t) - for _, item := range dfSoFar { - if df == item { - t.Errorf("Expected Framer to return new DataFrames since SetNoReuseFrames not set.") - } - } - dfSoFar[i] = df - } -} - -func readAndVerifyDataFrame(data string, length byte, fr *Framer, buf *bytes.Buffer, t *testing.T) *DataFrame { - var streamID uint32 = 1<<24 + 2<<16 + 3<<8 + 4 - fr.WriteData(streamID, true, []byte(data)) - wantEnc := "\x00\x00" + string(length) + "\x00\x01\x01\x02\x03\x04" + data - if buf.String() != wantEnc { - t.Errorf("encoded as %q; want %q", buf.Bytes(), wantEnc) - } - f, err := fr.ReadFrame() - if err != nil { - t.Fatal(err) - } - df, ok := f.(*DataFrame) - if !ok { - t.Fatalf("got %T; want *DataFrame", f) - } - if !bytes.Equal(df.Data(), []byte(data)) { - t.Errorf("got %q; want %q", df.Data(), []byte(data)) - } - if f.Header().Flags&1 == 0 { - t.Errorf("didn't see END_STREAM flag") - } - return df -} - func encodeHeaderRaw(t *testing.T, pairs ...string) []byte { var he hpackEncoder return he.encodeHeaderRaw(t, pairs...) diff --git a/vendor/golang.org/x/net/http2/go18.go b/vendor/golang.org/x/net/http2/go18.go index 73cc238..633202c 100644 --- a/vendor/golang.org/x/net/http2/go18.go +++ b/vendor/golang.org/x/net/http2/go18.go @@ -12,11 +12,7 @@ import ( "net/http" ) -func cloneTLSConfig(c *tls.Config) *tls.Config { - c2 := c.Clone() - c2.GetClientCertificate = c.GetClientCertificate // golang.org/issue/19264 - return c2 -} +func cloneTLSConfig(c *tls.Config) *tls.Config { return c.Clone() } var _ http.Pusher = (*responseWriter)(nil) diff --git a/vendor/golang.org/x/net/http2/go18_test.go b/vendor/golang.org/x/net/http2/go18_test.go index 30e3b03..8365505 100644 --- a/vendor/golang.org/x/net/http2/go18_test.go +++ b/vendor/golang.org/x/net/http2/go18_test.go @@ -7,7 +7,6 @@ package http2 import ( - "crypto/tls" "net/http" "testing" "time" @@ -65,15 +64,3 @@ func TestConfigureServerIdleTimeout_Go18(t *testing.T) { } } } - -func TestCertClone(t *testing.T) { - c := &tls.Config{ - GetClientCertificate: func(*tls.CertificateRequestInfo) (*tls.Certificate, error) { - panic("shouldn't be called") - }, - } - c2 := cloneTLSConfig(c) - if c2.GetClientCertificate == nil { - t.Error("GetClientCertificate is nil") - } -} diff --git a/vendor/golang.org/x/net/http2/h2demo/h2demo.go b/vendor/golang.org/x/net/http2/h2demo/h2demo.go index 9853107..980b6d6 100644 --- a/vendor/golang.org/x/net/http2/h2demo/h2demo.go +++ b/vendor/golang.org/x/net/http2/h2demo/h2demo.go @@ -87,7 +87,6 @@ href="https://golang.org/s/http2bug">file a bug.

  • GET /reqinfo to dump the request + headers received
  • GET /clockstream streams the current time every second
  • GET /gophertiles to see a page with a bunch of images
  • -
  • GET /serverpush to see a page with server push
  • GET /file/gopher.png for a small file (does If-Modified-Since, Content-Range, etc)
  • GET /file/go.src.tar.gz for a larger file (~10 MB)
  • GET /redirect to redirect back to / (this page)
  • @@ -169,11 +168,8 @@ var ( // fileServer returns a file-serving handler that proxies URL. // It lazily fetches URL on the first access and caches its contents forever. -func fileServer(url string, latency time.Duration) http.Handler { +func fileServer(url string) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if latency > 0 { - time.Sleep(latency) - } hi, err := fsGrp.Do(url, func() (interface{}, error) { fsMu.Lock() if h, ok := fsCache[url]; ok { @@ -231,18 +227,14 @@ func clockStreamHandler(w http.ResponseWriter, r *http.Request) { func registerHandlers() { tiles := newGopherTilesHandler() - push := newPushHandler() mux2 := http.NewServeMux() http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - switch { - case r.URL.Path == "/gophertiles": - tiles.ServeHTTP(w, r) // allow HTTP/2 + HTTP/1.x - return - case strings.HasPrefix(r.URL.Path, "/serverpush"): - push.ServeHTTP(w, r) // allow HTTP/2 + HTTP/1.x - return - case r.TLS == nil: // do not allow HTTP/1.x for anything else + if r.TLS == nil { + if r.URL.Path == "/gophertiles" { + tiles.ServeHTTP(w, r) + return + } http.Redirect(w, r, "https://"+httpsHost()+"/", http.StatusFound) return } @@ -257,8 +249,8 @@ func registerHandlers() { mux2.ServeHTTP(w, r) }) mux2.HandleFunc("/", home) - mux2.Handle("/file/gopher.png", fileServer("https://golang.org/doc/gopher/frontpage.png", 0)) - mux2.Handle("/file/go.src.tar.gz", fileServer("https://storage.googleapis.com/golang/go1.4.1.src.tar.gz", 0)) + mux2.Handle("/file/gopher.png", fileServer("https://golang.org/doc/gopher/frontpage.png")) + mux2.Handle("/file/go.src.tar.gz", fileServer("https://storage.googleapis.com/golang/go1.4.1.src.tar.gz")) mux2.HandleFunc("/reqinfo", reqInfoHandler) mux2.HandleFunc("/crc32", crcHandler) mux2.HandleFunc("/ECHO", echoCapitalHandler) @@ -275,46 +267,6 @@ func registerHandlers() { }) } -var pushResources = map[string]http.Handler{ - "/serverpush/static/jquery.min.js": fileServer("https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js", 100*time.Millisecond), - "/serverpush/static/godocs.js": fileServer("https://golang.org/lib/godoc/godocs.js", 100*time.Millisecond), - "/serverpush/static/playground.js": fileServer("https://golang.org/lib/godoc/playground.js", 100*time.Millisecond), - "/serverpush/static/style.css": fileServer("https://golang.org/lib/godoc/style.css", 100*time.Millisecond), -} - -func newPushHandler() http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - for path, handler := range pushResources { - if r.URL.Path == path { - handler.ServeHTTP(w, r) - return - } - } - - cacheBust := time.Now().UnixNano() - if pusher, ok := w.(http.Pusher); ok { - for path := range pushResources { - url := fmt.Sprintf("%s?%d", path, cacheBust) - if err := pusher.Push(url, nil); err != nil { - log.Printf("Failed to push %v: %v", path, err) - } - } - } - time.Sleep(100 * time.Millisecond) // fake network latency + parsing time - if err := pushTmpl.Execute(w, struct { - CacheBust int64 - HTTPSHost string - HTTPHost string - }{ - CacheBust: cacheBust, - HTTPSHost: httpsHost(), - HTTPHost: httpHost(), - }); err != nil { - log.Printf("Executing server push template: %v", err) - } - }) -} - func newGopherTilesHandler() http.Handler { const gopherURL = "https://blog.golang.org/go-programming-language-turns-two_gophers.jpg" res, err := http.Get(gopherURL) @@ -441,11 +393,7 @@ func serveProdTLS() error { GetCertificate: m.GetCertificate, }, } - http2.ConfigureServer(srv, &http2.Server{ - NewWriteScheduler: func() http2.WriteScheduler { - return http2.NewPriorityWriteScheduler(nil) - }, - }) + http2.ConfigureServer(srv, &http2.Server{}) ln, err := net.Listen("tcp", ":443") if err != nil { return err diff --git a/vendor/golang.org/x/net/http2/h2demo/tmpl.go b/vendor/golang.org/x/net/http2/h2demo/tmpl.go deleted file mode 100644 index 504d6a7..0000000 --- a/vendor/golang.org/x/net/http2/h2demo/tmpl.go +++ /dev/null @@ -1,1991 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build h2demo - -package main - -import "html/template" - -var pushTmpl = template.Must(template.New("serverpush").Parse(` - - - - - - - - - HTTP/2 Server Push Demo - - - - - - - - - -
    -Note: This page exists for demonstration purposes. For the actual cmd/go docs, go to golang.org/cmd/go. -
    - - - -
    -... -
    - - - - -
    -
    -
    -
    - Run - Format - - - -
    -
    - - -
    -
    - - -

    Command go

    - - - - - - - - - - - - - - -

    -Go is a tool for managing Go source code. -

    -

    -Usage: -

    -
    go command [arguments]
    -
    -

    -The commands are: -

    -
    build       compile packages and dependencies
    -clean       remove object files
    -doc         show documentation for package or symbol
    -env         print Go environment information
    -bug         start a bug report
    -fix         run go tool fix on packages
    -fmt         run gofmt on package sources
    -generate    generate Go files by processing source
    -get         download and install packages and dependencies
    -install     compile and install packages and dependencies
    -list        list packages
    -run         compile and run Go program
    -test        test packages
    -tool        run specified go tool
    -version     print Go version
    -vet         run go tool vet on packages
    -
    -

    -Use "go help [command]" for more information about a command. -

    -

    -Additional help topics: -

    -
    c           calling between Go and C
    -buildmode   description of build modes
    -filetype    file types
    -gopath      GOPATH environment variable
    -environment environment variables
    -importpath  import path syntax
    -packages    description of package lists
    -testflag    description of testing flags
    -testfunc    description of testing functions
    -
    -

    -Use "go help [topic]" for more information about that topic. -

    -

    Compile packages and dependencies

    -

    -Usage: -

    -
    go build [-o output] [-i] [build flags] [packages]
    -
    -

    -Build compiles the packages named by the import paths, -along with their dependencies, but it does not install the results. -

    -

    -If the arguments to build are a list of .go files, build treats -them as a list of source files specifying a single package. -

    -

    -When compiling a single main package, build writes -the resulting executable to an output file named after -the first source file ('go build ed.go rx.go' writes 'ed' or 'ed.exe') -or the source code directory ('go build unix/sam' writes 'sam' or 'sam.exe'). -The '.exe' suffix is added when writing a Windows executable. -

    -

    -When compiling multiple packages or a single non-main package, -build compiles the packages but discards the resulting object, -serving only as a check that the packages can be built. -

    -

    -When compiling packages, build ignores files that end in '_test.go'. -

    -

    -The -o flag, only allowed when compiling a single package, -forces build to write the resulting executable or object -to the named output file, instead of the default behavior described -in the last two paragraphs. -

    -

    -The -i flag installs the packages that are dependencies of the target. -

    -

    -The build flags are shared by the build, clean, get, install, list, run, -and test commands: -

    -
    -a
    -	force rebuilding of packages that are already up-to-date.
    --n
    -	print the commands but do not run them.
    --p n
    -	the number of programs, such as build commands or
    -	test binaries, that can be run in parallel.
    -	The default is the number of CPUs available.
    --race
    -	enable data race detection.
    -	Supported only on linux/amd64, freebsd/amd64, darwin/amd64 and windows/amd64.
    --msan
    -	enable interoperation with memory sanitizer.
    -	Supported only on linux/amd64,
    -	and only with Clang/LLVM as the host C compiler.
    --v
    -	print the names of packages as they are compiled.
    --work
    -	print the name of the temporary work directory and
    -	do not delete it when exiting.
    --x
    -	print the commands.
    -
    --asmflags 'flag list'
    -	arguments to pass on each go tool asm invocation.
    --buildmode mode
    -	build mode to use. See 'go help buildmode' for more.
    --compiler name
    -	name of compiler to use, as in runtime.Compiler (gccgo or gc).
    --gccgoflags 'arg list'
    -	arguments to pass on each gccgo compiler/linker invocation.
    --gcflags 'arg list'
    -	arguments to pass on each go tool compile invocation.
    --installsuffix suffix
    -	a suffix to use in the name of the package installation directory,
    -	in order to keep output separate from default builds.
    -	If using the -race flag, the install suffix is automatically set to race
    -	or, if set explicitly, has _race appended to it.  Likewise for the -msan
    -	flag.  Using a -buildmode option that requires non-default compile flags
    -	has a similar effect.
    --ldflags 'flag list'
    -	arguments to pass on each go tool link invocation.
    --linkshared
    -	link against shared libraries previously created with
    -	-buildmode=shared.
    --pkgdir dir
    -	install and load all packages from dir instead of the usual locations.
    -	For example, when building with a non-standard configuration,
    -	use -pkgdir to keep generated packages in a separate location.
    --tags 'tag list'
    -	a list of build tags to consider satisfied during the build.
    -	For more information about build tags, see the description of
    -	build constraints in the documentation for the go/build package.
    --toolexec 'cmd args'
    -	a program to use to invoke toolchain programs like vet and asm.
    -	For example, instead of running asm, the go command will run
    -	'cmd args /path/to/asm <arguments for asm>'.
    -
    -

    -The list flags accept a space-separated list of strings. To embed spaces -in an element in the list, surround it with either single or double quotes. -

    -

    -For more about specifying packages, see 'go help packages'. -For more about where packages and binaries are installed, -run 'go help gopath'. -For more about calling between Go and C/C++, run 'go help c'. -

    -

    -Note: Build adheres to certain conventions such as those described -by 'go help gopath'. Not all projects can follow these conventions, -however. Installations that have their own conventions or that use -a separate software build system may choose to use lower-level -invocations such as 'go tool compile' and 'go tool link' to avoid -some of the overheads and design decisions of the build tool. -

    -

    -See also: go install, go get, go clean. -

    -

    Remove object files

    -

    -Usage: -

    -
    go clean [-i] [-r] [-n] [-x] [build flags] [packages]
    -
    -

    -Clean removes object files from package source directories. -The go command builds most objects in a temporary directory, -so go clean is mainly concerned with object files left by other -tools or by manual invocations of go build. -

    -

    -Specifically, clean removes the following files from each of the -source directories corresponding to the import paths: -

    -
    _obj/            old object directory, left from Makefiles
    -_test/           old test directory, left from Makefiles
    -_testmain.go     old gotest file, left from Makefiles
    -test.out         old test log, left from Makefiles
    -build.out        old test log, left from Makefiles
    -*.[568ao]        object files, left from Makefiles
    -
    -DIR(.exe)        from go build
    -DIR.test(.exe)   from go test -c
    -MAINFILE(.exe)   from go build MAINFILE.go
    -*.so             from SWIG
    -
    -

    -In the list, DIR represents the final path element of the -directory, and MAINFILE is the base name of any Go source -file in the directory that is not included when building -the package. -

    -

    -The -i flag causes clean to remove the corresponding installed -archive or binary (what 'go install' would create). -

    -

    -The -n flag causes clean to print the remove commands it would execute, -but not run them. -

    -

    -The -r flag causes clean to be applied recursively to all the -dependencies of the packages named by the import paths. -

    -

    -The -x flag causes clean to print remove commands as it executes them. -

    -

    -For more about build flags, see 'go help build'. -

    -

    -For more about specifying packages, see 'go help packages'. -

    -

    Show documentation for package or symbol

    -

    -Usage: -

    -
    go doc [-u] [-c] [package|[package.]symbol[.method]]
    -
    -

    -Doc prints the documentation comments associated with the item identified by its -arguments (a package, const, func, type, var, or method) followed by a one-line -summary of each of the first-level items "under" that item (package-level -declarations for a package, methods for a type, etc.). -

    -

    -Doc accepts zero, one, or two arguments. -

    -

    -Given no arguments, that is, when run as -

    -
    go doc
    -
    -

    -it prints the package documentation for the package in the current directory. -If the package is a command (package main), the exported symbols of the package -are elided from the presentation unless the -cmd flag is provided. -

    -

    -When run with one argument, the argument is treated as a Go-syntax-like -representation of the item to be documented. What the argument selects depends -on what is installed in GOROOT and GOPATH, as well as the form of the argument, -which is schematically one of these: -

    -
    go doc <pkg>
    -go doc <sym>[.<method>]
    -go doc [<pkg>.]<sym>[.<method>]
    -go doc [<pkg>.][<sym>.]<method>
    -
    -

    -The first item in this list matched by the argument is the one whose documentation -is printed. (See the examples below.) However, if the argument starts with a capital -letter it is assumed to identify a symbol or method in the current directory. -

    -

    -For packages, the order of scanning is determined lexically in breadth-first order. -That is, the package presented is the one that matches the search and is nearest -the root and lexically first at its level of the hierarchy. The GOROOT tree is -always scanned in its entirety before GOPATH. -

    -

    -If there is no package specified or matched, the package in the current -directory is selected, so "go doc Foo" shows the documentation for symbol Foo in -the current package. -

    -

    -The package path must be either a qualified path or a proper suffix of a -path. The go tool's usual package mechanism does not apply: package path -elements like . and ... are not implemented by go doc. -

    -

    -When run with two arguments, the first must be a full package path (not just a -suffix), and the second is a symbol or symbol and method; this is similar to the -syntax accepted by godoc: -

    -
    go doc <pkg> <sym>[.<method>]
    -
    -

    -In all forms, when matching symbols, lower-case letters in the argument match -either case but upper-case letters match exactly. This means that there may be -multiple matches of a lower-case argument in a package if different symbols have -different cases. If this occurs, documentation for all matches is printed. -

    -

    -Examples: -

    -
    go doc
    -	Show documentation for current package.
    -go doc Foo
    -	Show documentation for Foo in the current package.
    -	(Foo starts with a capital letter so it cannot match
    -	a package path.)
    -go doc encoding/json
    -	Show documentation for the encoding/json package.
    -go doc json
    -	Shorthand for encoding/json.
    -go doc json.Number (or go doc json.number)
    -	Show documentation and method summary for json.Number.
    -go doc json.Number.Int64 (or go doc json.number.int64)
    -	Show documentation for json.Number's Int64 method.
    -go doc cmd/doc
    -	Show package docs for the doc command.
    -go doc -cmd cmd/doc
    -	Show package docs and exported symbols within the doc command.
    -go doc template.new
    -	Show documentation for html/template's New function.
    -	(html/template is lexically before text/template)
    -go doc text/template.new # One argument
    -	Show documentation for text/template's New function.
    -go doc text/template new # Two arguments
    -	Show documentation for text/template's New function.
    -
    -At least in the current tree, these invocations all print the
    -documentation for json.Decoder's Decode method:
    -
    -go doc json.Decoder.Decode
    -go doc json.decoder.decode
    -go doc json.decode
    -cd go/src/encoding/json; go doc decode
    -
    -

    -Flags: -

    -
    -c
    -	Respect case when matching symbols.
    --cmd
    -	Treat a command (package main) like a regular package.
    -	Otherwise package main's exported symbols are hidden
    -	when showing the package's top-level documentation.
    --u
    -	Show documentation for unexported as well as exported
    -	symbols and methods.
    -
    -

    Print Go environment information

    -

    -Usage: -

    -
    go env [var ...]
    -
    -

    -Env prints Go environment information. -

    -

    -By default env prints information as a shell script -(on Windows, a batch file). If one or more variable -names is given as arguments, env prints the value of -each named variable on its own line. -

    -

    Start a bug report

    -

    -Usage: -

    -
    go bug
    -
    -

    -Bug opens the default browser and starts a new bug report. -The report includes useful system information. -

    -

    Run go tool fix on packages

    -

    -Usage: -

    -
    go fix [packages]
    -
    -

    -Fix runs the Go fix command on the packages named by the import paths. -

    -

    -For more about fix, see 'go doc cmd/fix'. -For more about specifying packages, see 'go help packages'. -

    -

    -To run fix with specific options, run 'go tool fix'. -

    -

    -See also: go fmt, go vet. -

    -

    Run gofmt on package sources

    -

    -Usage: -

    -
    go fmt [-n] [-x] [packages]
    -
    -

    -Fmt runs the command 'gofmt -l -w' on the packages named -by the import paths. It prints the names of the files that are modified. -

    -

    -For more about gofmt, see 'go doc cmd/gofmt'. -For more about specifying packages, see 'go help packages'. -

    -

    -The -n flag prints commands that would be executed. -The -x flag prints commands as they are executed. -

    -

    -To run gofmt with specific options, run gofmt itself. -

    -

    -See also: go fix, go vet. -

    -

    Generate Go files by processing source

    -

    -Usage: -

    -
    go generate [-run regexp] [-n] [-v] [-x] [build flags] [file.go... | packages]
    -
    -

    -Generate runs commands described by directives within existing -files. Those commands can run any process but the intent is to -create or update Go source files. -

    -

    -Go generate is never run automatically by go build, go get, go test, -and so on. It must be run explicitly. -

    -

    -Go generate scans the file for directives, which are lines of -the form, -

    -
    //go:generate command argument...
    -
    -

    -(note: no leading spaces and no space in "//go") where command -is the generator to be run, corresponding to an executable file -that can be run locally. It must either be in the shell path -(gofmt), a fully qualified path (/usr/you/bin/mytool), or a -command alias, described below. -

    -

    -Note that go generate does not parse the file, so lines that look -like directives in comments or multiline strings will be treated -as directives. -

    -

    -The arguments to the directive are space-separated tokens or -double-quoted strings passed to the generator as individual -arguments when it is run. -

    -

    -Quoted strings use Go syntax and are evaluated before execution; a -quoted string appears as a single argument to the generator. -

    -

    -Go generate sets several variables when it runs the generator: -

    -
    $GOARCH
    -	The execution architecture (arm, amd64, etc.)
    -$GOOS
    -	The execution operating system (linux, windows, etc.)
    -$GOFILE
    -	The base name of the file.
    -$GOLINE
    -	The line number of the directive in the source file.
    -$GOPACKAGE
    -	The name of the package of the file containing the directive.
    -$DOLLAR
    -	A dollar sign.
    -
    -

    -Other than variable substitution and quoted-string evaluation, no -special processing such as "globbing" is performed on the command -line. -

    -

    -As a last step before running the command, any invocations of any -environment variables with alphanumeric names, such as $GOFILE or -$HOME, are expanded throughout the command line. The syntax for -variable expansion is $NAME on all operating systems. Due to the -order of evaluation, variables are expanded even inside quoted -strings. If the variable NAME is not set, $NAME expands to the -empty string. -

    -

    -A directive of the form, -

    -
    //go:generate -command xxx args...
    -
    -

    -specifies, for the remainder of this source file only, that the -string xxx represents the command identified by the arguments. This -can be used to create aliases or to handle multiword generators. -For example, -

    -
    //go:generate -command foo go tool foo
    -
    -

    -specifies that the command "foo" represents the generator -"go tool foo". -

    -

    -Generate processes packages in the order given on the command line, -one at a time. If the command line lists .go files, they are treated -as a single package. Within a package, generate processes the -source files in a package in file name order, one at a time. Within -a source file, generate runs generators in the order they appear -in the file, one at a time. -

    -

    -If any generator returns an error exit status, "go generate" skips -all further processing for that package. -

    -

    -The generator is run in the package's source directory. -

    -

    -Go generate accepts one specific flag: -

    -
    -run=""
    -	if non-empty, specifies a regular expression to select
    -	directives whose full original source text (excluding
    -	any trailing spaces and final newline) matches the
    -	expression.
    -
    -

    -It also accepts the standard build flags including -v, -n, and -x. -The -v flag prints the names of packages and files as they are -processed. -The -n flag prints commands that would be executed. -The -x flag prints commands as they are executed. -

    -

    -For more about build flags, see 'go help build'. -

    -

    -For more about specifying packages, see 'go help packages'. -

    -

    Download and install packages and dependencies

    -

    -Usage: -

    -
    go get [-d] [-f] [-fix] [-insecure] [-t] [-u] [build flags] [packages]
    -
    -

    -Get downloads the packages named by the import paths, along with their -dependencies. It then installs the named packages, like 'go install'. -

    -

    -The -d flag instructs get to stop after downloading the packages; that is, -it instructs get not to install the packages. -

    -

    -The -f flag, valid only when -u is set, forces get -u not to verify that -each package has been checked out from the source control repository -implied by its import path. This can be useful if the source is a local fork -of the original. -

    -

    -The -fix flag instructs get to run the fix tool on the downloaded packages -before resolving dependencies or building the code. -

    -

    -The -insecure flag permits fetching from repositories and resolving -custom domains using insecure schemes such as HTTP. Use with caution. -

    -

    -The -t flag instructs get to also download the packages required to build -the tests for the specified packages. -

    -

    -The -u flag instructs get to use the network to update the named packages -and their dependencies. By default, get uses the network to check out -missing packages but does not use it to look for updates to existing packages. -

    -

    -The -v flag enables verbose progress and debug output. -

    -

    -Get also accepts build flags to control the installation. See 'go help build'. -

    -

    -When checking out a new package, get creates the target directory -GOPATH/src/<import-path>. If the GOPATH contains multiple entries, -get uses the first one. For more details see: 'go help gopath'. -

    -

    -When checking out or updating a package, get looks for a branch or tag -that matches the locally installed version of Go. The most important -rule is that if the local installation is running version "go1", get -searches for a branch or tag named "go1". If no such version exists it -retrieves the most recent version of the package. -

    -

    -When go get checks out or updates a Git repository, -it also updates any git submodules referenced by the repository. -

    -

    -Get never checks out or updates code stored in vendor directories. -

    -

    -For more about specifying packages, see 'go help packages'. -

    -

    -For more about how 'go get' finds source code to -download, see 'go help importpath'. -

    -

    -See also: go build, go install, go clean. -

    -

    Compile and install packages and dependencies

    -

    -Usage: -

    -
    go install [build flags] [packages]
    -
    -

    -Install compiles and installs the packages named by the import paths, -along with their dependencies. -

    -

    -For more about the build flags, see 'go help build'. -For more about specifying packages, see 'go help packages'. -

    -

    -See also: go build, go get, go clean. -

    -

    List packages

    -

    -Usage: -

    -
    go list [-e] [-f format] [-json] [build flags] [packages]
    -
    -

    -List lists the packages named by the import paths, one per line. -

    -

    -The default output shows the package import path: -

    -
    bytes
    -encoding/json
    -github.com/gorilla/mux
    -golang.org/x/net/html
    -
    -

    -The -f flag specifies an alternate format for the list, using the -syntax of package template. The default output is equivalent to -f -''. The struct being passed to the template is: -

    -
    type Package struct {
    -    Dir           string // directory containing package sources
    -    ImportPath    string // import path of package in dir
    -    ImportComment string // path in import comment on package statement
    -    Name          string // package name
    -    Doc           string // package documentation string
    -    Target        string // install path
    -    Shlib         string // the shared library that contains this package (only set when -linkshared)
    -    Goroot        bool   // is this package in the Go root?
    -    Standard      bool   // is this package part of the standard Go library?
    -    Stale         bool   // would 'go install' do anything for this package?
    -    StaleReason   string // explanation for Stale==true
    -    Root          string // Go root or Go path dir containing this package
    -    ConflictDir   string // this directory shadows Dir in $GOPATH
    -    BinaryOnly    bool   // binary-only package: cannot be recompiled from sources
    -
    -    // Source files
    -    GoFiles        []string // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles)
    -    CgoFiles       []string // .go sources files that import "C"
    -    IgnoredGoFiles []string // .go sources ignored due to build constraints
    -    CFiles         []string // .c source files
    -    CXXFiles       []string // .cc, .cxx and .cpp source files
    -    MFiles         []string // .m source files
    -    HFiles         []string // .h, .hh, .hpp and .hxx source files
    -    FFiles         []string // .f, .F, .for and .f90 Fortran source files
    -    SFiles         []string // .s source files
    -    SwigFiles      []string // .swig files
    -    SwigCXXFiles   []string // .swigcxx files
    -    SysoFiles      []string // .syso object files to add to archive
    -    TestGoFiles    []string // _test.go files in package
    -    XTestGoFiles   []string // _test.go files outside package
    -
    -    // Cgo directives
    -    CgoCFLAGS    []string // cgo: flags for C compiler
    -    CgoCPPFLAGS  []string // cgo: flags for C preprocessor
    -    CgoCXXFLAGS  []string // cgo: flags for C++ compiler
    -    CgoFFLAGS    []string // cgo: flags for Fortran compiler
    -    CgoLDFLAGS   []string // cgo: flags for linker
    -    CgoPkgConfig []string // cgo: pkg-config names
    -
    -    // Dependency information
    -    Imports      []string // import paths used by this package
    -    Deps         []string // all (recursively) imported dependencies
    -    TestImports  []string // imports from TestGoFiles
    -    XTestImports []string // imports from XTestGoFiles
    -
    -    // Error information
    -    Incomplete bool            // this package or a dependency has an error
    -    Error      *PackageError   // error loading package
    -    DepsErrors []*PackageError // errors loading dependencies
    -}
    -
    -

    -Packages stored in vendor directories report an ImportPath that includes the -path to the vendor directory (for example, "d/vendor/p" instead of "p"), -so that the ImportPath uniquely identifies a given copy of a package. -The Imports, Deps, TestImports, and XTestImports lists also contain these -expanded imports paths. See golang.org/s/go15vendor for more about vendoring. -

    -

    -The error information, if any, is -

    -
    type PackageError struct {
    -    ImportStack   []string // shortest path from package named on command line to this one
    -    Pos           string   // position of error (if present, file:line:col)
    -    Err           string   // the error itself
    -}
    -
    -

    -The template function "join" calls strings.Join. -

    -

    -The template function "context" returns the build context, defined as: -

    -
    type Context struct {
    -	GOARCH        string   // target architecture
    -	GOOS          string   // target operating system
    -	GOROOT        string   // Go root
    -	GOPATH        string   // Go path
    -	CgoEnabled    bool     // whether cgo can be used
    -	UseAllFiles   bool     // use files regardless of +build lines, file names
    -	Compiler      string   // compiler to assume when computing target paths
    -	BuildTags     []string // build constraints to match in +build lines
    -	ReleaseTags   []string // releases the current release is compatible with
    -	InstallSuffix string   // suffix to use in the name of the install dir
    -}
    -
    -

    -For more information about the meaning of these fields see the documentation -for the go/build package's Context type. -

    -

    -The -json flag causes the package data to be printed in JSON format -instead of using the template format. -

    -

    -The -e flag changes the handling of erroneous packages, those that -cannot be found or are malformed. By default, the list command -prints an error to standard error for each erroneous package and -omits the packages from consideration during the usual printing. -With the -e flag, the list command never prints errors to standard -error and instead processes the erroneous packages with the usual -printing. Erroneous packages will have a non-empty ImportPath and -a non-nil Error field; other information may or may not be missing -(zeroed). -

    -

    -For more about build flags, see 'go help build'. -

    -

    -For more about specifying packages, see 'go help packages'. -

    -

    Compile and run Go program

    -

    -Usage: -

    -
    go run [build flags] [-exec xprog] gofiles... [arguments...]
    -
    -

    -Run compiles and runs the main package comprising the named Go source files. -A Go source file is defined to be a file ending in a literal ".go" suffix. -

    -

    -By default, 'go run' runs the compiled binary directly: 'a.out arguments...'. -If the -exec flag is given, 'go run' invokes the binary using xprog: -

    -
    'xprog a.out arguments...'.
    -
    -

    -If the -exec flag is not given, GOOS or GOARCH is different from the system -default, and a program named go_$GOOS_$GOARCH_exec can be found -on the current search path, 'go run' invokes the binary using that program, -for example 'go_nacl_386_exec a.out arguments...'. This allows execution of -cross-compiled programs when a simulator or other execution method is -available. -

    -

    -For more about build flags, see 'go help build'. -

    -

    -See also: go build. -

    -

    Test packages

    -

    -Usage: -

    -
    go test [build/test flags] [packages] [build/test flags & test binary flags]
    -
    -

    -'Go test' automates testing the packages named by the import paths. -It prints a summary of the test results in the format: -

    -
    ok   archive/tar   0.011s
    -FAIL archive/zip   0.022s
    -ok   compress/gzip 0.033s
    -...
    -
    -

    -followed by detailed output for each failed package. -

    -

    -'Go test' recompiles each package along with any files with names matching -the file pattern "*_test.go". -Files whose names begin with "_" (including "_test.go") or "." are ignored. -These additional files can contain test functions, benchmark functions, and -example functions. See 'go help testfunc' for more. -Each listed package causes the execution of a separate test binary. -

    -

    -Test files that declare a package with the suffix "_test" will be compiled as a -separate package, and then linked and run with the main test binary. -

    -

    -The go tool will ignore a directory named "testdata", making it available -to hold ancillary data needed by the tests. -

    -

    -By default, go test needs no arguments. It compiles and tests the package -with source in the current directory, including tests, and runs the tests. -

    -

    -The package is built in a temporary directory so it does not interfere with the -non-test installation. -

    -

    -In addition to the build flags, the flags handled by 'go test' itself are: -

    -
    -args
    -    Pass the remainder of the command line (everything after -args)
    -    to the test binary, uninterpreted and unchanged.
    -    Because this flag consumes the remainder of the command line,
    -    the package list (if present) must appear before this flag.
    -
    --c
    -    Compile the test binary to pkg.test but do not run it
    -    (where pkg is the last element of the package's import path).
    -    The file name can be changed with the -o flag.
    -
    --exec xprog
    -    Run the test binary using xprog. The behavior is the same as
    -    in 'go run'. See 'go help run' for details.
    -
    --i
    -    Install packages that are dependencies of the test.
    -    Do not run the test.
    -
    --o file
    -    Compile the test binary to the named file.
    -    The test still runs (unless -c or -i is specified).
    -
    -

    -The test binary also accepts flags that control execution of the test; these -flags are also accessible by 'go test'. See 'go help testflag' for details. -

    -

    -For more about build flags, see 'go help build'. -For more about specifying packages, see 'go help packages'. -

    -

    -See also: go build, go vet. -

    -

    Run specified go tool

    -

    -Usage: -

    -
    go tool [-n] command [args...]
    -
    -

    -Tool runs the go tool command identified by the arguments. -With no arguments it prints the list of known tools. -

    -

    -The -n flag causes tool to print the command that would be -executed but not execute it. -

    -

    -For more about each tool command, see 'go tool command -h'. -

    -

    Print Go version

    -

    -Usage: -

    -
    go version
    -
    -

    -Version prints the Go version, as reported by runtime.Version. -

    -

    Run go tool vet on packages

    -

    -Usage: -

    -
    go vet [-n] [-x] [build flags] [packages]
    -
    -

    -Vet runs the Go vet command on the packages named by the import paths. -

    -

    -For more about vet, see 'go doc cmd/vet'. -For more about specifying packages, see 'go help packages'. -

    -

    -To run the vet tool with specific options, run 'go tool vet'. -

    -

    -The -n flag prints commands that would be executed. -The -x flag prints commands as they are executed. -

    -

    -For more about build flags, see 'go help build'. -

    -

    -See also: go fmt, go fix. -

    -

    Calling between Go and C

    -

    -There are two different ways to call between Go and C/C++ code. -

    -

    -The first is the cgo tool, which is part of the Go distribution. For -information on how to use it see the cgo documentation (go doc cmd/cgo). -

    -

    -The second is the SWIG program, which is a general tool for -interfacing between languages. For information on SWIG see -http://swig.org/. When running go build, any file with a .swig -extension will be passed to SWIG. Any file with a .swigcxx extension -will be passed to SWIG with the -c++ option. -

    -

    -When either cgo or SWIG is used, go build will pass any .c, .m, .s, -or .S files to the C compiler, and any .cc, .cpp, .cxx files to the C++ -compiler. The CC or CXX environment variables may be set to determine -the C or C++ compiler, respectively, to use. -

    -

    Description of build modes

    -

    -The 'go build' and 'go install' commands take a -buildmode argument which -indicates which kind of object file is to be built. Currently supported values -are: -

    -
    -buildmode=archive
    -	Build the listed non-main packages into .a files. Packages named
    -	main are ignored.
    -
    --buildmode=c-archive
    -	Build the listed main package, plus all packages it imports,
    -	into a C archive file. The only callable symbols will be those
    -	functions exported using a cgo //export comment. Requires
    -	exactly one main package to be listed.
    -
    --buildmode=c-shared
    -	Build the listed main packages, plus all packages that they
    -	import, into C shared libraries. The only callable symbols will
    -	be those functions exported using a cgo //export comment.
    -	Non-main packages are ignored.
    -
    --buildmode=default
    -	Listed main packages are built into executables and listed
    -	non-main packages are built into .a files (the default
    -	behavior).
    -
    --buildmode=shared
    -	Combine all the listed non-main packages into a single shared
    -	library that will be used when building with the -linkshared
    -	option. Packages named main are ignored.
    -
    --buildmode=exe
    -	Build the listed main packages and everything they import into
    -	executables. Packages not named main are ignored.
    -
    --buildmode=pie
    -	Build the listed main packages and everything they import into
    -	position independent executables (PIE). Packages not named
    -	main are ignored.
    -
    --buildmode=plugin
    -	Build the listed main packages, plus all packages that they
    -	import, into a Go plugin. Packages not named main are ignored.
    -
    -

    File types

    -

    -The go command examines the contents of a restricted set of files -in each directory. It identifies which files to examine based on -the extension of the file name. These extensions are: -

    -
    .go
    -	Go source files.
    -.c, .h
    -	C source files.
    -	If the package uses cgo or SWIG, these will be compiled with the
    -	OS-native compiler (typically gcc); otherwise they will
    -	trigger an error.
    -.cc, .cpp, .cxx, .hh, .hpp, .hxx
    -	C++ source files. Only useful with cgo or SWIG, and always
    -	compiled with the OS-native compiler.
    -.m
    -	Objective-C source files. Only useful with cgo, and always
    -	compiled with the OS-native compiler.
    -.s, .S
    -	Assembler source files.
    -	If the package uses cgo or SWIG, these will be assembled with the
    -	OS-native assembler (typically gcc (sic)); otherwise they
    -	will be assembled with the Go assembler.
    -.swig, .swigcxx
    -	SWIG definition files.
    -.syso
    -	System object files.
    -
    -

    -Files of each of these types except .syso may contain build -constraints, but the go command stops scanning for build constraints -at the first item in the file that is not a blank line or //-style -line comment. See the go/build package documentation for -more details. -

    -

    -Non-test Go source files can also include a //go:binary-only-package -comment, indicating that the package sources are included -for documentation only and must not be used to build the -package binary. This enables distribution of Go packages in -their compiled form alone. See the go/build package documentation -for more details. -

    -

    GOPATH environment variable

    -

    -The Go path is used to resolve import statements. -It is implemented by and documented in the go/build package. -

    -

    -The GOPATH environment variable lists places to look for Go code. -On Unix, the value is a colon-separated string. -On Windows, the value is a semicolon-separated string. -On Plan 9, the value is a list. -

    -

    -If the environment variable is unset, GOPATH defaults -to a subdirectory named "go" in the user's home directory -($HOME/go on Unix, %USERPROFILE%\go on Windows), -unless that directory holds a Go distribution. -Run "go env GOPATH" to see the current GOPATH. -

    -

    -See https://golang.org/wiki/SettingGOPATH to set a custom GOPATH. -

    -

    -Each directory listed in GOPATH must have a prescribed structure: -

    -

    -The src directory holds source code. The path below src -determines the import path or executable name. -

    -

    -The pkg directory holds installed package objects. -As in the Go tree, each target operating system and -architecture pair has its own subdirectory of pkg -(pkg/GOOS_GOARCH). -

    -

    -If DIR is a directory listed in the GOPATH, a package with -source in DIR/src/foo/bar can be imported as "foo/bar" and -has its compiled form installed to "DIR/pkg/GOOS_GOARCH/foo/bar.a". -

    -

    -The bin directory holds compiled commands. -Each command is named for its source directory, but only -the final element, not the entire path. That is, the -command with source in DIR/src/foo/quux is installed into -DIR/bin/quux, not DIR/bin/foo/quux. The "foo/" prefix is stripped -so that you can add DIR/bin to your PATH to get at the -installed commands. If the GOBIN environment variable is -set, commands are installed to the directory it names instead -of DIR/bin. GOBIN must be an absolute path. -

    -

    -Here's an example directory layout: -

    -
    GOPATH=/home/user/go
    -
    -/home/user/go/
    -    src/
    -        foo/
    -            bar/               (go code in package bar)
    -                x.go
    -            quux/              (go code in package main)
    -                y.go
    -    bin/
    -        quux                   (installed command)
    -    pkg/
    -        linux_amd64/
    -            foo/
    -                bar.a          (installed package object)
    -
    -

    -Go searches each directory listed in GOPATH to find source code, -but new packages are always downloaded into the first directory -in the list. -

    -

    -See https://golang.org/doc/code.html for an example. -

    -

    Internal Directories

    -

    -Code in or below a directory named "internal" is importable only -by code in the directory tree rooted at the parent of "internal". -Here's an extended version of the directory layout above: -

    -
    /home/user/go/
    -    src/
    -        crash/
    -            bang/              (go code in package bang)
    -                b.go
    -        foo/                   (go code in package foo)
    -            f.go
    -            bar/               (go code in package bar)
    -                x.go
    -            internal/
    -                baz/           (go code in package baz)
    -                    z.go
    -            quux/              (go code in package main)
    -                y.go
    -
    -

    -The code in z.go is imported as "foo/internal/baz", but that -import statement can only appear in source files in the subtree -rooted at foo. The source files foo/f.go, foo/bar/x.go, and -foo/quux/y.go can all import "foo/internal/baz", but the source file -crash/bang/b.go cannot. -

    -

    -See https://golang.org/s/go14internal for details. -

    -

    Vendor Directories

    -

    -Go 1.6 includes support for using local copies of external dependencies -to satisfy imports of those dependencies, often referred to as vendoring. -

    -

    -Code below a directory named "vendor" is importable only -by code in the directory tree rooted at the parent of "vendor", -and only using an import path that omits the prefix up to and -including the vendor element. -

    -

    -Here's the example from the previous section, -but with the "internal" directory renamed to "vendor" -and a new foo/vendor/crash/bang directory added: -

    -
    /home/user/go/
    -    src/
    -        crash/
    -            bang/              (go code in package bang)
    -                b.go
    -        foo/                   (go code in package foo)
    -            f.go
    -            bar/               (go code in package bar)
    -                x.go
    -            vendor/
    -                crash/
    -                    bang/      (go code in package bang)
    -                        b.go
    -                baz/           (go code in package baz)
    -                    z.go
    -            quux/              (go code in package main)
    -                y.go
    -
    -

    -The same visibility rules apply as for internal, but the code -in z.go is imported as "baz", not as "foo/vendor/baz". -

    -

    -Code in vendor directories deeper in the source tree shadows -code in higher directories. Within the subtree rooted at foo, an import -of "crash/bang" resolves to "foo/vendor/crash/bang", not the -top-level "crash/bang". -

    -

    -Code in vendor directories is not subject to import path -checking (see 'go help importpath'). -

    -

    -When 'go get' checks out or updates a git repository, it now also -updates submodules. -

    -

    -Vendor directories do not affect the placement of new repositories -being checked out for the first time by 'go get': those are always -placed in the main GOPATH, never in a vendor subtree. -

    -

    -See https://golang.org/s/go15vendor for details. -

    -

    Environment variables

    -

    -The go command, and the tools it invokes, examine a few different -environment variables. For many of these, you can see the default -value of on your system by running 'go env NAME', where NAME is the -name of the variable. -

    -

    -General-purpose environment variables: -

    -
    GCCGO
    -	The gccgo command to run for 'go build -compiler=gccgo'.
    -GOARCH
    -	The architecture, or processor, for which to compile code.
    -	Examples are amd64, 386, arm, ppc64.
    -GOBIN
    -	The directory where 'go install' will install a command.
    -GOOS
    -	The operating system for which to compile code.
    -	Examples are linux, darwin, windows, netbsd.
    -GOPATH
    -	For more details see: 'go help gopath'.
    -GORACE
    -	Options for the race detector.
    -	See https://golang.org/doc/articles/race_detector.html.
    -GOROOT
    -	The root of the go tree.
    -
    -

    -Environment variables for use with cgo: -

    -
    CC
    -	The command to use to compile C code.
    -CGO_ENABLED
    -	Whether the cgo command is supported.  Either 0 or 1.
    -CGO_CFLAGS
    -	Flags that cgo will pass to the compiler when compiling
    -	C code.
    -CGO_CPPFLAGS
    -	Flags that cgo will pass to the compiler when compiling
    -	C or C++ code.
    -CGO_CXXFLAGS
    -	Flags that cgo will pass to the compiler when compiling
    -	C++ code.
    -CGO_FFLAGS
    -	Flags that cgo will pass to the compiler when compiling
    -	Fortran code.
    -CGO_LDFLAGS
    -	Flags that cgo will pass to the compiler when linking.
    -CXX
    -	The command to use to compile C++ code.
    -PKG_CONFIG
    -	Path to pkg-config tool.
    -
    -

    -Architecture-specific environment variables: -

    -
    GOARM
    -	For GOARCH=arm, the ARM architecture for which to compile.
    -	Valid values are 5, 6, 7.
    -GO386
    -	For GOARCH=386, the floating point instruction set.
    -	Valid values are 387, sse2.
    -
    -

    -Special-purpose environment variables: -

    -
    GOROOT_FINAL
    -	The root of the installed Go tree, when it is
    -	installed in a location other than where it is built.
    -	File names in stack traces are rewritten from GOROOT to
    -	GOROOT_FINAL.
    -GO_EXTLINK_ENABLED
    -	Whether the linker should use external linking mode
    -	when using -linkmode=auto with code that uses cgo.
    -	Set to 0 to disable external linking mode, 1 to enable it.
    -GIT_ALLOW_PROTOCOL
    -	Defined by Git. A colon-separated list of schemes that are allowed to be used
    -	with git fetch/clone. If set, any scheme not explicitly mentioned will be
    -	considered insecure by 'go get'.
    -
    -

    Import path syntax

    -

    -An import path (see 'go help packages') denotes a package stored in the local -file system. In general, an import path denotes either a standard package (such -as "unicode/utf8") or a package found in one of the work spaces (For more -details see: 'go help gopath'). -

    -

    Relative import paths

    -

    -An import path beginning with ./ or ../ is called a relative path. -The toolchain supports relative import paths as a shortcut in two ways. -

    -

    -First, a relative path can be used as a shorthand on the command line. -If you are working in the directory containing the code imported as -"unicode" and want to run the tests for "unicode/utf8", you can type -"go test ./utf8" instead of needing to specify the full path. -Similarly, in the reverse situation, "go test .." will test "unicode" from -the "unicode/utf8" directory. Relative patterns are also allowed, like -"go test ./..." to test all subdirectories. See 'go help packages' for details -on the pattern syntax. -

    -

    -Second, if you are compiling a Go program not in a work space, -you can use a relative path in an import statement in that program -to refer to nearby code also not in a work space. -This makes it easy to experiment with small multipackage programs -outside of the usual work spaces, but such programs cannot be -installed with "go install" (there is no work space in which to install them), -so they are rebuilt from scratch each time they are built. -To avoid ambiguity, Go programs cannot use relative import paths -within a work space. -

    -

    Remote import paths

    -

    -Certain import paths also -describe how to obtain the source code for the package using -a revision control system. -

    -

    -A few common code hosting sites have special syntax: -

    -
    Bitbucket (Git, Mercurial)
    -
    -	import "bitbucket.org/user/project"
    -	import "bitbucket.org/user/project/sub/directory"
    -
    -GitHub (Git)
    -
    -	import "github.com/user/project"
    -	import "github.com/user/project/sub/directory"
    -
    -Launchpad (Bazaar)
    -
    -	import "launchpad.net/project"
    -	import "launchpad.net/project/series"
    -	import "launchpad.net/project/series/sub/directory"
    -
    -	import "launchpad.net/~user/project/branch"
    -	import "launchpad.net/~user/project/branch/sub/directory"
    -
    -IBM DevOps Services (Git)
    -
    -	import "hub.jazz.net/git/user/project"
    -	import "hub.jazz.net/git/user/project/sub/directory"
    -
    -

    -For code hosted on other servers, import paths may either be qualified -with the version control type, or the go tool can dynamically fetch -the import path over https/http and discover where the code resides -from a <meta> tag in the HTML. -

    -

    -To declare the code location, an import path of the form -

    -
    repository.vcs/path
    -
    -

    -specifies the given repository, with or without the .vcs suffix, -using the named version control system, and then the path inside -that repository. The supported version control systems are: -

    -
    Bazaar      .bzr
    -Git         .git
    -Mercurial   .hg
    -Subversion  .svn
    -
    -

    -For example, -

    -
    import "example.org/user/foo.hg"
    -
    -

    -denotes the root directory of the Mercurial repository at -example.org/user/foo or foo.hg, and -

    -
    import "example.org/repo.git/foo/bar"
    -
    -

    -denotes the foo/bar directory of the Git repository at -example.org/repo or repo.git. -

    -

    -When a version control system supports multiple protocols, -each is tried in turn when downloading. For example, a Git -download tries https://, then git+ssh://. -

    -

    -By default, downloads are restricted to known secure protocols -(e.g. https, ssh). To override this setting for Git downloads, the -GIT_ALLOW_PROTOCOL environment variable can be set (For more details see: -'go help environment'). -

    -

    -If the import path is not a known code hosting site and also lacks a -version control qualifier, the go tool attempts to fetch the import -over https/http and looks for a <meta> tag in the document's HTML -<head>. -

    -

    -The meta tag has the form: -

    -
    <meta name="go-import" content="import-prefix vcs repo-root">
    -
    -

    -The import-prefix is the import path corresponding to the repository -root. It must be a prefix or an exact match of the package being -fetched with "go get". If it's not an exact match, another http -request is made at the prefix to verify the <meta> tags match. -

    -

    -The meta tag should appear as early in the file as possible. -In particular, it should appear before any raw JavaScript or CSS, -to avoid confusing the go command's restricted parser. -

    -

    -The vcs is one of "git", "hg", "svn", etc, -

    -

    -The repo-root is the root of the version control system -containing a scheme and not containing a .vcs qualifier. -

    -

    -For example, -

    -
    import "example.org/pkg/foo"
    -
    -

    -will result in the following requests: -

    -
    https://example.org/pkg/foo?go-get=1 (preferred)
    -http://example.org/pkg/foo?go-get=1  (fallback, only with -insecure)
    -
    -

    -If that page contains the meta tag -

    -
    <meta name="go-import" content="example.org git https://code.org/r/p/exproj">
    -
    -

    -the go tool will verify that https://example.org/?go-get=1 contains the -same meta tag and then git clone https://code.org/r/p/exproj into -GOPATH/src/example.org. -

    -

    -New downloaded packages are written to the first directory listed in the GOPATH -environment variable (For more details see: 'go help gopath'). -

    -

    -The go command attempts to download the version of the -package appropriate for the Go release being used. -Run 'go help get' for more. -

    -

    Import path checking

    -

    -When the custom import path feature described above redirects to a -known code hosting site, each of the resulting packages has two possible -import paths, using the custom domain or the known hosting site. -

    -

    -A package statement is said to have an "import comment" if it is immediately -followed (before the next newline) by a comment of one of these two forms: -

    -
    package math // import "path"
    -package math /* import "path" */
    -
    -

    -The go command will refuse to install a package with an import comment -unless it is being referred to by that import path. In this way, import comments -let package authors make sure the custom import path is used and not a -direct path to the underlying code hosting site. -

    -

    -Import path checking is disabled for code found within vendor trees. -This makes it possible to copy code into alternate locations in vendor trees -without needing to update import comments. -

    -

    -See https://golang.org/s/go14customimport for details. -

    -

    Description of package lists

    -

    -Many commands apply to a set of packages: -

    -
    go action [packages]
    -
    -

    -Usually, [packages] is a list of import paths. -

    -

    -An import path that is a rooted path or that begins with -a . or .. element is interpreted as a file system path and -denotes the package in that directory. -

    -

    -Otherwise, the import path P denotes the package found in -the directory DIR/src/P for some DIR listed in the GOPATH -environment variable (For more details see: 'go help gopath'). -

    -

    -If no import paths are given, the action applies to the -package in the current directory. -

    -

    -There are four reserved names for paths that should not be used -for packages to be built with the go tool: -

    -

    -- "main" denotes the top-level package in a stand-alone executable. -

    -

    -- "all" expands to all package directories found in all the GOPATH -trees. For example, 'go list all' lists all the packages on the local -system. -

    -

    -- "std" is like all but expands to just the packages in the standard -Go library. -

    -

    -- "cmd" expands to the Go repository's commands and their -internal libraries. -

    -

    -Import paths beginning with "cmd/" only match source code in -the Go repository. -

    -

    -An import path is a pattern if it includes one or more "..." wildcards, -each of which can match any string, including the empty string and -strings containing slashes. Such a pattern expands to all package -directories found in the GOPATH trees with names matching the -patterns. As a special case, x/... matches x as well as x's subdirectories. -For example, net/... expands to net and packages in its subdirectories. -

    -

    -An import path can also name a package to be downloaded from -a remote repository. Run 'go help importpath' for details. -

    -

    -Every package in a program must have a unique import path. -By convention, this is arranged by starting each path with a -unique prefix that belongs to you. For example, paths used -internally at Google all begin with 'google', and paths -denoting remote repositories begin with the path to the code, -such as 'github.com/user/repo'. -

    -

    -Packages in a program need not have unique package names, -but there are two reserved package names with special meaning. -The name main indicates a command, not a library. -Commands are built into binaries and cannot be imported. -The name documentation indicates documentation for -a non-Go program in the directory. Files in package documentation -are ignored by the go command. -

    -

    -As a special case, if the package list is a list of .go files from a -single directory, the command is applied to a single synthesized -package made up of exactly those files, ignoring any build constraints -in those files and ignoring any other files in the directory. -

    -

    -Directory and file names that begin with "." or "_" are ignored -by the go tool, as are directories named "testdata". -

    -

    Description of testing flags

    -

    -The 'go test' command takes both flags that apply to 'go test' itself -and flags that apply to the resulting test binary. -

    -

    -Several of the flags control profiling and write an execution profile -suitable for "go tool pprof"; run "go tool pprof -h" for more -information. The --alloc_space, --alloc_objects, and --show_bytes -options of pprof control how the information is presented. -

    -

    -The following flags are recognized by the 'go test' command and -control the execution of any test: -

    -
    -bench regexp
    -    Run (sub)benchmarks matching a regular expression.
    -    The given regular expression is split into smaller ones by
    -    top-level '/', where each must match the corresponding part of a
    -    benchmark's identifier.
    -    By default, no benchmarks run. To run all benchmarks,
    -    use '-bench .' or '-bench=.'.
    -
    --benchtime t
    -    Run enough iterations of each benchmark to take t, specified
    -    as a time.Duration (for example, -benchtime 1h30s).
    -    The default is 1 second (1s).
    -
    --count n
    -    Run each test and benchmark n times (default 1).
    -    If -cpu is set, run n times for each GOMAXPROCS value.
    -    Examples are always run once.
    -
    --cover
    -    Enable coverage analysis.
    -
    --covermode set,count,atomic
    -    Set the mode for coverage analysis for the package[s]
    -    being tested. The default is "set" unless -race is enabled,
    -    in which case it is "atomic".
    -    The values:
    -	set: bool: does this statement run?
    -	count: int: how many times does this statement run?
    -	atomic: int: count, but correct in multithreaded tests;
    -		significantly more expensive.
    -    Sets -cover.
    -
    --coverpkg pkg1,pkg2,pkg3
    -    Apply coverage analysis in each test to the given list of packages.
    -    The default is for each test to analyze only the package being tested.
    -    Packages are specified as import paths.
    -    Sets -cover.
    -
    --cpu 1,2,4
    -    Specify a list of GOMAXPROCS values for which the tests or
    -    benchmarks should be executed.  The default is the current value
    -    of GOMAXPROCS.
    -
    --parallel n
    -    Allow parallel execution of test functions that call t.Parallel.
    -    The value of this flag is the maximum number of tests to run
    -    simultaneously; by default, it is set to the value of GOMAXPROCS.
    -    Note that -parallel only applies within a single test binary.
    -    The 'go test' command may run tests for different packages
    -    in parallel as well, according to the setting of the -p flag
    -    (see 'go help build').
    -
    --run regexp
    -    Run only those tests and examples matching the regular expression.
    -    For tests the regular expression is split into smaller ones by
    -    top-level '/', where each must match the corresponding part of a
    -    test's identifier.
    -
    --short
    -    Tell long-running tests to shorten their run time.
    -    It is off by default but set during all.bash so that installing
    -    the Go tree can run a sanity check but not spend time running
    -    exhaustive tests.
    -
    --timeout t
    -    If a test runs longer than t, panic.
    -    The default is 10 minutes (10m).
    -
    --v
    -    Verbose output: log all tests as they are run. Also print all
    -    text from Log and Logf calls even if the test succeeds.
    -
    -

    -The following flags are also recognized by 'go test' and can be used to -profile the tests during execution: -

    -
    -benchmem
    -    Print memory allocation statistics for benchmarks.
    -
    --blockprofile block.out
    -    Write a goroutine blocking profile to the specified file
    -    when all tests are complete.
    -    Writes test binary as -c would.
    -
    --blockprofilerate n
    -    Control the detail provided in goroutine blocking profiles by
    -    calling runtime.SetBlockProfileRate with n.
    -    See 'go doc runtime.SetBlockProfileRate'.
    -    The profiler aims to sample, on average, one blocking event every
    -    n nanoseconds the program spends blocked.  By default,
    -    if -test.blockprofile is set without this flag, all blocking events
    -    are recorded, equivalent to -test.blockprofilerate=1.
    -
    --coverprofile cover.out
    -    Write a coverage profile to the file after all tests have passed.
    -    Sets -cover.
    -
    --cpuprofile cpu.out
    -    Write a CPU profile to the specified file before exiting.
    -    Writes test binary as -c would.
    -
    --memprofile mem.out
    -    Write a memory profile to the file after all tests have passed.
    -    Writes test binary as -c would.
    -
    --memprofilerate n
    -    Enable more precise (and expensive) memory profiles by setting
    -    runtime.MemProfileRate.  See 'go doc runtime.MemProfileRate'.
    -    To profile all memory allocations, use -test.memprofilerate=1
    -    and pass --alloc_space flag to the pprof tool.
    -
    --mutexprofile mutex.out
    -    Write a mutex contention profile to the specified file
    -    when all tests are complete.
    -    Writes test binary as -c would.
    -
    --mutexprofilefraction n
    -    Sample 1 in n stack traces of goroutines holding a
    -    contended mutex.
    -
    --outputdir directory
    -    Place output files from profiling in the specified directory,
    -    by default the directory in which "go test" is running.
    -
    --trace trace.out
    -    Write an execution trace to the specified file before exiting.
    -
    -

    -Each of these flags is also recognized with an optional 'test.' prefix, -as in -test.v. When invoking the generated test binary (the result of -'go test -c') directly, however, the prefix is mandatory. -

    -

    -The 'go test' command rewrites or removes recognized flags, -as appropriate, both before and after the optional package list, -before invoking the test binary. -

    -

    -For instance, the command -

    -
    go test -v -myflag testdata -cpuprofile=prof.out -x
    -
    -

    -will compile the test binary and then run it as -

    -
    pkg.test -test.v -myflag testdata -test.cpuprofile=prof.out
    -
    -

    -(The -x flag is removed because it applies only to the go command's -execution, not to the test itself.) -

    -

    -The test flags that generate profiles (other than for coverage) also -leave the test binary in pkg.test for use when analyzing the profiles. -

    -

    -When 'go test' runs a test binary, it does so from within the -corresponding package's source code directory. Depending on the test, -it may be necessary to do the same when invoking a generated test -binary directly. -

    -

    -The command-line package list, if present, must appear before any -flag not known to the go test command. Continuing the example above, -the package list would have to appear before -myflag, but could appear -on either side of -v. -

    -

    -To keep an argument for a test binary from being interpreted as a -known flag or a package name, use -args (see 'go help test') which -passes the remainder of the command line through to the test binary -uninterpreted and unaltered. -

    -

    -For instance, the command -

    -
    go test -v -args -x -v
    -
    -

    -will compile the test binary and then run it as -

    -
    pkg.test -test.v -x -v
    -
    -

    -Similarly, -

    -
    go test -args math
    -
    -

    -will compile the test binary and then run it as -

    -
    pkg.test math
    -
    -

    -In the first example, the -x and the second -v are passed through to the -test binary unchanged and with no effect on the go command itself. -In the second example, the argument math is passed through to the test -binary, instead of being interpreted as the package list. -

    -

    Description of testing functions

    -

    -The 'go test' command expects to find test, benchmark, and example functions -in the "*_test.go" files corresponding to the package under test. -

    -

    -A test function is one named TestXXX (where XXX is any alphanumeric string -not starting with a lower case letter) and should have the signature, -

    -
    func TestXXX(t *testing.T) { ... }
    -
    -

    -A benchmark function is one named BenchmarkXXX and should have the signature, -

    -
    func BenchmarkXXX(b *testing.B) { ... }
    -
    -

    -An example function is similar to a test function but, instead of using -*testing.T to report success or failure, prints output to os.Stdout. -If the last comment in the function starts with "Output:" then the output -is compared exactly against the comment (see examples below). If the last -comment begins with "Unordered output:" then the output is compared to the -comment, however the order of the lines is ignored. An example with no such -comment is compiled but not executed. An example with no text after -"Output:" is compiled, executed, and expected to produce no output. -

    -

    -Godoc displays the body of ExampleXXX to demonstrate the use -of the function, constant, or variable XXX. An example of a method M with -receiver type T or *T is named ExampleT_M. There may be multiple examples -for a given function, constant, or variable, distinguished by a trailing _xxx, -where xxx is a suffix not beginning with an upper case letter. -

    -

    -Here is an example of an example: -

    -
    func ExamplePrintln() {
    -	Println("The output of\nthis example.")
    -	// Output: The output of
    -	// this example.
    -}
    -
    -

    -Here is another example where the ordering of the output is ignored: -

    -
    func ExamplePerm() {
    -	for _, value := range Perm(4) {
    -		fmt.Println(value)
    -	}
    -
    -	// Unordered output: 4
    -	// 2
    -	// 1
    -	// 3
    -	// 0
    -}
    -
    -

    -The entire test file is presented as the example when it contains a single -example function, at least one other function, type, variable, or constant -declaration, and no test or benchmark functions. -

    -

    -See the documentation of the testing package for more information. -

    - - - -
    -
    - - - - - - - - -`)) diff --git a/vendor/golang.org/x/net/http2/h2i/h2i.go b/vendor/golang.org/x/net/http2/h2i/h2i.go index 76c7787..228edf8 100644 --- a/vendor/golang.org/x/net/http2/h2i/h2i.go +++ b/vendor/golang.org/x/net/http2/h2i/h2i.go @@ -88,14 +88,6 @@ func withPort(host string) string { return host } -// withoutPort strips the port from addr if present. -func withoutPort(addr string) string { - if h, _, err := net.SplitHostPort(addr); err == nil { - return h - } - return addr -} - // h2i is the app's state. type h2i struct { host string @@ -142,7 +134,7 @@ func main() { func (app *h2i) Main() error { cfg := &tls.Config{ - ServerName: withoutPort(app.host), + ServerName: app.host, NextProtos: strings.Split(*flagNextProto, ","), InsecureSkipVerify: *flagInsecure, } @@ -481,7 +473,7 @@ func (app *h2i) encodeHeaders(req *http.Request) []byte { host = req.URL.Host } - path := req.RequestURI + path := req.URL.Path if path == "" { path = "/" } diff --git a/vendor/golang.org/x/net/http2/hpack/encode.go b/vendor/golang.org/x/net/http2/hpack/encode.go index 54726c2..f9bb033 100644 --- a/vendor/golang.org/x/net/http2/hpack/encode.go +++ b/vendor/golang.org/x/net/http2/hpack/encode.go @@ -39,14 +39,13 @@ func NewEncoder(w io.Writer) *Encoder { tableSizeUpdate: false, w: w, } - e.dynTab.table.init() e.dynTab.setMaxSize(initialHeaderTableSize) return e } // WriteField encodes f into a single Write to e's underlying Writer. // This function may also produce bytes for "Header Table Size Update" -// if necessary. If produced, it is done before encoding f. +// if necessary. If produced, it is done before encoding f. func (e *Encoder) WriteField(f HeaderField) error { e.buf = e.buf[:0] @@ -89,17 +88,29 @@ func (e *Encoder) WriteField(f HeaderField) error { // only name matches, i points to that index and nameValueMatch // becomes false. func (e *Encoder) searchTable(f HeaderField) (i uint64, nameValueMatch bool) { - i, nameValueMatch = staticTable.search(f) - if nameValueMatch { - return i, true + for idx, hf := range staticTable { + if !constantTimeStringCompare(hf.Name, f.Name) { + continue + } + if i == 0 { + i = uint64(idx + 1) + } + if f.Sensitive { + continue + } + if !constantTimeStringCompare(hf.Value, f.Value) { + continue + } + i = uint64(idx + 1) + nameValueMatch = true + return } - j, nameValueMatch := e.dynTab.table.search(f) + j, nameValueMatch := e.dynTab.search(f) if nameValueMatch || (i == 0 && j != 0) { - return j + uint64(staticTable.len()), nameValueMatch + i = j + uint64(len(staticTable)) } - - return i, false + return } // SetMaxDynamicTableSize changes the dynamic header table size to v. diff --git a/vendor/golang.org/x/net/http2/hpack/encode_test.go b/vendor/golang.org/x/net/http2/hpack/encode_test.go index 05f12db..92286f3 100644 --- a/vendor/golang.org/x/net/http2/hpack/encode_test.go +++ b/vendor/golang.org/x/net/http2/hpack/encode_test.go @@ -7,8 +7,6 @@ package hpack import ( "bytes" "encoding/hex" - "fmt" - "math/rand" "reflect" "strings" "testing" @@ -103,20 +101,17 @@ func TestEncoderSearchTable(t *testing.T) { wantMatch bool }{ // Name and Value match - {pair("foo", "bar"), uint64(staticTable.len()) + 3, true}, - {pair("blake", "miz"), uint64(staticTable.len()) + 2, true}, + {pair("foo", "bar"), uint64(len(staticTable) + 3), true}, + {pair("blake", "miz"), uint64(len(staticTable) + 2), true}, {pair(":method", "GET"), 2, true}, - // Only name match because Sensitive == true. This is allowed to match - // any ":method" entry. The current implementation uses the last entry - // added in newStaticTable. - {HeaderField{":method", "GET", true}, 3, false}, + // Only name match because Sensitive == true + {HeaderField{":method", "GET", true}, 2, false}, // Only Name matches - {pair("foo", "..."), uint64(staticTable.len()) + 3, false}, - {pair("blake", "..."), uint64(staticTable.len()) + 2, false}, - // As before, this is allowed to match any ":method" entry. - {pair(":method", "..."), 3, false}, + {pair("foo", "..."), uint64(len(staticTable) + 3), false}, + {pair("blake", "..."), uint64(len(staticTable) + 2), false}, + {pair(":method", "..."), 2, false}, // None match {pair("foo-", "bar"), 0, false}, @@ -333,54 +328,3 @@ func TestEncoderSetMaxDynamicTableSizeLimit(t *testing.T) { func removeSpace(s string) string { return strings.Replace(s, " ", "", -1) } - -func BenchmarkEncoderSearchTable(b *testing.B) { - e := NewEncoder(nil) - - // A sample of possible header fields. - // This is not based on any actual data from HTTP/2 traces. - var possible []HeaderField - for _, f := range staticTable.ents { - if f.Value == "" { - possible = append(possible, f) - continue - } - // Generate 5 random values, except for cookie and set-cookie, - // which we know can have many values in practice. - num := 5 - if f.Name == "cookie" || f.Name == "set-cookie" { - num = 25 - } - for i := 0; i < num; i++ { - f.Value = fmt.Sprintf("%s-%d", f.Name, i) - possible = append(possible, f) - } - } - for k := 0; k < 10; k++ { - f := HeaderField{ - Name: fmt.Sprintf("x-header-%d", k), - Sensitive: rand.Int()%2 == 0, - } - for i := 0; i < 5; i++ { - f.Value = fmt.Sprintf("%s-%d", f.Name, i) - possible = append(possible, f) - } - } - - // Add a random sample to the dynamic table. This very loosely simulates - // a history of 100 requests with 20 header fields per request. - for r := 0; r < 100*20; r++ { - f := possible[rand.Int31n(int32(len(possible)))] - // Skip if this is in the staticTable verbatim. - if _, has := staticTable.search(f); !has { - e.dynTab.add(f) - } - } - - b.ResetTimer() - for n := 0; n < b.N; n++ { - for _, f := range possible { - e.searchTable(f) - } - } -} diff --git a/vendor/golang.org/x/net/http2/hpack/hpack.go b/vendor/golang.org/x/net/http2/hpack/hpack.go index 176644a..135b9f6 100644 --- a/vendor/golang.org/x/net/http2/hpack/hpack.go +++ b/vendor/golang.org/x/net/http2/hpack/hpack.go @@ -61,7 +61,7 @@ func (hf HeaderField) String() string { func (hf HeaderField) Size() uint32 { // http://http2.github.io/http2-spec/compression.html#rfc.section.4.1 // "The size of the dynamic table is the sum of the size of - // its entries. The size of an entry is the sum of its name's + // its entries. The size of an entry is the sum of its name's // length in octets (as defined in Section 5.2), its value's // length in octets (see Section 5.2), plus 32. The size of // an entry is calculated using the length of the name and @@ -102,7 +102,6 @@ func NewDecoder(maxDynamicTableSize uint32, emitFunc func(f HeaderField)) *Decod emit: emitFunc, emitEnabled: true, } - d.dynTab.table.init() d.dynTab.allowedMaxSize = maxDynamicTableSize d.dynTab.setMaxSize(maxDynamicTableSize) return d @@ -155,9 +154,12 @@ func (d *Decoder) SetAllowedMaxDynamicTableSize(v uint32) { } type dynamicTable struct { + // ents is the FIFO described at // http://http2.github.io/http2-spec/compression.html#rfc.section.2.3.2 - table headerFieldTable - size uint32 // in bytes + // The newest (low index) is append at the end, and items are + // evicted from the front. + ents []HeaderField + size uint32 maxSize uint32 // current maxSize allowedMaxSize uint32 // maxSize may go up to this, inclusive } @@ -167,45 +169,95 @@ func (dt *dynamicTable) setMaxSize(v uint32) { dt.evict() } +// TODO: change dynamicTable to be a struct with a slice and a size int field, +// per http://http2.github.io/http2-spec/compression.html#rfc.section.4.1: +// +// +// Then make add increment the size. maybe the max size should move from Decoder to +// dynamicTable and add should return an ok bool if there was enough space. +// +// Later we'll need a remove operation on dynamicTable. + func (dt *dynamicTable) add(f HeaderField) { - dt.table.addEntry(f) + dt.ents = append(dt.ents, f) dt.size += f.Size() dt.evict() } -// If we're too big, evict old stuff. +// If we're too big, evict old stuff (front of the slice) func (dt *dynamicTable) evict() { - var n int - for dt.size > dt.maxSize && n < dt.table.len() { - dt.size -= dt.table.ents[n].Size() - n++ + base := dt.ents // keep base pointer of slice + for dt.size > dt.maxSize { + dt.size -= dt.ents[0].Size() + dt.ents = dt.ents[1:] } - dt.table.evictOldest(n) + + // Shift slice contents down if we evicted things. + if len(dt.ents) != len(base) { + copy(base, dt.ents) + dt.ents = base[:len(dt.ents)] + } +} + +// constantTimeStringCompare compares string a and b in a constant +// time manner. +func constantTimeStringCompare(a, b string) bool { + if len(a) != len(b) { + return false + } + + c := byte(0) + + for i := 0; i < len(a); i++ { + c |= a[i] ^ b[i] + } + + return c == 0 +} + +// Search searches f in the table. The return value i is 0 if there is +// no name match. If there is name match or name/value match, i is the +// index of that entry (1-based). If both name and value match, +// nameValueMatch becomes true. +func (dt *dynamicTable) search(f HeaderField) (i uint64, nameValueMatch bool) { + l := len(dt.ents) + for j := l - 1; j >= 0; j-- { + ent := dt.ents[j] + if !constantTimeStringCompare(ent.Name, f.Name) { + continue + } + if i == 0 { + i = uint64(l - j) + } + if f.Sensitive { + continue + } + if !constantTimeStringCompare(ent.Value, f.Value) { + continue + } + i = uint64(l - j) + nameValueMatch = true + return + } + return } func (d *Decoder) maxTableIndex() int { - // This should never overflow. RFC 7540 Section 6.5.2 limits the size of - // the dynamic table to 2^32 bytes, where each entry will occupy more than - // one byte. Further, the staticTable has a fixed, small length. - return d.dynTab.table.len() + staticTable.len() + return len(d.dynTab.ents) + len(staticTable) } func (d *Decoder) at(i uint64) (hf HeaderField, ok bool) { - // See Section 2.3.3. - if i == 0 { + if i < 1 { return } - if i <= uint64(staticTable.len()) { - return staticTable.ents[i-1], true - } if i > uint64(d.maxTableIndex()) { return } - // In the dynamic table, newer entries have lower indices. - // However, dt.ents[0] is the oldest entry. Hence, dt.ents is - // the reversed dynamic table. - dt := d.dynTab.table - return dt.ents[dt.len()-(int(i)-staticTable.len())], true + if i <= uint64(len(staticTable)) { + return staticTable[i-1], true + } + dents := d.dynTab.ents + return dents[len(dents)-(int(i)-len(staticTable))], true } // Decode decodes an entire block. @@ -255,7 +307,7 @@ func (d *Decoder) Write(p []byte) (n int, err error) { err = d.parseHeaderFieldRepr() if err == errNeedMore { // Extra paranoia, making sure saveBuf won't - // get too large. All the varint and string + // get too large. All the varint and string // reading code earlier should already catch // overlong things and return ErrStringLength, // but keep this as a last resort. diff --git a/vendor/golang.org/x/net/http2/hpack/hpack_test.go b/vendor/golang.org/x/net/http2/hpack/hpack_test.go index c2f8fd1..4c7b17b 100644 --- a/vendor/golang.org/x/net/http2/hpack/hpack_test.go +++ b/vendor/golang.org/x/net/http2/hpack/hpack_test.go @@ -5,16 +5,117 @@ package hpack import ( + "bufio" "bytes" "encoding/hex" "fmt" "math/rand" "reflect" + "regexp" + "strconv" "strings" "testing" "time" ) +func TestStaticTable(t *testing.T) { + fromSpec := ` + +-------+-----------------------------+---------------+ + | 1 | :authority | | + | 2 | :method | GET | + | 3 | :method | POST | + | 4 | :path | / | + | 5 | :path | /index.html | + | 6 | :scheme | http | + | 7 | :scheme | https | + | 8 | :status | 200 | + | 9 | :status | 204 | + | 10 | :status | 206 | + | 11 | :status | 304 | + | 12 | :status | 400 | + | 13 | :status | 404 | + | 14 | :status | 500 | + | 15 | accept-charset | | + | 16 | accept-encoding | gzip, deflate | + | 17 | accept-language | | + | 18 | accept-ranges | | + | 19 | accept | | + | 20 | access-control-allow-origin | | + | 21 | age | | + | 22 | allow | | + | 23 | authorization | | + | 24 | cache-control | | + | 25 | content-disposition | | + | 26 | content-encoding | | + | 27 | content-language | | + | 28 | content-length | | + | 29 | content-location | | + | 30 | content-range | | + | 31 | content-type | | + | 32 | cookie | | + | 33 | date | | + | 34 | etag | | + | 35 | expect | | + | 36 | expires | | + | 37 | from | | + | 38 | host | | + | 39 | if-match | | + | 40 | if-modified-since | | + | 41 | if-none-match | | + | 42 | if-range | | + | 43 | if-unmodified-since | | + | 44 | last-modified | | + | 45 | link | | + | 46 | location | | + | 47 | max-forwards | | + | 48 | proxy-authenticate | | + | 49 | proxy-authorization | | + | 50 | range | | + | 51 | referer | | + | 52 | refresh | | + | 53 | retry-after | | + | 54 | server | | + | 55 | set-cookie | | + | 56 | strict-transport-security | | + | 57 | transfer-encoding | | + | 58 | user-agent | | + | 59 | vary | | + | 60 | via | | + | 61 | www-authenticate | | + +-------+-----------------------------+---------------+ +` + bs := bufio.NewScanner(strings.NewReader(fromSpec)) + re := regexp.MustCompile(`\| (\d+)\s+\| (\S+)\s*\| (\S(.*\S)?)?\s+\|`) + for bs.Scan() { + l := bs.Text() + if !strings.Contains(l, "|") { + continue + } + m := re.FindStringSubmatch(l) + if m == nil { + continue + } + i, err := strconv.Atoi(m[1]) + if err != nil { + t.Errorf("Bogus integer on line %q", l) + continue + } + if i < 1 || i > len(staticTable) { + t.Errorf("Bogus index %d on line %q", i, l) + continue + } + if got, want := staticTable[i-1].Name, m[2]; got != want { + t.Errorf("header index %d name = %q; want %q", i, got, want) + } + if got, want := staticTable[i-1].Value, m[3]; got != want { + t.Errorf("header index %d value = %q; want %q", i, got, want) + } + } + if err := bs.Err(); err != nil { + t.Error(err) + } +} + func (d *Decoder) mustAt(idx int) HeaderField { if hf, ok := d.at(uint64(idx)); !ok { panic(fmt.Sprintf("bogus index %d", idx)) @@ -31,10 +132,10 @@ func TestDynamicTableAt(t *testing.T) { } d.dynTab.add(pair("foo", "bar")) d.dynTab.add(pair("blake", "miz")) - if got, want := at(staticTable.len()+1), (pair("blake", "miz")); got != want { + if got, want := at(len(staticTable)+1), (pair("blake", "miz")); got != want { t.Errorf("at(dyn 1) = %v; want %v", got, want) } - if got, want := at(staticTable.len()+2), (pair("foo", "bar")); got != want { + if got, want := at(len(staticTable)+2), (pair("foo", "bar")); got != want { t.Errorf("at(dyn 2) = %v; want %v", got, want) } if got, want := at(3), (pair(":method", "POST")); got != want { @@ -42,6 +143,41 @@ func TestDynamicTableAt(t *testing.T) { } } +func TestDynamicTableSearch(t *testing.T) { + dt := dynamicTable{} + dt.setMaxSize(4096) + + dt.add(pair("foo", "bar")) + dt.add(pair("blake", "miz")) + dt.add(pair(":method", "GET")) + + tests := []struct { + hf HeaderField + wantI uint64 + wantMatch bool + }{ + // Name and Value match + {pair("foo", "bar"), 3, true}, + {pair(":method", "GET"), 1, true}, + + // Only name match because of Sensitive == true + {HeaderField{"blake", "miz", true}, 2, false}, + + // Only Name matches + {pair("foo", "..."), 3, false}, + {pair("blake", "..."), 2, false}, + {pair(":method", "..."), 1, false}, + + // None match + {pair("foo-", "bar"), 0, false}, + } + for _, tt := range tests { + if gotI, gotMatch := dt.search(tt.hf); gotI != tt.wantI || gotMatch != tt.wantMatch { + t.Errorf("d.search(%+v) = %v, %v; want %v, %v", tt.hf, gotI, gotMatch, tt.wantI, tt.wantMatch) + } + } +} + func TestDynamicTableSizeEvict(t *testing.T) { d := NewDecoder(4096, nil) if want := uint32(0); d.dynTab.size != want { @@ -60,7 +196,7 @@ func TestDynamicTableSizeEvict(t *testing.T) { if want := uint32(6 + 32); d.dynTab.size != want { t.Fatalf("after setMaxSize, size = %d; want %d", d.dynTab.size, want) } - if got, want := d.mustAt(staticTable.len()+1), (pair("foo", "bar")); got != want { + if got, want := d.mustAt(len(staticTable)+1), (pair("foo", "bar")); got != want { t.Errorf("at(dyn 1) = %v; want %v", got, want) } add(pair("long", strings.Repeat("x", 500))) @@ -119,9 +255,9 @@ func TestDecoderDecode(t *testing.T) { } func (dt *dynamicTable) reverseCopy() (hf []HeaderField) { - hf = make([]HeaderField, len(dt.table.ents)) + hf = make([]HeaderField, len(dt.ents)) for i := range hf { - hf[i] = dt.table.ents[len(dt.table.ents)-1-i] + hf[i] = dt.ents[len(dt.ents)-1-i] } return } diff --git a/vendor/golang.org/x/net/http2/hpack/tables.go b/vendor/golang.org/x/net/http2/hpack/tables.go index 31bd5a5..b9283a0 100644 --- a/vendor/golang.org/x/net/http2/hpack/tables.go +++ b/vendor/golang.org/x/net/http2/hpack/tables.go @@ -4,199 +4,73 @@ package hpack -import ( - "fmt" -) - -// headerFieldTable implements a list of HeaderFields. -// This is used to implement the static and dynamic tables. -type headerFieldTable struct { - // For static tables, entries are never evicted. - // - // For dynamic tables, entries are evicted from ents[0] and added to the end. - // Each entry has a unique id that starts at one and increments for each - // entry that is added. This unique id is stable across evictions, meaning - // it can be used as a pointer to a specific entry. As in hpack, unique ids - // are 1-based. The unique id for ents[k] is k + evictCount + 1. - // - // Zero is not a valid unique id. - // - // evictCount should not overflow in any remotely practical situation. In - // practice, we will have one dynamic table per HTTP/2 connection. If we - // assume a very powerful server that handles 1M QPS per connection and each - // request adds (then evicts) 100 entries from the table, it would still take - // 2M years for evictCount to overflow. - ents []HeaderField - evictCount uint64 - - // byName maps a HeaderField name to the unique id of the newest entry with - // the same name. See above for a definition of "unique id". - byName map[string]uint64 - - // byNameValue maps a HeaderField name/value pair to the unique id of the newest - // entry with the same name and value. See above for a definition of "unique id". - byNameValue map[pairNameValue]uint64 -} - -type pairNameValue struct { - name, value string -} - -func (t *headerFieldTable) init() { - t.byName = make(map[string]uint64) - t.byNameValue = make(map[pairNameValue]uint64) -} - -// len reports the number of entries in the table. -func (t *headerFieldTable) len() int { - return len(t.ents) -} - -// addEntry adds a new entry. -func (t *headerFieldTable) addEntry(f HeaderField) { - id := uint64(t.len()) + t.evictCount + 1 - t.byName[f.Name] = id - t.byNameValue[pairNameValue{f.Name, f.Value}] = id - t.ents = append(t.ents, f) -} - -// evictOldest evicts the n oldest entries in the table. -func (t *headerFieldTable) evictOldest(n int) { - if n > t.len() { - panic(fmt.Sprintf("evictOldest(%v) on table with %v entries", n, t.len())) - } - for k := 0; k < n; k++ { - f := t.ents[k] - id := t.evictCount + uint64(k) + 1 - if t.byName[f.Name] == id { - delete(t.byName, f.Name) - } - if p := (pairNameValue{f.Name, f.Value}); t.byNameValue[p] == id { - delete(t.byNameValue, p) - } - } - copy(t.ents, t.ents[n:]) - for k := t.len() - n; k < t.len(); k++ { - t.ents[k] = HeaderField{} // so strings can be garbage collected - } - t.ents = t.ents[:t.len()-n] - if t.evictCount+uint64(n) < t.evictCount { - panic("evictCount overflow") - } - t.evictCount += uint64(n) -} - -// search finds f in the table. If there is no match, i is 0. -// If both name and value match, i is the matched index and nameValueMatch -// becomes true. If only name matches, i points to that index and -// nameValueMatch becomes false. -// -// The returned index is a 1-based HPACK index. For dynamic tables, HPACK says -// that index 1 should be the newest entry, but t.ents[0] is the oldest entry, -// meaning t.ents is reversed for dynamic tables. Hence, when t is a dynamic -// table, the return value i actually refers to the entry t.ents[t.len()-i]. -// -// All tables are assumed to be a dynamic tables except for the global -// staticTable pointer. -// -// See Section 2.3.3. -func (t *headerFieldTable) search(f HeaderField) (i uint64, nameValueMatch bool) { - if !f.Sensitive { - if id := t.byNameValue[pairNameValue{f.Name, f.Value}]; id != 0 { - return t.idToIndex(id), true - } - } - if id := t.byName[f.Name]; id != 0 { - return t.idToIndex(id), false - } - return 0, false -} - -// idToIndex converts a unique id to an HPACK index. -// See Section 2.3.3. -func (t *headerFieldTable) idToIndex(id uint64) uint64 { - if id <= t.evictCount { - panic(fmt.Sprintf("id (%v) <= evictCount (%v)", id, t.evictCount)) - } - k := id - t.evictCount - 1 // convert id to an index t.ents[k] - if t != staticTable { - return uint64(t.len()) - k // dynamic table - } - return k + 1 -} - func pair(name, value string) HeaderField { return HeaderField{Name: name, Value: value} } // http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-07#appendix-B -var staticTable = newStaticTable() - -func newStaticTable() *headerFieldTable { - t := &headerFieldTable{} - t.init() - t.addEntry(pair(":authority", "")) - t.addEntry(pair(":method", "GET")) - t.addEntry(pair(":method", "POST")) - t.addEntry(pair(":path", "/")) - t.addEntry(pair(":path", "/index.html")) - t.addEntry(pair(":scheme", "http")) - t.addEntry(pair(":scheme", "https")) - t.addEntry(pair(":status", "200")) - t.addEntry(pair(":status", "204")) - t.addEntry(pair(":status", "206")) - t.addEntry(pair(":status", "304")) - t.addEntry(pair(":status", "400")) - t.addEntry(pair(":status", "404")) - t.addEntry(pair(":status", "500")) - t.addEntry(pair("accept-charset", "")) - t.addEntry(pair("accept-encoding", "gzip, deflate")) - t.addEntry(pair("accept-language", "")) - t.addEntry(pair("accept-ranges", "")) - t.addEntry(pair("accept", "")) - t.addEntry(pair("access-control-allow-origin", "")) - t.addEntry(pair("age", "")) - t.addEntry(pair("allow", "")) - t.addEntry(pair("authorization", "")) - t.addEntry(pair("cache-control", "")) - t.addEntry(pair("content-disposition", "")) - t.addEntry(pair("content-encoding", "")) - t.addEntry(pair("content-language", "")) - t.addEntry(pair("content-length", "")) - t.addEntry(pair("content-location", "")) - t.addEntry(pair("content-range", "")) - t.addEntry(pair("content-type", "")) - t.addEntry(pair("cookie", "")) - t.addEntry(pair("date", "")) - t.addEntry(pair("etag", "")) - t.addEntry(pair("expect", "")) - t.addEntry(pair("expires", "")) - t.addEntry(pair("from", "")) - t.addEntry(pair("host", "")) - t.addEntry(pair("if-match", "")) - t.addEntry(pair("if-modified-since", "")) - t.addEntry(pair("if-none-match", "")) - t.addEntry(pair("if-range", "")) - t.addEntry(pair("if-unmodified-since", "")) - t.addEntry(pair("last-modified", "")) - t.addEntry(pair("link", "")) - t.addEntry(pair("location", "")) - t.addEntry(pair("max-forwards", "")) - t.addEntry(pair("proxy-authenticate", "")) - t.addEntry(pair("proxy-authorization", "")) - t.addEntry(pair("range", "")) - t.addEntry(pair("referer", "")) - t.addEntry(pair("refresh", "")) - t.addEntry(pair("retry-after", "")) - t.addEntry(pair("server", "")) - t.addEntry(pair("set-cookie", "")) - t.addEntry(pair("strict-transport-security", "")) - t.addEntry(pair("transfer-encoding", "")) - t.addEntry(pair("user-agent", "")) - t.addEntry(pair("vary", "")) - t.addEntry(pair("via", "")) - t.addEntry(pair("www-authenticate", "")) - return t +var staticTable = [...]HeaderField{ + pair(":authority", ""), // index 1 (1-based) + pair(":method", "GET"), + pair(":method", "POST"), + pair(":path", "/"), + pair(":path", "/index.html"), + pair(":scheme", "http"), + pair(":scheme", "https"), + pair(":status", "200"), + pair(":status", "204"), + pair(":status", "206"), + pair(":status", "304"), + pair(":status", "400"), + pair(":status", "404"), + pair(":status", "500"), + pair("accept-charset", ""), + pair("accept-encoding", "gzip, deflate"), + pair("accept-language", ""), + pair("accept-ranges", ""), + pair("accept", ""), + pair("access-control-allow-origin", ""), + pair("age", ""), + pair("allow", ""), + pair("authorization", ""), + pair("cache-control", ""), + pair("content-disposition", ""), + pair("content-encoding", ""), + pair("content-language", ""), + pair("content-length", ""), + pair("content-location", ""), + pair("content-range", ""), + pair("content-type", ""), + pair("cookie", ""), + pair("date", ""), + pair("etag", ""), + pair("expect", ""), + pair("expires", ""), + pair("from", ""), + pair("host", ""), + pair("if-match", ""), + pair("if-modified-since", ""), + pair("if-none-match", ""), + pair("if-range", ""), + pair("if-unmodified-since", ""), + pair("last-modified", ""), + pair("link", ""), + pair("location", ""), + pair("max-forwards", ""), + pair("proxy-authenticate", ""), + pair("proxy-authorization", ""), + pair("range", ""), + pair("referer", ""), + pair("refresh", ""), + pair("retry-after", ""), + pair("server", ""), + pair("set-cookie", ""), + pair("strict-transport-security", ""), + pair("transfer-encoding", ""), + pair("user-agent", ""), + pair("vary", ""), + pair("via", ""), + pair("www-authenticate", ""), } var huffmanCodes = [256]uint32{ diff --git a/vendor/golang.org/x/net/http2/hpack/tables_test.go b/vendor/golang.org/x/net/http2/hpack/tables_test.go deleted file mode 100644 index d963f36..0000000 --- a/vendor/golang.org/x/net/http2/hpack/tables_test.go +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package hpack - -import ( - "bufio" - "regexp" - "strconv" - "strings" - "testing" -) - -func TestHeaderFieldTable(t *testing.T) { - table := &headerFieldTable{} - table.init() - table.addEntry(pair("key1", "value1-1")) - table.addEntry(pair("key2", "value2-1")) - table.addEntry(pair("key1", "value1-2")) - table.addEntry(pair("key3", "value3-1")) - table.addEntry(pair("key4", "value4-1")) - table.addEntry(pair("key2", "value2-2")) - - // Tests will be run twice: once before evicting anything, and - // again after evicting the three oldest entries. - tests := []struct { - f HeaderField - beforeWantStaticI uint64 - beforeWantMatch bool - afterWantStaticI uint64 - afterWantMatch bool - }{ - {HeaderField{"key1", "value1-1", false}, 1, true, 0, false}, - {HeaderField{"key1", "value1-2", false}, 3, true, 0, false}, - {HeaderField{"key1", "value1-3", false}, 3, false, 0, false}, - {HeaderField{"key2", "value2-1", false}, 2, true, 3, false}, - {HeaderField{"key2", "value2-2", false}, 6, true, 3, true}, - {HeaderField{"key2", "value2-3", false}, 6, false, 3, false}, - {HeaderField{"key4", "value4-1", false}, 5, true, 2, true}, - // Name match only, because sensitive. - {HeaderField{"key4", "value4-1", true}, 5, false, 2, false}, - // Key not found. - {HeaderField{"key5", "value5-x", false}, 0, false, 0, false}, - } - - staticToDynamic := func(i uint64) uint64 { - if i == 0 { - return 0 - } - return uint64(table.len()) - i + 1 // dynamic is the reversed table - } - - searchStatic := func(f HeaderField) (uint64, bool) { - old := staticTable - staticTable = table - defer func() { staticTable = old }() - return staticTable.search(f) - } - - searchDynamic := func(f HeaderField) (uint64, bool) { - return table.search(f) - } - - for _, test := range tests { - gotI, gotMatch := searchStatic(test.f) - if wantI, wantMatch := test.beforeWantStaticI, test.beforeWantMatch; gotI != wantI || gotMatch != wantMatch { - t.Errorf("before evictions: searchStatic(%+v)=%v,%v want %v,%v", test.f, gotI, gotMatch, wantI, wantMatch) - } - gotI, gotMatch = searchDynamic(test.f) - wantDynamicI := staticToDynamic(test.beforeWantStaticI) - if wantI, wantMatch := wantDynamicI, test.beforeWantMatch; gotI != wantI || gotMatch != wantMatch { - t.Errorf("before evictions: searchDynamic(%+v)=%v,%v want %v,%v", test.f, gotI, gotMatch, wantI, wantMatch) - } - } - - table.evictOldest(3) - - for _, test := range tests { - gotI, gotMatch := searchStatic(test.f) - if wantI, wantMatch := test.afterWantStaticI, test.afterWantMatch; gotI != wantI || gotMatch != wantMatch { - t.Errorf("after evictions: searchStatic(%+v)=%v,%v want %v,%v", test.f, gotI, gotMatch, wantI, wantMatch) - } - gotI, gotMatch = searchDynamic(test.f) - wantDynamicI := staticToDynamic(test.afterWantStaticI) - if wantI, wantMatch := wantDynamicI, test.afterWantMatch; gotI != wantI || gotMatch != wantMatch { - t.Errorf("after evictions: searchDynamic(%+v)=%v,%v want %v,%v", test.f, gotI, gotMatch, wantI, wantMatch) - } - } -} - -func TestHeaderFieldTable_LookupMapEviction(t *testing.T) { - table := &headerFieldTable{} - table.init() - table.addEntry(pair("key1", "value1-1")) - table.addEntry(pair("key2", "value2-1")) - table.addEntry(pair("key1", "value1-2")) - table.addEntry(pair("key3", "value3-1")) - table.addEntry(pair("key4", "value4-1")) - table.addEntry(pair("key2", "value2-2")) - - // evict all pairs - table.evictOldest(table.len()) - - if l := table.len(); l > 0 { - t.Errorf("table.len() = %d, want 0", l) - } - - if l := len(table.byName); l > 0 { - t.Errorf("len(table.byName) = %d, want 0", l) - } - - if l := len(table.byNameValue); l > 0 { - t.Errorf("len(table.byNameValue) = %d, want 0", l) - } -} - -func TestStaticTable(t *testing.T) { - fromSpec := ` - +-------+-----------------------------+---------------+ - | 1 | :authority | | - | 2 | :method | GET | - | 3 | :method | POST | - | 4 | :path | / | - | 5 | :path | /index.html | - | 6 | :scheme | http | - | 7 | :scheme | https | - | 8 | :status | 200 | - | 9 | :status | 204 | - | 10 | :status | 206 | - | 11 | :status | 304 | - | 12 | :status | 400 | - | 13 | :status | 404 | - | 14 | :status | 500 | - | 15 | accept-charset | | - | 16 | accept-encoding | gzip, deflate | - | 17 | accept-language | | - | 18 | accept-ranges | | - | 19 | accept | | - | 20 | access-control-allow-origin | | - | 21 | age | | - | 22 | allow | | - | 23 | authorization | | - | 24 | cache-control | | - | 25 | content-disposition | | - | 26 | content-encoding | | - | 27 | content-language | | - | 28 | content-length | | - | 29 | content-location | | - | 30 | content-range | | - | 31 | content-type | | - | 32 | cookie | | - | 33 | date | | - | 34 | etag | | - | 35 | expect | | - | 36 | expires | | - | 37 | from | | - | 38 | host | | - | 39 | if-match | | - | 40 | if-modified-since | | - | 41 | if-none-match | | - | 42 | if-range | | - | 43 | if-unmodified-since | | - | 44 | last-modified | | - | 45 | link | | - | 46 | location | | - | 47 | max-forwards | | - | 48 | proxy-authenticate | | - | 49 | proxy-authorization | | - | 50 | range | | - | 51 | referer | | - | 52 | refresh | | - | 53 | retry-after | | - | 54 | server | | - | 55 | set-cookie | | - | 56 | strict-transport-security | | - | 57 | transfer-encoding | | - | 58 | user-agent | | - | 59 | vary | | - | 60 | via | | - | 61 | www-authenticate | | - +-------+-----------------------------+---------------+ -` - bs := bufio.NewScanner(strings.NewReader(fromSpec)) - re := regexp.MustCompile(`\| (\d+)\s+\| (\S+)\s*\| (\S(.*\S)?)?\s+\|`) - for bs.Scan() { - l := bs.Text() - if !strings.Contains(l, "|") { - continue - } - m := re.FindStringSubmatch(l) - if m == nil { - continue - } - i, err := strconv.Atoi(m[1]) - if err != nil { - t.Errorf("Bogus integer on line %q", l) - continue - } - if i < 1 || i > staticTable.len() { - t.Errorf("Bogus index %d on line %q", i, l) - continue - } - if got, want := staticTable.ents[i-1].Name, m[2]; got != want { - t.Errorf("header index %d name = %q; want %q", i, got, want) - } - if got, want := staticTable.ents[i-1].Value, m[3]; got != want { - t.Errorf("header index %d value = %q; want %q", i, got, want) - } - } - if err := bs.Err(); err != nil { - t.Error(err) - } -} diff --git a/vendor/golang.org/x/net/http2/pipe.go b/vendor/golang.org/x/net/http2/pipe.go index 914aaf8..53b7a1d 100644 --- a/vendor/golang.org/x/net/http2/pipe.go +++ b/vendor/golang.org/x/net/http2/pipe.go @@ -10,7 +10,7 @@ import ( "sync" ) -// pipe is a goroutine-safe io.Reader/io.Writer pair. It's like +// pipe is a goroutine-safe io.Reader/io.Writer pair. It's like // io.Pipe except there are no PipeReader/PipeWriter halves, and the // underlying buffer is an interface. (io.Pipe is always unbuffered) type pipe struct { diff --git a/vendor/golang.org/x/net/http2/server.go b/vendor/golang.org/x/net/http2/server.go index 550427d..3c6b90c 100644 --- a/vendor/golang.org/x/net/http2/server.go +++ b/vendor/golang.org/x/net/http2/server.go @@ -110,38 +110,11 @@ type Server struct { // activity for the purposes of IdleTimeout. IdleTimeout time.Duration - // MaxUploadBufferPerConnection is the size of the initial flow - // control window for each connections. The HTTP/2 spec does not - // allow this to be smaller than 65535 or larger than 2^32-1. - // If the value is outside this range, a default value will be - // used instead. - MaxUploadBufferPerConnection int32 - - // MaxUploadBufferPerStream is the size of the initial flow control - // window for each stream. The HTTP/2 spec does not allow this to - // be larger than 2^32-1. If the value is zero or larger than the - // maximum, a default value will be used instead. - MaxUploadBufferPerStream int32 - // NewWriteScheduler constructs a write scheduler for a connection. // If nil, a default scheduler is chosen. NewWriteScheduler func() WriteScheduler } -func (s *Server) initialConnRecvWindowSize() int32 { - if s.MaxUploadBufferPerConnection > initialWindowSize { - return s.MaxUploadBufferPerConnection - } - return 1 << 20 -} - -func (s *Server) initialStreamRecvWindowSize() int32 { - if s.MaxUploadBufferPerStream > 0 { - return s.MaxUploadBufferPerStream - } - return 1 << 20 -} - func (s *Server) maxReadFrameSize() uint32 { if v := s.MaxReadFrameSize; v >= minMaxFrameSize && v <= maxFrameSize { return v @@ -282,27 +255,27 @@ func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) { defer cancel() sc := &serverConn{ - srv: s, - hs: opts.baseConfig(), - conn: c, - baseCtx: baseCtx, - remoteAddrStr: c.RemoteAddr().String(), - bw: newBufferedWriter(c), - handler: opts.handler(), - streams: make(map[uint32]*stream), - readFrameCh: make(chan readFrameResult), - wantWriteFrameCh: make(chan FrameWriteRequest, 8), - wantStartPushCh: make(chan startPushRequest, 8), - wroteFrameCh: make(chan frameWriteResult, 1), // buffered; one send in writeFrameAsync - bodyReadCh: make(chan bodyReadMsg), // buffering doesn't matter either way - doneServing: make(chan struct{}), - clientMaxStreams: math.MaxUint32, // Section 6.5.2: "Initially, there is no limit to this value" - advMaxStreams: s.maxConcurrentStreams(), - initialStreamSendWindowSize: initialWindowSize, - maxFrameSize: initialMaxFrameSize, - headerTableSize: initialHeaderTableSize, - serveG: newGoroutineLock(), - pushEnabled: true, + srv: s, + hs: opts.baseConfig(), + conn: c, + baseCtx: baseCtx, + remoteAddrStr: c.RemoteAddr().String(), + bw: newBufferedWriter(c), + handler: opts.handler(), + streams: make(map[uint32]*stream), + readFrameCh: make(chan readFrameResult), + wantWriteFrameCh: make(chan FrameWriteRequest, 8), + wantStartPushCh: make(chan startPushRequest, 8), + wroteFrameCh: make(chan frameWriteResult, 1), // buffered; one send in writeFrameAsync + bodyReadCh: make(chan bodyReadMsg), // buffering doesn't matter either way + doneServing: make(chan struct{}), + clientMaxStreams: math.MaxUint32, // Section 6.5.2: "Initially, there is no limit to this value" + advMaxStreams: s.maxConcurrentStreams(), + initialWindowSize: initialWindowSize, + maxFrameSize: initialMaxFrameSize, + headerTableSize: initialHeaderTableSize, + serveG: newGoroutineLock(), + pushEnabled: true, } // The net/http package sets the write deadline from the @@ -321,9 +294,6 @@ func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) { sc.writeSched = NewRandomWriteScheduler() } - // These start at the RFC-specified defaults. If there is a higher - // configured value for inflow, that will be updated when we send a - // WINDOW_UPDATE shortly after sending SETTINGS. sc.flow.add(initialWindowSize) sc.inflow.add(initialWindowSize) sc.hpackEncoder = hpack.NewEncoder(&sc.headerWriteBuf) @@ -417,34 +387,34 @@ type serverConn struct { writeSched WriteScheduler // Everything following is owned by the serve loop; use serveG.check(): - serveG goroutineLock // used to verify funcs are on serve() - pushEnabled bool - sawFirstSettings bool // got the initial SETTINGS frame after the preface - needToSendSettingsAck bool - unackedSettings int // how many SETTINGS have we sent without ACKs? - clientMaxStreams uint32 // SETTINGS_MAX_CONCURRENT_STREAMS from client (our PUSH_PROMISE limit) - advMaxStreams uint32 // our SETTINGS_MAX_CONCURRENT_STREAMS advertised the client - curClientStreams uint32 // number of open streams initiated by the client - curPushedStreams uint32 // number of open streams initiated by server push - maxClientStreamID uint32 // max ever seen from client (odd), or 0 if there have been no client requests - maxPushPromiseID uint32 // ID of the last push promise (even), or 0 if there have been no pushes - streams map[uint32]*stream - initialStreamSendWindowSize int32 - maxFrameSize int32 - headerTableSize uint32 - peerMaxHeaderListSize uint32 // zero means unknown (default) - canonHeader map[string]string // http2-lower-case -> Go-Canonical-Case - writingFrame bool // started writing a frame (on serve goroutine or separate) - writingFrameAsync bool // started a frame on its own goroutine but haven't heard back on wroteFrameCh - needsFrameFlush bool // last frame write wasn't a flush - inGoAway bool // we've started to or sent GOAWAY - inFrameScheduleLoop bool // whether we're in the scheduleFrameWrite loop - needToSendGoAway bool // we need to schedule a GOAWAY frame write - goAwayCode ErrCode - shutdownTimerCh <-chan time.Time // nil until used - shutdownTimer *time.Timer // nil until used - idleTimer *time.Timer // nil if unused - idleTimerCh <-chan time.Time // nil if unused + serveG goroutineLock // used to verify funcs are on serve() + pushEnabled bool + sawFirstSettings bool // got the initial SETTINGS frame after the preface + needToSendSettingsAck bool + unackedSettings int // how many SETTINGS have we sent without ACKs? + clientMaxStreams uint32 // SETTINGS_MAX_CONCURRENT_STREAMS from client (our PUSH_PROMISE limit) + advMaxStreams uint32 // our SETTINGS_MAX_CONCURRENT_STREAMS advertised the client + curClientStreams uint32 // number of open streams initiated by the client + curPushedStreams uint32 // number of open streams initiated by server push + maxClientStreamID uint32 // max ever seen from client (odd), or 0 if there have been no client requests + maxPushPromiseID uint32 // ID of the last push promise (even), or 0 if there have been no pushes + streams map[uint32]*stream + initialWindowSize int32 + maxFrameSize int32 + headerTableSize uint32 + peerMaxHeaderListSize uint32 // zero means unknown (default) + canonHeader map[string]string // http2-lower-case -> Go-Canonical-Case + writingFrame bool // started writing a frame (on serve goroutine or separate) + writingFrameAsync bool // started a frame on its own goroutine but haven't heard back on wroteFrameCh + needsFrameFlush bool // last frame write wasn't a flush + inGoAway bool // we've started to or sent GOAWAY + inFrameScheduleLoop bool // whether we're in the scheduleFrameWrite loop + needToSendGoAway bool // we need to schedule a GOAWAY frame write + goAwayCode ErrCode + shutdownTimerCh <-chan time.Time // nil until used + shutdownTimer *time.Timer // nil until used + idleTimer *time.Timer // nil if unused + idleTimerCh <-chan time.Time // nil if unused // Owned by the writeFrameAsync goroutine: headerWriteBuf bytes.Buffer @@ -493,9 +463,10 @@ type stream struct { numTrailerValues int64 weight uint8 state streamState - resetQueued bool // RST_STREAM queued for write; set by sc.resetStream - gotTrailerHeader bool // HEADER frame for trailers was seen - wroteHeaders bool // whether we wrote headers (not status 100) + resetQueued bool // RST_STREAM queued for write; set by sc.resetStream + gotTrailerHeader bool // HEADER frame for trailers was seen + wroteHeaders bool // whether we wrote headers (not status 100) + reqBuf []byte // if non-nil, body pipe buffer to return later at EOF trailer http.Header // accumulated trailers reqTrailer http.Header // handler's Request.Trailer @@ -725,23 +696,21 @@ func (sc *serverConn) serve() { {SettingMaxFrameSize, sc.srv.maxReadFrameSize()}, {SettingMaxConcurrentStreams, sc.advMaxStreams}, {SettingMaxHeaderListSize, sc.maxHeaderListSize()}, - {SettingInitialWindowSize, uint32(sc.srv.initialStreamRecvWindowSize())}, + + // TODO: more actual settings, notably + // SettingInitialWindowSize, but then we also + // want to bump up the conn window size the + // same amount here right after the settings }, }) sc.unackedSettings++ - // Each connection starts with intialWindowSize inflow tokens. - // If a higher value is configured, we add more tokens. - if diff := sc.srv.initialConnRecvWindowSize() - initialWindowSize; diff > 0 { - sc.sendWindowUpdate(nil, int(diff)) - } - if err := sc.readPreface(); err != nil { sc.condlogf(err, "http2: server: error reading preface from client %v: %v", sc.conn.RemoteAddr(), err) return } // Now that we've got the preface, get us out of the - // "StateNew" state. We can't go directly to idle, though. + // "StateNew" state. We can't go directly to idle, though. // Active means we read some data and anticipate a request. We'll // do another Active when we get a HEADERS frame. sc.setConnState(http.StateActive) @@ -1426,9 +1395,9 @@ func (sc *serverConn) processSettingInitialWindowSize(val uint32) error { // adjust the size of all stream flow control windows that it // maintains by the difference between the new value and the // old value." - old := sc.initialStreamSendWindowSize - sc.initialStreamSendWindowSize = int32(val) - growth := int32(val) - old // may be negative + old := sc.initialWindowSize + sc.initialWindowSize = int32(val) + growth := sc.initialWindowSize - old // may be negative for _, st := range sc.streams { if !st.flow.add(growth) { // 6.9.2 Initial Flow Control Window Size @@ -1750,9 +1719,9 @@ func (sc *serverConn) newStream(id, pusherID uint32, state streamState) *stream } st.cw.Init() st.flow.conn = &sc.flow // link to conn-level counter - st.flow.add(sc.initialStreamSendWindowSize) - st.inflow.conn = &sc.inflow // link to conn-level counter - st.inflow.add(sc.srv.initialStreamRecvWindowSize()) + st.flow.add(sc.initialWindowSize) + st.inflow.conn = &sc.inflow // link to conn-level counter + st.inflow.add(initialWindowSize) // TODO: update this when we send a higher initial window size in the initial settings sc.streams[id] = st sc.writeSched.OpenStream(st.id, OpenStreamOptions{PusherID: pusherID}) @@ -1816,14 +1785,16 @@ func (sc *serverConn) newWriterAndRequest(st *stream, f *MetaHeadersFrame) (*res return nil, nil, err } if bodyOpen { + st.reqBuf = getRequestBodyBuf() + req.Body.(*requestBody).pipe = &pipe{ + b: &fixedBuffer{buf: st.reqBuf}, + } + if vv, ok := rp.header["Content-Length"]; ok { req.ContentLength, _ = strconv.ParseInt(vv[0], 10, 64) } else { req.ContentLength = -1 } - req.Body.(*requestBody).pipe = &pipe{ - b: &dataBuffer{expected: req.ContentLength}, - } } return rw, req, nil } @@ -1919,6 +1890,24 @@ func (sc *serverConn) newWriterAndRequestNoBody(st *stream, rp requestParam) (*r return rw, req, nil } +var reqBodyCache = make(chan []byte, 8) + +func getRequestBodyBuf() []byte { + select { + case b := <-reqBodyCache: + return b + default: + return make([]byte, initialWindowSize) + } +} + +func putRequestBodyBuf(b []byte) { + select { + case reqBodyCache <- b: + default: + } +} + // Run on its own goroutine. func (sc *serverConn) runHandler(rw *responseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) { didPanic := true @@ -2014,6 +2003,12 @@ func (sc *serverConn) noteBodyReadFromHandler(st *stream, n int, err error) { case <-sc.doneServing: } } + if err == io.EOF { + if buf := st.reqBuf; buf != nil { + st.reqBuf = nil // shouldn't matter; field unused by other + putRequestBodyBuf(buf) + } + } } func (sc *serverConn) noteBodyRead(st *stream, n int) { @@ -2108,8 +2103,8 @@ func (b *requestBody) Read(p []byte) (n int, err error) { return } -// responseWriter is the http.ResponseWriter implementation. It's -// intentionally small (1 pointer wide) to minimize garbage. The +// responseWriter is the http.ResponseWriter implementation. It's +// intentionally small (1 pointer wide) to minimize garbage. The // responseWriterState pointer inside is zeroed at the end of a // request (in handlerDone) and calls on the responseWriter thereafter // simply crash (caller's mistake), but the much larger responseWriterState @@ -2283,7 +2278,7 @@ const TrailerPrefix = "Trailer:" // says you SHOULD (but not must) predeclare any trailers in the // header, the official ResponseWriter rules said trailers in Go must // be predeclared, and then we reuse the same ResponseWriter.Header() -// map to mean both Headers and Trailers. When it's time to write the +// map to mean both Headers and Trailers. When it's time to write the // Trailers, we pick out the fields of Headers that were declared as // trailers. That worked for a while, until we found the first major // user of Trailers in the wild: gRPC (using them only over http2), diff --git a/vendor/golang.org/x/net/http2/server_push_test.go b/vendor/golang.org/x/net/http2/server_push_test.go index f70edd3..fd550d2 100644 --- a/vendor/golang.org/x/net/http2/server_push_test.go +++ b/vendor/golang.org/x/net/http2/server_push_test.go @@ -430,20 +430,18 @@ func TestServer_Push_RejectForbiddenHeader(t *testing.T) { func TestServer_Push_StateTransitions(t *testing.T) { const body = "foo" - gotPromise := make(chan bool) + startedPromise := make(chan bool) finishedPush := make(chan bool) - st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) { switch r.URL.RequestURI() { case "/": if err := w.(http.Pusher).Push("/pushed", nil); err != nil { t.Errorf("Push error: %v", err) } + close(startedPromise) // Don't finish this request until the push finishes so we don't // nondeterministically interleave output frames with the push. <-finishedPush - case "/pushed": - <-gotPromise } w.Header().Set("Content-Type", "text/html") w.Header().Set("Content-Length", strconv.Itoa(len(body))) @@ -460,16 +458,11 @@ func TestServer_Push_StateTransitions(t *testing.T) { t.Fatalf("streamState(2)=%v, want %v", got, want) } getSlash(st) - // After the PUSH_PROMISE is sent, the stream should be stateHalfClosedRemote. - st.wantPushPromise() + <-startedPromise if got, want := st.streamState(2), stateHalfClosedRemote; got != want { t.Fatalf("streamState(2)=%v, want %v", got, want) } - // We stall the HTTP handler for "/pushed" until the above check. If we don't - // stall the handler, then the handler might write HEADERS and DATA and finish - // the stream before we check st.streamState(2) -- should that happen, we'll - // see stateClosed and fail the above check. - close(gotPromise) + st.wantPushPromise() st.wantHeaders() if df := st.wantData(); !df.StreamEnded() { t.Fatal("expected END_STREAM flag on DATA") diff --git a/vendor/golang.org/x/net/http2/server_test.go b/vendor/golang.org/x/net/http2/server_test.go index 407fafc..dfa4cff 100644 --- a/vendor/golang.org/x/net/http2/server_test.go +++ b/vendor/golang.org/x/net/http2/server_test.go @@ -80,7 +80,6 @@ type serverTesterOpt string var optOnlyServer = serverTesterOpt("only_server") var optQuiet = serverTesterOpt("quiet_logging") -var optFramerReuseFrames = serverTesterOpt("frame_reuse_frames") func newServerTester(t testing.TB, handler http.HandlerFunc, opts ...interface{}) *serverTester { resetHooks() @@ -92,7 +91,7 @@ func newServerTester(t testing.TB, handler http.HandlerFunc, opts ...interface{} NextProtos: []string{NextProtoTLS}, } - var onlyServer, quiet, framerReuseFrames bool + var onlyServer, quiet bool h2server := new(Server) for _, opt := range opts { switch v := opt.(type) { @@ -108,8 +107,6 @@ func newServerTester(t testing.TB, handler http.HandlerFunc, opts ...interface{} onlyServer = true case optQuiet: quiet = true - case optFramerReuseFrames: - framerReuseFrames = true } case func(net.Conn, http.ConnState): ts.Config.ConnState = v @@ -152,9 +149,6 @@ func newServerTester(t testing.TB, handler http.HandlerFunc, opts ...interface{} } st.cc = cc st.fr = NewFramer(cc, cc) - if framerReuseFrames { - st.fr.SetReuseFrames() - } if !logFrameReads && !logFrameWrites { st.fr.debugReadLoggerf = func(m string, v ...interface{}) { m = time.Now().Format("2006-01-02 15:04:05.999999999 ") + strings.TrimPrefix(m, "http2: ") + "\n" @@ -260,52 +254,11 @@ func (st *serverTester) Close() { // greet initiates the client's HTTP/2 connection into a state where // frames may be sent. func (st *serverTester) greet() { - st.greetAndCheckSettings(func(Setting) error { return nil }) -} - -func (st *serverTester) greetAndCheckSettings(checkSetting func(s Setting) error) { st.writePreface() st.writeInitialSettings() - st.wantSettings().ForeachSetting(checkSetting) + st.wantSettings() st.writeSettingsAck() - - // The initial WINDOW_UPDATE and SETTINGS ACK can come in any order. - var gotSettingsAck bool - var gotWindowUpdate bool - - for i := 0; i < 2; i++ { - f, err := st.readFrame() - if err != nil { - st.t.Fatal(err) - } - switch f := f.(type) { - case *SettingsFrame: - if !f.Header().Flags.Has(FlagSettingsAck) { - st.t.Fatal("Settings Frame didn't have ACK set") - } - gotSettingsAck = true - - case *WindowUpdateFrame: - if f.FrameHeader.StreamID != 0 { - st.t.Fatalf("WindowUpdate StreamID = %d; want 0", f.FrameHeader.StreamID, 0) - } - incr := uint32((&Server{}).initialConnRecvWindowSize() - initialWindowSize) - if f.Increment != incr { - st.t.Fatalf("WindowUpdate increment = %d; want %d", f.Increment, incr) - } - gotWindowUpdate = true - - default: - st.t.Fatalf("Wanting a settings ACK or window update, received a %T", f) - } - } - - if !gotSettingsAck { - st.t.Fatalf("Didn't get a settings ACK") - } - if !gotWindowUpdate { - st.t.Fatalf("Didn't get a window update") - } + st.wantSettingsAck() } func (st *serverTester) writePreface() { @@ -365,7 +318,7 @@ func (st *serverTester) encodeHeaderRaw(headers ...string) []byte { } // encodeHeader encodes headers and returns their HPACK bytes. headers -// must contain an even number of key/value pairs. There may be +// must contain an even number of key/value pairs. There may be // multiple pairs for keys (e.g. "cookie"). The :method, :path, and // :scheme headers default to GET, / and https. The :authority header // defaults to st.ts.Listener.Addr(). @@ -625,7 +578,12 @@ func TestServer(t *testing.T) { server sends in the HTTP/2 connection. `) - st.greet() + st.writePreface() + st.writeInitialSettings() + st.wantSettings() + st.writeSettingsAck() + st.wantSettingsAck() + st.writeHeaders(HeadersFrameParam{ StreamID: 1, // clients send odd numbers BlockFragment: st.encodeHeader(), @@ -698,7 +656,7 @@ func TestServer_Request_Get_PathSlashes(t *testing.T) { } // TODO: add a test with EndStream=true on the HEADERS but setting a -// Content-Length anyway. Should we just omit it and force it to +// Content-Length anyway. Should we just omit it and force it to // zero? func TestServer_Request_Post_NoContentLength_EndStream(t *testing.T) { @@ -1234,7 +1192,7 @@ func TestServer_Handler_Sends_WindowUpdate_Padding(t *testing.T) { EndStream: false, EndHeaders: true, }) - st.writeDataPadded(1, false, []byte("abcdef"), []byte{0, 0, 0, 0}) + st.writeDataPadded(1, false, []byte("abcdef"), []byte("1234")) // Expect to immediately get our 5 bytes of padding back for // both the connection and stream (4 bytes of padding + 1 byte of length) @@ -2637,9 +2595,11 @@ func TestServerDoS_MaxHeaderListSize(t *testing.T) { defer st.Close() // shake hands + st.writePreface() + st.writeInitialSettings() frameSize := defaultMaxReadFrameSize var advHeaderListSize *uint32 - st.greetAndCheckSettings(func(s Setting) error { + st.wantSettings().ForeachSetting(func(s Setting) error { switch s.ID { case SettingMaxFrameSize: if s.Val < minMaxFrameSize { @@ -2654,6 +2614,8 @@ func TestServerDoS_MaxHeaderListSize(t *testing.T) { } return nil }) + st.writeSettingsAck() + st.wantSettingsAck() if advHeaderListSize == nil { t.Errorf("server didn't advertise a max header list size") @@ -3032,89 +2994,6 @@ func BenchmarkServerPosts(b *testing.B) { } } -// Send a stream of messages from server to client in separate data frames. -// Brings up performance issues seen in long streams. -// Created to show problem in go issue #18502 -func BenchmarkServerToClientStreamDefaultOptions(b *testing.B) { - benchmarkServerToClientStream(b) -} - -// Justification for Change-Id: Iad93420ef6c3918f54249d867098f1dadfa324d8 -// Expect to see memory/alloc reduction by opting in to Frame reuse with the Framer. -func BenchmarkServerToClientStreamReuseFrames(b *testing.B) { - benchmarkServerToClientStream(b, optFramerReuseFrames) -} - -func benchmarkServerToClientStream(b *testing.B, newServerOpts ...interface{}) { - defer disableGoroutineTracking()() - b.ReportAllocs() - const msgLen = 1 - // default window size - const windowSize = 1<<16 - 1 - - // next message to send from the server and for the client to expect - nextMsg := func(i int) []byte { - msg := make([]byte, msgLen) - msg[0] = byte(i) - if len(msg) != msgLen { - panic("invalid test setup msg length") - } - return msg - } - - st := newServerTester(b, func(w http.ResponseWriter, r *http.Request) { - // Consume the (empty) body from th peer before replying, otherwise - // the server will sometimes (depending on scheduling) send the peer a - // a RST_STREAM with the CANCEL error code. - if n, err := io.Copy(ioutil.Discard, r.Body); n != 0 || err != nil { - b.Errorf("Copy error; got %v, %v; want 0, nil", n, err) - } - for i := 0; i < b.N; i += 1 { - w.Write(nextMsg(i)) - w.(http.Flusher).Flush() - } - }, newServerOpts...) - defer st.Close() - st.greet() - - const id = uint32(1) - - st.writeHeaders(HeadersFrameParam{ - StreamID: id, - BlockFragment: st.encodeHeader(":method", "POST"), - EndStream: false, - EndHeaders: true, - }) - - st.writeData(id, true, nil) - st.wantHeaders() - - var pendingWindowUpdate = uint32(0) - - for i := 0; i < b.N; i += 1 { - expected := nextMsg(i) - df := st.wantData() - if bytes.Compare(expected, df.data) != 0 { - b.Fatalf("Bad message received; want %v; got %v", expected, df.data) - } - // try to send infrequent but large window updates so they don't overwhelm the test - pendingWindowUpdate += uint32(len(df.data)) - if pendingWindowUpdate >= windowSize/2 { - if err := st.fr.WriteWindowUpdate(0, pendingWindowUpdate); err != nil { - b.Fatal(err) - } - if err := st.fr.WriteWindowUpdate(id, pendingWindowUpdate); err != nil { - b.Fatal(err) - } - pendingWindowUpdate = 0 - } - } - df := st.wantData() - if !df.StreamEnded() { - b.Fatalf("DATA didn't have END_STREAM; got %v", df) - } -} - // go-fuzz bug, originally reported at https://github.com/bradfitz/http2/issues/53 // Verify we don't hang. func TestIssue53(t *testing.T) { diff --git a/vendor/golang.org/x/net/http2/transport.go b/vendor/golang.org/x/net/http2/transport.go index 84d042d..0c7e859 100644 --- a/vendor/golang.org/x/net/http2/transport.go +++ b/vendor/golang.org/x/net/http2/transport.go @@ -575,7 +575,7 @@ func (cc *ClientConn) canTakeNewRequestLocked() bool { cc.nextStreamID < math.MaxInt32 } -// onIdleTimeout is called from a time.AfterFunc goroutine. It will +// onIdleTimeout is called from a time.AfterFunc goroutine. It will // only be called when we're idle, but because we're coming from a new // goroutine, there could be a new request coming in at the same time, // so this simply calls the synchronized closeIfIdle to shut down this @@ -809,8 +809,8 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) { // 2xx, however, then assume the server DOES potentially // want our body (e.g. full-duplex streaming: // golang.org/issue/13444). If it turns out the server - // doesn't, they'll RST_STREAM us soon enough. This is a - // heuristic to avoid adding knobs to Transport. Hopefully + // doesn't, they'll RST_STREAM us soon enough. This is a + // heuristic to avoid adding knobs to Transport. Hopefully // we can keep it. bodyWriter.cancel() cs.abortRequestBodyWrite(errStopReqBodyWrite) @@ -1528,7 +1528,8 @@ func (rl *clientConnReadLoop) handleResponse(cs *clientStream, f *MetaHeadersFra return res, nil } - cs.bufPipe = pipe{b: &dataBuffer{expected: res.ContentLength}} + buf := new(bytes.Buffer) // TODO(bradfitz): recycle this garbage + cs.bufPipe = pipe{b: buf} cs.bytesRemain = res.ContentLength res.Body = transportResponseBody{cs} go cs.awaitRequestCancel(cs.req) diff --git a/vendor/golang.org/x/net/http2/transport_test.go b/vendor/golang.org/x/net/http2/transport_test.go index 7ae8ff7..8ef4f33 100644 --- a/vendor/golang.org/x/net/http2/transport_test.go +++ b/vendor/golang.org/x/net/http2/transport_test.go @@ -2406,7 +2406,7 @@ func TestTransportReturnsDataPaddingFlowControl(t *testing.T) { EndStream: false, BlockFragment: buf.Bytes(), }) - pad := make([]byte, 5) + pad := []byte("12345") ct.fr.WriteDataPadded(hf.StreamID, false, make([]byte, 5000), pad) // without ending stream f, err := ct.readNonSettingsFrame() diff --git a/vendor/golang.org/x/net/idna/example_test.go b/vendor/golang.org/x/net/idna/example_test.go deleted file mode 100644 index 941e707..0000000 --- a/vendor/golang.org/x/net/idna/example_test.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. - -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package idna_test - -import ( - "fmt" - - "golang.org/x/net/idna" -) - -func ExampleProfile() { - // Raw Punycode has no restrictions and does no mappings. - fmt.Println(idna.ToASCII("")) - fmt.Println(idna.ToASCII("*.faß.com")) - fmt.Println(idna.Punycode.ToASCII("*.faß.com")) - - // Rewrite IDN for lookup. This (currently) uses transitional mappings to - // find a balance between IDNA2003 and IDNA2008 compatibility. - fmt.Println(idna.Lookup.ToASCII("")) - fmt.Println(idna.Lookup.ToASCII("www.faß.com")) - - // Convert an IDN to ASCII for registration purposes. This changes the - // encoding, but reports an error if the input was illformed. - fmt.Println(idna.Registration.ToASCII("")) - fmt.Println(idna.Registration.ToASCII("www.faß.com")) - - // Output: - // - // *.xn--fa-hia.com - // *.xn--fa-hia.com - // - // www.fass.com - // idna: invalid label "" - // www.xn--fa-hia.com -} - -func ExampleNew() { - var p *idna.Profile - - // Raw Punycode has no restrictions and does no mappings. - p = idna.New() - fmt.Println(p.ToASCII("*.faß.com")) - - // Do mappings. Note that star is not allowed in a DNS lookup. - p = idna.New( - idna.MapForLookup(), - idna.Transitional(true)) // Map ß -> ss - fmt.Println(p.ToASCII("*.faß.com")) - - // Set up a profile maps for lookup, but allows wild cards. - p = idna.New( - idna.MapForLookup(), - idna.Transitional(true), // Map ß -> ss - idna.StrictDomainName(false)) // Set more permissive ASCII rules. - fmt.Println(p.ToASCII("*.faß.com")) - - // Output: - // *.xn--fa-hia.com - // *.fass.com idna: disallowed rune U+002E - // *.fass.com -} diff --git a/vendor/golang.org/x/net/idna/idna.go b/vendor/golang.org/x/net/idna/idna.go index ee2dbda..47466e9 100644 --- a/vendor/golang.org/x/net/idna/idna.go +++ b/vendor/golang.org/x/net/idna/idna.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// Copied from the golang.org/x/text repo; DO NOT EDIT // Copyright 2016 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style @@ -39,24 +39,27 @@ import ( // error in the future. // I think Option 1 is best, but it is quite opinionated. -// ToASCII is a wrapper for Punycode.ToASCII. +// ToASCII converts a domain or domain label to its ASCII form. For example, +// ToASCII("bücher.example.com") is "xn--bcher-kva.example.com", and +// ToASCII("golang") is "golang". If an error is encountered it will return +// an error and a (partially) processed result. func ToASCII(s string) (string, error) { - return Punycode.process(s, true) + return Resolve.process(s, true) } -// ToUnicode is a wrapper for Punycode.ToUnicode. +// ToUnicode converts a domain or domain label to its Unicode form. For example, +// ToUnicode("xn--bcher-kva.example.com") is "bücher.example.com", and +// ToUnicode("golang") is "golang". If an error is encountered it will return +// an error and a (partially) processed result. func ToUnicode(s string) (string, error) { - return Punycode.process(s, false) + return NonTransitional.process(s, false) } // An Option configures a Profile at creation time. type Option func(*options) -// Transitional sets a Profile to use the Transitional mapping as defined in UTS -// #46. This will cause, for example, "ß" to be mapped to "ss". Using the -// transitional mapping provides a compromise between IDNA2003 and IDNA2008 -// compatibility. It is used by most browsers when resolving domain names. This -// option is only meaningful if combined with MapForLookup. +// Transitional sets a Profile to use the Transitional mapping as defined +// in UTS #46. func Transitional(transitional bool) Option { return func(o *options) { o.transitional = true } } @@ -67,93 +70,19 @@ func VerifyDNSLength(verify bool) Option { return func(o *options) { o.verifyDNSLength = verify } } -// ValidateLabels sets whether to check the mandatory label validation criteria -// as defined in Section 5.4 of RFC 5891. This includes testing for correct use -// of hyphens ('-'), normalization, validity of runes, and the context rules. -func ValidateLabels(enable bool) Option { - return func(o *options) { - // Don't override existing mappings, but set one that at least checks - // normalization if it is not set. - if o.mapping == nil && enable { - o.mapping = normalize - } - o.trie = trie - o.validateLabels = enable - o.fromPuny = validateFromPunycode - } -} - -// StrictDomainName limits the set of permissable ASCII characters to those -// allowed in domain names as defined in RFC 1034 (A-Z, a-z, 0-9 and the -// hyphen). This is set by default for MapForLookup and ValidateForRegistration. -// -// This option is useful, for instance, for browsers that allow characters -// outside this range, for example a '_' (U+005F LOW LINE). See -// http://www.rfc-editor.org/std/std3.txt for more details This option -// corresponds to the UseSTD3ASCIIRules option in UTS #46. -func StrictDomainName(use bool) Option { - return func(o *options) { - o.trie = trie - o.useSTD3Rules = use - o.fromPuny = validateFromPunycode - } -} - -// NOTE: the following options pull in tables. The tables should not be linked -// in as long as the options are not used. - -// BidiRule enables the Bidi rule as defined in RFC 5893. Any application -// that relies on proper validation of labels should include this rule. -func BidiRule() Option { - return func(o *options) { o.bidirule = bidirule.ValidString } -} - -// ValidateForRegistration sets validation options to verify that a given IDN is -// properly formatted for registration as defined by Section 4 of RFC 5891. -func ValidateForRegistration() Option { - return func(o *options) { - o.mapping = validateRegistration - StrictDomainName(true)(o) - ValidateLabels(true)(o) - VerifyDNSLength(true)(o) - BidiRule()(o) - } -} - -// MapForLookup sets validation and mapping options such that a given IDN is -// transformed for domain name lookup according to the requirements set out in -// Section 5 of RFC 5891. The mappings follow the recommendations of RFC 5894, -// RFC 5895 and UTS 46. It does not add the Bidi Rule. Use the BidiRule option -// to add this check. -// -// The mappings include normalization and mapping case, width and other -// compatibility mappings. -func MapForLookup() Option { - return func(o *options) { - o.mapping = validateAndMap - StrictDomainName(true)(o) - ValidateLabels(true)(o) - } +// IgnoreSTD3Rules sets whether ASCII characters outside the A-Z, a-z, 0-9 and +// the hyphen should be allowed. By default this is not allowed, but IDNA2003, +// and as a consequence UTS #46, allows this to be overridden to support +// browsers that allow characters outside this range, for example a '_' (U+005F +// LOW LINE). See http://www.rfc- editor.org/std/std3.txt for more details. +func IgnoreSTD3Rules(ignore bool) Option { + return func(o *options) { o.ignoreSTD3Rules = ignore } } type options struct { transitional bool - useSTD3Rules bool - validateLabels bool + ignoreSTD3Rules bool verifyDNSLength bool - - trie *idnaTrie - - // fromPuny calls validation rules when converting A-labels to U-labels. - fromPuny func(p *Profile, s string) error - - // mapping implements a validation and mapping step as defined in RFC 5895 - // or UTS 46, tailored to, for example, domain registration or lookup. - mapping func(p *Profile, s string) (string, error) - - // bidirule, if specified, checks whether s conforms to the Bidi Rule - // defined in RFC 5893. - bidirule func(s string) bool } // A Profile defines the configuration of a IDNA mapper. @@ -168,13 +97,8 @@ func apply(o *options, opts []Option) { } // New creates a new Profile. -// -// With no options, the returned Profile is the most permissive and equals the -// Punycode Profile. Options can be passed to further restrict the Profile. The -// MapForLookup and ValidateForRegistration options set a collection of options, -// for lookup and registration purposes respectively, which can be tailored by -// adding more fine-grained options, where later options override earlier -// options. +// With no options, the returned profile is the non-transitional profile as +// defined in UTS #46. func New(o ...Option) *Profile { p := &Profile{} apply(&p.options, o) @@ -208,67 +132,33 @@ func (p *Profile) String() string { } else { s = "NonTransitional" } - if p.useSTD3Rules { - s += ":UseSTD3Rules" - } - if p.validateLabels { - s += ":ValidateLabels" - } - if p.verifyDNSLength { - s += ":VerifyDNSLength" + if p.ignoreSTD3Rules { + s += ":NoSTD3Rules" } return s } var ( - // Punycode is a Profile that does raw punycode processing with a minimum - // of validation. - Punycode *Profile = punycode - - // Lookup is the recommended profile for looking up domain names, according - // to Section 5 of RFC 5891. The exact configuration of this profile may - // change over time. - Lookup *Profile = lookup + // Resolve is the recommended profile for resolving domain names. + // The configuration of this profile may change over time. + Resolve = resolve // Display is the recommended profile for displaying domain names. // The configuration of this profile may change over time. - Display *Profile = display + Display = display - // Registration is the recommended profile for checking whether a given - // IDN is valid for registration, according to Section 4 of RFC 5891. - Registration *Profile = registration + // NonTransitional defines a profile that implements the Transitional + // mapping as defined in UTS #46 with no additional constraints. + NonTransitional = nonTransitional - punycode = &Profile{} - lookup = &Profile{options{ - transitional: true, - useSTD3Rules: true, - validateLabels: true, - trie: trie, - fromPuny: validateFromPunycode, - mapping: validateAndMap, - bidirule: bidirule.ValidString, - }} - display = &Profile{options{ - useSTD3Rules: true, - validateLabels: true, - trie: trie, - fromPuny: validateFromPunycode, - mapping: validateAndMap, - bidirule: bidirule.ValidString, - }} - registration = &Profile{options{ - useSTD3Rules: true, - validateLabels: true, - verifyDNSLength: true, - trie: trie, - fromPuny: validateFromPunycode, - mapping: validateRegistration, - bidirule: bidirule.ValidString, - }} + resolve = &Profile{options{transitional: true}} + display = &Profile{} + nonTransitional = &Profile{} // TODO: profiles - // Register: recommended for approving domain names: don't do any mappings - // but rather reject on invalid input. Bundle or block deviation characters. + // V2008: strict IDNA2008 + // Register: recommended for approving domain names: nontransitional, but + // bundle or block deviation characters. ) type labelError struct{ label, code_ string } @@ -288,117 +178,12 @@ func (e runeError) Error() string { // process implements the algorithm described in section 4 of UTS #46, // see http://www.unicode.org/reports/tr46. func (p *Profile) process(s string, toASCII bool) (string, error) { - var err error - if p.mapping != nil { - s, err = p.mapping(p, s) - } - // Remove leading empty labels. - for ; len(s) > 0 && s[0] == '.'; s = s[1:] { - } - // It seems like we should only create this error on ToASCII, but the - // UTS 46 conformance tests suggests we should always check this. - if err == nil && p.verifyDNSLength && s == "" { - err = &labelError{s, "A4"} - } - labels := labelIter{orig: s} - for ; !labels.done(); labels.next() { - label := labels.label() - if label == "" { - // Empty labels are not okay. The label iterator skips the last - // label if it is empty. - if err == nil && p.verifyDNSLength { - err = &labelError{s, "A4"} - } - continue - } - if strings.HasPrefix(label, acePrefix) { - u, err2 := decode(label[len(acePrefix):]) - if err2 != nil { - if err == nil { - err = err2 - } - // Spec says keep the old label. - continue - } - labels.set(u) - if err == nil && p.validateLabels { - err = p.fromPuny(p, u) - } - if err == nil { - // This should be called on NonTransitional, according to the - // spec, but that currently does not have any effect. Use the - // original profile to preserve options. - err = p.validateLabel(u) - } - } else if err == nil { - err = p.validateLabel(label) - } - } - if toASCII { - for labels.reset(); !labels.done(); labels.next() { - label := labels.label() - if !ascii(label) { - a, err2 := encode(acePrefix, label) - if err == nil { - err = err2 - } - label = a - labels.set(a) - } - n := len(label) - if p.verifyDNSLength && err == nil && (n == 0 || n > 63) { - err = &labelError{label, "A4"} - } - } - } - s = labels.result() - if toASCII && p.verifyDNSLength && err == nil { - // Compute the length of the domain name minus the root label and its dot. - n := len(s) - if n > 0 && s[n-1] == '.' { - n-- - } - if len(s) < 1 || n > 253 { - err = &labelError{s, "A4"} - } - } - return s, err -} - -func normalize(p *Profile, s string) (string, error) { - return norm.NFC.String(s), nil -} - -func validateRegistration(p *Profile, s string) (string, error) { - if !norm.NFC.IsNormalString(s) { - return s, &labelError{s, "V1"} - } - var err error - for i := 0; i < len(s); { - v, sz := trie.lookupString(s[i:]) - i += sz - // Copy bytes not copied so far. - switch p.simplify(info(v).category()) { - // TODO: handle the NV8 defined in the Unicode idna data set to allow - // for strict conformance to IDNA2008. - case valid, deviation: - case disallowed, mapped, unknown, ignored: - if err == nil { - r, _ := utf8.DecodeRuneInString(s[i:]) - err = runeError(r) - } - } - } - return s, err -} - -func validateAndMap(p *Profile, s string) (string, error) { var ( - err error - b []byte - k int + b []byte + err error + k, i int ) - for i := 0; i < len(s); { + for i < len(s) { v, sz := trie.lookupString(s[i:]) start := i i += sz @@ -435,6 +220,71 @@ func validateAndMap(p *Profile, s string) (string, error) { // TODO: the punycode converters require strings as input. s = string(b) } + // Remove leading empty labels + for ; len(s) > 0 && s[0] == '.'; s = s[1:] { + } + if s == "" { + return "", &labelError{s, "A4"} + } + labels := labelIter{orig: s} + for ; !labels.done(); labels.next() { + label := labels.label() + if label == "" { + // Empty labels are not okay. The label iterator skips the last + // label if it is empty. + if err == nil { + err = &labelError{s, "A4"} + } + continue + } + if strings.HasPrefix(label, acePrefix) { + u, err2 := decode(label[len(acePrefix):]) + if err2 != nil { + if err == nil { + err = err2 + } + // Spec says keep the old label. + continue + } + labels.set(u) + if err == nil { + err = p.validateFromPunycode(u) + } + if err == nil { + err = NonTransitional.validate(u) + } + } else if err == nil { + err = p.validate(label) + } + } + if toASCII { + for labels.reset(); !labels.done(); labels.next() { + label := labels.label() + if !ascii(label) { + a, err2 := encode(acePrefix, label) + if err == nil { + err = err2 + } + label = a + labels.set(a) + } + n := len(label) + if p.verifyDNSLength && err == nil && (n == 0 || n > 63) { + err = &labelError{label, "A4"} + } + } + } + s = labels.result() + if toASCII && p.verifyDNSLength && err == nil { + // Compute the length of the domain name minus the root label and its dot. + n := len(s) + if n > 0 && s[n-1] == '.' { + n-- + } + if len(s) < 1 || n > 253 { + err = &labelError{s, "A4"} + } + } return s, err } @@ -504,13 +354,13 @@ const acePrefix = "xn--" func (p *Profile) simplify(cat category) category { switch cat { case disallowedSTD3Mapped: - if p.useSTD3Rules { + if !p.ignoreSTD3Rules { cat = disallowed } else { cat = mapped } case disallowedSTD3Valid: - if p.useSTD3Rules { + if !p.ignoreSTD3Rules { cat = disallowed } else { cat = valid @@ -526,7 +376,7 @@ func (p *Profile) simplify(cat category) category { return cat } -func validateFromPunycode(p *Profile, s string) error { +func (p *Profile) validateFromPunycode(s string) error { if !norm.NFC.IsNormalString(s) { return &labelError{s, "V1"} } @@ -602,22 +452,9 @@ var joinStates = [][numJoinTypes]joinState{ }, } -// validateLabel validates the criteria from Section 4.1. Item 1, 4, and 6 are +// validate validates the criteria from Section 4.1. Item 1, 4, and 6 are // already implicitly satisfied by the overall implementation. -func (p *Profile) validateLabel(s string) error { - if s == "" { - if p.verifyDNSLength { - return &labelError{s, "A4"} - } - return nil - } - if p.bidirule != nil && !p.bidirule(s) { - return &labelError{s, "B"} - } - if !p.validateLabels { - return nil - } - trie := p.trie // p.validateLabels is only set if trie is set. +func (p *Profile) validate(s string) error { if len(s) > 4 && s[2] == '-' && s[3] == '-' { return &labelError{s, "V2"} } @@ -630,6 +467,9 @@ func (p *Profile) validateLabel(s string) error { if x.isModifier() { return &labelError{s, "V5"} } + if !bidirule.ValidString(s) { + return &labelError{s, "B"} + } // Quickly return in the absence of zero-width (non) joiners. if strings.Index(s, zwj) == -1 && strings.Index(s, zwnj) == -1 { return nil diff --git a/vendor/golang.org/x/net/idna/idna_test.go b/vendor/golang.org/x/net/idna/idna_test.go index b1bc6fa..0f0ba64 100644 --- a/vendor/golang.org/x/net/idna/idna_test.go +++ b/vendor/golang.org/x/net/idna/idna_test.go @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// This file contains a few basic functional tests. +// Full tests are done in x/text/internal/export/idna. + package idna import ( @@ -38,6 +41,3 @@ func TestIDNA(t *testing.T) { } } } - -// TODO(nigeltao): test errors, once we've specified when ToASCII and ToUnicode -// return errors. diff --git a/vendor/golang.org/x/net/idna/punycode.go b/vendor/golang.org/x/net/idna/punycode.go index 02c7d59..df3411a 100644 --- a/vendor/golang.org/x/net/idna/punycode.go +++ b/vendor/golang.org/x/net/idna/punycode.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// Copied from the golang.org/x/text repo; DO NOT EDIT // Copyright 2016 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/vendor/golang.org/x/net/idna/punycode_test.go b/vendor/golang.org/x/net/idna/punycode_test.go deleted file mode 100644 index bfec81d..0000000 --- a/vendor/golang.org/x/net/idna/punycode_test.go +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package idna - -import ( - "strings" - "testing" -) - -var punycodeTestCases = [...]struct { - s, encoded string -}{ - {"", ""}, - {"-", "--"}, - {"-a", "-a-"}, - {"-a-", "-a--"}, - {"a", "a-"}, - {"a-", "a--"}, - {"a-b", "a-b-"}, - {"books", "books-"}, - {"bücher", "bcher-kva"}, - {"Hello世界", "Hello-ck1hg65u"}, - {"ü", "tda"}, - {"üý", "tdac"}, - - // The test cases below come from RFC 3492 section 7.1 with Errata 3026. - { - // (A) Arabic (Egyptian). - "\u0644\u064A\u0647\u0645\u0627\u0628\u062A\u0643\u0644" + - "\u0645\u0648\u0634\u0639\u0631\u0628\u064A\u061F", - "egbpdaj6bu4bxfgehfvwxn", - }, - { - // (B) Chinese (simplified). - "\u4ED6\u4EEC\u4E3A\u4EC0\u4E48\u4E0D\u8BF4\u4E2D\u6587", - "ihqwcrb4cv8a8dqg056pqjye", - }, - { - // (C) Chinese (traditional). - "\u4ED6\u5011\u7232\u4EC0\u9EBD\u4E0D\u8AAA\u4E2D\u6587", - "ihqwctvzc91f659drss3x8bo0yb", - }, - { - // (D) Czech. - "\u0050\u0072\u006F\u010D\u0070\u0072\u006F\u0073\u0074" + - "\u011B\u006E\u0065\u006D\u006C\u0075\u0076\u00ED\u010D" + - "\u0065\u0073\u006B\u0079", - "Proprostnemluvesky-uyb24dma41a", - }, - { - // (E) Hebrew. - "\u05DC\u05DE\u05D4\u05D4\u05DD\u05E4\u05E9\u05D5\u05D8" + - "\u05DC\u05D0\u05DE\u05D3\u05D1\u05E8\u05D9\u05DD\u05E2" + - "\u05D1\u05E8\u05D9\u05EA", - "4dbcagdahymbxekheh6e0a7fei0b", - }, - { - // (F) Hindi (Devanagari). - "\u092F\u0939\u0932\u094B\u0917\u0939\u093F\u0928\u094D" + - "\u0926\u0940\u0915\u094D\u092F\u094B\u0902\u0928\u0939" + - "\u0940\u0902\u092C\u094B\u0932\u0938\u0915\u0924\u0947" + - "\u0939\u0948\u0902", - "i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd", - }, - { - // (G) Japanese (kanji and hiragana). - "\u306A\u305C\u307F\u3093\u306A\u65E5\u672C\u8A9E\u3092" + - "\u8A71\u3057\u3066\u304F\u308C\u306A\u3044\u306E\u304B", - "n8jok5ay5dzabd5bym9f0cm5685rrjetr6pdxa", - }, - { - // (H) Korean (Hangul syllables). - "\uC138\uACC4\uC758\uBAA8\uB4E0\uC0AC\uB78C\uB4E4\uC774" + - "\uD55C\uAD6D\uC5B4\uB97C\uC774\uD574\uD55C\uB2E4\uBA74" + - "\uC5BC\uB9C8\uB098\uC88B\uC744\uAE4C", - "989aomsvi5e83db1d2a355cv1e0vak1dwrv93d5xbh15a0dt30a5j" + - "psd879ccm6fea98c", - }, - { - // (I) Russian (Cyrillic). - "\u043F\u043E\u0447\u0435\u043C\u0443\u0436\u0435\u043E" + - "\u043D\u0438\u043D\u0435\u0433\u043E\u0432\u043E\u0440" + - "\u044F\u0442\u043F\u043E\u0440\u0443\u0441\u0441\u043A" + - "\u0438", - "b1abfaaepdrnnbgefbadotcwatmq2g4l", - }, - { - // (J) Spanish. - "\u0050\u006F\u0072\u0071\u0075\u00E9\u006E\u006F\u0070" + - "\u0075\u0065\u0064\u0065\u006E\u0073\u0069\u006D\u0070" + - "\u006C\u0065\u006D\u0065\u006E\u0074\u0065\u0068\u0061" + - "\u0062\u006C\u0061\u0072\u0065\u006E\u0045\u0073\u0070" + - "\u0061\u00F1\u006F\u006C", - "PorqunopuedensimplementehablarenEspaol-fmd56a", - }, - { - // (K) Vietnamese. - "\u0054\u1EA1\u0069\u0073\u0061\u006F\u0068\u1ECD\u006B" + - "\u0068\u00F4\u006E\u0067\u0074\u0068\u1EC3\u0063\u0068" + - "\u1EC9\u006E\u00F3\u0069\u0074\u0069\u1EBF\u006E\u0067" + - "\u0056\u0069\u1EC7\u0074", - "TisaohkhngthchnitingVit-kjcr8268qyxafd2f1b9g", - }, - { - // (L) 3B. - "\u0033\u5E74\u0042\u7D44\u91D1\u516B\u5148\u751F", - "3B-ww4c5e180e575a65lsy2b", - }, - { - // (M) -with-SUPER-MONKEYS. - "\u5B89\u5BA4\u5948\u7F8E\u6075\u002D\u0077\u0069\u0074" + - "\u0068\u002D\u0053\u0055\u0050\u0045\u0052\u002D\u004D" + - "\u004F\u004E\u004B\u0045\u0059\u0053", - "-with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n", - }, - { - // (N) Hello-Another-Way-. - "\u0048\u0065\u006C\u006C\u006F\u002D\u0041\u006E\u006F" + - "\u0074\u0068\u0065\u0072\u002D\u0057\u0061\u0079\u002D" + - "\u305D\u308C\u305E\u308C\u306E\u5834\u6240", - "Hello-Another-Way--fc4qua05auwb3674vfr0b", - }, - { - // (O) 2. - "\u3072\u3068\u3064\u5C4B\u6839\u306E\u4E0B\u0032", - "2-u9tlzr9756bt3uc0v", - }, - { - // (P) MajiKoi5 - "\u004D\u0061\u006A\u0069\u3067\u004B\u006F\u0069\u3059" + - "\u308B\u0035\u79D2\u524D", - "MajiKoi5-783gue6qz075azm5e", - }, - { - // (Q) de - "\u30D1\u30D5\u30A3\u30FC\u0064\u0065\u30EB\u30F3\u30D0", - "de-jg4avhby1noc0d", - }, - { - // (R) - "\u305D\u306E\u30B9\u30D4\u30FC\u30C9\u3067", - "d9juau41awczczp", - }, - { - // (S) -> $1.00 <- - "\u002D\u003E\u0020\u0024\u0031\u002E\u0030\u0030\u0020" + - "\u003C\u002D", - "-> $1.00 <--", - }, -} - -func TestPunycode(t *testing.T) { - for _, tc := range punycodeTestCases { - if got, err := decode(tc.encoded); err != nil { - t.Errorf("decode(%q): %v", tc.encoded, err) - } else if got != tc.s { - t.Errorf("decode(%q): got %q, want %q", tc.encoded, got, tc.s) - } - - if got, err := encode("", tc.s); err != nil { - t.Errorf(`encode("", %q): %v`, tc.s, err) - } else if got != tc.encoded { - t.Errorf(`encode("", %q): got %q, want %q`, tc.s, got, tc.encoded) - } - } -} - -var punycodeErrorTestCases = [...]string{ - "decode -", // A sole '-' is invalid. - "decode foo\x00bar", // '\x00' is not in [0-9A-Za-z]. - "decode foo#bar", // '#' is not in [0-9A-Za-z]. - "decode foo\u00A3bar", // '\u00A3' is not in [0-9A-Za-z]. - "decode 9", // "9a" decodes to codepoint \u00A3; "9" is truncated. - "decode 99999a", // "99999a" decodes to codepoint \U0048A3C1, which is > \U0010FFFF. - "decode 9999999999a", // "9999999999a" overflows the int32 calculation. - - "encode " + strings.Repeat("x", 65536) + "\uff00", // int32 overflow. -} - -func TestPunycodeErrors(t *testing.T) { - for _, tc := range punycodeErrorTestCases { - var err error - switch { - case strings.HasPrefix(tc, "decode "): - _, err = decode(tc[7:]) - case strings.HasPrefix(tc, "encode "): - _, err = encode("", tc[7:]) - } - if err == nil { - if len(tc) > 256 { - tc = tc[:100] + "..." + tc[len(tc)-100:] - } - t.Errorf("no error for %s", tc) - } - } -} diff --git a/vendor/golang.org/x/net/idna/tables.go b/vendor/golang.org/x/net/idna/tables.go index d281934..663d73c 100644 --- a/vendor/golang.org/x/net/idna/tables.go +++ b/vendor/golang.org/x/net/idna/tables.go @@ -1,4 +1,6 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// Copied from the golang.org/x/text repo; DO NOT EDIT + +// This file was generated by go generate; DO NOT EDIT package idna diff --git a/vendor/golang.org/x/net/idna/trie.go b/vendor/golang.org/x/net/idna/trie.go index c4ef847..6d37998 100644 --- a/vendor/golang.org/x/net/idna/trie.go +++ b/vendor/golang.org/x/net/idna/trie.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// Copied from the golang.org/x/text repo; DO NOT EDIT // Copyright 2016 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style @@ -44,8 +44,7 @@ var idnaSparse = sparseBlocks{ offset: idnaSparseOffset[:], } -// Don't use newIdnaTrie to avoid unconditional linking in of the table. -var trie = &idnaTrie{} +var trie = newIdnaTrie(0) // lookup determines the type of block n and looks up the value for b. // For n < t.cutoff, the block is a simple lookup table. Otherwise, the block diff --git a/vendor/golang.org/x/net/idna/trieval.go b/vendor/golang.org/x/net/idna/trieval.go index 63cb03b..d1b3256 100644 --- a/vendor/golang.org/x/net/idna/trieval.go +++ b/vendor/golang.org/x/net/idna/trieval.go @@ -1,4 +1,6 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// Copied from the golang.org/x/text repo; DO NOT EDIT + +// This file was generated by go generate; DO NOT EDIT package idna diff --git a/vendor/golang.org/x/net/internal/netreflect/socket.go b/vendor/golang.org/x/net/internal/netreflect/socket.go index 1495b65..e82e51c 100644 --- a/vendor/golang.org/x/net/internal/netreflect/socket.go +++ b/vendor/golang.org/x/net/internal/netreflect/socket.go @@ -2,12 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !go1.9 - // Package netreflect implements run-time reflection for the // facilities of net package. -// -// This package works only for Go 1.8 or below. package netreflect import ( diff --git a/vendor/golang.org/x/net/internal/netreflect/socket_19.go b/vendor/golang.org/x/net/internal/netreflect/socket_19.go deleted file mode 100644 index 74df52e..0000000 --- a/vendor/golang.org/x/net/internal/netreflect/socket_19.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.9 - -package netreflect - -import ( - "errors" - "net" -) - -var ( - errInvalidType = errors.New("invalid type") - errOpNoSupport = errors.New("operation not supported") -) - -// SocketOf returns the socket descriptor of c. -func SocketOf(c net.Conn) (uintptr, error) { - switch c.(type) { - case *net.TCPConn, *net.UDPConn, *net.IPConn, *net.UnixConn: - return 0, errOpNoSupport - default: - return 0, errInvalidType - } -} - -// PacketSocketOf returns the socket descriptor of c. -func PacketSocketOf(c net.PacketConn) (uintptr, error) { - switch c.(type) { - case *net.UDPConn, *net.IPConn, *net.UnixConn: - return 0, errOpNoSupport - default: - return 0, errInvalidType - } -} diff --git a/vendor/golang.org/x/net/internal/netreflect/socket_posix.go b/vendor/golang.org/x/net/internal/netreflect/socket_posix.go index 410c092..df475a2 100644 --- a/vendor/golang.org/x/net/internal/netreflect/socket_posix.go +++ b/vendor/golang.org/x/net/internal/netreflect/socket_posix.go @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !go1.9 // +build darwin dragonfly freebsd linux netbsd openbsd solaris windows package netreflect diff --git a/vendor/golang.org/x/net/internal/netreflect/socket_stub.go b/vendor/golang.org/x/net/internal/netreflect/socket_stub.go index 17b20c4..85adb4b 100644 --- a/vendor/golang.org/x/net/internal/netreflect/socket_stub.go +++ b/vendor/golang.org/x/net/internal/netreflect/socket_stub.go @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !go1.9 // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows package netreflect diff --git a/vendor/golang.org/x/net/internal/netreflect/socket_test.go b/vendor/golang.org/x/net/internal/netreflect/socket_test.go index b3aad0d..305665a 100644 --- a/vendor/golang.org/x/net/internal/netreflect/socket_test.go +++ b/vendor/golang.org/x/net/internal/netreflect/socket_test.go @@ -2,26 +2,79 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !go1.9 -// +build darwin dragonfly freebsd linux netbsd openbsd solaris windows - package netreflect_test import ( + "fmt" + "io/ioutil" "net" "os" + "runtime" "testing" "golang.org/x/net/internal/netreflect" - "golang.org/x/net/internal/nettest" ) +func localPath() string { + f, err := ioutil.TempFile("", "netreflect") + if err != nil { + panic(err) + } + path := f.Name() + f.Close() + os.Remove(path) + return path +} + +func newLocalListener(network string) (net.Listener, error) { + switch network { + case "tcp": + if ln, err := net.Listen("tcp4", "127.0.0.1:0"); err == nil { + return ln, nil + } + return net.Listen("tcp6", "[::1]:0") + case "tcp4": + return net.Listen("tcp4", "127.0.0.1:0") + case "tcp6": + return net.Listen("tcp6", "[::1]:0") + case "unix", "unixpacket": + return net.Listen(network, localPath()) + } + return nil, fmt.Errorf("%s is not supported", network) +} + +func newLocalPacketListener(network string) (net.PacketConn, error) { + switch network { + case "udp": + if c, err := net.ListenPacket("udp4", "127.0.0.1:0"); err == nil { + return c, nil + } + return net.ListenPacket("udp6", "[::1]:0") + case "udp4": + return net.ListenPacket("udp4", "127.0.0.1:0") + case "udp6": + return net.ListenPacket("udp6", "[::1]:0") + case "unixgram": + return net.ListenPacket(network, localPath()) + } + return nil, fmt.Errorf("%s is not supported", network) +} + func TestSocketOf(t *testing.T) { for _, network := range []string{"tcp", "unix", "unixpacket"} { - if !nettest.TestableNetwork(network) { + switch runtime.GOOS { + case "darwin": + if network == "unixpacket" { + continue + } + case "nacl", "plan9": continue + case "windows": + if network == "unix" || network == "unixpacket" { + continue + } } - ln, err := nettest.NewLocalListener(network) + ln, err := newLocalListener(network) if err != nil { t.Error(err) continue @@ -48,10 +101,15 @@ func TestSocketOf(t *testing.T) { func TestPacketSocketOf(t *testing.T) { for _, network := range []string{"udp", "unixgram"} { - if !nettest.TestableNetwork(network) { + switch runtime.GOOS { + case "nacl", "plan9": continue + case "windows": + if network == "unixgram" { + continue + } } - c, err := nettest.NewLocalPacketListener(network) + c, err := newLocalPacketListener(network) if err != nil { t.Error(err) continue diff --git a/vendor/golang.org/x/net/internal/nettest/stack.go b/vendor/golang.org/x/net/internal/nettest/stack.go index cc92c03..5ab9530 100644 --- a/vendor/golang.org/x/net/internal/nettest/stack.go +++ b/vendor/golang.org/x/net/internal/nettest/stack.go @@ -2,40 +2,35 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Package nettest provides utilities for network testing. +// Package nettest provides utilities for IP testing. package nettest // import "golang.org/x/net/internal/nettest" -import ( - "fmt" - "io/ioutil" - "net" - "os" - "runtime" -) - -var ( - supportsIPv4 bool - supportsIPv6 bool -) - -func init() { - if ln, err := net.Listen("tcp4", "127.0.0.1:0"); err == nil { - ln.Close() - supportsIPv4 = true - } - if ln, err := net.Listen("tcp6", "[::1]:0"); err == nil { - ln.Close() - supportsIPv6 = true - } -} +import "net" // SupportsIPv4 reports whether the platform supports IPv4 networking // functionality. -func SupportsIPv4() bool { return supportsIPv4 } +func SupportsIPv4() bool { + ln, err := net.Listen("tcp4", "127.0.0.1:0") + if err != nil { + return false + } + ln.Close() + return true +} // SupportsIPv6 reports whether the platform supports IPv6 networking // functionality. -func SupportsIPv6() bool { return supportsIPv6 } +func SupportsIPv6() bool { + if causesIPv6Crash() { + return false + } + ln, err := net.Listen("tcp6", "[::1]:0") + if err != nil { + return false + } + ln.Close() + return true +} // SupportsRawIPSocket reports whether the platform supports raw IP // sockets. @@ -55,93 +50,3 @@ func SupportsIPv6MulticastDeliveryOnLoopback() bool { func ProtocolNotSupported(err error) bool { return protocolNotSupported(err) } - -// TestableNetwork reports whether network is testable on the current -// platform configuration. -func TestableNetwork(network string) bool { - // This is based on logic from standard library's - // net/platform_test.go. - switch network { - case "unix", "unixgram": - switch runtime.GOOS { - case "android", "nacl", "plan9", "windows": - return false - } - if runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") { - return false - } - case "unixpacket": - switch runtime.GOOS { - case "android", "darwin", "freebsd", "nacl", "plan9", "windows": - return false - } - } - return true -} - -// NewLocalListener returns a listener which listens to a loopback IP -// address or local file system path. -// Network must be "tcp", "tcp4", "tcp6", "unix" or "unixpacket". -func NewLocalListener(network string) (net.Listener, error) { - switch network { - case "tcp": - if supportsIPv4 { - if ln, err := net.Listen("tcp4", "127.0.0.1:0"); err == nil { - return ln, nil - } - } - if supportsIPv6 { - return net.Listen("tcp6", "[::1]:0") - } - case "tcp4": - if supportsIPv4 { - return net.Listen("tcp4", "127.0.0.1:0") - } - case "tcp6": - if supportsIPv6 { - return net.Listen("tcp6", "[::1]:0") - } - case "unix", "unixpacket": - return net.Listen(network, localPath()) - } - return nil, fmt.Errorf("%s is not supported", network) -} - -// NewLocalPacketListener returns a packet listener which listens to a -// loopback IP address or local file system path. -// Network must be "udp", "udp4", "udp6" or "unixgram". -func NewLocalPacketListener(network string) (net.PacketConn, error) { - switch network { - case "udp": - if supportsIPv4 { - if c, err := net.ListenPacket("udp4", "127.0.0.1:0"); err == nil { - return c, nil - } - } - if supportsIPv6 { - return net.ListenPacket("udp6", "[::1]:0") - } - case "udp4": - if supportsIPv4 { - return net.ListenPacket("udp4", "127.0.0.1:0") - } - case "udp6": - if supportsIPv6 { - return net.ListenPacket("udp6", "[::1]:0") - } - case "unixgram": - return net.ListenPacket(network, localPath()) - } - return nil, fmt.Errorf("%s is not supported", network) -} - -func localPath() string { - f, err := ioutil.TempFile("", "nettest") - if err != nil { - panic(err) - } - path := f.Name() - f.Close() - os.Remove(path) - return path -} diff --git a/vendor/golang.org/x/net/internal/timeseries/timeseries.go b/vendor/golang.org/x/net/internal/timeseries/timeseries.go index 685f0e7..1119f34 100644 --- a/vendor/golang.org/x/net/internal/timeseries/timeseries.go +++ b/vendor/golang.org/x/net/internal/timeseries/timeseries.go @@ -371,7 +371,7 @@ func (ts *timeSeries) ComputeRange(start, finish time.Time, num int) []Observabl } } - // Failed to find a level that covers the desired range. So just + // Failed to find a level that covers the desired range. So just // extract from the last level, even if it doesn't cover the entire // desired range. ts.extract(ts.levels[len(ts.levels)-1], start, finish, num, results) diff --git a/vendor/golang.org/x/net/ipv4/doc.go b/vendor/golang.org/x/net/ipv4/doc.go index b43935a..b4ce40f 100644 --- a/vendor/golang.org/x/net/ipv4/doc.go +++ b/vendor/golang.org/x/net/ipv4/doc.go @@ -21,7 +21,7 @@ // // The options for unicasting are available for net.TCPConn, // net.UDPConn and net.IPConn which are created as network connections -// that use the IPv4 transport. When a single TCP connection carrying +// that use the IPv4 transport. When a single TCP connection carrying // a data flow of multiple packets needs to indicate the flow is // important, Conn is used to set the type-of-service field on the // IPv4 header for each packet. @@ -56,7 +56,7 @@ // // The options for multicasting are available for net.UDPConn and // net.IPconn which are created as network connections that use the -// IPv4 transport. A few network facilities must be prepared before +// IPv4 transport. A few network facilities must be prepared before // you begin multicasting, at a minimum joining network interfaces and // multicast groups. // @@ -80,7 +80,7 @@ // defer c.Close() // // Second, the application joins multicast groups, starts listening to -// the groups on the specified network interfaces. Note that the +// the groups on the specified network interfaces. Note that the // service port for transport layer protocol does not matter with this // operation as joining groups affects only network and link layer // protocols, such as IPv4 and Ethernet. @@ -94,7 +94,7 @@ // } // // The application might set per packet control message transmissions -// between the protocol stack within the kernel. When the application +// between the protocol stack within the kernel. When the application // needs a destination address on an incoming packet, // SetControlMessage of PacketConn is used to enable control message // transmissions. @@ -145,7 +145,7 @@ // More multicasting // // An application that uses PacketConn or RawConn may join multiple -// multicast groups. For example, a UDP listener with port 1024 might +// multicast groups. For example, a UDP listener with port 1024 might // join two different groups across over two different network // interfaces by using: // @@ -166,7 +166,7 @@ // } // // It is possible for multiple UDP listeners that listen on the same -// UDP port to join the same multicast group. The net package will +// UDP port to join the same multicast group. The net package will // provide a socket that listens to a wildcard address with reusable // UDP port when an appropriate multicast address prefix is passed to // the net.ListenPacket or net.ListenUDP. diff --git a/vendor/golang.org/x/net/ipv4/endpoint.go b/vendor/golang.org/x/net/ipv4/endpoint.go index 8f7e07a..01c4e39 100644 --- a/vendor/golang.org/x/net/ipv4/endpoint.go +++ b/vendor/golang.org/x/net/ipv4/endpoint.go @@ -38,8 +38,8 @@ func NewConn(c net.Conn) *Conn { } // A PacketConn represents a packet network endpoint that uses the -// IPv4 transport. It is used to control several IP-level socket -// options including multicasting. It also provides datagram based +// IPv4 transport. It is used to control several IP-level socket +// options including multicasting. It also provides datagram based // network I/O methods specific to the IPv4 and higher layer protocols // such as UDP. type PacketConn struct { @@ -118,8 +118,8 @@ func NewPacketConn(c net.PacketConn) *PacketConn { } // A RawConn represents a packet network endpoint that uses the IPv4 -// transport. It is used to control several IP-level socket options -// including IPv4 header manipulation. It also provides datagram +// transport. It is used to control several IP-level socket options +// including IPv4 header manipulation. It also provides datagram // based network I/O methods specific to the IPv4 and higher layer // protocols that handle IPv4 datagram directly such as OSPF, GRE. type RawConn struct { diff --git a/vendor/golang.org/x/net/ipv4/go19_test.go b/vendor/golang.org/x/net/ipv4/go19_test.go deleted file mode 100644 index 82a27b1..0000000 --- a/vendor/golang.org/x/net/ipv4/go19_test.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.9 - -package ipv4 - -func init() { - disableTests = true -} diff --git a/vendor/golang.org/x/net/ipv4/ipv4_test.go b/vendor/golang.org/x/net/ipv4/ipv4_test.go deleted file mode 100644 index 9172992..0000000 --- a/vendor/golang.org/x/net/ipv4/ipv4_test.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ipv4 - -import ( - "fmt" - "os" - "testing" -) - -var disableTests = false - -func TestMain(m *testing.M) { - if disableTests { - fmt.Fprintf(os.Stderr, "ipv4 tests disabled in Go 1.9 until netreflect is fixed. (Issue 19051)\n") - os.Exit(0) - } - // call flag.Parse() here if TestMain uses flags - os.Exit(m.Run()) -} diff --git a/vendor/golang.org/x/net/ipv4/packet.go b/vendor/golang.org/x/net/ipv4/packet.go index d43723c..7f3bf48 100644 --- a/vendor/golang.org/x/net/ipv4/packet.go +++ b/vendor/golang.org/x/net/ipv4/packet.go @@ -21,7 +21,7 @@ type packetHandler struct { func (c *packetHandler) ok() bool { return c != nil && c.c != nil } // ReadFrom reads an IPv4 datagram from the endpoint c, copying the -// datagram into b. It returns the received datagram as the IPv4 +// datagram into b. It returns the received datagram as the IPv4 // header h, the payload p and the control message cm. func (c *packetHandler) ReadFrom(b []byte) (h *Header, p []byte, cm *ControlMessage, err error) { if !c.ok() { @@ -57,9 +57,9 @@ func slicePacket(b []byte) (h, p []byte, err error) { } // WriteTo writes an IPv4 datagram through the endpoint c, copying the -// datagram from the IPv4 header h and the payload p. The control +// datagram from the IPv4 header h and the payload p. The control // message cm allows the datagram path and the outgoing interface to be -// specified. Currently only Darwin and Linux support this. The cm +// specified. Currently only Darwin and Linux support this. The cm // may be nil if control of the outgoing datagram is not required. // // The IPv4 header h must contain appropriate fields that include: diff --git a/vendor/golang.org/x/net/ipv4/payload_cmsg.go b/vendor/golang.org/x/net/ipv4/payload_cmsg.go index 5e6e55c..9bcde8f 100644 --- a/vendor/golang.org/x/net/ipv4/payload_cmsg.go +++ b/vendor/golang.org/x/net/ipv4/payload_cmsg.go @@ -12,7 +12,7 @@ import ( ) // ReadFrom reads a payload of the received IPv4 datagram, from the -// endpoint c, copying the payload into b. It returns the number of +// endpoint c, copying the payload into b. It returns the number of // bytes copied into b, the control message cm and the source address // src of the received datagram. func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) { @@ -53,10 +53,10 @@ func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net. } // WriteTo writes a payload of the IPv4 datagram, to the destination -// address dst through the endpoint c, copying the payload from b. It -// returns the number of bytes written. The control message cm allows +// address dst through the endpoint c, copying the payload from b. It +// returns the number of bytes written. The control message cm allows // the datagram path and the outgoing interface to be specified. -// Currently only Darwin and Linux support this. The cm may be nil if +// Currently only Darwin and Linux support this. The cm may be nil if // control of the outgoing datagram is not required. func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) { if !c.ok() { diff --git a/vendor/golang.org/x/net/ipv4/payload_nocmsg.go b/vendor/golang.org/x/net/ipv4/payload_nocmsg.go index 6f9d5b0..6f1b402 100644 --- a/vendor/golang.org/x/net/ipv4/payload_nocmsg.go +++ b/vendor/golang.org/x/net/ipv4/payload_nocmsg.go @@ -12,7 +12,7 @@ import ( ) // ReadFrom reads a payload of the received IPv4 datagram, from the -// endpoint c, copying the payload into b. It returns the number of +// endpoint c, copying the payload into b. It returns the number of // bytes copied into b, the control message cm and the source address // src of the received datagram. func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) { @@ -26,10 +26,10 @@ func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net. } // WriteTo writes a payload of the IPv4 datagram, to the destination -// address dst through the endpoint c, copying the payload from b. It -// returns the number of bytes written. The control message cm allows +// address dst through the endpoint c, copying the payload from b. It +// returns the number of bytes written. The control message cm allows // the datagram path and the outgoing interface to be specified. -// Currently only Darwin and Linux support this. The cm may be nil if +// Currently only Darwin and Linux support this. The cm may be nil if // control of the outgoing datagram is not required. func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) { if !c.ok() { diff --git a/vendor/golang.org/x/net/ipv4/sys_darwin.go b/vendor/golang.org/x/net/ipv4/sys_darwin.go index abfffca..bc69414 100644 --- a/vendor/golang.org/x/net/ipv4/sys_darwin.go +++ b/vendor/golang.org/x/net/ipv4/sys_darwin.go @@ -6,8 +6,6 @@ package ipv4 import ( "net" - "strconv" - "strings" "syscall" "unsafe" ) @@ -38,40 +36,41 @@ var ( func init() { // Seems like kern.osreldate is veiled on latest OS X. We use // kern.osrelease instead. - s, err := syscall.Sysctl("kern.osrelease") + osver, err := syscall.Sysctl("kern.osrelease") if err != nil { return } - ss := strings.Split(s, ".") - if len(ss) == 0 { - return + var i int + for i = range osver { + if osver[i] == '.' { + break + } } // The IP_PKTINFO and protocol-independent multicast API were - // introduced in OS X 10.7 (Darwin 11). But it looks like - // those features require OS X 10.8 (Darwin 12) or above. + // introduced in OS X 10.7 (Darwin 11.0.0). But it looks like + // those features require OS X 10.8 (Darwin 12.0.0) and above. // See http://support.apple.com/kb/HT1633. - if mjver, err := strconv.Atoi(ss[0]); err != nil || mjver < 12 { - return + if i > 2 || i == 2 && osver[0] >= '1' && osver[1] >= '2' { + ctlOpts[ctlPacketInfo].name = sysIP_PKTINFO + ctlOpts[ctlPacketInfo].length = sizeofInetPktinfo + ctlOpts[ctlPacketInfo].marshal = marshalPacketInfo + ctlOpts[ctlPacketInfo].parse = parsePacketInfo + sockOpts[ssoPacketInfo].name = sysIP_RECVPKTINFO + sockOpts[ssoPacketInfo].typ = ssoTypeInt + sockOpts[ssoMulticastInterface].typ = ssoTypeIPMreqn + sockOpts[ssoJoinGroup].name = sysMCAST_JOIN_GROUP + sockOpts[ssoJoinGroup].typ = ssoTypeGroupReq + sockOpts[ssoLeaveGroup].name = sysMCAST_LEAVE_GROUP + sockOpts[ssoLeaveGroup].typ = ssoTypeGroupReq + sockOpts[ssoJoinSourceGroup].name = sysMCAST_JOIN_SOURCE_GROUP + sockOpts[ssoJoinSourceGroup].typ = ssoTypeGroupSourceReq + sockOpts[ssoLeaveSourceGroup].name = sysMCAST_LEAVE_SOURCE_GROUP + sockOpts[ssoLeaveSourceGroup].typ = ssoTypeGroupSourceReq + sockOpts[ssoBlockSourceGroup].name = sysMCAST_BLOCK_SOURCE + sockOpts[ssoBlockSourceGroup].typ = ssoTypeGroupSourceReq + sockOpts[ssoUnblockSourceGroup].name = sysMCAST_UNBLOCK_SOURCE + sockOpts[ssoUnblockSourceGroup].typ = ssoTypeGroupSourceReq } - ctlOpts[ctlPacketInfo].name = sysIP_PKTINFO - ctlOpts[ctlPacketInfo].length = sizeofInetPktinfo - ctlOpts[ctlPacketInfo].marshal = marshalPacketInfo - ctlOpts[ctlPacketInfo].parse = parsePacketInfo - sockOpts[ssoPacketInfo].name = sysIP_RECVPKTINFO - sockOpts[ssoPacketInfo].typ = ssoTypeInt - sockOpts[ssoMulticastInterface].typ = ssoTypeIPMreqn - sockOpts[ssoJoinGroup].name = sysMCAST_JOIN_GROUP - sockOpts[ssoJoinGroup].typ = ssoTypeGroupReq - sockOpts[ssoLeaveGroup].name = sysMCAST_LEAVE_GROUP - sockOpts[ssoLeaveGroup].typ = ssoTypeGroupReq - sockOpts[ssoJoinSourceGroup].name = sysMCAST_JOIN_SOURCE_GROUP - sockOpts[ssoJoinSourceGroup].typ = ssoTypeGroupSourceReq - sockOpts[ssoLeaveSourceGroup].name = sysMCAST_LEAVE_SOURCE_GROUP - sockOpts[ssoLeaveSourceGroup].typ = ssoTypeGroupSourceReq - sockOpts[ssoBlockSourceGroup].name = sysMCAST_BLOCK_SOURCE - sockOpts[ssoBlockSourceGroup].typ = ssoTypeGroupSourceReq - sockOpts[ssoUnblockSourceGroup].name = sysMCAST_UNBLOCK_SOURCE - sockOpts[ssoUnblockSourceGroup].typ = ssoTypeGroupSourceReq } func (pi *inetPktinfo) setIfindex(i int) { diff --git a/vendor/golang.org/x/net/ipv6/control.go b/vendor/golang.org/x/net/ipv6/control.go index 674628d..56303f0 100644 --- a/vendor/golang.org/x/net/ipv6/control.go +++ b/vendor/golang.org/x/net/ipv6/control.go @@ -11,7 +11,7 @@ import ( ) // Note that RFC 3542 obsoletes RFC 2292 but OS X Snow Leopard and the -// former still support RFC 2292 only. Please be aware that almost +// former still support RFC 2292 only. Please be aware that almost // all protocol implementations prohibit using a combination of RFC // 2292 and RFC 3542 for some practical reasons. diff --git a/vendor/golang.org/x/net/ipv6/dgramopt_posix.go b/vendor/golang.org/x/net/ipv6/dgramopt_posix.go index a448cba..5714308 100644 --- a/vendor/golang.org/x/net/ipv6/dgramopt_posix.go +++ b/vendor/golang.org/x/net/ipv6/dgramopt_posix.go @@ -227,7 +227,7 @@ func (c *dgramOpt) IncludeSourceSpecificGroup(ifi *net.Interface, group, source } // Checksum reports whether the kernel will compute, store or verify a -// checksum for both incoming and outgoing packets. If on is true, it +// checksum for both incoming and outgoing packets. If on is true, it // returns an offset in bytes into the data of where the checksum // field is located. func (c *dgramOpt) Checksum() (on bool, offset int, err error) { @@ -248,7 +248,7 @@ func (c *dgramOpt) Checksum() (on bool, offset int, err error) { return true, offset, nil } -// SetChecksum enables the kernel checksum processing. If on is ture, +// SetChecksum enables the kernel checksum processing. If on is ture, // the offset should be an offset in bytes into the data of where the // checksum field is located. func (c *dgramOpt) SetChecksum(on bool, offset int) error { diff --git a/vendor/golang.org/x/net/ipv6/dgramopt_stub.go b/vendor/golang.org/x/net/ipv6/dgramopt_stub.go index 82b0686..bc3290a 100644 --- a/vendor/golang.org/x/net/ipv6/dgramopt_stub.go +++ b/vendor/golang.org/x/net/ipv6/dgramopt_stub.go @@ -94,14 +94,14 @@ func (c *dgramOpt) IncludeSourceSpecificGroup(ifi *net.Interface, group, source } // Checksum reports whether the kernel will compute, store or verify a -// checksum for both incoming and outgoing packets. If on is true, it +// checksum for both incoming and outgoing packets. If on is true, it // returns an offset in bytes into the data of where the checksum // field is located. func (c *dgramOpt) Checksum() (on bool, offset int, err error) { return false, 0, errOpNoSupport } -// SetChecksum enables the kernel checksum processing. If on is ture, +// SetChecksum enables the kernel checksum processing. If on is ture, // the offset should be an offset in bytes into the data of where the // checksum field is located. func (c *dgramOpt) SetChecksum(on bool, offset int) error { diff --git a/vendor/golang.org/x/net/ipv6/doc.go b/vendor/golang.org/x/net/ipv6/doc.go index eaa24c5..88383e9 100644 --- a/vendor/golang.org/x/net/ipv6/doc.go +++ b/vendor/golang.org/x/net/ipv6/doc.go @@ -22,7 +22,7 @@ // // The options for unicasting are available for net.TCPConn, // net.UDPConn and net.IPConn which are created as network connections -// that use the IPv6 transport. When a single TCP connection carrying +// that use the IPv6 transport. When a single TCP connection carrying // a data flow of multiple packets needs to indicate the flow is // important, Conn is used to set the traffic class field on the IPv6 // header for each packet. @@ -57,7 +57,7 @@ // // The options for multicasting are available for net.UDPConn and // net.IPconn which are created as network connections that use the -// IPv6 transport. A few network facilities must be prepared before +// IPv6 transport. A few network facilities must be prepared before // you begin multicasting, at a minimum joining network interfaces and // multicast groups. // @@ -81,7 +81,7 @@ // defer c.Close() // // Second, the application joins multicast groups, starts listening to -// the groups on the specified network interfaces. Note that the +// the groups on the specified network interfaces. Note that the // service port for transport layer protocol does not matter with this // operation as joining groups affects only network and link layer // protocols, such as IPv6 and Ethernet. @@ -95,7 +95,7 @@ // } // // The application might set per packet control message transmissions -// between the protocol stack within the kernel. When the application +// between the protocol stack within the kernel. When the application // needs a destination address on an incoming packet, // SetControlMessage of PacketConn is used to enable control message // transmissions. @@ -144,7 +144,7 @@ // More multicasting // // An application that uses PacketConn may join multiple multicast -// groups. For example, a UDP listener with port 1024 might join two +// groups. For example, a UDP listener with port 1024 might join two // different groups across over two different network interfaces by // using: // @@ -165,7 +165,7 @@ // } // // It is possible for multiple UDP listeners that listen on the same -// UDP port to join the same multicast group. The net package will +// UDP port to join the same multicast group. The net package will // provide a socket that listens to a wildcard address with reusable // UDP port when an appropriate multicast address prefix is passed to // the net.ListenPacket or net.ListenUDP. diff --git a/vendor/golang.org/x/net/ipv6/endpoint.go b/vendor/golang.org/x/net/ipv6/endpoint.go index ce0b0ce..f6a68ab 100644 --- a/vendor/golang.org/x/net/ipv6/endpoint.go +++ b/vendor/golang.org/x/net/ipv6/endpoint.go @@ -55,8 +55,8 @@ func NewConn(c net.Conn) *Conn { } // A PacketConn represents a packet network endpoint that uses IPv6 -// transport. It is used to control several IP-level socket options -// including IPv6 header manipulation. It also provides datagram +// transport. It is used to control several IP-level socket options +// including IPv6 header manipulation. It also provides datagram // based network I/O methods specific to the IPv6 and higher layer // protocols such as OSPF, GRE, and UDP. type PacketConn struct { diff --git a/vendor/golang.org/x/net/ipv6/go19_test.go b/vendor/golang.org/x/net/ipv6/go19_test.go deleted file mode 100644 index c7cb057..0000000 --- a/vendor/golang.org/x/net/ipv6/go19_test.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.9 - -package ipv6 - -func init() { - disableTests = true -} diff --git a/vendor/golang.org/x/net/ipv6/ipv6_test.go b/vendor/golang.org/x/net/ipv6/ipv6_test.go deleted file mode 100644 index 8d2d235..0000000 --- a/vendor/golang.org/x/net/ipv6/ipv6_test.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ipv6 - -import ( - "fmt" - "os" - "testing" -) - -var disableTests = false - -func TestMain(m *testing.M) { - if disableTests { - fmt.Fprintf(os.Stderr, "ipv6 tests disabled in Go 1.9 until netreflect is fixed (Issue 19051)\n") - os.Exit(0) - } - // call flag.Parse() here if TestMain uses flags - os.Exit(m.Run()) -} diff --git a/vendor/golang.org/x/net/ipv6/payload_cmsg.go b/vendor/golang.org/x/net/ipv6/payload_cmsg.go index e853c80..3a33585 100644 --- a/vendor/golang.org/x/net/ipv6/payload_cmsg.go +++ b/vendor/golang.org/x/net/ipv6/payload_cmsg.go @@ -12,7 +12,7 @@ import ( ) // ReadFrom reads a payload of the received IPv6 datagram, from the -// endpoint c, copying the payload into b. It returns the number of +// endpoint c, copying the payload into b. It returns the number of // bytes copied into b, the control message cm and the source address // src of the received datagram. func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) { @@ -43,9 +43,9 @@ func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net. } // WriteTo writes a payload of the IPv6 datagram, to the destination -// address dst through the endpoint c, copying the payload from b. It -// returns the number of bytes written. The control message cm allows -// the IPv6 header fields and the datagram path to be specified. The +// address dst through the endpoint c, copying the payload from b. It +// returns the number of bytes written. The control message cm allows +// the IPv6 header fields and the datagram path to be specified. The // cm may be nil if control of the outgoing datagram is not required. func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) { if !c.ok() { diff --git a/vendor/golang.org/x/net/ipv6/payload_nocmsg.go b/vendor/golang.org/x/net/ipv6/payload_nocmsg.go index 99a4354..9731cba 100644 --- a/vendor/golang.org/x/net/ipv6/payload_nocmsg.go +++ b/vendor/golang.org/x/net/ipv6/payload_nocmsg.go @@ -12,7 +12,7 @@ import ( ) // ReadFrom reads a payload of the received IPv6 datagram, from the -// endpoint c, copying the payload into b. It returns the number of +// endpoint c, copying the payload into b. It returns the number of // bytes copied into b, the control message cm and the source address // src of the received datagram. func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) { @@ -26,9 +26,9 @@ func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net. } // WriteTo writes a payload of the IPv6 datagram, to the destination -// address dst through the endpoint c, copying the payload from b. It -// returns the number of bytes written. The control message cm allows -// the IPv6 header fields and the datagram path to be specified. The +// address dst through the endpoint c, copying the payload from b. It +// returns the number of bytes written. The control message cm allows +// the IPv6 header fields and the datagram path to be specified. The // cm may be nil if control of the outgoing datagram is not required. func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) { if !c.ok() { diff --git a/vendor/golang.org/x/net/lif/address.go b/vendor/golang.org/x/net/lif/address.go index afb957f..f9b34ae 100644 --- a/vendor/golang.org/x/net/lif/address.go +++ b/vendor/golang.org/x/net/lif/address.go @@ -67,7 +67,7 @@ func Addrs(af int, name string) ([]Addr, error) { continue } sa := (*sockaddrStorage)(unsafe.Pointer(&lifr.Lifru[0])) - l := int(nativeEndian.Uint32(lifr.Lifru1[:4])) + l := int(littleEndian.Uint32(lifr.Lifru1[:4])) if l == 0 { continue } @@ -77,7 +77,7 @@ func Addrs(af int, name string) ([]Addr, error) { copy(a.IP[:], lifr.Lifru[4:8]) as = append(as, a) case sysAF_INET6: - a := &Inet6Addr{PrefixLen: l, ZoneID: int(nativeEndian.Uint32(lifr.Lifru[24:28]))} + a := &Inet6Addr{PrefixLen: l, ZoneID: int(littleEndian.Uint32(lifr.Lifru[24:28]))} copy(a.IP[:], lifr.Lifru[8:24]) as = append(as, a) } diff --git a/vendor/golang.org/x/net/lif/binary.go b/vendor/golang.org/x/net/lif/binary.go index 738a94f..aade9ea 100644 --- a/vendor/golang.org/x/net/lif/binary.go +++ b/vendor/golang.org/x/net/lif/binary.go @@ -12,10 +12,7 @@ package lif // library. Therefore the package set used in the package must be the // same as net package. -var ( - littleEndian binaryLittleEndian - bigEndian binaryBigEndian -) +var littleEndian binaryLittleEndian type binaryByteOrder interface { Uint16([]byte) uint16 @@ -69,47 +66,3 @@ func (binaryLittleEndian) PutUint64(b []byte, v uint64) { b[6] = byte(v >> 48) b[7] = byte(v >> 56) } - -type binaryBigEndian struct{} - -func (binaryBigEndian) Uint16(b []byte) uint16 { - _ = b[1] // bounds check hint to compiler; see golang.org/issue/14808 - return uint16(b[1]) | uint16(b[0])<<8 -} - -func (binaryBigEndian) PutUint16(b []byte, v uint16) { - _ = b[1] // early bounds check to guarantee safety of writes below - b[0] = byte(v >> 8) - b[1] = byte(v) -} - -func (binaryBigEndian) Uint32(b []byte) uint32 { - _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808 - return uint32(b[3]) | uint32(b[2])<<8 | uint32(b[1])<<16 | uint32(b[0])<<24 -} - -func (binaryBigEndian) PutUint32(b []byte, v uint32) { - _ = b[3] // early bounds check to guarantee safety of writes below - b[0] = byte(v >> 24) - b[1] = byte(v >> 16) - b[2] = byte(v >> 8) - b[3] = byte(v) -} - -func (binaryBigEndian) Uint64(b []byte) uint64 { - _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808 - return uint64(b[7]) | uint64(b[6])<<8 | uint64(b[5])<<16 | uint64(b[4])<<24 | - uint64(b[3])<<32 | uint64(b[2])<<40 | uint64(b[1])<<48 | uint64(b[0])<<56 -} - -func (binaryBigEndian) PutUint64(b []byte, v uint64) { - _ = b[7] // early bounds check to guarantee safety of writes below - b[0] = byte(v >> 56) - b[1] = byte(v >> 48) - b[2] = byte(v >> 40) - b[3] = byte(v >> 32) - b[4] = byte(v >> 24) - b[5] = byte(v >> 16) - b[6] = byte(v >> 8) - b[7] = byte(v) -} diff --git a/vendor/golang.org/x/net/lif/link.go b/vendor/golang.org/x/net/lif/link.go index fce6b21..76fa6c6 100644 --- a/vendor/golang.org/x/net/lif/link.go +++ b/vendor/golang.org/x/net/lif/link.go @@ -31,15 +31,15 @@ func (ll *Link) fetch(s uintptr) { } ioc := int64(sysSIOCGLIFINDEX) if err := ioctl(s, uintptr(ioc), unsafe.Pointer(&lifr)); err == nil { - ll.Index = int(nativeEndian.Uint32(lifr.Lifru[:4])) + ll.Index = int(littleEndian.Uint32(lifr.Lifru[:4])) } ioc = int64(sysSIOCGLIFFLAGS) if err := ioctl(s, uintptr(ioc), unsafe.Pointer(&lifr)); err == nil { - ll.Flags = int(nativeEndian.Uint64(lifr.Lifru[:8])) + ll.Flags = int(littleEndian.Uint64(lifr.Lifru[:8])) } ioc = int64(sysSIOCGLIFMTU) if err := ioctl(s, uintptr(ioc), unsafe.Pointer(&lifr)); err == nil { - ll.MTU = int(nativeEndian.Uint32(lifr.Lifru[:4])) + ll.MTU = int(littleEndian.Uint32(lifr.Lifru[:4])) } switch ll.Type { case sysIFT_IPV4, sysIFT_IPV6, sysIFT_6TO4: @@ -84,11 +84,7 @@ func links(eps []endpoint, name string) ([]Link, error) { b := make([]byte, lifn.Count*sizeofLifreq) lifc.Family = uint16(ep.af) lifc.Len = lifn.Count * sizeofLifreq - if len(lifc.Lifcu) == 8 { - nativeEndian.PutUint64(lifc.Lifcu[:], uint64(uintptr(unsafe.Pointer(&b[0])))) - } else { - nativeEndian.PutUint32(lifc.Lifcu[:], uint32(uintptr(unsafe.Pointer(&b[0])))) - } + littleEndian.PutUint64(lifc.Lifcu[:], uint64(uintptr(unsafe.Pointer(&b[0])))) ioc = int64(sysSIOCGLIFCONF) if err := ioctl(ep.s, uintptr(ioc), unsafe.Pointer(&lifc)); err != nil { continue diff --git a/vendor/golang.org/x/net/lif/sys.go b/vendor/golang.org/x/net/lif/sys.go deleted file mode 100644 index c896041..0000000 --- a/vendor/golang.org/x/net/lif/sys.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build solaris - -package lif - -import "unsafe" - -var nativeEndian binaryByteOrder - -func init() { - i := uint32(1) - b := (*[4]byte)(unsafe.Pointer(&i)) - if b[0] == 1 { - nativeEndian = littleEndian - } else { - nativeEndian = bigEndian - } -} diff --git a/vendor/golang.org/x/net/lif/sys_solaris_amd64.s b/vendor/golang.org/x/net/lif/sys_solaris_amd64.s index 39d76af..1ebca37 100644 --- a/vendor/golang.org/x/net/lif/sys_solaris_amd64.s +++ b/vendor/golang.org/x/net/lif/sys_solaris_amd64.s @@ -6,3 +6,6 @@ TEXT ·sysvicall6(SB),NOSPLIT,$0-88 JMP syscall·sysvicall6(SB) + +TEXT ·keepAlive(SB),NOSPLIT,$0 + RET diff --git a/vendor/golang.org/x/net/lif/syscall.go b/vendor/golang.org/x/net/lif/syscall.go index aadab2e..5fe0736 100644 --- a/vendor/golang.org/x/net/lif/syscall.go +++ b/vendor/golang.org/x/net/lif/syscall.go @@ -19,8 +19,13 @@ var procIoctl uintptr func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (uintptr, uintptr, syscall.Errno) +// TODO: replace with runtime.KeepAlive when available +//go:noescape +func keepAlive(p unsafe.Pointer) + func ioctl(s, ioc uintptr, arg unsafe.Pointer) error { _, _, errno := sysvicall6(uintptr(unsafe.Pointer(&procIoctl)), 3, s, ioc, uintptr(arg), 0, 0, 0) + keepAlive(arg) if errno != 0 { return error(errno) } diff --git a/vendor/golang.org/x/net/nettest/conntest_test.go b/vendor/golang.org/x/net/nettest/conntest_test.go index 9f9453f..23bd69f 100644 --- a/vendor/golang.org/x/net/nettest/conntest_test.go +++ b/vendor/golang.org/x/net/nettest/conntest_test.go @@ -7,14 +7,64 @@ package nettest import ( + "fmt" + "io/ioutil" "net" "os" "runtime" "testing" - - "golang.org/x/net/internal/nettest" ) +// testUnixAddr uses ioutil.TempFile to get a name that is unique. +// It also uses /tmp directory in case it is prohibited to create UNIX +// sockets in TMPDIR. +func testUnixAddr() string { + f, err := ioutil.TempFile("", "go-nettest") + if err != nil { + panic(err) + } + addr := f.Name() + f.Close() + os.Remove(addr) + return addr +} + +// testableNetwork reports whether network is testable on the current +// platform configuration. +// This is based on logic from standard library's net/platform_test.go. +func testableNetwork(network string) bool { + switch network { + case "unix": + switch runtime.GOOS { + case "android", "nacl", "plan9", "windows": + return false + } + if runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") { + return false + } + case "unixpacket": + switch runtime.GOOS { + case "android", "darwin", "nacl", "plan9", "windows", "freebsd": + return false + } + } + return true +} + +func newLocalListener(network string) (net.Listener, error) { + switch network { + case "tcp": + ln, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + ln, err = net.Listen("tcp6", "[::1]:0") + } + return ln, err + case "unix", "unixpacket": + return net.Listen(network, testUnixAddr()) + } + return nil, fmt.Errorf("%s is not supported", network) +} + func TestTestConn(t *testing.T) { tests := []struct{ name, network string }{ {"TCP", "tcp"}, @@ -24,12 +74,12 @@ func TestTestConn(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - if !nettest.TestableNetwork(tt.network) { + if !testableNetwork(tt.network) { t.Skipf("not supported on %s", runtime.GOOS) } mp := func() (c1, c2 net.Conn, stop func(), err error) { - ln, err := nettest.NewLocalListener(tt.network) + ln, err := newLocalListener(tt.network) if err != nil { return nil, nil, nil, err } diff --git a/vendor/golang.org/x/net/proxy/socks5.go b/vendor/golang.org/x/net/proxy/socks5.go index 973f57f..9b96282 100644 --- a/vendor/golang.org/x/net/proxy/socks5.go +++ b/vendor/golang.org/x/net/proxy/socks5.go @@ -72,28 +72,24 @@ func (s *socks5) Dial(network, addr string) (net.Conn, error) { if err != nil { return nil, err } - if err := s.connect(conn, addr); err != nil { - conn.Close() - return nil, err - } - return conn, nil -} + closeConn := &conn + defer func() { + if closeConn != nil { + (*closeConn).Close() + } + }() -// connect takes an existing connection to a socks5 proxy server, -// and commands the server to extend that connection to target, -// which must be a canonical address with a host and port. -func (s *socks5) connect(conn net.Conn, target string) error { - host, portStr, err := net.SplitHostPort(target) + host, portStr, err := net.SplitHostPort(addr) if err != nil { - return err + return nil, err } port, err := strconv.Atoi(portStr) if err != nil { - return errors.New("proxy: failed to parse port number: " + portStr) + return nil, errors.New("proxy: failed to parse port number: " + portStr) } if port < 1 || port > 0xffff { - return errors.New("proxy: port number out of range: " + portStr) + return nil, errors.New("proxy: port number out of range: " + portStr) } // the size here is just an estimate @@ -107,17 +103,17 @@ func (s *socks5) connect(conn net.Conn, target string) error { } if _, err := conn.Write(buf); err != nil { - return errors.New("proxy: failed to write greeting to SOCKS5 proxy at " + s.addr + ": " + err.Error()) + return nil, errors.New("proxy: failed to write greeting to SOCKS5 proxy at " + s.addr + ": " + err.Error()) } if _, err := io.ReadFull(conn, buf[:2]); err != nil { - return errors.New("proxy: failed to read greeting from SOCKS5 proxy at " + s.addr + ": " + err.Error()) + return nil, errors.New("proxy: failed to read greeting from SOCKS5 proxy at " + s.addr + ": " + err.Error()) } if buf[0] != 5 { - return errors.New("proxy: SOCKS5 proxy at " + s.addr + " has unexpected version " + strconv.Itoa(int(buf[0]))) + return nil, errors.New("proxy: SOCKS5 proxy at " + s.addr + " has unexpected version " + strconv.Itoa(int(buf[0]))) } if buf[1] == 0xff { - return errors.New("proxy: SOCKS5 proxy at " + s.addr + " requires authentication") + return nil, errors.New("proxy: SOCKS5 proxy at " + s.addr + " requires authentication") } if buf[1] == socks5AuthPassword { @@ -129,15 +125,15 @@ func (s *socks5) connect(conn net.Conn, target string) error { buf = append(buf, s.password...) if _, err := conn.Write(buf); err != nil { - return errors.New("proxy: failed to write authentication request to SOCKS5 proxy at " + s.addr + ": " + err.Error()) + return nil, errors.New("proxy: failed to write authentication request to SOCKS5 proxy at " + s.addr + ": " + err.Error()) } if _, err := io.ReadFull(conn, buf[:2]); err != nil { - return errors.New("proxy: failed to read authentication reply from SOCKS5 proxy at " + s.addr + ": " + err.Error()) + return nil, errors.New("proxy: failed to read authentication reply from SOCKS5 proxy at " + s.addr + ": " + err.Error()) } if buf[1] != 0 { - return errors.New("proxy: SOCKS5 proxy at " + s.addr + " rejected username/password") + return nil, errors.New("proxy: SOCKS5 proxy at " + s.addr + " rejected username/password") } } @@ -154,7 +150,7 @@ func (s *socks5) connect(conn net.Conn, target string) error { buf = append(buf, ip...) } else { if len(host) > 255 { - return errors.New("proxy: destination hostname too long: " + host) + return nil, errors.New("proxy: destination hostname too long: " + host) } buf = append(buf, socks5Domain) buf = append(buf, byte(len(host))) @@ -163,11 +159,11 @@ func (s *socks5) connect(conn net.Conn, target string) error { buf = append(buf, byte(port>>8), byte(port)) if _, err := conn.Write(buf); err != nil { - return errors.New("proxy: failed to write connect request to SOCKS5 proxy at " + s.addr + ": " + err.Error()) + return nil, errors.New("proxy: failed to write connect request to SOCKS5 proxy at " + s.addr + ": " + err.Error()) } if _, err := io.ReadFull(conn, buf[:4]); err != nil { - return errors.New("proxy: failed to read connect reply from SOCKS5 proxy at " + s.addr + ": " + err.Error()) + return nil, errors.New("proxy: failed to read connect reply from SOCKS5 proxy at " + s.addr + ": " + err.Error()) } failure := "unknown error" @@ -176,7 +172,7 @@ func (s *socks5) connect(conn net.Conn, target string) error { } if len(failure) > 0 { - return errors.New("proxy: SOCKS5 proxy at " + s.addr + " failed to connect: " + failure) + return nil, errors.New("proxy: SOCKS5 proxy at " + s.addr + " failed to connect: " + failure) } bytesToDiscard := 0 @@ -188,11 +184,11 @@ func (s *socks5) connect(conn net.Conn, target string) error { case socks5Domain: _, err := io.ReadFull(conn, buf[:1]) if err != nil { - return errors.New("proxy: failed to read domain length from SOCKS5 proxy at " + s.addr + ": " + err.Error()) + return nil, errors.New("proxy: failed to read domain length from SOCKS5 proxy at " + s.addr + ": " + err.Error()) } bytesToDiscard = int(buf[0]) default: - return errors.New("proxy: got unknown address type " + strconv.Itoa(int(buf[3])) + " from SOCKS5 proxy at " + s.addr) + return nil, errors.New("proxy: got unknown address type " + strconv.Itoa(int(buf[3])) + " from SOCKS5 proxy at " + s.addr) } if cap(buf) < bytesToDiscard { @@ -201,13 +197,14 @@ func (s *socks5) connect(conn net.Conn, target string) error { buf = buf[:bytesToDiscard] } if _, err := io.ReadFull(conn, buf); err != nil { - return errors.New("proxy: failed to read address from SOCKS5 proxy at " + s.addr + ": " + err.Error()) + return nil, errors.New("proxy: failed to read address from SOCKS5 proxy at " + s.addr + ": " + err.Error()) } // Also need to discard the port number if _, err := io.ReadFull(conn, buf[:2]); err != nil { - return errors.New("proxy: failed to read port from SOCKS5 proxy at " + s.addr + ": " + err.Error()) + return nil, errors.New("proxy: failed to read port from SOCKS5 proxy at " + s.addr + ": " + err.Error()) } - return nil + closeConn = nil + return conn, nil } diff --git a/vendor/golang.org/x/net/publicsuffix/table.go b/vendor/golang.org/x/net/publicsuffix/table.go index 5db1e69..bf20c03 100644 --- a/vendor/golang.org/x/net/publicsuffix/table.go +++ b/vendor/golang.org/x/net/publicsuffix/table.go @@ -2,7 +2,7 @@ package publicsuffix -const version = "publicsuffix.org's public_suffix_list.dat, git revision 45a2bf8ef3e22000fbe4bfa5f9252db41d777001 (2017-01-18T01:04:06Z)" +const version = "publicsuffix.org's public_suffix_list.dat, git revision 915565885d0fbd25caf7d8b339cd3478f558da94 (2016-10-19T08:16:09Z)" const ( nodesBitsChildren = 9 @@ -23,447 +23,446 @@ const ( ) // numTLD is the number of top level domains. -const numTLD = 1554 +const numTLD = 1553 // Text is the combined text of all labels. -const text = "bikedagestangeorgeorgiaxagrocerybnikahokutobishimaizuruhreportar" + - "nobrzegyptianaturalhistorymuseumcentereviewskrakoweddinggfarmers" + - "einexus-2bilbaogakievenesalangenikiiyamanouchikuhokuryugasakitau" + - "rayasudabillustrationikkoebenhavnikolaevennodessagamiharabiomuta" + - "shinainfinitintuitattoolsztynsettlersalondonetskarpaczeladzjcbre" + - "mangerbirdartcenterprisesakikuchikuseikarugapartmentsaltdalimoli" + - "serniabirkenesoddtangenovaravennagasukeverbankaruizawabirthplace" + - "vje-og-hornnesalvadordalibabajddarchaeologyusuisserveexchangebja" + - "rkoyuufcfanikonantanangerbjerkreimbalsanagochihayaakasakawaharau" + - "malopolskanlandds3-us-west-1bjugninohekinannestadrangedalindasda" + - "burblockbusternidray-dnsupdaterbloombergbauerninomiyakonojosoyro" + - "rosalzburgjovikarumaifarmsteadraydnsamegawabloxcmsamnangerblueda" + - "ncebmoattachmentsamsclubindalindesnesamsungladell-ogliastraderbm" + - "sandvikcoromantovalle-d-aostatic-accessanfranciscofreakunemurora" + - "ngeiseiyoichiropracticasinordre-landrivelandrobaknoluoktabuseekl" + - "ogesurancertmgretachikawakkanaibetsubamericanfamilydscloudcontro" + - "lledekafjordrudunsangoppdalivornobmweirbnpparibaselburglassassin" + - "ationalheritagematsubarakawagoebnrwfarsundupontariobonnirasakinu" + - "yamashinashikitchenishiazainvestmentsanjournalismailillesandefjo" + - "rdurbanamexhibitionishigobookingliwicebootsannanishiharaboschaef" + - "flerdalomzaporizhzhegurinzais-a-bulls-fanishiizunazukis-a-candid" + - "atebostikasaokamiminersannohelplfinancialorenskoglobalashovhachi" + - "nohedmarkashibatakasakiyokawarabostonakijinsekikogentinglobodoes" + - "-itvedestrandurhamburglogowhalingloppenzaogashimadachicagoboatsa" + - "nokashiharabotanicalgardenishikatakayamatta-varjjataxihuanishika" + - "tsuragithubusercontentgoryuzawabotanicgardenishikawazukamitondab" + - "ayashiogamagoriziabotanybouncemerckmsdnipropetrovskjakdnepropetr" + - "ovskiervaapsteiermarkashiwarabounty-fullensakerrypropertiesantab" + - "arbaraboutiquebecngmbhartiffanybozentsujiiebradescorporationishi" + - "merabrandywinevalleybrasiliabresciabrindisibenikebristoloslocalh" + - "istoryggeelvinckashiwazakiyosatokashikiyosemitebritishcolumbialo" + - "wiezachpomorskienishinomiyashironobroadcastlefrakkestadvrcambrid" + - "gestonextdirectjeldsundvrdnsantacruzsantafedextraspacekitagataji" + - "rittogoldpoint2thisamitsukebroadwaybroke-itjmaxxxboxenapponazure" + - "-mobilebrokerbronnoysundwgminakamichiharabrothermesaverdeatnurem" + - "bergmodellingmxfinitybrowsersafetymarketsanukis-a-catererbrumund" + - "dalotenkawabrunelasticbeanstalkasukabedzin-the-bandaikawachinaga" + - "noharamcoalaskanittedallasalleasinglest-mon-blogueurovisionthewi" + - "fiat-band-campaniabrusselsaotomemergencyberlevagangaviikanonjis-" + - "a-celticsfanishinoomotegobruxellesapodlasiellakasamatsudovre-eik" + - "erbryanskjervoyagebrynewhampshirebungoonordlandyndns-at-workingg" + - "roupalacebuskerudinewjerseybuzenishinoshimattelefonicarbonia-igl" + - "esias-carboniaiglesiascarboniabuzzlgrimstadyndns-blogdnsapporobw" + - "hoswhokksundyndns-freebox-ostrowiecateringebuilderschmidtre-gaul" + - "dalottebzhitomirumalselvendrellottokonamegatakasugais-a-chefashi" + - "onishiokoppegardyndns-homednsardegnamsskoganeis-a-conservativefs" + - "nillfjordyndns-ipaleocondoshichinohealth-carereformitakeharaconf" + - "erenceconstructionconsuladoesntexistanbullensvanguardyndns-wikin" + - "dlegokasells-for-lessaudaconsultanthropologyconsultingvolluxuryc" + - "ontactoyookanmakiwakunigamifunecontemporaryarteducationalchikugo" + - "doharuovatoyosatoyakokonoecontractorskenconventureshinodesashibe" + - "tsuikinderoycookingchannelblagdenesnaaseralingenkainanaejrietisa" + - "latinabenonichernihivanovodkagoshimalvikasumigaurawa-mazowszexjc" + - "palermomahachijorpelandyndns-mailouvreisenishitosashimizunaminam" + - "iashigaracoolkuszkoladbrokesauheradyndns-workisboringrpamperedch" + - "efastlylbaltimore-og-romsdalwaysdatabaseballangenoamishirasatoch" + - "igiessenebakkeshibechambagriculturennebudejjudygarlandigitalavan" + - "genavigationavuotnaklodzkodairamusementarumizusawabruzzoologyeon" + - "gbuk12cooperaunitemasekatsushikabeeldengeluidyndns1copenhagencyc" + - "lopedichernivtsiciliacorsicagliarightathomeftpanamacorvettenriku" + - "zentakataitogliattiresavannahgacosenzaganquannakadomaritimekeepi" + - "ngatlantaijis-a-financialadvisor-aurdaluzerncosidnsfor-better-th" + - "anawawildlifedjeffersoncostumedio-campidano-mediocampidanomedioc" + - "ouchpotatofriesaves-the-whalessandria-trani-barletta-andriatrani" + - "barlettaandriacouncilvivano-frankivskatsuyamasfjordencouponsavon" + - "aplesaxocoursesbschokoladencq-acranbrookuwanalyticscholarshipsch" + - "oolcreditcardynnschulezajskydivingruecreditunioncremonashorokana" + - "iecrewilliamhillcricketrzyncrimeastcoastaldefencecrotonewyorkshi" + - "recipesaro-urbino-pesarourbinopesaromasvuotnaharimamurogawacrown" + - "providercrsvpanasonichernovtsykkylvenetogakushimotoganewportllig" + - "atjxn--0trq7p7nnishiwakis-a-cpadoval-daostavalleycruiseschwarzgw" + - "angjuegoshikiminokamoenairtraffichiryukyuragifuchungbukasuyaltak" + - "ashimaseratis-a-cubicle-slavellinowtvalleaostatoilowiczest-le-pa" + - "trondheimmobilienissandnessjoenissayokoshibahikariwanumatakazaki" + - "s-a-democratkmaxxn--11b4c3dyndns-office-on-the-webcampobassociat" + - "esardiniacryptonomichigangwoncuisinellahppiacenzakopanerairguard" + - "ynv6culturalcentertainmentoyotaris-a-geekgalaxycuneocupcakecxn--" + - "1ctwolominamatakkokaminokawanishiaizubangecymrussiacyonabarulsan" + - "doycyouthdfcbankaufenfiguerestaurantoyotomiyazakis-a-greenfilate" + - "liafilminamiawajikis-a-guruslivinghistoryfinalfinancefineartscie" + - "ntistoragefinlandfinnoyfirebaseapparliamentoyotsukaidownloadfire" + - "nzefirestonefirmdaleirfjordfishingolffanscjohnsonfitjarqhachioji" + - "yahikobeatscotlandfitnessettlementoyourafjalerflesbergushikamifu" + - "ranoshiroomuraflickragerotikakamigaharaflightscrapper-siteflirfl" + - "ogintogurafloraflorencefloridavvesiidazaifudaigojomedizinhistori" + - "schescrappingxn--1lqs71dfloristanohatakahamaniwakuratexascolipic" + - "enord-aurdalipayflorogerserveftparmaflowerservegame-serversaille" + - "servehalflifestyleflynnhubambleclercartoonartdecoldwarmiamibugat" + - "tipschlesisches3-us-west-2fndfoodnetworkshoppingfor-ourfor-somee" + - "thnologyfor-theaterforexrothruherecreationforgotdnservehttparoch" + - "erkasyno-dservehumourforli-cesena-forlicesenaforlikescandynamic-" + - "dnserveirchitachinakagawatchandclockaszubyforsaleirvikazoforsand" + - "asuoloftoystre-slidrettozawafortmissoulair-traffic-controlleyfor" + - "tworthachirogatakahatakaishimogosenforuminamibosogndalfosneserve" + - "minecraftozsdev-myqnapcloudcontrolappspotagerfotaruis-a-hard-wor" + - "kerfoxfordedyn-ip24freeboxoservemp3utilitiesquarezzoologicalvink" + - "lein-addrammenuernbergdyniabogadocscbnl-o-g-i-nativeamericananti" + - "ques3-ap-northeast-1kappchizippodhaleangaviikadenadexeterepbodyn" + - "athomebuilt3l3p0rtargets-itargiving12000emmafanconagawakayamadri" + - "dvagsoyericssonyoursidealerimo-i-ranaamesjevuemielno-ip6freemaso" + - "nryfreiburgfreightcminamidaitomangotsukisosakitagawafreseniuscou" + - "ntryestateofdelawaredstonefribourgfriuli-v-giuliafriuli-ve-giuli" + - "afriuli-vegiuliafriuli-venezia-giuliafriuli-veneziagiuliafriuli-" + - "vgiuliafriuliv-giuliafriulive-giuliafriulivegiuliafriulivenezia-" + - "giuliafriuliveneziagiuliafriulivgiuliafrlfroganservep2parservepi" + - "cservequakefrognfrolandfrom-akrehamnfrom-alfrom-arfrom-azwinbana" + - "narepublicasadelamonedatsunanjoburgjerstadotsuruokakegawasnesodd" + - "enmarkhangelskiptveterinairealtychyattorneyagawalmartatamotors3-" + - "ap-south-1from-capebretonamiastapleservesarcasmatartanddesignfro" + - "m-collectionfrom-ctrani-andria-barletta-trani-andriafrom-dchitos" + - "etogitsuldalucaniafrom-defenseljordfrom-flanderservicesettsurgeo" + - "nshalloffamemorialfrom-gausdalfrom-higashiagatsumagoizumizakiraf" + - "rom-iafrom-idfrom-ilfrom-incheonfrom-ksevastopolefrom-kyowariasa" + - "hikawafrom-lajollamericanexpressexyfrom-mannortonsbergfrom-mdfro" + - "m-megurokunohealthcareersevenassisicilyfrom-midoris-a-hunterfrom" + - "-mnfrom-mochizukirkenesewindmillfrom-msfranziskanerdpolicefrom-m" + - "tnfrom-nchloefrom-ndfrom-nefrom-nhktraniandriabarlettatraniandri" + - "afrom-njelenia-gorafrom-nminamiechizenfrom-nvalled-aostavangerfr" + - "om-nyfrom-ohkurafrom-oketohmansionshangrilanciafrom-orfrom-pader" + - "bornfrom-pratohnoshoooshikamaishimodatextileitungsenfrom-ris-a-k" + - "nightpointtokaizukameokameyamatotakadafrom-schoenbrunnfrom-sdfro" + - "m-tnfrom-txn--1qqw23afrom-utazuerichardlillehammerfeste-ipartis-" + - "a-landscaperfrom-vaksdalfrom-vtranoyfrom-wafrom-wielunnerfrom-wv" + - "alledaostavernfrom-wyfrosinonefrostalowa-wolawafroyahababyglandf" + - "stcgroupartnersharis-a-lawyerfujiiderafujikawaguchikonefujiminoh" + - "tawaramotoineppubolognakanotoddenfujinomiyadafujiokayamanxn--2m4" + - "a15efujisatoshonairportland-4-salernoboribetsucksharpartshawaiij" + - "imarugame-hostrodawarafujisawafujishiroishidakabiratoridegreefuj" + - "itsurugashimamateramodalenfujixeroxn--30rr7yfujiyoshidafukayabea" + - "rdubaiduckdnshellaspeziafukuchiyamadafukudominichocolatelevision" + - "issedaluccapitalonewmexicoffeedbackplaneapplinzis-a-designerimar" + - "umorimachidafukuis-a-liberalfukumitsubishigakirovogradoyfukuokaz" + - "akiryuohadanotaireshimojis-a-libertarianfukuroishikarikaturindal" + - "fukusakisarazurewebsiteshikagamiishibukawafukuyamagatakaharustka" + - "noyakagefunabashiriuchinadafunagatakahashimamakishiwadafunahashi" + - "kamiamakusatsumasendaisennangonohejis-a-linux-useranishiaritabas" + - "hijonawatefundaciofuoiskujukuriyamaoris-a-llamarylandfuosskoczow" + - "indowshimokawafurnituredumbrellanbibaidarfurubiraquarelleborkang" + - "erfurudonostiaarpartyfurukawairtelecityeatshimokitayamafusodegau" + - "rafussaikisofukushimapasadenamsosnowiechofunatorientexpressarluc" + - "ernefutabayamaguchinomigawafutboldlygoingnowhere-for-moregontrai" + - "lroadfuttsurugimperiafuturehostingfuturemailingfvgfyis-a-musicia" + - "nfylkesbiblackfridayfyresdalhangglidinghangoutsystemscloudfrontd" + - "oorhannanmokuizumodenakasatsunais-a-painteractivegarsheis-a-pats" + - "fanhannotteroyhanyuzenhapmirhareidsbergenharstadharvestcelebrati" + - "onhasamarnardalhasaminami-alpssells-itransportransurlhashbanghas" + - "udahasura-appassenger-associationhasvikazunohatogayahoohatoyamaz" + - "akitahiroshimarriottrapaniimimatakatoris-a-personaltrainerhatsuk" + - "aichikaiseis-a-photographerokuappaviancargodaddynaliascoli-picen" + - "oipirangamvikddielddanuorrissagaeroclubmedecincinnationwidealsta" + - "haugesunderseaportsinfolldalabamagasakishimabarackmazehattfjelld" + - "alhayashimamotobungotakadapliernewhollandhazuminobusellsyourhome" + - "goodshimotsumahboehringerikehelsinkitakamiizumisanofidelitysvard" + - "ollshinichinanhembygdsforbundhemneshinjournalistjohnhemsedalhepf" + - "orgeherokussldheroyhgtvallee-aosteroyhigashichichibunkyonanaoshi" + - "mageandsoundandvisionhigashihiroshimanehigashiizumozakitakatakam" + - "oriokalmykiahigashikagawahigashikagurasoedahigashikawakitaaikita" + - "kyushuaiahigashikurumeiwamarshallstatebankfhappouhigashimatsushi" + - "maritimodernhigashimatsuyamakitaakitadaitoigawahigashimurayamamo" + - "torcycleshinjukumanohigashinarusembokukitamidsundhigashinehigash" + - "iomihachimanchesterhigashiosakasayamanakakogawahigashishirakawam" + - "atakanabeautydalhigashisumiyoshikawaminamiaikitamotosumitakagild" + - "eskaliszhigashitsunowruzhgorodeohigashiurausukitanakagusukumodum" + - "inamiiselectravelchannelhigashiyamatokoriyamanashifteditchyourip" + - "fizerhigashiyodogawahigashiyoshinogaris-a-playerhiraizumisatohob" + - "by-sitehirakatashinagawahiranais-a-republicancerresearchaeologic" + - "aliforniahirarahiratsukagawahirayaitakanezawahistorichouseshinka" + - "migotoyohashimotoshimahitachiomiyaginankokubunjis-a-rockstaracho" + - "wicehitachiotagooglecodespotravelersinsurancehitraeumtgeradeloit" + - "tevadsoccertificationhjartdalhjelmelandholeckobierzyceholidayhom" + - "eipgfoggiahomelinkhakassiahomelinuxn--32vp30haebaruminamifuranoh" + - "omeofficehomesecuritymaceratakaokaluganskodjejuifminamiizukamiok" + - "amikitayamatsuris-a-socialistmein-vigorgehomesecuritypccwinnersh" + - "inshinotsurgeryhomesenseminehomeunixn--3bst00minamimakis-a-soxfa" + - "nhondahoneywellbeingzonehongopocznosegawahonjyoitakarazukamakura" + - "zakitashiobarahornindalhorseoulminamiminowahortendofinternet-dns" + - "hinshirohospitalhoteleshintokushimahotmailhoyangerhoylandetroits" + - "kolelhumanitieshintomikasaharahurdalhurumajis-a-studentalhyllest" + - "adhyogoris-a-teacherkassymantechnologyhyugawarahyundaiwafunehzch" + - "onanbuildingripescaravantaajlchoyodobashichikashukujitawarajlljm" + - "pharmacienshirakofuefukihaboromskoguchikuzenjnjeonnamerikawauejo" + - "yokaichibahcavuotnagaranzannefrankfurtrentino-alto-adigejpmorgan" + - "jpnjprshiranukamogawajuniperjurkoshunantokigawakosugekotohiradom" + - "ainsureggiocalabriakotourakouhokutamakis-an-artisteinkjerusalemb" + - "roiderykounosupplieshiraokanagawakouyamashikokuchuokouzushimasoy" + - "kozagawakozakis-an-engineeringkpnkppspdnshiratakahagivestbytomar" + - "idagawassamukawataricohdatingkrasnodarkredirectmeldalkristiansan" + - "dcatshishikuis-an-entertainerkristiansundkrodsheradkrokstadelval" + - "daostarostwodzislawioshisognekryminamisanrikubetsupportrentino-a" + - "ltoadigekumatorinokumejimasudakumenanyokkaichirurgiens-dentistes" + - "-en-francekunisakis-bykunitachiarailwaykunitomigusukumamotoyamas" + - "sa-carrara-massacarraramassabusinessebyklegallocus-1kunneppulawy" + - "kunstsammlungkunstunddesignkuokgrouphdkureggioemiliaromagnakayam" + - "atsumaebashikshacknetrentino-s-tirollagrigentomologyeonggiehtavu" + - "oatnagaivuotnagaokakyotambabia-goracleaningkurgankurobelaudibleb" + - "timnetzkurogimilanokuroisoftwarendalenugkuromatsunais-certifiedo" + - "gawarabikomaezakirunorthwesternmutualkurotakikawasakis-foundatio" + - "nkushirogawakusupplykutchanelkutnokuzumakis-gonekvafjordkvalsund" + - "kvamfamberkeleykvanangenkvinesdalkvinnheradkviteseidskogkvitsoyk" + - "wpspiegelkzmissilevangermisugitokorozawamitourismolancastermitoy" + - "oakemiuramiyazumiyotamanomjondalenmlbfanmonmouthagebostadmonster" + - "monticellombardiamondshisuifuelveruminamitanemontrealestatefarme" + - "quipmentrentino-stirolmonza-brianzaporizhzhiamonza-e-della-brian" + - "zapposhitaramamonzabrianzaptokuyamatsusakahoginowaniihamatamakaw" + - "ajimarburgmonzaebrianzaramonzaedellabrianzamoparachutingmordovia" + - "jessheiminamiuonumatsumotofukemoriyamatsushigemoriyoshimilitarym" + - "ormoneymoroyamatsuuramortgagemoscowitdkmpspbarcelonagasakijobser" + - "verisignieznord-odalaziobihirosakikamijimassnasaarlandd-dnshome-" + - "webservercellikes-piedmontblancomeeres3-ap-southeast-1moseushist" + - "orymosjoenmoskeneshizukuishimofusaitamatsukuris-into-gamessinats" + - "ukigatakasagotembaixadamosshizuokananporovigotpantheonsitemosvik" + - "nx-serveronakatsugawamoteginozawaonsenmoviemovistargardmtpchrist" + - "masakikugawatchesarufutsunomiyawakasaikaitakoelniyodogawamtranby" + - "muenstermugithubcloudusercontentrentino-sud-tirolmuikamisatokama" + - "chippubetsubetsugarumukochikushinonsenergymulhouservebeermunakat" + - "anemuncieszynmuosattemuphiladelphiaareadmyblogsitemurmanskolobrz" + - "egersundmurotorcraftrentino-sudtirolmusashimurayamatsuzakis-leet" + - "rdmusashinoharamuseetrentino-sued-tirolmuseumverenigingmutsuzawa" + - "mutuellewismillermy-vigorlicemy-wanggouvicenzamyactivedirectorym" + - "yasustor-elvdalmycdn77-securechtrainingmydissentrentino-suedtiro" + - "lmydrobofagemydshoujis-lostre-toteneis-a-techietis-a-therapistoi" + - "amyeffectrentinoa-adigemyfirewallonieruchomoscienceandindustrynm" + - "yfritzmyftpaccesshowamyfusionmyhome-serverrankoshigayamelhusgard" + - "enmykolaivaolbia-tempio-olbiatempioolbialystokkepnogiftshowtimet" + - "eorapphilatelymymediapchromedicaltanissettairamyokohamamatsudamy" + - "pepsongdalenviknakanojohanamakinoharamypetshriramlidlugolekagami" + - "nogatagajobojis-not-certifieducatorahimeshimakanegasakinkobayash" + - "ikaoirminamiogunicomcastresistancemyphotoshibahccavuotnagareyama" + - "lborkdalvdalcesienarashinomypsxn--3e0b707emysecuritycamerakermys" + - "hopblocksigdalmyvnchryslerpictetrentinoaadigepicturesimple-urlpi" + - "emontepilotsirdalpimientaketomisatolgapinkomakiyosunndalpioneerp" + - "ippuphoenixn--3oq18vl8pn36apiszpittsburghofauskedsmokorsetagayas" + - "ells-for-ulvikautokeinopiwatepizzapkomatsushimashikizunokunimiho" + - "boleslawiechristiansburgriwataraidyndns-picsarpsborgroks-thisaya" + - "manobeokakudamatsueplanetariuminamiyamashirokawanabellevuelosang" + - "elesjaguarchitecturealtorlandplantationplantslingplatforminanopl" + - "aystationplazaplchungnamdalseidfjordyndns-remotewdyndns-serverda" + - "luroyplombardynamisches-dnslupskomforbarclaycards3-website-ap-no" + - "rtheast-1plumbingopmnpodzonepohlpoivronpokerpokrovskommunalforbu" + - "ndpolitiendapolkowicepoltavalle-aostathellexusdecorativeartsnoas" + - "aitomobellunorddalpomorzeszowithgoogleapisa-hockeynutsiracusakat" + - "akinouepordenonepornporsangerporsanguidelmenhorstalbansokanazawa" + - "porsgrunnanpoznanpraxis-a-bookkeeperugiaprdpreservationpresidiop" + - "rgmrprimeloyalistockholmestrandprincipeprivatizehealthinsurancep" + - "rochowiceproductionsokndalprofbsbxn--1lqs03nprogressivegasiaproj" + - "ectrentinoalto-adigepromombetsurfbx-ostrowwlkpmgulenpropertyprot" + - "ectionprotonetrentinoaltoadigeprudentialpruszkowithyoutubentleyp" + - "rzeworskogptplusterpvtrentinos-tirolpwchurchaseljeepostfoldnavyp" + - "zqldqponqslgbtrentinostirolquicksytesolarssonqvcirclegnicafedera" + - "tionstufftoread-booksnesolundbeckommunestuttgartrentoyokawasusak" + - "is-slickharkovalleeaosteigensusonosuzakaneyamazoesuzukaniepcesuz" + - "ukis-uberleetrentino-a-adigesvalbardunloppacificircustomersveios" + - "velvikomvuxn--3ds443gsvizzeraswedenswidnicarrierswiebodzindianap" + - "olis-a-bloggerswiftcoversicherungswinoujscienceandhistoryswisshi" + - "kis-very-badaddjamisonsynology-dsolutionsolognetuscanytushuissie" + - "r-justicetuvalle-daostaticsootuxfamilyvenneslaskerrylogisticsopo" + - "trentinosud-tirolvestfoldvestnesor-odalvestre-slidreamhostersor-" + - "varangervestre-totennishiawakuravestvagoyvevelstadvibo-valentiav" + - "ibovalentiavideovillaskoyabearalvahkihokumakogengerdalpha-myqnap" + - "cloudapplebesbydgoszczecinemakeupowiathletajimabariakembuchikuma" + - "gayagawakuyabukicks-assedicitadeliveryvinnicartiervinnytsiavipsi" + - "naapphonefossilkomaganevirginiavirtualvirtueeldomeindianmarketin" + - "gvirtuelvisakegawavistaprinternationalfirearmsorfoldviterboltroa" + - "ndinosaurepaircraftrevisohughesomavivoldavlaanderenvladikavkazim" + - "ierz-dolnyvladimirvlogoiphotographysiovolkswagentsorreisahayakaw" + - "akamiichikawamisatotalvologdanskongsvingervolvolkenkundenvolyngd" + - "alvossevangenvotevotingvotoyonakagyokutoursortlandworldworse-tha" + - "ndawowiwatsukiyonowritesthisblogsytewroclawloclawekoninjavald-ao" + - "starnbergwtciticatholicheltenham-radio-opencraftranagatorodoywtf" + - "bxosciencecentersciencehistorywuozuwwwmflabsorumincommbanklabudh" + - "abikinokawabarthagakhanamigawawzmiuwajimaxn--4gq48lf9jetztrentin" + - "o-aadigexn--4it168dxn--4it797konsulatrobeepilepsydneyxn--4pvxsou" + - "thcarolinazawaxn--54b7fta0ccivilizationxn--55qw42gxn--55qx5dxn--" + - "5js045dxn--5rtp49civilwarmanagementmpalmspringsakerxn--5rtq34kon" + - "yvelolxn--5su34j936bgsgxn--5tzm5gxn--6btw5axn--6frz82gxn--6orx2r" + - "xn--6qq986b3xlxn--7t0a264claimsasayamaxn--80adxhksouthwestfalenx" + - "n--80ao21axn--80aqecdr1axn--80asehdbarefootballooningjesdalillyo" + - "mbondiscountysnes3-website-ap-southeast-2xn--80aswgxn--80audneda" + - "lnxn--8ltr62kooris-an-actorxn--8pvr4uxn--8y0a063axn--90a3academy" + - "-firewall-gatewayxn--90aishobaraomoriguchiharahkkeravjuedischesa" + - "peakebayernrtrogstadxn--90azhytomyrxn--9dbhblg6dietcimdbargainst" + - "itutelemarkaratsuginamikatagamiharuconnectatarantottoribestadisc" + - "overyomitanobirastronomy-gatewayokosukanzakiwienaturalsciencesna" + - "turelles3-ap-southeast-2xn--9dbq2axn--9et52uxn--9krt00axn--andy-" + - "iraxn--aroport-byanaizuxn--asky-iraxn--aurskog-hland-jnbarreauct" + - "ionayorovnobninskarelianceu-1xn--avery-yuasakuhokkaidontexistein" + - "geekopervikhmelnitskiyamashikexn--b-5gaxn--b4w605ferdxn--bck1b9a" + - "5dre4clickatowicexn--bdddj-mrabdxn--bearalvhki-y4axn--berlevg-jx" + - "axn--bhcavuotna-s4axn--bhccavuotna-k7axn--bidr-5nachikatsuuraxn-" + - "-bievt-0qa2xn--bjarky-fyandexn--3pxu8konskowolayangroupharmacysh" + - "iraois-an-accountantshinyoshitomiokamitsuexn--bjddar-ptamayufuet" + - "tertdasnetzxn--blt-elabourxn--bmlo-graingerxn--bod-2naroyxn--brn" + - "ny-wuaccident-investigation-aptibleaseating-organicbcn-north-1xn" + - "--brnnysund-m8accident-prevention-webhopenairbusantiquest-a-la-m" + - "aisondre-landebudapest-a-la-masionionjukudoyamagazineat-urlxn--b" + - "rum-voagatromsakakinokiaxn--btsfjord-9zaxn--c1avgxn--c2br7gxn--c" + - "3s14mintelligencexn--cck2b3barrel-of-knowledgemologicallyngenvir" + - "onmentalconservationflfanfshostrolekamisunagawaugustowadaegubs3-" + - "ca-central-1xn--cg4bkis-very-evillagexn--ciqpnxn--clchc0ea0b2g2a" + - "9gcdn77-sslattumisakis-into-carshioyanagawaxn--comunicaes-v6a2ox" + - "n--correios-e-telecomunicaes-ghc29axn--czr694barrell-of-knowledg" + - "eologyonagoyaukraanghkeymachineustarhubalestrandabergamoareke164" + - "xn--czrs0tromsojaworznoxn--czru2dxn--czrw28bashkiriaurskog-holan" + - "droverhalla-speziaeroportalaheadjudaicaaarborteaches-yogasawarac" + - "ingroks-theatree12xn--d1acj3basilicataniaustevollarvikarasjokara" + - "suyamarylhurstjordalshalsenaturbruksgymnaturhistorisches3-eu-cen" + - "tral-1xn--d1alfaromeoxn--d1atrusteexn--d5qv7z876clinichernigover" + - "nmentjometlifeinsurancexn--davvenjrga-y4axn--djrs72d6uyxn--djty4" + - "koryokamikawanehonbetsurutaharaxn--dnna-grajewolterskluwerxn--dr" + - "bak-wuaxn--dyry-iraxn--e1a4cliniquenoharaxn--eckvdtc9dxn--efvn9s" + - "owaxn--efvy88haibarakitahatakamatsukawaxn--ehqz56nxn--elqq16hair" + - "-surveillancexn--estv75gxn--eveni-0qa01gaxn--f6qx53axn--fct429ko" + - "saigawaxn--fhbeiarnxn--finny-yuaxn--fiq228c5hspjelkavikomonoxn--" + - "fiq64basketballfinanzgoraustinnatuurwetenschappenaumburgjemnes3-" + - "eu-west-1xn--fiqs8spreadbettingxn--fiqz9spydebergxn--fjord-lraxn" + - "--fjq720axn--fl-ziaxn--flor-jraxn--flw351exn--fpcrj9c3dxn--frde-" + - "grandrapidsrlxn--frna-woaraisaijotrvarggatritonxn--frya-hraxn--f" + - "zc2c9e2clintonoshoesaseboknowsitallutskypexn--fzys8d69uvgmailxn-" + - "-g2xx48clothingrondarxn--gckr3f0fermobilyxn--gecrj9cloudnsdojoet" + - "suwanouchikujogaszczytnore-og-uvdaluxembourgrongaxn--ggaviika-8y" + - "a47hakatanotogawaxn--gildeskl-g0axn--givuotna-8yaotsurreyxn--gjv" + - "ik-wuaxn--gk3at1exn--gls-elacaixaxn--gmq050is-very-goodhandsonxn" + - "--gmqw5axn--h-2failxn--h1aeghakodatexn--h2brj9cnsaskatchewanxn--" + - "hbmer-xqaxn--hcesuolo-7ya35batodayonaguniversityoriikariyakumold" + - "eltaiwanairlinedre-eikerxn--hery-iraxn--hgebostad-g3axn--hmmrfea" + - "sta-s4acctrysiljan-mayenxn--hnefoss-q1axn--hobl-iraxn--holtlen-h" + - "xaxn--hpmir-xqaxn--hxt814exn--hyanger-q1axn--hylandet-54axn--i1b" + - "6b1a6a2exn--imr513nxn--indery-fyasakaiminatoyonezawaxn--io0a7is-" + - "very-nicexn--j1aeferraraxn--j1amhakonexn--j6w193gxn--jlq61u9w7ba" + - "tsfjordishakotankarlsoyoshiokarasjohkamikoaniikappugliaustraliai" + - "sondriodejaneirochesterhcloudfunctions3-external-1xn--jlster-bya" + - "sugis-very-sweetpepperxn--jrpeland-54axn--jvr189misasaguris-into" + - "-cartoonshirahamatonbetsurnadalxn--k7yn95exn--karmy-yuaxn--kbrq7" + - "oxn--kcrx77d1x4axn--kfjord-iuaxn--klbu-woaxn--klt787dxn--kltp7dx" + - "n--kltx9axn--klty5xn--42c2d9axn--koluokta-7ya57hakubadajozorahol" + - "taleniwaizumiotsukumiyamazonawsabaerobaticketshimonosekikawaxn--" + - "kprw13dxn--kpry57dxn--kpu716ferrarivnexn--kput3is-with-thebandoo" + - "mdnsiskinkyotobetsumidatlantichoseiroumuenchenisshingugexn--krag" + - "er-gyasuokanraxn--kranghke-b0axn--krdsherad-m8axn--krehamn-dxaxn" + - "--krjohka-hwab49jevnakershuscultureggio-emilia-romagnakatombetsu" + - "my-routerxn--ksnes-uuaxn--kvfjord-nxaxn--kvitsy-fyatomitamamurax" + - "n--kvnangen-k0axn--l-1fairwindsrtrentinosudtirolxn--l1accenturek" + - "lamborghiniizaxn--laheadju-7yatsukanumazuryxn--langevg-jxaxn--lc" + - "vr32dxn--ldingen-q1axn--leagaviika-52bauhausposts-and-telecommun" + - "icationsncfdivtasvuodnakaiwamizawaustrheimatunduhrennesoyokotebi" + - "nagisochildrensgardenaustdalavagiskebinorfolkebibleikangerxn--le" + - "sund-huaxn--lgbbat1ad8jewelryxn--lgrd-poacoachampionshiphoptobam" + - "agentositelekommunikationlinebraskaunjargallupinbbcaseihichisobe" + - "tsuitainairforceoceanographics3-website-eu-west-1xn--lhppi-xqaxn" + - "--linds-pramericanartulangevagrarboretumbriamallamaintenancechir" + - "ealminnesotaketakatsukis-into-animelbournexn--lns-qlansrvareserv" + - "eblogspotrentinosued-tirolxn--loabt-0qaxn--lrdal-sraxn--lrenskog" + - "-54axn--lt-liacntoyonoxn--lten-granexn--lury-iraxn--mely-iraxn--" + - "merker-kuaxn--mgb2ddestordalxn--mgb9awbferreroticanonoichinomiya" + - "kexn--mgba3a3ejtunesomnaritakurashikis-savedunetbankharkivguccip" + - "rianiigataishinomakimobetsuliguriaxn--mgba3a4f16axn--mgba3a4fran" + - "amizuholdingsmileksvikosakaerodromegalsacebetsukubankhmelnytskyi" + - "vanylvenicexn--mgba7c0bbn0axn--mgbaakc7dvfetsundynvpnxn--mgbaam7" + - "a8hakuis-a-nascarfanxn--mgbab2bdxn--mgbai9a5eva00bbtateshinanoma" + - "chintaifun-dnsaliaskimitsubatamicable-modembetsukuibigawauthorda" + - "landroiddnskingjerdrumckinseyokozebizenakaniikawatanaguraetnagah" + - "amaroygardendoftheinternetflixilovecollegefantasyleaguernseyboml" + - "oans3-ap-northeast-2xn--mgbai9azgqp6jewishartgalleryxn--mgbayh7g" + - "padualstackspace-to-rentalstomakomaibaraxn--mgbb9fbpobanazawaxn-" + - "-mgbbh1a71exn--mgbc0a9azcgxn--mgbca7dzdoxn--mgberp4a5d4a87gxn--m" + - "gberp4a5d4arxn--mgbi4ecexposedxn--mgbpl2fhskleppiagetmyiphilipsy" + - "nology-diskstationxn--mgbqly7c0a67fbcolonialwilliamsburgrossetou" + - "chijiwadellogliastradingroundhandlingroznyxn--mgbqly7cvafredriks" + - "tadtvstoreitrentinosuedtirolxn--mgbt3dhdxn--mgbtf8flatangerxn--m" + - "gbtx2bbvacationswatch-and-clockerxn--mgbx4cd0abbottunkongsbergxn" + - "--mix082fgunmarcheaparisor-fronxn--mix891fhvalerxn--mjndalen-64a" + - "xn--mk0axindustriesteambulancexn--mk1bu44coloradoplateaudioxn--m" + - "kru45isleofmandalxn--mlatvuopmi-s4axn--mli-tlanxesstorfjordxn--m" + - "lselv-iuaxn--moreke-juaxn--mori-qsakuragawaxn--mosjen-eyatsushir" + - "oxn--mot-tlapyxn--mre-og-romsdal-qqbeppublishproxyzgorzeleccolog" + - "newspaperxn--msy-ula0hakusandiegoodyearthadselfipassagenshimonit" + - "ayanagitlaborxn--mtta-vrjjat-k7afamilycompanycolumbusheyxn--muos" + - "t-0qaxn--mxtq1misawaxn--ngbc5azdxn--ngbe9e0axn--ngbrxn--45brj9ci" + - "vilaviationxn--nit225koseis-an-actresshiojirishirifujiedaxn--nme" + - "sjevuemie-tcbalatinord-frontierxn--nnx388axn--nodexn--nqv7fs00em" + - "axn--nry-yla5gxn--ntso0iqx3axn--ntsq17gxn--nttery-byaeservecount" + - "erstrikexn--nvuotna-hwaxn--nyqy26axn--o1achattanooganordreisa-ge" + - "ekosherbrookegawaxn--o3cw4haldenxn--od0algxn--od0aq3bernuorockar" + - "tuzyukibmdivttasvuotnakamagayachts3-website-sa-east-1xn--ogbpf8f" + - "lekkefjordxn--oppegrd-ixaxn--ostery-fyawaraxn--osyro-wuaxn--p1ac" + - "fidonnakamuratajimicrolightinguovdageaidnunzenxn--p1aissmarterth" + - "anyouxn--pbt977communitysfjordyndns-weberlincolnxn--pgbs0dhlxn--" + - "porsgu-sta26fieldyroyrvikinguitarschweizparaglidingujolsterxn--p" + - "ssu33lxn--pssy2uxn--q9jyb4comobaraxn--qcka1pmcdonaldstpetersburg" + - "xn--qqqt11misconfusedxn--qxamuneuestreamsterdamnserverbaniaxn--r" + - "ady-iraxn--rdal-poaxn--rde-ulaquilancashirehabmerxn--rdy-0nabari" + - "wchoshibuyachiyodavvenjargaulardalukowiiheyaizuwakamatsubushikus" + - "akadogawaxn--rennesy-v1axn--rhkkervju-01aflakstadaokagakibichuox" + - "n--rholt-mragowoodsidexn--rhqv96gxn--rht27zxn--rht3dxn--rht61exn" + - "--risa-5narusawaxn--risr-iraxn--rland-uuaxn--rlingen-mxaxn--rmsk" + - "og-byawatahamaxn--rny31halsaintlouis-a-anarchistoireggio-calabri" + - "axn--rovu88beskidyn-vpncasertaipeiheijiinetnedalimanowarudautomo" + - "tivecodyn-o-saurlandes3-fips-us-gov-west-1xn--rros-granvindafjor" + - "dxn--rskog-uuaxn--rst-0narutokyotangovturystykannamihamadaxn--rs" + - "ta-francaiseharaxn--ryken-vuaxn--ryrvik-byaxn--s-1faitheguardian" + - "xn--s9brj9comparemarkerryhotelsassaris-a-doctorayxn--sandnessjen" + - "-ogbizxn--sandy-yuaxn--seral-lraxn--ses554gxn--sgne-gratangenxn-" + - "-skierv-utazaskvolloabathsbcompute-1xn--skjervy-v1axn--skjk-soax" + - "n--sknit-yqaxn--sknland-fxaxn--slat-5narviikamishihoronobeauxart" + - "sandcraftstudioxn--slt-elabbvieeexn--smla-hraxn--smna-gratis-a-b" + - "ruinsfanxn--snase-nraxn--sndre-land-0cbstudyndns-at-homedepotenz" + - "amamicrosoftbankomorotsukaminoyamaxunusualpersonxn--snes-poaxn--" + - "snsa-roaxn--sr-aurdal-l8axn--sr-fron-q1axn--sr-odal-q1axn--sr-va" + - "ranger-ggbestbuyshouses3-website-us-east-1xn--srfold-byaxn--srre" + - "isa-q1axn--srum-grazxn--stfold-9xaxn--stjrdal-s1axn--stjrdalshal" + - "sen-sqbetainaboxfusejnynysadodgeometre-experts-comptables3-websi" + - "te-us-west-1xn--stre-toten-zcbieigersundiyukuhashimoichinosekiga" + - "harautoscanadaejeonbukaratehimeji234xn--t60b56axn--tckweathercha" + - "nnelxn--tiq49xqyjfkhersonxn--tjme-hraxn--tn0agrinet-freakstuff-4" + - "-salexn--tnsberg-q1axn--tor131oxn--trany-yuaxn--trgstad-r1axn--t" + - "rna-woaxn--troms-zuaxn--tysvr-vraxn--uc0atvaroyxn--uc0ay4axn--ui" + - "st22hammarfeastafricapetownnews-stagingxn--uisz3gxn--unjrga-rtao" + - "baokinawashirosatochiokinoshimalatvuopmiasakuchinotsuchiurakawal" + - "brzycharternopilawalesundxn--unup4yxn--uuwu58axn--vads-jraxn--va" + - "rd-jraxn--vegrshei-c0axn--vermgensberater-ctbielawalterxn--vermg" + - "ensberatung-pwbiellaakesvuemielecceu-2xn--vestvgy-ixa6oxn--vg-yi" + - "abcgxn--vgan-qoaxn--vgsy-qoa0jgoraxn--vgu402computerhistoryofsci" + - "ence-fictionxn--vhquvbarclays3-website-ap-southeast-1xn--vler-qo" + - "axn--vre-eiker-k8axn--vrggt-xqadxn--vry-yla5gxn--vuq861bieszczad" + - "ygeyachimataikikonaioirasebastopologyeongnamegawakeisenbahnhlfan" + - "hs3-website-us-west-2xn--w4r85el8fhu5dnraxn--w4rs40lxn--wcvs22dx" + - "n--wgbh1comsecuritytacticsatxn--1ck2e1balsfjordgcahcesuolodingen" + - "aval-d-aosta-valleyolasitemrxn--wgbl6axn--xhq521bievatmallorcada" + - "quesakuraiitatebayashiibaghdadultateyamaveroykenglanddnss3-sa-ea" + - "st-1xn--xkc2al3hye2axn--xkc2dl3a5ee0hamurakamigoriginshimosuwalk" + - "is-a-nurservebbshimotsukexn--y9a3aquariumishimatsunoxn--yer-znar" + - "vikoshimizumakis-an-anarchistoricalsocietyxn--yfro4i67oxn--ygard" + - "en-p1axn--ygbi2ammxn--45q11civilisationxn--ystre-slidre-ujbifuka" + - "gawarszawashingtondclkarmoyurihonjoyentatsunoceanographiquevents" + - "akyotanabeneventoeidsvollimitednpagefrontappagespeedmobilizerodd" + - "avocatanzarowegroweibolzanordkappgafanpachigasakidsmynasushiobar" + - "agusarts3-us-east-2xn--zbx025dxn--zf0ao64axn--zf0avxn--4gbrimini" + - "ngxn--zfr164bihorologyusuharavoues3-us-gov-west-1xperiaxz" +const text = "biellaakesvuemieleccebieszczadygeyachimatainaircraftraeumtgerade" + + "alstahaugesunderseaportsinfolldalaskanittedallasalleasinglesango" + + "ppdalinzaintuitateshinanomachintaifun-dnsaliaskimitsubatamicable" + + "-modembetsukuinuyamanouchikuhokuryugasakitaurayasudabievatmallor" + + "cadaquesanjotateyamabifukagawalmartatsunobihorologyuzhno-sakhali" + + "nskaszubybikedagestangebilbaogakievenesannaninomiyakonojoshkar-o" + + "lawabillustrationirasakinvestmentsannohelplfinancialipetskatowic" + + "ebiobirdartcenterprisesakikuchikuseikarugapartmentsanokatsushika" + + "beeldengeluidunloppacificasinore-og-uvdalivornobirkenesoddtangen" + + "ovarabirthplacebjarkoybjerkreimdbalatinorddalillyonagoyastronomy" + + "asustor-elvdalwaysdatabaseballangenoamishirasatochigiessenebakke" + + "shibechambagriculturennebudapest-a-la-masionativeamericanantique" + + "s3-ap-northeast-2bjugnieznordlandunsantabarbarablockbusternidupo" + + "ntariobloombergbauernrtattoolsztynsettlersantacruzsantafedextras" + + "pace-to-rentalstomakomaibarabloxcmsanukis-a-candidatebluedaplier" + + "neustarhubalestrandabergamoarekeymachineues3-us-west-1bmoattachm" + + "entsaotomeloyalistjordalshalsenishiazais-a-catererbmsapodhalewis" + + "millerbmweirbnpparibaselburgloppenzaogashimadachicagoboatsapporo" + + "bnrwfarmsteadurbanamexhibitionishigotsukisosakitagawabomloanswat" + + "ch-and-clockerbondurhamburgmbhartiffanybonnishiharabookingminaka" + + "michiharabootsaratovalleaostatoilomzaporizhzheguris-a-celticsfan" + + "ishiizunazukis-a-chefarsundvrcambridgestonewyorkshirecreationish" + + "ikatakayamatsuzakis-a-conservativefsncfdvrdnsiskinkyotobetsumida" + + "tlanticateringebudejjuedischesapeakebayernurembergmodenakanotodd" + + "enishikatsuragithubusercontentaxihuanishikawazukanazawaboschaeff" + + "lerdalorenskogmxfinitybostikatsuyamaseratis-a-cpadoval-daostaval" + + "leybostonakijinsekikogentingrimstadwgripebotanicalgardenishimera" + + "botanicgardenishinomiyashironobotanybouncemerckmsdnipropetrovskl" + + "eppalmspringsakerbounty-fullensakerrypropertiesardegnamsosnowiec" + + "atholicheltenham-radio-openair-traffic-controlleyboutiquebecngri" + + "wataraidyndns-ipamperedchefashionishinoomotegovtgorybozentsujiie" + + "bradescorporationishinoshimatta-varjjatjeldsundyndns-mailotenkaw" + + "abrandywinevalleybrasiliabresciabrindisibenikebristolgaulardalot" + + "tebritishcolumbialowiezaganquannefrankfurtjmaxxxjaworznowtvalled" + + "-aostavangerbroadcastleclerchelyabinskypescaravantaabroadwaybrok" + + "e-itjometlifeinsurancebrokerbronnoysundyndns-office-on-the-webca" + + "mpobassociatesardiniabrothermesaverdeatnuorockartuzybrowsersafet" + + "ymarketsarlottokorozawabrumunddalouvreitjxn--0trq7p7nnishiokoppe" + + "gardyndns-picsarpsborgroks-thisayamanashiibaghdadultkmaxxn--11b4" + + "c3dyndns-remotegildeskalmykiabrunelblagdenesnaaseralingenkainana" + + "ejrietisalatinabenoboribetsucksarufutsunomiyawakasaikaitakoelnis" + + "hitosashimizunaminamiashigarabrusselsasayamabruxellesaseboknowsi" + + "tallowiczest-le-patrondheimperiabryanskodjeepostfoldnavyatkakami" + + "gaharabrynewhampshirebungoonordreisa-geekaufenishiwakis-a-cubicl" + + "e-slavellinotteroybuskerudinewhollandyndns-servercellikes-piedmo" + + "ntblancomeeresaskatchewanggouvicenzabuzenissandnessjoenissayokos" + + "hibahikariwanumatakazakis-a-democratmpanamabuzzgradyndns-weberli" + + "ncolnissedalucaniabwhalingrondarbzhitomirkutskydivingrongacomput" + + "erhistoryofscience-fictioncomsecuritytacticschulezajskddielddanu" + + "orrikuzentakatajirissagamiharacondoshichinohealth-carereformitak" + + "eharaconferenceconstructionconsuladoharuhrconsultanthropologycon" + + "sultingvollutskfhappoumuenchencontactoyotomiyazakis-a-geekgalaxy" + + "contemporaryarteducationalchikugojomedio-campidano-mediocampidan" + + "omediocontractorskenconventureshinodesashibetsuikinderoycookingc" + + "hannelveruminamibosogndaluxembourgujolstercoolkuszippodlasiellak" + + "asamatsudovre-eikercoopencraftoyotsukaidownloadcopenhagencyclope" + + "dichernovtsykkylvenetogakushimotoganewmexicoldwarmiamiastalowa-w" + + "oladbrokesassaris-a-designerimarumorimachidacorsicagliaridagawal" + + "tercorvettenrightathomegoodschwarzgwangjuifminamidaitomangotemba" + + "ixadacosenzamamibuilderschmidtre-gauldaluxurycostumedizinhistori" + + "scheschweizjcbnluzerncouchpotatofriesciencecentersciencehistoryc" + + "ouncilvivano-frankivskhabarovskhakassiacouponscientistockholmest" + + "randcoursescjohnsoncq-acranbrookuwanalyticscotlandcreditcardcred" + + "itunioncremonashorokanaiecrewiiheyaizuwakamatsubushikusakadogawa" + + "cricketrzyncrimeacrotonewspapercrownprovidercrsvparaglidingulenc" + + "ruisescrapper-sitecryptonomichigangwoncuisinellajollamericanexpr" + + "essexyculturalcentertainmentoyouracuneocupcakecxn--1ctwolominama" + + "takkofuefukihabororostrowwlkpmgunmarnardalcymruovatoystre-slidre" + + "ttozawacyonabarussiacyouthdfcbankzlguovdageaidnufcfanfieldfiguer" + + "estaurantozsdefilateliafilminamiechizenfinalfinancefineartservef" + + "tparisor-fronfinlandfinnoyfirebaseapparliamentranbyfirenzefirest" + + "onexus-east-1firmdaleirfjordfishingolffanservegame-serverisignfi" + + "tjarqhachiojiyahikobeatservehalflifestylefitnessettlementrani-an" + + "dria-barletta-trani-andriafjalerflesbergflickragerotikamakurazak" + + "irkeneservehttparmaflightservehumourflirumansionserveirchiryukyu" + + "ragifuchukotkakegawassamukawataricohdavvenjargausdaluccapitalone" + + "wjerseyflogintogurafloraflorencefloridafloristanohatakaharulvikh" + + "arkovalledaostavernflorokunohealthcareerserveminecraftraniandria" + + "barlettatraniandriaflowerservemp3utilitiesquarezzoologicalvinkle" + + "in-addrammenuernbergdyniabogadocscbggfareastcoastaldefence-burgj" + + "emnes3-ap-northeast-1kappleaseating-organicbcg12000emmafanconaga" + + "wakayamadridvagsoyericsson-aptibleangaviikadenaamesjevuemielno-i" + + "p6flynnhubalsfjordiscountysnes3-us-west-2fndfoodnetworkshoppingf" + + "or-ourfor-someetnedalfor-theaterforexrothruheredstoneforgotdnser" + + "vep2parocherkasyzrankoshigayaltaijis-a-greenforli-cesena-forlice" + + "senaforlikescandyndns-at-workinggrouparservepicservequakeforsale" + + "irvikhersonforsandasuoloftranoyfortmissoulan-udefenseljordfortwo" + + "rthachirogatakamoriokamikitayamatotakadaforuminamifuranofosneser" + + "vesarcasmatartanddesignfotaruis-a-gurunzenfoxfordegreefreeboxost" + + "rowiechitachinakagawatchandclockazimierz-dolnyfreemasonryfreibur" + + "gfreightcmwildlifedjejuegoshikiminokamoenairlinedre-eikerfreseni" + + "uscountryestateofdelawaredumbrellanbibaidarfribourgfriuli-v-giul" + + "iafriuli-ve-giuliafriuli-vegiuliafriuli-venezia-giuliafriuli-ven" + + "eziagiuliafriuli-vgiuliafriuliv-giuliafriulive-giuliafriulivegiu" + + "liafriulivenezia-giuliafriuliveneziagiuliafriulivgiuliafrlfrogan" + + "servicesettsurgeonshalloffamemergencyberlevagangaviikanonjis-a-h" + + "ard-workerfrognfrolandfrom-akrehamnfrom-alfrom-arfrom-azpartis-a" + + "-hunterfrom-capebretonamiasakuchinotsuchiurakawarszawashingtondc" + + "lkhmelnitskiyamasfjordenfrom-collectionfrom-ctransportransurlfro" + + "m-dchitosetogitsuldalucernefrom-dell-ogliastrakhanawafrom-flande" + + "rsevastopolefrom-gafrom-higashiagatsumagoirminamiiselectrapaniim" + + "imatakatoris-a-knightpointtokamachippubetsubetsugaruslivinghisto" + + "ryfrom-iafrom-idfrom-ilfrom-incheonfrom-ksevenassisicilyfrom-kyo" + + "wariasahikawafrom-lancashireggio-calabriafrom-manxn--1qqw23afrom" + + "-mdfrom-meguromskoguchikuzenfrom-microsoftbankhmelnytskyivallee-" + + "aosteroyfrom-mnfrom-mochizukirovogradoyfrom-msewilliamhillfrom-m" + + "tnfrom-nchloefrom-ndfrom-nefrom-nhktravelchannelfrom-njcpartners" + + "franziskanerdpolicefrom-nminamiizukamitondabayashiogamagoriziafr" + + "om-nvalleeaosteigenfrom-nyfrom-ohkurafrom-oketohmaorivnefrom-orf" + + "rom-paderbornfrom-pratohnoshoooshikamaishimofusartshangrilangeva" + + "grarboretumbriafrom-ris-a-landscaperugiafrom-schoenbrunnfrom-sdf" + + "rom-tnfrom-txn--2m4a15efrom-utazuerichardlillehammerfest-mon-blo" + + "gueurovisionfrom-vaksdalfrom-vtravelersinsurancefrom-wafrom-wiel" + + "unnerfrom-wvanylvenicefrom-wyfrosinonefrostalbansharis-a-lawyerf" + + "royahabadajozoraholtalenvironmentalconservationfstavropolitienda" + + "fujiiderafujikawaguchikonefujiminohtawaramotoineppubolognakaniik" + + "awatanagurafujinomiyadafujiokayamapartsharpartyfujisatoshonairpo" + + "rtland-4-salernogatagajobojis-a-liberalfujisawafujishiroishidaka" + + "biratoridellogliastraderfujitsurugashimamateramodalenfujixeroxn-" + + "-30rr7yfujiyoshidafukayabeardubaiduckdnshomebuiltrdfukuchiyamada" + + "fukudominichocolatemasekazofukuis-a-libertarianfukumitsubishigak" + + "iryuohadanoshiroomurafukuokazakisarazurewebsiteshikagamiishibuka" + + "wafukuroishikarikaturindalfukusakishiwadafukuyamagatakahashimama" + + "kisofukushimarburgfunabashiriuchinadafunagatakahatakaishimoichin" + + "osekigaharafunahashikamiamakusatsumasendaisennangonohejis-a-linu" + + "x-useranishiaritabashikaoizumizakitchenfundaciofuoiskujukuriyama" + + "rcheapasadenaklodzkodairafuosskoczowinbaltimore-og-romsdalimited" + + "iscoveryonaguniversityoriikashibatakashimarylhurstjohnaval-d-aos" + + "ta-valleyukibestadishakotankashiharaukraanghkepnord-frontierepai" + + "rbusantiquest-a-la-maisondre-landebusinessebyklefrakkestadds3-ap" + + "-southeast-2furnitureggio-emilia-romagnakanojohanamakinoharafuru" + + "biraquarellebesbyglandfurudonostiafurukawairtelecityeatshawaiiji" + + "marugame-hostingfusodegaurafussaintlouis-a-anarchistoireggiocala" + + "briafutabayamaguchinomigawafutboldlygoingnowhere-for-moregontrai" + + "lroadfuttsurugiminamimakis-a-llamarylandfuturemailingfvgfyis-a-m" + + "usicianfylkesbiblackfridayfyresdalhannanmokuizumodernhannovarese" + + "rveblogspotrentino-a-adigehanyuzenhapmirhareidsbergenharstadharv" + + "estcelebrationhasamarahasaminami-alpssells-itrentino-aadigehashb" + + "anghasudahasura-appassenger-associationhasviklabudhabikinokawaba" + + "rthaebaruminamiminowahatogayahoohatoyamazakitahiroshimarriottren" + + "tino-alto-adigehatsukaichikaiseis-a-painteractivegarsheis-a-pats" + + "fanhattfjelldalhayashimamotobuildinghazuminobusellsyourhomeipavi" + + "ancargodaddyndns-at-homednshimonosekikawahboehringerikehelsinkit" + + "akamiizumisanofidelitysvardollshimosuwalkis-a-personaltrainerhem" + + "bygdsforbundhemneshimotsukehemsedalhepforgeherokussldheroyhgtvsh" + + "imotsumahigashichichibungotakadatinghigashihiroshimanehigashiizu" + + "mozakitakatakanezawahigashikagawahigashikagurasoedahigashikawaki" + + "taaikitakyushuaiahigashikurumeiwamarshallstatebankmpspbamblebtim" + + "netz-2higashimatsushimarinehigashimatsuyamakitaakitadaitoigawahi" + + "gashimurayamalatvuopmidoris-a-photographerokuappfizerhigashinaru" + + "sembokukitamidsundhigashinehigashiomihachimanchesterhigashiosaka" + + "sayamamotorcycleshinichinanhigashishirakawamatakaokamikoaniikapp" + + "ugliahigashisumiyoshikawaminamiaikitamotosumitakaginankokubunjis" + + "-a-playerhigashitsunotogawahigashiurausukitanakagusukumoduminami" + + "ogunicomcastresistancehigashiyamatokoriyamanakakogawahigashiyodo" + + "gawahigashiyoshinogaris-a-republicancerresearchaeologicalifornia" + + "hiraizumisatohobby-sitehirakatashinagawahiranairtraffichofunator" + + "ientexpressatxn--1ck2e1balsanagochihayaakasakawaharavennagasakik" + + "onaikawachinaganoharamcoalaheadjudaicaaarborteaches-yogasawaraci" + + "ngroks-theatreemersongdalenviknakamuratakahamannortonsbergladelm" + + "enhorstackspacekitagataiwanairguardigitalimanowarudaugustowadaeg" + + "ubs3-ap-southeast-1hirarahiratsukagawahirayaitakarazukamiminersh" + + "injournalismailillesandefjordhistorichouseshinjukumanohitachiomi" + + "yaginowaniihamatamakawajimaritimodellinghitachiotagooglecodespot" + + "rentino-altoadigehitoyoshimifunehitradinghjartdalhjelmelandholec" + + "kobierzyceholidayhomelinuxn--32vp30hagakhanamigawahomesecurityma" + + "ceratakasagoperaunitextileitungsenhomesecuritypccwindmillhomesen" + + "seminehomeunixn--3bst00minamisanrikubetsupplyhondahoneywellbeing" + + "zonehongorgehonjyoitakasakitashiobarahornindalhorseoulminamitane" + + "hortendofinternetrentino-s-tirollagrigentomologyhoteleshinkamigo" + + "toyohashimototalhotmailhoyangerhoylandetroitskokonoehumanitieshi" + + "nshinotsurgeryhurdalhurumajis-a-rockstarachowicehyllestadhyogori" + + "s-a-socialistmeindianapolis-a-bloggerhyugawarahyundaiwafunehzcho" + + "nanbugattipschlesischesaudajgorajlchoshibuyachiyodavvesiidazaifu" + + "daigodoesntexistanbullensvanguardyndns-wikindleikangerjlljmpharm" + + "acienshiojirishirifujiedajnjelenia-gorajoyentrentino-sued-tirolj" + + "oyokaichibahcavuotnagaraumalselvendrelljpmorganjpnchoyodobashich" + + "ikashukujitawarajprshioyamemorialjuniperjurkristiansundkrodshera" + + "dkrokstadelvaldaostarnbergkryminamiyamashirokawanabelgorodeokuma" + + "torinokumejimassa-carrara-massacarraramassabunkyonanaoshimageand" + + "soundandvisionkumenanyokkaichirurgiens-dentistes-en-francekunisa" + + "kis-an-artistcgroupgfoggiakunitachiarailwaykunitomigusukumamotoy" + + "amasoykunneppulawykunstsammlungkunstunddesignkuokgrouphdkureisen" + + "kurgankurobelaudibleborkdalkurogimilitarykuroisoftwarendalenugku" + + "romatsunais-an-engineeringkurotakikawasakis-an-entertainerkursko" + + "mmunalforbundkushirogawakustanais-bykusupplieshiranukaniepcekutc" + + "hanelkutnokuzbassnillfjordkuzumakis-certifiedogawarabikomaezakir" + + "unorthwesternmutualkvafjordkvalsundkvamfamberkeleykvanangenkvine" + + "sdalkvinnheradkviteseidskogkvitsoykwpspjelkavikommunemitourismol" + + "anciamitoyoakemiuramiyazumiyotamanomjondalenmlbfanmonmouthagebos" + + "tadmonstermonticellombardiamondshiraois-into-carshintomikasahara" + + "montrealestatefarmequipmentrentino-suedtirolmonza-brianzaporizhz" + + "hiamonza-e-della-brianzapposhiraokanmakiyokawaramonzabrianzaptok" + + "yotangotpantheonsitemonzaebrianzaramonzaedellabrianzamoparachuti" + + "ngmordoviajessheiminanomoriyamatsunomoriyoshiokamitsuemormoneymo" + + "royamatsusakahoginozawaonsenmortgagemoscowindowshiratakahagivest" + + "bytomaritimekeepingmoseushistorymosjoenmoskeneshishikuis-into-ca" + + "rtoonshinyoshitomiokaneyamaxunusualpersonmosshisognemosvikomorot" + + "sukamisunagawamoviemovistargardmtpchristmasakikugawatchesauherad" + + "yndns-workisboringrossetouchijiwadeloittevadsoccertificationissh" + + "ingugemtranakatsugawamuenstermugithubcloudusercontentrentinoa-ad" + + "igemuikamogawamukochikushinonsenergymulhouservebeermunakatanemun" + + "cieszynmuosattemuphiladelphiaareadmyblogsitemurmanskomvuxn--3ds4" + + "43gmurotorcraftrentinoaadigemusashimurayamatsushigemusashinohara" + + "museetrentinoalto-adigemuseumverenigingmutsuzawamutuellevangermy" + + "dissentrentinoaltoadigemydrobofagemydshisuifuelmyeffectrentinos-" + + "tirolmyfritzwinnershitaramamyftphilatelymykolaivarggatrentinosti" + + "rolmymediapchromedicaltanissettaishinomakimobetsuliguriamyokoham" + + "amatsudamypepsonyoursidedyn-o-saurecipesaro-urbino-pesarourbinop" + + "esaromamurogawawioshizukuishimogosenmypetshizuokannamiharumyphot" + + "oshibahccavuotnagareyamalvikongsbergmypsxn--3e0b707emysecurityca" + + "merakermyshopblockshoujis-into-gamessinashikiwakunigamihamadamyt" + + "is-a-bookkeepermincommbankomonomyvnchryslerpictetrentinosud-tiro" + + "lpictureshowtimeteorapphoenixn--3oq18vl8pn36apiemontepilotshrira" + + "mlidlugolekagaminogiftsienaplesigdalpimientaketomisatomskongsvin" + + "gerpinkoninjamisonpioneerpippuphonefosshowapiszpittsburghofastly" + + "piwatepizzapkonskowolayangroupharmacyshirahamatonbetsurgutsiracu" + + "saitoshimaplanetariuminnesotaketakatsukis-foundationplantationpl" + + "antsilkonsulatrobeepilepsydneyplatformintelligenceplaystationpla" + + "zaplchungbukazunoplombardyndns-blogdnsimbirskonyvelolplumbingopm" + + "npodzonepohlpoivronpokerpokrovskooris-a-techietis-a-soxfanpolkow" + + "icepoltavalle-aostarostwodzislawitdkopervikomforbananarepublicar" + + "toonartdecoffeedbackplaneappalacemreviewskrakoweddinglassassinat" + + "ionalheritagematsubarakawagoeu-1pomorzeszowithgoogleapisa-hockey" + + "nutrentinosudtirolpordenonepornporsangerporsanguideltajimicrolig" + + "htingporsgrunnanpoznanpraxis-a-bruinsfanprdpreservationpresidiop" + + "rgmrprimelhusgardenprincipeprivatizehealthinsuranceprochowicepro" + + "ductionsimple-urlprofauskedsmokorsetagayasells-for-ulsandoyprogr" + + "essivegasiaprojectrentinosued-tirolpromombetsurfbsbxn--1lqs03npr" + + "opertyprotectionprotonetrentinosuedtirolprudentialpruszkowithyou" + + "tubeneventoeidsvollprzeworskogptplusterptzpvtrentoyonakagyokutoy" + + "akokamishihoronobeokaminoyamatsuris-leetrentino-stirolpwchungnam" + + "dalseidfjordynnsavannahgapzqldqponqslgbtrevisohughesirdalquicksy" + + "teslingqvchurchaseljeffersoniyodogawastoragestordalstorenburgsto" + + "rfjordstpetersburgstreamsterdamnserverbaniastudiostudyndns-homef" + + "tpaccessnoasakakinokiastuff-4-salestufftoread-booksnesnzstuttgar" + + "trogstadsurreysusakis-not-certifieducatorahimeshimakanegasakinko" + + "bayashikshacknethnologysusonosuzakanrasuzukanumazurysuzukis-save" + + "dunetbankolobrzegersundsvalbardudinkakudamatsuesveiosvelvikoseis" + + "-a-therapistoiasvizzeraswedenswidnicarrierswiebodzindianmarketin" + + "gswiftcoveronaritakurashikis-slickomaganeswinoujscienceandhistor" + + "yswisshikis-uberleetrentino-sud-tirolturystykarasjohkamiokaminok" + + "awanishiaizubangetuscanytushuissier-justicetuvalle-daostatichuva" + + "shiatuxfamilyversicherungvestfoldvestnesolutionslupskoryolasitev" + + "estre-slidreamhostersomavestre-totennishiawakuravestvagoyvevelst" + + "advibo-valentiavibovalentiavideovillaskoyabearalvahkijobserverda" + + "lvdalcesomnarashinovinnicartiervinnytsiavipsinaapphotographysiov" + + "irginiavirtualvirtueeldomeindustriesteambulancevirtuelvisakegawa" + + "vistaprinternationalfirearmsooviterboltromsakatakinouevivoldavla" + + "dikavkazanvladimirvladivostokaizukarasuyamazoevlogoipiagetmyiphi" + + "lipsyvolkenkundenvolkswagentsopotritonvologdanskoshunantokonameg" + + "atakasugais-an-accountantshinshirovolvolgogradvolyngdalvoronezhy" + + "tomyrvossevangenvotevotingvotoyonezawavrnworldworse-thanggliding" + + "wowiwatsukiyonowruzhgorodoywritesthisblogsytewroclawloclawekostr" + + "omahachijorpelandwtcirclegnicafederationwtfbx-oslodingenwuozuwww" + + "mflabsor-odalwzmiuwajimaxn--4gq48lf9jeonnamerikawauexn--4it168dx" + + "n--4it797kotohiradomainsurehabmerxn--4pvxsor-varangerxn--54b7fta" + + "0ccitichernigovernmentoyookanzakiyosatokigawaxn--55qw42gxn--55qx" + + "5dxn--5js045dxn--5rtp49civilaviationxn--5rtq34kotouraxn--5su34j9" + + "36bgsgxn--5tzm5gxn--6btw5axn--6frz82gxn--6orx2rxn--6qq986b3xlxn-" + + "-7t0a264civilisationxn--80adxhksorfoldxn--80ao21axn--80aqecdr1ax" + + "n--80asehdbarclaycardsakuraibigawaurskog-holandroverhalla-spezia" + + "grocerybnikahokutobishimaizurubtsovskiervaapsteiermarkariyakumol" + + "dev-myqnapcloudcontrolappagefrontappagespeedmobilizerobiraeropor" + + "talabamagasakishimabarackmaze12xn--80aswgxn--80audnedalnxn--8ltr" + + "62kouhokutamakis-an-actorxn--8pvr4uxn--8y0a063axn--90a3academyac" + + "tivedirectoryazannakadomari-elasticbeanstalkounosunndalxn--90ais" + + "hobaraomoriguchiharahkkeravjudygarlandxn--90azhaibarakitahatakan" + + "abeautydalxn--9dbhblg6dietcimmobilienxn--9dbq2axn--9et52uxn--9kr" + + "t00axn--andy-iraxn--aroport-byanagawaxn--asky-iraxn--aurskog-hla" + + "nd-jnbarclaysakyotanabellunordkappgafanpachigasakidsmynasushioba" + + "ragusaarlandiskstationavigationavuotnakayamatsuuraustevollavagis" + + "kebinagisochildrensgardenaturalhistorymuseumcenterepbodyndns-fre" + + "ebox-oskolegokasells-for-less3-eu-central-1xn--avery-yuasakuhokk" + + "aidontexisteingeekouyamashikis-an-actresshintokushimaxn--b-5gaxn" + + "--b4w605ferdxn--bck1b9a5dre4civilizationxn--bdddj-mrabdxn--beara" + + "lvhki-y4axn--berlevg-jxaxn--bhcavuotna-s4axn--bhccavuotna-k7axn-" + + "-bidr-5nachikatsuuraxn--bievt-0qa2xn--bjarky-fyanaizuxn--bjddar-" + + "ptamayufuettertdasnetzxn--blt-elabourxn--bmlo-graingerxn--bod-2n" + + "aroyxn--brnny-wuaccident-investigationjukudoyamagadancebetsukuba" + + "bia-goracleaningatlantabusebastopologyeonggiehtavuoatnadexeterim" + + "o-i-ranagahamaroygardendoftheinternetflixilovecollegefantasyleag" + + "uernseyxn--brnnysund-m8accident-preventionlineat-urlxn--brum-voa" + + "gatromsojavald-aostaplesokanoyakagexn--btsfjord-9zaxn--c1avgxn--" + + "c2br7gxn--c3s14misasaguris-into-animelbournexn--cck2b3barefootba" + + "llooningliwiceventsalangenayoroddaustinnaturalsciencesnaturelles" + + "3-eu-west-1xn--cg4bkis-very-badaddjamalborkangerxn--ciqpnxn--clc" + + "hc0ea0b2g2a9gcdn77-sslattumisawaxn--comunicaes-v6a2oxn--correios" + + "-e-telecomunicaes-ghc29axn--czr694bargainstitutelemarkashiwaraus" + + "traliaisondriodejaneirochestereportarantours3-external-1xn--czrs" + + "0trusteexn--czru2dxn--czrw28barreauctionflfanfshostrodawaraustrh" + + "eimatunduhrennesoyokotebinorilskarlsoyokozebizenakamagayachts3-e" + + "xternal-2xn--d1acj3barrel-of-knowledgeologyukuhashimojibmditchyo" + + "uripalanakhodkanagawauthordalandroidgcahcesuolocalhistoryggeelvi" + + "nckarmoyomitanobninskarpaczeladz-1xn--d1alfaromeoxn--d1atrvbarce" + + "lonagasukeu-2xn--d5qv7z876civilwarmanagementoyosatoyokawaxn--dav" + + "venjrga-y4axn--djrs72d6uyxn--djty4kouzushimashikokuchuoxn--dnna-" + + "grajewolterskluwerxn--drbak-wuaxn--dyry-iraxn--e1a4claimsaves-th" + + "e-whalessandria-trani-barletta-andriatranibarlettaandriaxn--eckv" + + "dtc9dxn--efvn9sorreisahayakawakamiichikawamisatottoris-lostre-to" + + "teneis-a-studentalxn--efvy88hair-surveillancexn--ehqz56nxn--elqq" + + "16hakatanotaireshimokawaxn--estv75gxn--eveni-0qa01gaxn--f6qx53ax" + + "n--fct429kozagawaxn--fhbeiarnxn--finny-yuaxn--fiq228c5hsortlandx" + + "n--fiq64barrell-of-knowledgeometre-experts-comptablesalondonetsk" + + "ashiwazakiyosemiteverbankasukabedzin-the-bandaioiraseeklogesuran" + + "certmgretachikawakkanaibetsubamericanfamilydscloudcontrolledekaf" + + "jordivtasvuodnagatorogersaltdalimoliserniautomotivecodynaliascol" + + "i-picenoipirangamvikaruizawamusementaobaokinawashirosatochiokino" + + "shimakeupowiathletajimabariakembuchikumagayagawakuyabukihokumako" + + "gengerdalipayekaterinburgjerdrumckinseyokosukareliance164xn--fiq" + + "s8sorumisakis-gonexn--fiqz9southcarolinazawaxn--fjord-lraxn--fjq" + + "720axn--fl-ziaxn--flor-jraxn--flw351exn--fpcrj9c3dxn--frde-grand" + + "rapidsouthwestfalenxn--frna-woaraisaijosoyrovigorlicexn--frya-hr" + + "axn--fzc2c9e2clickchristiansburgroundhandlingroznyxn--fzys8d69uv" + + "gmailxn--g2xx48clinichernihivanovosibirskautokeinoxn--gckr3f0fbx" + + "ostrolekaluganskharkivgucciprianiigataitogliattirescrappingushik" + + "amifuranosegawaxn--gecrj9cliniquenoharaxn--ggaviika-8ya47hakodat" + + "exn--gildeskl-g0axn--givuotna-8yandexn--3pxu8kosugexn--gjvik-wua" + + "xn--gk3at1exn--gls-elacaixaxn--gmq050is-very-evillagexn--gmqw5ax" + + "n--h-2failxn--h1aeghakonexn--h2brj9clintonoshoesavonamsskoganeis" + + "-a-doctorayxn--hbmer-xqaxn--hcesuolo-7ya35bashkiriautoscanadaeje" + + "onbukarumaifarmerseinextdirectargets-itargivingjesdalavangenatur" + + "bruksgymnaturhistorisches3-fips-us-gov-west-1xn--hery-iraxn--hge" + + "bostad-g3axn--hmmrfeasta-s4acctrysiljan-mayenxn--hnefoss-q1axn--" + + "hobl-iraxn--holtlen-hxaxn--hpmir-xqaxn--hxt814exn--hyanger-q1axn" + + "--hylandet-54axn--i1b6b1a6a2exn--imr513nxn--indery-fyaotsurnadal" + + "xn--io0a7is-very-goodhandsonxn--j1aefermobilyxn--j1amhakubankhva" + + "olbia-tempio-olbiatempioolbialystokkemerovodkagoshimalopolskanla" + + "ndxn--j6w193gxn--jlq61u9w7basilicataniaveroykeniwaizumiotsukumiy" + + "amazonawsabaerobaticketsaritsynologyeongnamegawakeisenbahnatuurw" + + "etenschappenaumburgjovikasaokamisatokashikiwienaustdalazioceanog" + + "raphics3-sa-east-1xn--jlster-byaroslavlaanderenxn--jrpeland-54ax" + + "n--jvr189misconfusedxn--k7yn95exn--karmy-yuaxn--kbrq7oxn--kcrx77" + + "d1x4axn--kfjord-iuaxn--klbu-woaxn--klt787dxn--kltp7dxn--kltx9axn" + + "--klty5xn--42c2d9axn--koluokta-7ya57hakuis-a-nascarfanxn--kprw13" + + "dxn--kpry57dxn--kpu716ferraraxn--kput3is-very-nicexn--krager-gya" + + "sakaiminatoyonoxn--kranghke-b0axn--krdsherad-m8axn--krehamn-dxax" + + "n--krjohka-hwab49jetztrentino-sudtirolxn--ksnes-uuaxn--kvfjord-n" + + "xaxn--kvitsy-fyasugis-very-sweetpepperxn--kvnangen-k0axn--l-1fai" + + "rwindsowaxn--l1accentureklamborghiniizaxn--laheadju-7yasuokarate" + + "xn--langevg-jxaxn--lcvr32dxn--ldingen-q1axn--leagaviika-52basket" + + "ballfinanzgoravocatanzarowebhopocznoceanographiquehimeji234xn--l" + + "esund-huaxn--lgbbat1ad8jevnakershuscultureggioemiliaromagnakasat" + + "sunais-a-teacherkassymantechnologyxn--lgrd-poacoachampionshiphop" + + "tobamagazinebraskaunjargallupinbatodayurihonjournalisteinkjerusa" + + "lembroideryusuharavoues3-us-gov-west-1xn--lhppi-xqaxn--linds-pra" + + "mericanartulansokndalxn--lns-qlanxesspreadbettingxn--loabt-0qaxn" + + "--lrdal-sraxn--lrenskog-54axn--lt-liaclothingrpanasonichernivtsi" + + "ciliaxn--lten-granexn--lury-iraxn--mely-iraxn--merker-kuaxn--mgb" + + "2ddespydebergxn--mgb9awbferrarittogoldpoint2thisamitsukexn--mgba" + + "3a3ejtunesolarssonxn--mgba3a4f16axn--mgba3a4franamizuholdingsmil" + + "eksvikozakis-an-anarchistoricalsocietyumenxn--mgba7c0bbn0axn--mg" + + "baakc7dvferreroticanonoichinomiyakexn--mgbaam7a8hakusandiegoodye" + + "arthadselfipassagenshellaspeziaxn--mgbab2bdxn--mgbai9a5eva00bats" + + "fjordivttasvuotnaharimaniwakuratexascolipicenord-aurdalpha-myqna" + + "pcloudappspotagerhcloudfunctionsalvadordalibabaikaliszczytnord-o" + + "dalindasdaburyatiaarpaleomutashinaiinetarnobrzegyptianhlfanhsalz" + + "burglobalashovhachinohedmarkasumigaurawa-mazowszexboxenapponazur" + + "e-mobilevje-og-hornnesamegawaxasnesoddenmarkhangelskjervoyagemol" + + "ogicallyngenglanddnskingjerstadotsuruokamchatkameokameyamashinat" + + "sukigatakamatsukawaetnagaivuotnagaokakyotambabydgoszczecinemagen" + + "tositelekommunikationthewifiat-band-campaniamallamaintenanceobih" + + "irosakikamijimattelefonicarbonia-iglesias-carboniaiglesiascarbon" + + "iabruzzoologyeongbuk-uralsk12xn--mgbai9azgqp6jewelryxn--mgbayh7g" + + "paduaxn--mgbb9fbpobanazawaxn--mgbbh1a71exn--mgbc0a9azcgxn--mgbca" + + "7dzdoxn--mgberp4a5d4a87gxn--mgberp4a5d4arxn--mgbi4ecexposedxn--m" + + "gbpl2fhskpnxn--mgbqly7c0a67fbcloudnsdojoetsuwanouchikujogaszkola" + + "hppiacenzakopanerairforcexn--mgbqly7cvafredrikstadtverranzanxn--" + + "mgbt3dhdxn--mgbtf8flatangerxn--mgbtx2bauhausposts-and-telecommun" + + "icationsnasadodgeorgeorgiaxn--mgbx4cd0abbottunkosherbrookegawaxn" + + "--mix082fetsundxn--mix891fgxn--1lqs71dxn--mjndalen-64axn--mk0axi" + + "nfinitis-with-thebandoomdnsfor-better-thandaxn--mk1bu44cnsaxoxn-" + + "-mkru45isleofmandalxn--mlatvuopmi-s4axn--mli-tlapyatigorskppspie" + + "gelxn--mlselv-iuaxn--moreke-juaxn--mori-qsakuragawaxn--mosjen-ey" + + "atominamiawajikissmarterthanyoustkarasjokomakiyosumycdn77-secure" + + "chtrainingxn--mot-tlaquilancasterxn--mre-og-romsdal-qqbbcasadela" + + "monedatsunanjoburglobodoes-itvedestrandiyusuisserveexchangexn--m" + + "sy-ula0haldenxn--mtta-vrjjat-k7afamilycompanycntoyotaris-a-finan" + + "cialadvisor-aurdalukowhoswhokksundynv6xn--muost-0qaxn--mxtq1mish" + + "imatsumaebashimodatexn--ngbc5azdxn--ngbe9e0axn--ngbrxn--45brj9ci" + + "rcus-2xn--nit225krasnodarxn--nmesjevuemie-tcbajddarchaeologyxn--" + + "nnx388axn--nodexn--nqv7fs00emaxn--nry-yla5gxn--ntso0iqx3axn--nts" + + "q17gxn--nttery-byaeservecounterstrikexn--nvuotna-hwaxn--nyqy26ax" + + "n--o1achattanooganorfolkebiblegallocus-1xn--o3cw4halsaitamatsuku" + + "ris-a-nurservebbshimokitayamaxn--od0algxn--od0aq3bbtarumizusawax" + + "n--ogbpf8flekkefjordxn--oppegrd-ixaxn--ostery-fyatsukaratsuginam" + + "ikatagamihoboleslawiecolonialwilliamsburgruexn--osyro-wuaxn--p1a" + + "cfhvalerxn--p1aiwchoseirouterxn--pbt977coloradoplateaudioxn--pgb" + + "s0dhlxn--porsgu-sta26fidonnakaiwamizawaxn--pssu33lxn--pssy2uxn--" + + "q9jyb4columbusheyxn--qcka1pmcdonaldsrlxn--qqqt11missilelxn--qxam" + + "urskjakdnepropetrovskiptveterinairealtorlandxn--rady-iraxn--rdal" + + "-poaxn--rde-ularvikrasnoyarskomitamamuraxn--rdy-0nabarixn--renne" + + "sy-v1axn--rhkkervju-01aflakstadaokagakibichuoxn--rholt-mragowood" + + "sidexn--rhqv96gxn--rht27zxn--rht3dxn--rht61exn--risa-5narusawaxn" + + "--risr-iraxn--rland-uuaxn--rlingen-mxaxn--rmskog-byatsushiroxn--" + + "rny31hammarfeastafricapetownnews-stagingxn--rovu88bbvacationsupd" + + "atelevisionikiitatebayashijonawatexn--rros-granvindafjordxn--rsk" + + "og-uuaxn--rst-0narutomobellevuelosangelesjaguarchitecturealtychy" + + "attorneyagawalbrzycharternopilawalesundxn--rsta-francaiseharaxn-" + + "-ryken-vuaxn--ryrvik-byawaraxn--s-1faitheguardianxn--s9brj9commu" + + "nitysfjordyroyrvikinguitarsbschokoladenxn--sandnessjen-ogbizhevs" + + "kredirectmeldalxn--sandy-yuaxn--seral-lraxn--ses554gxn--sgne-gra" + + "tangenxn--skierv-utazaskvolloabathsbcomobaraxn--skjervy-v1axn--s" + + "kjk-soaxn--sknit-yqaxn--sknland-fxaxn--slat-5narviikananporovnox" + + "n--slt-elabbvieeexn--smla-hraxn--smna-gratis-a-bulls-fanxn--snas" + + "e-nraxn--sndre-land-0cbremangerxn--snes-poaxn--snsa-roaxn--sr-au" + + "rdal-l8axn--sr-fron-q1axn--sr-odal-q1axn--sr-varanger-ggbentleyu" + + "uconnectatamotorsamnangerxn--srfold-byawatahamaxn--srreisa-q1axn" + + "--srum-grazxn--stfold-9xaxn--stjrdal-s1axn--stjrdalshalsen-sqbep" + + "publishproxyzgorzeleccolognewportlligatewayuzawaxn--stre-toten-z" + + "cbsrtroandinosaurlandesmolenskosaigawaxn--t60b56axn--tckweatherc" + + "hannelxn--tiq49xqyjewishartgalleryxn--tjme-hraxn--tn0agrinet-fre" + + "aksrvaroyxn--tnsberg-q1axn--tor131oxn--trany-yuaxn--trgstad-r1ax" + + "n--trna-woaxn--troms-zuaxn--tysvr-vraxn--uc0atvdonskoshimizumaki" + + "zunokunimilanoxn--uc0ay4axn--uist22hamurakamigoriginshimonitayan" + + "agitlaborxn--uisz3gxn--unjrga-rtambovenneslaskerrylogisticsologn" + + "exn--unup4yxn--uuwu58axn--vads-jraxn--vard-jraxn--vegrshei-c0axn" + + "--vermgensberater-ctberndnpalermomasvuotnakatombetsupportatarsta" + + "nikkoebenhavnikolaevennodessaikiraxn--vermgensberatung-pwbeskidy" + + "nathomedepotenzachpomorskienikonantanangerxn--vestvgy-ixa6oxn--v" + + "g-yiabcn-north-1xn--vgan-qoaxn--vgsy-qoa0jfkomatsushimashikexn--" + + "vgu402comparemarkerryhotelscholarshipschooluroyxn--vhquversaille" + + "solundbeckosakaerodromegalsacechirealminamiuonumasudaxn--vler-qo" + + "axn--vre-eiker-k8axn--vrggt-xqadxn--vry-yla5gxn--vuq861bestbuysh" + + "ousesamsclubindalindesnesamsunglogowegroweibolzanordre-landrange" + + "dalinkasuyakutiaxn--w4r85el8fhu5dnraxn--w4rs40lxn--wcvs22dxn--wg" + + "bh1compute-1xn--wgbl6axn--xhq521betainaboxfusejnynysagaeroclubme" + + "decincinnationwidealerxn--xkc2al3hye2axn--xkc2dl3a5ee0hangoutsys" + + "temscloudfrontdoorxn--y9a3aquariumisugitokuyamatsumotofukexn--ye" + + "r-znarvikristiansandcatshirakoenigxn--yfro4i67oxn--ygarden-p1axn" + + "--ygbi2ammxn--45q11citadeliveryokamikawanehonbetsurutaharaxn--ys" + + "tre-slidre-ujbieigersundrivelandrobaknoluoktaikicks-assedicaseih" + + "ichisobetsuitaipeiheijiiyamanobeauxartsandcraftsandvikcoromantov" + + "alle-d-aostathellexusdecorativeartsanfranciscofreakunemurorangei" + + "seiyoichiropracticasertairaxn--zbx025dxn--zf0ao64axn--zf0avxn--4" + + "gbriminingxn--zfr164bielawallonieruchomoscienceandindustryninohe" + + "kinannestadrudmurtiaxperiaxz" // nodes is the list of nodes. Each node is represented as a uint32, which // encodes the node's children, wildcard bit and node type (as an index into @@ -483,8127 +482,8141 @@ const text = "bikedagestangeorgeorgiaxagrocerybnikahokutobishimaizuruhreportar" // [15 bits] text index // [ 6 bits] text length var nodes = [...]uint32{ - 0x32f983, - 0x28a344, - 0x30e286, - 0x371b43, - 0x371b46, - 0x394646, - 0x3a5003, - 0x367844, - 0x260687, - 0x30dec8, - 0x1a04cc2, - 0x316e47, - 0x355d89, - 0x32228a, - 0x32228b, - 0x22eec3, - 0x28fac6, - 0x2327c5, - 0x1e04e02, - 0x217c04, - 0x2a90c3, - 0x3ac705, - 0x2203942, - 0x329e03, - 0x26957c4, - 0x368e05, - 0x2a10182, - 0x3787ce, - 0x253343, - 0x3a03c6, - 0x2e00142, - 0x30e407, - 0x23ae46, - 0x3200c42, - 0x22a343, - 0x254b04, - 0x325a86, - 0x35c208, - 0x28a706, - 0x21ad04, - 0x3601442, - 0x332309, - 0x207587, - 0x256286, - 0x339309, - 0x29d788, - 0x328d44, - 0x364906, - 0x36b606, - 0x3a02942, - 0x27144f, - 0x20f94e, - 0x2131c4, - 0x2c6085, - 0x367745, - 0x385989, - 0x241a89, - 0x368047, - 0x23c9c6, - 0x273a43, - 0x3e02342, - 0x2df283, - 0x205aca, - 0x221d83, - 0x303145, - 0x289c02, - 0x289c09, - 0x4200f82, - 0x203d84, - 0x2250c6, - 0x2eb205, - 0x34cbc4, - 0x4a04c04, - 0x205283, - 0x231ac4, - 0x4e02e02, - 0x209f04, - 0x52f4e04, - 0x24ae0a, - 0x5601342, - 0x303907, - 0x26b8c8, - 0x6202f82, - 0x31cf07, - 0x2c2e04, - 0x2c2e07, - 0x373d85, - 0x357a47, - 0x367e06, - 0x2e8384, - 0x39c0c5, - 0x294847, - 0x7206cc2, - 0x34f703, - 0x200582, - 0x200583, - 0x76125c2, - 0x221ec5, - 0x7a02302, - 0x27bd84, - 0x2810c5, - 0x213107, - 0x269f0e, - 0x224bc4, - 0x206a84, - 0x211503, - 0x2ceac9, - 0x2ed94b, - 0x3a6548, - 0x3148c8, - 0x318dc8, - 0x237908, - 0x33914a, - 0x357947, - 0x318146, - 0x7ea4fc2, - 0x35bc03, - 0x366c43, - 0x371144, - 0x3a5043, - 0x324cc3, - 0x171f542, - 0x8203682, - 0x252185, - 0x2a11c6, - 0x2d6d44, - 0x2f6e07, - 0x382986, - 0x319dc4, - 0x398247, - 0x20f7c3, - 0x86c8902, - 0x8b124c2, - 0x8e1c502, - 0x21c506, - 0x9200002, - 0x359b85, - 0x320a83, - 0x200004, - 0x2ee344, - 0x2ee345, - 0x203e43, - 0x9768883, - 0x9a07f42, - 0x28e245, - 0x28e24b, - 0x2d0686, - 0x20a0cb, - 0x225b04, - 0x20a7c9, - 0x20be84, - 0x9e0c0c2, - 0x20cf83, - 0x210843, - 0x1600802, - 0x260903, - 0x2109ca, - 0xa211cc2, - 0x217e85, - 0x2983ca, - 0x2dc184, - 0x369f03, - 0x315044, - 0x213643, - 0x213644, - 0x213647, - 0x213985, - 0x213e05, - 0x2150c6, - 0x2167c6, - 0x2182c3, - 0x21c188, - 0x221c43, - 0xa601082, - 0x21cac8, - 0x21ff0b, - 0x2216c8, - 0x2221c6, - 0x222a47, - 0x226488, - 0xb2413c2, - 0xb6c2fc2, - 0x326388, - 0x257ec7, - 0x22bac5, - 0x22bac8, - 0x2bf708, - 0x3871c3, - 0x22a784, - 0x371182, - 0xba2af82, - 0xbe5ba02, - 0xc62c1c2, - 0x22c1c3, - 0xca0e542, - 0x367803, - 0x2f8e04, - 0x218443, - 0x328d04, - 0x25fe4b, - 0x21fe43, - 0x2e4d06, - 0x226284, - 0x2a5a8e, - 0x361c05, - 0x3a04c8, - 0x282247, - 0x28224a, - 0x229d03, - 0x2b3447, - 0x2edb05, - 0x22ea44, - 0x272486, - 0x272487, - 0x32b704, - 0x304ac7, - 0x26a244, - 0x35bc84, - 0x35bc86, - 0x386904, - 0x20e546, - 0x223c83, - 0x22b888, - 0x30c3c8, - 0x24e2c3, - 0x2608c3, - 0x204f04, - 0x395943, - 0xce0d882, - 0xd2db442, - 0x20c043, - 0x201806, - 0x35c383, - 0x28bfc4, - 0xd6081c2, - 0x2081c3, - 0x358243, - 0x219942, - 0xda02ac2, - 0x2c55c6, - 0x2334c7, - 0x2f7a85, - 0x37da44, - 0x3723c5, - 0x367007, - 0x274205, - 0x2d3e89, - 0x2e0586, - 0x2e5488, - 0x2f7986, - 0xde0db42, - 0x362f48, - 0x2f8bc6, - 0x20db45, - 0x304687, - 0x30c2c4, - 0x30c2c5, - 0x28a8c4, - 0x28a8c8, - 0xe20a182, - 0xe60c502, - 0x313646, - 0x2c28c8, - 0x31f145, - 0x332c06, - 0x3356c8, - 0x33e1c8, - 0xea0fd45, - 0xee0c504, - 0x2958c7, - 0xf20bbc2, - 0xf61c402, - 0x1060d1c2, - 0x35aa45, - 0x2a8505, - 0x282606, - 0x3698c7, - 0x376ec7, - 0x10ed0783, - 0x2e3447, - 0x30dc88, - 0x3823c9, - 0x378987, - 0x390287, - 0x3a5b08, - 0x3aa206, - 0x22e546, - 0x22f18c, - 0x230b0a, - 0x230fc7, - 0x23268b, - 0x233307, - 0x23330e, - 0x236244, - 0x23a184, - 0x23b547, - 0x264f47, - 0x240d46, - 0x240d47, - 0x241207, - 0x18a20802, - 0x2420c6, - 0x2420ca, - 0x24294b, - 0x243407, - 0x244ec5, - 0x245203, - 0x246c46, - 0x246c47, - 0x241c43, - 0x18e38702, - 0x24b74a, - 0x19356fc2, - 0x196acdc2, - 0x19a4cec2, - 0x19e26982, - 0x24da85, - 0x24e0c4, - 0x1a604d02, - 0x209f85, - 0x294ac3, - 0x20bf85, - 0x237804, - 0x20a684, - 0x2ba5c6, - 0x26a546, - 0x28e443, - 0x3b1484, - 0x209383, - 0x1aa03b02, - 0x263544, - 0x263546, - 0x295e45, - 0x27fdc6, - 0x304788, - 0x20cb44, - 0x2a8e88, - 0x343fc5, - 0x24a108, - 0x2b1cc6, - 0x2bddc7, - 0x26cdc4, - 0x26cdc6, - 0x25e303, - 0x382e43, - 0x2c9388, - 0x318bc4, - 0x238d47, - 0x220246, - 0x2dad89, - 0x315108, - 0x319f08, - 0x349184, - 0x39b9c3, - 0x23e342, - 0x1ba34682, - 0x1be16102, - 0x3b2783, - 0x1c204a42, - 0x2607c4, - 0x390a46, - 0x39a6c5, - 0x2a4383, - 0x232004, - 0x2b6f47, - 0x26aa43, - 0x250d08, - 0x20e8c5, - 0x370083, - 0x281045, - 0x281184, - 0x2fb8c6, - 0x210384, - 0x211a46, - 0x213046, - 0x263004, - 0x21fd83, - 0x2225c3, - 0x1c604e42, - 0x377905, - 0x222e03, - 0x1ca1c3c2, - 0x22f143, - 0x210085, - 0x231b83, - 0x231b89, - 0x1ce07d02, - 0x1d601142, - 0x28d9c5, - 0x21a746, - 0x2d6906, - 0x2b94c8, - 0x2b94cb, - 0x20538b, - 0x2f7c85, - 0x2e1045, - 0x2c9fc9, - 0x1600742, - 0x2631c8, - 0x206044, - 0x1de001c2, - 0x25fa83, - 0x1e665106, - 0x20f088, - 0x1ea04782, - 0x233ec8, - 0x1ee01742, - 0x225c4a, - 0x1f2d0e43, - 0x3b1e86, - 0x206988, - 0x207d48, - 0x39a9c6, - 0x36d5c7, - 0x271647, - 0x220b0a, - 0x2dc204, - 0x3423c4, - 0x355589, - 0x1fb8fc85, - 0x20fb46, - 0x208203, - 0x251944, - 0x201e44, - 0x201e47, - 0x22cec7, - 0x237044, - 0x220a45, - 0x2826c8, - 0x350707, - 0x3619c7, - 0x1fe041c2, - 0x226004, - 0x298cc8, - 0x381004, - 0x24f0c4, - 0x24fa45, - 0x24fb87, - 0x215809, - 0x2505c4, - 0x2510c9, - 0x251308, - 0x2516c4, - 0x2516c7, - 0x20251c43, - 0x252487, - 0x16101c2, - 0x179d442, - 0x253386, - 0x2539c7, - 0x253e84, - 0x255607, - 0x256907, - 0x257483, - 0x2abc02, - 0x229c02, - 0x258743, - 0x258744, - 0x25874b, - 0x3149c8, - 0x25f184, - 0x2594c5, - 0x25ba87, - 0x25d8c5, - 0x2c4dca, - 0x25f0c3, - 0x2060da42, - 0x22b484, - 0x264d09, - 0x268983, - 0x268a47, - 0x28ee89, - 0x37b5c8, - 0x2d8483, - 0x27ff47, - 0x280689, - 0x2316c3, - 0x288284, - 0x289389, - 0x28c6c6, - 0x28dc83, - 0x2023c2, - 0x24ca43, - 0x36ab47, - 0x2bfa85, - 0x35ba06, - 0x256bc4, - 0x2d1d45, - 0x205a83, - 0x218506, - 0x20a9c2, - 0x391084, - 0x22ad02, - 0x22ad03, - 0x20a00182, - 0x29b083, - 0x216c44, - 0x216c47, - 0x200306, - 0x201e02, - 0x20e01dc2, - 0x21e184, - 0x2123b882, - 0x21600502, - 0x2dfcc4, - 0x2dfcc5, - 0x2b9cc5, - 0x262746, - 0x21a0ca82, - 0x20ca85, - 0x210d85, - 0x225883, - 0x215c06, - 0x216dc5, - 0x21c482, - 0x33de05, - 0x21c484, - 0x2230c3, - 0x223303, - 0x21e097c2, - 0x294a47, - 0x221144, - 0x221149, - 0x251844, - 0x228903, - 0x341cc9, - 0x3777c8, - 0x2a8384, - 0x2a8386, - 0x210503, - 0x259b43, - 0x332ec3, - 0x222ebc02, - 0x30eb82, - 0x22600642, - 0x3238c8, - 0x35c588, - 0x394d86, - 0x24ed45, - 0x2b32c5, - 0x200647, - 0x228fc5, - 0x2630c2, - 0x22a9a502, - 0x1614502, - 0x38fe08, - 0x362e85, - 0x351d04, - 0x2f18c5, - 0x3836c7, - 0x24f5c4, - 0x246f82, - 0x22e01182, - 0x336f04, - 0x2173c7, - 0x28e9c7, - 0x357a04, - 0x298383, - 0x24e204, - 0x24e208, - 0x22e886, - 0x27230a, - 0x2156c4, - 0x298708, - 0x259784, - 0x222b46, - 0x29a4c4, - 0x35ad46, - 0x221409, - 0x25b287, - 0x234483, - 0x23274842, - 0x274843, - 0x20c2c2, - 0x23651b02, - 0x2f0b06, - 0x364148, - 0x2a9d87, - 0x395d09, - 0x297f09, - 0x2ab245, - 0x2ad3c9, - 0x2ae045, - 0x2ae189, - 0x2af5c5, - 0x2b0208, - 0x27f284, - 0x23a8d6c7, - 0x294403, - 0x2b0407, - 0x390646, - 0x2b08c7, - 0x2a6d45, - 0x2a7f83, - 0x23e00dc2, - 0x392604, - 0x2423b8c2, - 0x264403, - 0x24618d82, - 0x307646, - 0x26b845, - 0x2b2bc7, - 0x37f183, - 0x324c44, - 0x2138c3, - 0x2386c3, - 0x24a0a3c2, - 0x25201a02, - 0x394744, - 0x2abbc3, - 0x38c985, - 0x226d85, - 0x25602282, - 0x25e00bc2, - 0x280286, - 0x318d04, - 0x2491c4, - 0x2491ca, - 0x26601d42, - 0x37324a, - 0x204148, - 0x26a964c4, - 0x201d43, - 0x25ff43, - 0x318f09, - 0x2a8909, - 0x2b7046, - 0x26e04303, - 0x328145, - 0x30664d, - 0x204306, - 0x21268b, - 0x27203482, - 0x295048, - 0x27e1c282, - 0x282051c2, - 0x37aa85, - 0x28600b02, - 0x2a3147, - 0x212b87, - 0x201503, - 0x22f848, - 0x28a02f02, - 0x202f04, - 0x217043, - 0x38d045, - 0x386fc3, - 0x2eb106, - 0x30bdc4, - 0x204ec3, - 0x234f83, - 0x28e07042, - 0x2f7c04, - 0x30ed45, - 0x35a587, - 0x27dbc3, - 0x2b36c3, - 0x2b3ec3, - 0x1621ac2, - 0x2b3f83, - 0x2b4b03, - 0x2920ae42, - 0x2cee84, - 0x26a746, - 0x33c7c3, - 0x2b4f83, - 0x296b5e02, - 0x2b5e08, - 0x2b60c4, - 0x2470c6, - 0x2b6547, - 0x24e3c6, - 0x295304, - 0x37200082, - 0x39050b, - 0x2ffbce, - 0x21bb0f, - 0x29da43, - 0x37a4ca02, - 0x166b142, - 0x37e02442, - 0x29c243, - 0x2472c3, - 0x233106, - 0x22ff46, - 0x212307, - 0x31aa84, - 0x3821a882, - 0x3860ec02, - 0x2d4ac5, - 0x2e88c7, - 0x37e046, - 0x38a82882, - 0x2f5b04, - 0x2b9783, - 0x38e01b02, - 0x39352883, - 0x2ba984, - 0x2c06c9, - 0x16c6fc2, - 0x39642682, - 0x351245, - 0x39ac7242, - 0x39e02682, - 0x341687, - 0x2364c9, - 0x35600b, - 0x271405, - 0x2c7c89, - 0x276a46, - 0x2d06c7, - 0x3a2092c4, - 0x32ef49, - 0x374b07, - 0x2255c7, - 0x234003, - 0x37b386, - 0x30f887, - 0x265383, - 0x27c5c6, - 0x3aa022c2, - 0x3ae31e02, - 0x220443, - 0x324845, - 0x257747, - 0x21fac6, - 0x2bfa05, - 0x230044, - 0x2efa45, - 0x2f8284, - 0x3b205e82, - 0x349f07, - 0x2e1c44, - 0x23e244, - 0x33328d, - 0x257249, - 0x381588, - 0x25ac04, - 0x314e85, - 0x3b2607, - 0x205e84, - 0x382a47, - 0x20c705, - 0x3b6aa384, - 0x36dec5, - 0x267644, - 0x24f706, - 0x3696c5, - 0x3ba24742, - 0x369fc4, - 0x369fc5, - 0x3716c6, - 0x2bfb45, - 0x25c104, - 0x3120c3, - 0x204986, - 0x22c085, - 0x22c785, - 0x3697c4, - 0x215743, - 0x21574c, - 0x3be8d002, - 0x3c2045c2, - 0x3c605d82, - 0x205d83, - 0x205d84, - 0x3ca032c2, - 0x2f9648, - 0x35bac5, - 0x33f884, - 0x230e46, - 0x3ce073c2, - 0x3d20fc42, - 0x3d600c02, - 0x321e85, - 0x262ec6, - 0x20b484, - 0x325fc6, - 0x3036c6, - 0x202983, - 0x3db1164a, - 0x264785, - 0x28b4c3, - 0x223886, - 0x305e09, - 0x223887, - 0x293308, - 0x29d649, - 0x248108, - 0x229a46, - 0x208843, - 0x3de017c2, - 0x384b03, - 0x384b09, - 0x368548, - 0x3e2513c2, - 0x3e601f02, - 0x22d603, - 0x2e0405, - 0x258f44, - 0x35e849, - 0x226784, - 0x26f288, - 0x205c03, - 0x2602c4, - 0x2784c3, - 0x21a788, - 0x3331c7, - 0x3ea0f302, - 0x2432c2, - 0x257d85, - 0x3960c9, - 0x20fbc3, - 0x281ac4, - 0x328104, - 0x219e03, - 0x28380a, - 0x3ef73102, - 0x3f2c0202, - 0x2c8883, - 0x374fc3, - 0x1649202, - 0x262a43, - 0x3f60bcc2, - 0x3fa05f02, - 0x3fe22044, - 0x222046, - 0x33e8c6, - 0x277844, - 0x2474c3, - 0x39bc83, - 0x235143, - 0x242cc6, - 0x2ce085, - 0x2c8e47, - 0x2d0589, - 0x2ccac5, - 0x2cdfc6, - 0x2ce548, - 0x2ce746, - 0x245bc4, - 0x29ef8b, - 0x2d3983, - 0x2d3985, - 0x2d3ac8, - 0x226302, - 0x341982, - 0x4024db02, - 0x4060b602, - 0x21a8c3, - 0x40a73fc2, - 0x273fc3, - 0x2d3dc4, - 0x2d4e43, - 0x41201682, - 0x41601686, - 0x2c47c6, - 0x2da008, - 0x41a95242, - 0x41e10882, - 0x42223342, - 0x4265e402, - 0x42a14202, - 0x42e01302, - 0x234103, - 0x261c05, - 0x32d1c6, - 0x43213184, - 0x295c4a, - 0x201306, - 0x2f7ec4, - 0x269ec3, - 0x43e0c002, - 0x202082, - 0x231743, - 0x44204ac3, - 0x362b47, - 0x3695c7, - 0x45a58847, - 0x32d747, - 0x228543, - 0x2977ca, - 0x377004, - 0x220144, - 0x22014a, - 0x202085, - 0x45e04182, - 0x3294c3, - 0x462002c2, - 0x2104c3, - 0x274803, - 0x46a00842, - 0x2e33c4, - 0x21db44, - 0x208285, - 0x30bd05, - 0x249406, - 0x249786, - 0x46e09282, - 0x47201002, - 0x3274c5, - 0x2c44d2, - 0x271ac6, - 0x248803, - 0x2a2486, - 0x248805, - 0x1610a02, - 0x4f611802, - 0x3522c3, - 0x211803, - 0x278203, - 0x4fa11f82, - 0x378ac3, - 0x4fe14602, - 0x200a83, - 0x2ceec8, - 0x24a843, - 0x24a846, - 0x3a1087, - 0x321b06, - 0x321b0b, - 0x2f7e07, - 0x392404, - 0x50603ec2, - 0x364805, - 0x50a04a83, - 0x239f83, - 0x326805, - 0x35b5c3, - 0x35b5c6, - 0x26334a, - 0x2774c3, - 0x23ad04, - 0x2c2806, - 0x20df46, - 0x50e00383, - 0x324b07, - 0x28bb8d, - 0x3adbc7, - 0x2a0685, - 0x250b46, - 0x22c0c3, - 0x52a15e43, - 0x52e04c82, - 0x3b2804, - 0x236d8c, - 0x245309, - 0x24bcc7, - 0x3724c5, - 0x268d84, - 0x27c1c8, - 0x27ed05, - 0x5328a405, - 0x377c09, - 0x256343, - 0x2acd44, - 0x53617902, - 0x21aac3, - 0x53a99f82, - 0x2a3fc6, - 0x16aa082, - 0x53e943c2, - 0x321d88, - 0x2c08c3, - 0x36de07, - 0x305105, - 0x2943c5, - 0x30860b, - 0x2e3906, - 0x308806, - 0x36dbc6, - 0x268f84, - 0x2e5686, - 0x2e5b48, - 0x23e943, - 0x23cf83, - 0x23cf84, - 0x2e6984, - 0x2e6e07, - 0x2e8745, - 0x542e8882, - 0x54606ec2, - 0x206ec5, - 0x2a4a84, - 0x2ebf8b, - 0x2ee248, - 0x2f7304, - 0x290602, - 0x54eb6042, - 0x38c543, - 0x2ee704, - 0x2ee9c5, - 0x2ef087, - 0x2f1404, - 0x2f7cc4, - 0x552054c2, - 0x35d209, - 0x2f2445, - 0x2716c5, - 0x2f3105, - 0x5561aa03, - 0x2f4244, - 0x2f424b, - 0x2f4684, - 0x2f4b0b, - 0x2f5505, - 0x21bc4a, - 0x2f5d08, - 0x2f5f0a, - 0x2f6783, - 0x2f678a, - 0x55a1b282, - 0x55e01202, - 0x26a103, - 0x562f7902, - 0x2f7903, - 0x5673aa42, - 0x56b21202, - 0x2f8104, - 0x21c2c6, - 0x325d05, - 0x2f8b43, - 0x32ff46, - 0x30c845, - 0x2e9784, - 0x56e00e02, - 0x2d7904, - 0x2c9c4a, - 0x2eb487, - 0x26b686, - 0x244007, - 0x236ec3, - 0x265488, - 0x28954b, - 0x386a45, - 0x235905, - 0x235906, - 0x370204, - 0x31d488, - 0x215a83, - 0x2b5984, - 0x36b507, - 0x307206, - 0x200e06, - 0x2a58ca, - 0x24e684, - 0x24e68a, - 0x57201946, - 0x201947, - 0x259547, - 0x279804, - 0x279809, - 0x2ba485, - 0x23b80b, - 0x2769c3, - 0x211c03, - 0x2a3f43, - 0x22ec44, - 0x57600682, - 0x259f06, - 0x2a7d05, - 0x2a26c5, - 0x2564c6, - 0x2531c4, - 0x57a01f82, - 0x245244, - 0x57e00d42, - 0x200d44, - 0x224303, - 0x58211842, - 0x3398c3, - 0x2478c6, - 0x58602602, - 0x2cfb88, - 0x223704, - 0x223706, - 0x375846, - 0x25bb44, - 0x204905, - 0x20c408, - 0x20c907, - 0x20d007, - 0x20d00f, - 0x298bc6, - 0x227843, - 0x227844, - 0x28be84, - 0x210e83, - 0x222c84, - 0x241104, - 0x58a36b82, - 0x28e183, - 0x241383, - 0x58e0c4c2, - 0x22a543, - 0x260883, - 0x213e8a, - 0x22bc87, - 0x241c8c, - 0x241f46, - 0x242406, - 0x246dc7, - 0x592ddb07, - 0x251a09, - 0x21cc04, - 0x252284, - 0x59609f42, - 0x59a01702, - 0x2a5c86, - 0x324904, - 0x2db5c6, - 0x2ab348, - 0x20eec4, - 0x2a3186, - 0x2d68c5, - 0x26ebc8, - 0x205583, - 0x272605, - 0x273583, - 0x2717c3, - 0x2717c4, - 0x273983, - 0x59edeec2, - 0x5a200b42, - 0x276889, - 0x27ec05, - 0x27ee04, - 0x281305, - 0x212504, - 0x2c1247, - 0x33d3c5, - 0x258a04, - 0x258a08, - 0x2dc3c6, - 0x2de404, - 0x2dfdc8, - 0x2e1a87, - 0x5a60e5c2, - 0x305304, - 0x210f44, - 0x2257c7, - 0x5aa53d84, - 0x249682, - 0x5ae01ac2, - 0x21b083, - 0x351144, - 0x242643, - 0x33d945, - 0x5b21de42, - 0x2ebb05, - 0x212bc2, - 0x381dc5, - 0x364305, - 0x5b60c842, - 0x3581c4, - 0x5ba06342, - 0x2a9146, - 0x2ac506, - 0x396208, - 0x2c3608, - 0x3075c4, - 0x2f8905, - 0x2fe809, - 0x2e10c4, - 0x263304, - 0x20aec3, - 0x5be20c45, - 0x2c7087, - 0x25e944, - 0x33a48d, - 0x33c282, - 0x33c283, - 0x355783, - 0x5c200202, - 0x388b45, - 0x26c747, - 0x2a7e04, - 0x32d807, - 0x29d849, - 0x2c9d89, - 0x248ac7, - 0x243843, - 0x27c008, - 0x2f33c9, - 0x2500c7, - 0x370145, - 0x385886, + 0x29e943, + 0x364444, + 0x28af46, + 0x371983, + 0x371986, 0x394246, - 0x3959c5, - 0x257345, - 0x5c603102, - 0x27eb05, - 0x2b8308, - 0x2c5386, - 0x2bcc07, - 0x2f5744, - 0x2ad207, - 0x2faf46, - 0x5ca2fb02, + 0x3a4103, + 0x202f04, + 0x24f607, + 0x28ab88, + 0x1a00882, + 0x309dc7, + 0x3533c9, + 0x2fb3ca, + 0x2fb3cb, + 0x22fe43, + 0x28cac6, + 0x2352c5, + 0x1e00702, + 0x211ac4, + 0x2c7a83, + 0x226bc5, + 0x2200d42, + 0x2a0f43, + 0x2707e44, + 0x368485, + 0x2a00c42, + 0x3797ce, + 0x24a483, + 0x38b406, + 0x2e04642, + 0x2a5907, + 0x237d46, + 0x3200a42, + 0x2ae043, + 0x2ae044, + 0x280f86, + 0x36f448, + 0x283a46, + 0x386144, + 0x3601002, + 0x326a09, + 0x363a07, + 0x3351c6, + 0x355049, + 0x293988, + 0x367104, + 0x3a6606, + 0x20e306, + 0x3a02e02, + 0x241d0f, + 0x33174e, + 0x212484, + 0x2bb945, + 0x202e05, + 0x2ea589, + 0x23e889, + 0x325747, + 0x221646, + 0x26b083, + 0x3e056c2, + 0x346fc3, + 0x207a4a, + 0x211e83, + 0x250585, + 0x2040c2, + 0x2830c9, + 0x4204802, + 0x209084, + 0x29e486, + 0x284b45, + 0x34c904, + 0x4a74a04, + 0x204803, + 0x234304, + 0x4e01842, + 0x364184, + 0x52e41c4, + 0x22410a, + 0x56009c2, + 0x334307, + 0x38e008, + 0x6201182, + 0x322847, + 0x2b7344, + 0x2b7347, + 0x383d05, + 0x370a47, + 0x325506, + 0x332a44, + 0x340c85, + 0x28df47, + 0x72046c2, + 0x349183, + 0x218782, + 0x366703, + 0x76108c2, + 0x2798c5, + 0x7a02d42, + 0x368ac4, + 0x277785, + 0x2123c7, + 0x2ddc0e, + 0x330a44, + 0x244744, + 0x20ca03, + 0x326ec9, + 0x30528b, + 0x30e148, + 0x31cd88, + 0x320888, + 0x20a588, + 0x354e8a, + 0x370947, + 0x217906, + 0x7e9c3c2, + 0x377d83, + 0x380c43, + 0x38bc84, + 0x250ac3, + 0x3a4143, + 0x1713b02, + 0x8203182, + 0x2484c5, + 0x30c046, + 0x2c9bc4, + 0x396e07, + 0x22eec6, + 0x280304, + 0x3a7dc7, + 0x203183, + 0x86bdb82, + 0x8a4f882, + 0x8e13702, + 0x213706, + 0x9200002, + 0x37f645, + 0x315043, + 0x205244, + 0x2dbe44, + 0x2dbe45, + 0x207043, + 0x9723ac3, + 0x9a093c2, + 0x2873c5, + 0x2873cb, + 0x22d086, + 0x20cbcb, + 0x26ff44, + 0x20d189, + 0x20ed44, + 0x9e0fd82, + 0x210c83, + 0x211183, + 0x1611302, + 0x23c343, + 0x21130a, + 0xa211d42, + 0x211d45, + 0x28ea8a, + 0x2cd704, + 0x212d43, + 0x213384, + 0x213cc3, + 0x213cc4, + 0x213cc7, + 0x214245, + 0x218dc5, + 0x219586, + 0x21a0c6, + 0x21aa43, + 0x21dc48, + 0x258e83, + 0xa615802, + 0x21f008, + 0x21580b, + 0x222d08, + 0x223586, + 0x224547, + 0x229748, + 0xb279a82, + 0xb693f02, + 0x20b608, + 0x2ad0c7, + 0x23b405, + 0x23b408, + 0x281888, + 0x2ada03, + 0x22eac4, + 0x38bcc2, + 0xba2f482, + 0xbe051c2, + 0xc62f802, + 0x22f803, + 0xca02ec2, + 0x202ec3, + 0x2fe704, + 0x21abc3, + 0x3670c4, + 0x24edcb, + 0x215743, + 0x2d2f86, + 0x223f84, + 0x29b84e, + 0x360445, + 0x38b508, + 0x24bd87, + 0x24bd8a, + 0x222a83, + 0x222a87, + 0x305445, + 0x231c84, + 0x24d886, + 0x24d887, + 0x2beb44, + 0x2f6607, + 0x377e04, + 0x3afe84, + 0x3afe86, + 0x267544, + 0x208606, + 0x210ac3, + 0x217188, + 0x21cfc8, + 0x244703, + 0x23c303, + 0x395544, + 0x39a003, + 0xce00482, + 0xd304e82, + 0x2004c3, + 0x2072c6, + 0x369e83, + 0x263584, + 0xd616942, + 0x244c43, + 0x216943, + 0x21b182, + 0xda008c2, + 0x2b9fc6, + 0x235fc7, + 0x2e9345, + 0x367a44, + 0x27e045, + 0x2026c7, + 0x26a205, + 0x2c6889, + 0x2cf2c6, + 0x2d48c8, + 0x2e9246, + 0xde06c02, + 0x33b648, + 0x2fe4c6, + 0x3b1a45, + 0x3ae4c7, + 0x301084, + 0x301085, + 0x283c04, + 0x283c08, + 0xe20cc82, + 0xe6131c2, + 0x329cc6, + 0x318208, + 0x339345, + 0x33a3c6, + 0x33c648, + 0x35b948, + 0xeac8945, + 0xefa8204, + 0x3aae87, + 0xf20e802, + 0xf61dec2, + 0x10a16582, + 0x357b85, + 0x2a3e05, + 0x2de246, + 0x319b87, + 0x399547, + 0x1122d183, + 0x29a147, + 0x2d4488, + 0x38fec9, + 0x379987, + 0x3a5187, + 0x22fe88, + 0x230686, + 0x231786, + 0x2323cc, + 0x232f4a, + 0x233787, + 0x23518b, + 0x235e07, + 0x235e0e, + 0x236a84, + 0x2374c4, + 0x239b07, + 0x25b087, + 0x23d9c6, + 0x23d9c7, + 0x23e107, + 0x14600bc2, + 0x23ec86, + 0x23ec8a, + 0x23ef0b, + 0x240007, + 0x2407c5, + 0x240b03, + 0x240fc6, + 0x240fc7, + 0x230a83, + 0x14a0b382, + 0x24198a, + 0x14f54502, + 0x152a6c02, + 0x15642b82, + 0x15a37e42, + 0x243a85, + 0x244504, + 0x16200682, + 0x364205, + 0x226b83, + 0x317c85, + 0x20a484, + 0x20ec44, + 0x291786, + 0x378106, + 0x2875c3, + 0x261f84, + 0x281e43, + 0x16600f82, + 0x200f84, + 0x3ab406, + 0x200f85, + 0x258c06, + 0x3ae5c8, + 0x263804, + 0x2c7848, + 0x2e0c45, + 0x22e708, + 0x32c306, + 0x2b49c7, + 0x239504, + 0x239506, + 0x307003, + 0x384083, + 0x2be608, + 0x30c584, + 0x2a0887, + 0x30a106, + 0x30a109, + 0x252448, + 0x27efc8, + 0x280444, + 0x378983, + 0x22aa02, + 0x16ab1d82, + 0x16e2cf42, + 0x3a1603, + 0x17219c42, + 0x24f744, + 0x3400c6, + 0x371305, + 0x23fe83, + 0x232884, + 0x300447, + 0x367783, + 0x2379c8, + 0x3af5c5, + 0x36fc43, + 0x277705, + 0x277844, + 0x208306, + 0x20c804, + 0x20cf06, + 0x212306, + 0x2512c4, + 0x215683, + 0x21a883, + 0x1767e402, + 0x360fc5, + 0x215dc3, + 0x17a00442, + 0x232383, + 0x331e85, + 0x2343c3, + 0x2343c9, + 0x17e08042, + 0x18614b42, + 0x286b45, + 0x21ba46, + 0x29f387, + 0x2c9786, + 0x2b83c8, + 0x2b83cb, + 0x20730b, + 0x22aac5, + 0x2d02c5, + 0x2bf489, + 0x1600ec2, + 0x251488, + 0x20ce04, + 0x18e00202, + 0x24ea03, + 0x1965b246, + 0x330e88, + 0x19a031c2, + 0x228108, + 0x19e00d82, + 0x27008a, + 0x20f043, + 0x31d346, + 0x330448, + 0x378cc8, + 0x32f8c6, + 0x36dd07, + 0x241f07, + 0x20de8a, + 0x2cd784, + 0x33f184, + 0x352f49, + 0x38f8c5, + 0x2f31c6, + 0x2138c3, + 0x247984, + 0x212104, + 0x3412c7, + 0x21e687, + 0x2d7e84, + 0x20ddc5, + 0x2de308, + 0x35d607, + 0x360207, + 0x1a206ac2, + 0x369684, + 0x28f388, + 0x384544, + 0x2455c4, + 0x2459c5, + 0x245b07, + 0x206ac9, + 0x246684, + 0x246e89, + 0x247348, + 0x247704, + 0x247707, + 0x1a647f83, + 0x248a47, + 0x16475c2, + 0x17a4a82, + 0x249a06, + 0x24a4c7, + 0x24a904, + 0x24c9c7, + 0x24e4c7, + 0x252083, + 0x23aa82, + 0x201682, + 0x252b03, + 0x252b04, + 0x252b0b, + 0x31ce88, + 0x258b44, + 0x253805, + 0x255e47, + 0x257a05, + 0x2d9a8a, + 0x258a83, + 0x1aa21842, + 0x258d84, + 0x25ae49, + 0x25edc3, + 0x25ee87, + 0x3ac249, + 0x280d08, + 0x200c83, + 0x276607, + 0x276d49, + 0x202883, + 0x27d9c4, + 0x282309, + 0x2856c6, + 0x286e03, + 0x2038c2, + 0x233e83, + 0x39b6c7, + 0x37f785, + 0x3585c6, + 0x247b84, + 0x2d37c5, + 0x207a03, + 0x21ac86, + 0x20d382, + 0x390e04, + 0x227982, + 0x2db883, + 0x1ae007c2, + 0x244a43, + 0x21a544, + 0x21a547, 0x3713c6, - 0x2fd38a, - 0x2fde45, - 0x5cee4742, - 0x5d245702, - 0x30fbc6, - 0x2b25c8, - 0x5d68eb87, - 0x5da04602, - 0x20edc3, - 0x38c706, - 0x2246c4, - 0x3a0f46, - 0x262446, - 0x26bd0a, - 0x319a45, - 0x204446, - 0x218c83, - 0x218c84, - 0x205302, - 0x30c283, - 0x5de05dc2, - 0x2ce903, - 0x3734c4, - 0x2b2704, - 0x2b270a, - 0x229b03, - 0x28a7c8, - 0x229b0a, - 0x23a407, - 0x301446, - 0x2a9004, - 0x296e42, - 0x219542, - 0x5e206e42, - 0x24e1c3, - 0x259307, - 0x330207, - 0x38fd4b, - 0x28a2c4, - 0x34f9c7, - 0x2ef186, - 0x21c607, - 0x258004, - 0x23c445, - 0x2c17c5, - 0x5e620382, - 0x221a86, - 0x246043, - 0x24a2c2, - 0x24a2c6, - 0x5ea04802, - 0x5ee05bc2, - 0x3abd45, - 0x5f222e82, - 0x5f600a42, - 0x343745, - 0x38e6c5, - 0x204505, - 0x270ac3, - 0x390b05, - 0x2e39c7, - 0x309445, - 0x30a985, - 0x3a05c4, - 0x24c646, - 0x25c1c4, - 0x5fa03382, - 0x6060ce05, - 0x36f447, - 0x2db7c8, - 0x2a32c6, - 0x2a32cd, - 0x2a86c9, - 0x2a86d2, - 0x332705, - 0x33c843, - 0x60a044c2, - 0x2f6d84, - 0x204383, - 0x3623c5, - 0x2fed85, - 0x60e17082, - 0x3700c3, - 0x6124d082, - 0x616c3142, - 0x61a18dc2, - 0x364c05, - 0x329ec3, - 0x319888, - 0x61e02d82, - 0x62206902, - 0x2e3386, - 0x34398a, - 0x272243, - 0x25c083, - 0x2ed703, - 0x62e016c2, - 0x71211fc2, - 0x71a19682, - 0x206602, - 0x3711c9, - 0x2c6404, - 0x22fb48, - 0x71ef8b82, - 0x72202502, - 0x2f4d45, - 0x232ac8, - 0x2cf008, - 0x2fd54c, - 0x23bd83, - 0x267002, - 0x726019c2, - 0x2ccf46, - 0x3022c5, - 0x239103, - 0x383586, - 0x302406, - 0x21e2c3, - 0x304ec3, - 0x3055c6, - 0x306204, - 0x225d46, - 0x2d3b45, - 0x30648a, - 0x240544, - 0x307884, - 0x307a4a, - 0x72a037c2, - 0x234605, - 0x30898a, - 0x309a85, - 0x30a344, - 0x30a446, - 0x30a5c4, - 0x228306, - 0x72e39342, - 0x2eadc6, - 0x3a2445, - 0x26bb87, - 0x3a3c46, - 0x246fc4, - 0x2da807, - 0x311586, - 0x25b5c5, - 0x2d4287, - 0x39cd87, - 0x39cd8e, - 0x24abc6, - 0x382905, - 0x285407, - 0x201c43, - 0x201c47, - 0x3b3445, - 0x2108c4, - 0x211882, - 0x22afc7, - 0x31ab04, - 0x22fec4, - 0x24314b, - 0x21d283, - 0x288fc7, - 0x21d284, - 0x2ace07, - 0x2824c3, - 0x334b4d, - 0x389388, - 0x228e04, - 0x258905, - 0x30ac85, - 0x30b0c3, - 0x73201a82, - 0x30c243, - 0x30cf43, - 0x221c04, - 0x280785, - 0x223387, - 0x218d06, - 0x373203, - 0x24a40b, - 0x3aa70b, - 0x27928b, - 0x28088a, - 0x2ad8cb, - 0x2fc28b, - 0x2e478c, - 0x2e7291, - 0x32170a, - 0x34e48b, - 0x379d0b, - 0x3b048a, - 0x3b4cca, - 0x30ea4d, - 0x31038e, - 0x3109cb, - 0x310c8a, - 0x312191, - 0x3125ca, - 0x312acb, - 0x31300e, - 0x31398c, - 0x313fcb, - 0x31428e, - 0x31460c, - 0x315a4a, - 0x31694c, - 0x73716c4a, - 0x317449, - 0x31b60a, - 0x31b88a, - 0x31bb0b, - 0x31e9ce, - 0x31ed51, - 0x327a09, - 0x327c4a, - 0x32844b, - 0x32a30a, - 0x32ab96, - 0x32c8cb, - 0x32e00a, - 0x32e5ca, - 0x33048b, - 0x332189, - 0x3354c9, - 0x335a4d, - 0x3360cb, - 0x33734b, - 0x337d0b, - 0x3381c9, - 0x33880e, - 0x338f0a, - 0x33a24a, - 0x33a7ca, - 0x33af8b, - 0x33b7cb, - 0x33ba8d, - 0x33cecd, - 0x33da90, - 0x33df4b, - 0x33e54c, - 0x33ea4b, - 0x34118b, - 0x34290b, - 0x3463cb, - 0x346e4f, - 0x34720b, - 0x347d0a, - 0x348249, - 0x348609, - 0x34898b, - 0x348c4e, - 0x34b98b, - 0x34d04f, - 0x34ff0b, - 0x3501cb, - 0x35048b, - 0x35098a, - 0x355c09, - 0x35a20f, - 0x36128c, - 0x36170c, - 0x36208e, - 0x36388f, - 0x363c4e, - 0x3652d0, - 0x3656cf, - 0x365d4e, - 0x36650c, - 0x366812, - 0x36a511, - 0x36ad0e, - 0x36ba0e, - 0x36bf4e, - 0x36c2cf, + 0x2499c2, + 0x1b22d642, + 0x325e44, + 0x1b626b02, + 0x1ba0acc2, + 0x2d6484, + 0x2d6485, + 0x2c3e85, + 0x341a46, + 0x1be01e02, + 0x29fe45, + 0x2ded05, + 0x201e03, + 0x3650c6, + 0x378445, + 0x213682, + 0x33a005, + 0x213684, + 0x217c43, + 0x219343, + 0x1c20c502, + 0x28e147, + 0x35d884, + 0x35d889, + 0x247884, + 0x22b603, + 0x346449, + 0x360e88, + 0x2a3c84, + 0x2a3c86, + 0x201f83, + 0x212883, + 0x21eb03, + 0x1c6e1102, + 0x2e9182, + 0x1ca0b2c2, + 0x316b88, + 0x34afc8, + 0x394986, + 0x2549c5, + 0x21a905, + 0x306007, + 0x255805, + 0x21c2c2, + 0x1ce61e82, + 0x1614b82, + 0x38fa48, + 0x33b585, + 0x2c8084, + 0x2e0b85, + 0x390507, + 0x258884, + 0x23a882, + 0x1d204c42, + 0x32c704, + 0x213507, + 0x3abd87, + 0x370a04, + 0x28ea43, + 0x244644, + 0x244648, + 0x231ac6, + 0x24d70a, + 0x206984, + 0x28edc8, + 0x253ac4, + 0x224646, + 0x290e84, + 0x357e86, + 0x35db49, + 0x259187, + 0x33a683, + 0x1d605e82, + 0x26a843, + 0x20ff82, + 0x1da04d42, + 0x2dfe86, + 0x35ed48, + 0x2a5287, + 0x3a30c9, + 0x23a4c9, + 0x2a5c85, + 0x2a6e49, + 0x2a7b45, + 0x2a7c89, + 0x2a8b85, + 0x284244, + 0x1de84247, + 0x2957c3, + 0x2a9c07, + 0x3a5546, + 0x2aa407, + 0x2a2945, + 0x2aba83, + 0x1e232a02, + 0x392844, + 0x1e63a3c2, + 0x25a183, + 0x1ea0f1c2, + 0x2e8b86, + 0x38df85, + 0x2acb87, + 0x324d83, + 0x250a44, + 0x206f83, + 0x20b343, + 0x1ee082c2, + 0x1f600042, + 0x394344, + 0x23aa43, + 0x364885, + 0x25fcc5, + 0x1fa05602, + 0x20200942, + 0x276946, + 0x209744, + 0x30c6c4, + 0x30c6ca, + 0x20a00a82, + 0x2f768a, + 0x372fc8, + 0x20e01604, + 0x201d83, + 0x216c03, + 0x3209c9, + 0x223349, + 0x300546, + 0x21202243, + 0x2da985, + 0x2f81cd, + 0x202246, + 0x2065cb, + 0x21606382, + 0x333208, + 0x21a0bf02, + 0x21e00b42, + 0x2af285, + 0x222074c2, + 0x264c47, + 0x2a2247, + 0x2103c3, + 0x2ae348, + 0x22601982, + 0x203a04, + 0x3786c3, + 0x332c05, + 0x3833c3, + 0x38da46, + 0x31b204, + 0x23c2c3, + 0x26ad83, + 0x22a095c2, + 0x22aa44, + 0x351445, + 0x36bb47, + 0x274643, + 0x2ad803, + 0x2aed83, + 0x1621a82, + 0x2aee43, + 0x2af643, + 0x22e04282, + 0x2f5d44, + 0x378306, + 0x204283, + 0x2af9c3, + 0x232b09c2, + 0x2b09c8, + 0x2b1404, + 0x25a546, + 0x2b1847, + 0x22ba06, + 0x230d44, + 0x30e001c2, + 0x3a540b, + 0x39fb4e, + 0x21c80f, + 0x233383, + 0x31633e42, + 0x1604ec2, + 0x31a02b82, + 0x227683, + 0x202b83, + 0x235c06, + 0x2aea46, + 0x27d807, + 0x34aa44, + 0x31e1bb82, + 0x32229e82, + 0x228e45, + 0x3a4ac7, + 0x371b86, + 0x326436c2, + 0x2436c4, + 0x36e203, + 0x32a09682, + 0x32f508c3, + 0x391004, + 0x2b6b49, + 0x16bc882, + 0x33216c82, + 0x216c85, + 0x33644802, + 0x33a00102, + 0x33e507, + 0x239049, + 0x35364b, + 0x241cc5, + 0x377609, + 0x2bcfc6, + 0x22d0c7, + 0x33e0c744, + 0x305ac9, + 0x35a787, + 0x201b47, + 0x209883, + 0x209886, + 0x2da2c7, + 0x206003, + 0x271e46, + 0x34605642, + 0x34a34642, + 0x21fa43, + 0x250645, + 0x222547, + 0x281b86, + 0x37f705, + 0x311244, + 0x3b1405, + 0x2e8904, + 0x34e02102, + 0x3210c7, + 0x2d6044, + 0x223244, + 0x22324d, + 0x248809, + 0x2e0f48, + 0x22cd04, + 0x209b05, + 0x27ee47, + 0x332784, + 0x22ef87, + 0x3a8405, + 0x353a9084, + 0x2fa005, + 0x25da84, + 0x265d46, + 0x319985, + 0x35636b42, + 0x212e04, + 0x212e05, + 0x213206, + 0x37f845, + 0x256584, + 0x2dbc83, + 0x32fd86, + 0x220f45, + 0x225285, + 0x319a84, + 0x206a03, + 0x206a0c, + 0x35a86002, + 0x35e01042, + 0x3620b402, + 0x332683, + 0x332684, + 0x366061c2, + 0x3a6088, + 0x358685, + 0x236604, + 0x23b9c6, + 0x36a0a242, + 0x36e09bc2, + 0x37200982, + 0x2d8845, + 0x251186, + 0x341204, + 0x2814c6, + 0x3340c6, + 0x203483, + 0x3772788a, + 0x23ad85, + 0x274803, + 0x225046, + 0x2efe09, + 0x225047, + 0x28bd48, + 0x293849, + 0x219888, + 0x36a346, + 0x20b203, + 0x37a9a1c2, + 0x3856c3, + 0x3856c9, + 0x3357c8, + 0x37e09782, + 0x38206742, + 0x2348c3, + 0x2cf145, + 0x253304, + 0x31c8c9, + 0x25f6c4, + 0x2b1648, + 0x206743, + 0x24f244, + 0x326b83, + 0x21ba88, + 0x223187, + 0x38643742, + 0x269d42, + 0x238c45, + 0x268849, + 0x211003, + 0x278184, + 0x2da944, + 0x202c03, + 0x278cca, + 0x38b72e82, + 0x38e12dc2, + 0x2bdb03, + 0x3751c3, + 0x164f202, + 0x250d03, + 0x39250042, + 0x39603042, + 0x39b07b04, + 0x366086, + 0x3469c6, + 0x276b84, + 0x25a943, + 0x27be43, + 0x2e4983, + 0x23f286, + 0x2c2e45, + 0x2be0c7, + 0x22cf89, + 0x2c1d45, + 0x2c2d86, + 0x2c3708, + 0x2c3906, + 0x238744, + 0x29718b, + 0x2c6383, + 0x2c6385, + 0x2c64c8, + 0x21e442, + 0x33e802, + 0x39e43b02, + 0x3a20e842, + 0x21bbc3, + 0x3a600e02, + 0x269fc3, + 0x2c67c4, + 0x2c8183, + 0x3ae25682, + 0x3b2cc5c6, + 0x2bb346, + 0x2ccc08, + 0x3b6cad42, + 0x3ba111c2, + 0x3be19382, + 0x3c209f82, + 0x3c614882, + 0x3ca00ac2, + 0x228343, + 0x318d45, + 0x209c86, + 0x3ce12444, + 0x3ab20a, + 0x310606, + 0x22ad04, + 0x27e943, + 0x3da06bc2, + 0x205902, + 0x24dbc3, + 0x3de38483, + 0x2ee087, + 0x319887, + 0x3f252c07, + 0x20f007, + 0x215a43, + 0x22c6ca, + 0x240584, + 0x341504, + 0x34150a, + 0x247045, + 0x3f601642, + 0x24d483, + 0x3fa01dc2, + 0x201f43, + 0x26a803, + 0x40201942, + 0x29a0c4, + 0x220a84, + 0x3a36c5, + 0x2d7205, + 0x22da06, + 0x22dd86, + 0x40608382, + 0x40a025c2, + 0x2eb445, + 0x2bb052, + 0x29fbc6, + 0x21ce83, + 0x2fd346, + 0x221d85, + 0x1611342, + 0x48e0d502, + 0x2ed8c3, + 0x212043, + 0x265603, + 0x49203382, + 0x379ac3, + 0x49602182, + 0x204a03, + 0x2f5d88, + 0x223b43, + 0x223b46, + 0x333a07, + 0x2d84c6, + 0x2d84cb, + 0x22ac47, + 0x392644, + 0x49e02602, + 0x3a6505, + 0x215a03, + 0x22fd83, + 0x31aa03, + 0x31aa06, + 0x2d038a, + 0x26d703, + 0x21d5c4, + 0x318146, + 0x3b1e46, + 0x4a2264c3, + 0x250907, + 0x29cf8d, + 0x39eb87, + 0x296ec5, + 0x237806, + 0x220f83, + 0x4bb65303, + 0x4be07a82, + 0x307604, + 0x21e3cc, + 0x35bb89, + 0x36f307, + 0x246045, + 0x255904, + 0x26ae08, + 0x274885, + 0x274a85, + 0x3612c9, + 0x335283, + 0x2a6b84, + 0x4c206d42, + 0x206d43, + 0x4c690942, + 0x295bc6, + 0x16b5482, + 0x4ca95782, + 0x2d8748, + 0x2b6d43, + 0x2f9f47, + 0x2d7785, + 0x295785, + 0x2f6c4b, + 0x2d1f06, + 0x2f6e46, + 0x2f9d06, + 0x226284, + 0x2d4ac6, + 0x2d5048, + 0x234b03, + 0x252ec3, + 0x252ec4, + 0x2d70c4, + 0x2d7487, + 0x2d8185, + 0x4ced82c2, + 0x4d206a42, + 0x209285, + 0x2990c4, + 0x2dac8b, + 0x2dbd48, + 0x2e6804, + 0x243702, + 0x4da80b82, + 0x2b0c03, + 0x2dc204, + 0x2dc4c5, + 0x272d87, + 0x2e06c4, + 0x22ab04, + 0x4de07442, + 0x359f49, + 0x2e1585, + 0x241f85, + 0x2e2105, + 0x4e21bd03, + 0x2e2f44, + 0x2e2f4b, + 0x2e3444, + 0x2e3ecb, + 0x2e48c5, + 0x21c94a, + 0x2e4f88, + 0x2e518a, + 0x2e5a03, + 0x2e5a0a, + 0x4e626402, + 0x4ea41542, + 0x265903, + 0x4eee7d82, + 0x2e7d83, + 0x4f35d142, + 0x4f7157c2, + 0x2e8784, + 0x21dd86, + 0x281205, + 0x2e91c3, + 0x29ef06, + 0x21d445, + 0x21e104, + 0x4fa08782, + 0x2ca784, + 0x2bf10a, + 0x386847, + 0x38ddc6, + 0x2d0847, + 0x21e503, + 0x253b48, + 0x25b5cb, + 0x300645, + 0x2b6e85, + 0x2b6e86, + 0x225904, + 0x335b88, + 0x20b4c3, + 0x20e204, + 0x20e207, + 0x280ec6, + 0x321746, + 0x29b68a, + 0x244fc4, + 0x244fca, + 0x2de886, + 0x2de887, + 0x253887, + 0x26f884, + 0x26f889, + 0x24b7c5, + 0x23a30b, + 0x26ddc3, + 0x20d0c3, + 0x21a943, + 0x231e84, + 0x4fe04b42, + 0x254186, + 0x2ab805, + 0x2b2dc5, + 0x3324c6, + 0x279384, + 0x502013c2, + 0x240b44, + 0x50607982, + 0x232984, + 0x227783, + 0x50a12082, + 0x349f83, + 0x24ae86, + 0x50e01bc2, + 0x30f108, + 0x224ec4, + 0x224ec6, + 0x305546, + 0x255f04, + 0x32fd05, + 0x3a8108, + 0x3a8607, + 0x3b0bc7, + 0x3b0bcf, + 0x28f286, + 0x210d03, + 0x210d04, + 0x2251c4, + 0x229103, + 0x224784, + 0x373e44, + 0x51226442, + 0x287303, + 0x390683, + 0x51617642, + 0x222a43, + 0x24f803, + 0x218e4a, + 0x23b5c7, + 0x3a568c, + 0x3a5946, + 0x230ac6, + 0x23a6c7, + 0x2302c7, + 0x23e289, + 0x21f144, + 0x23ea84, + 0x51a0a442, + 0x51e01402, + 0x29ba46, + 0x250704, + 0x376e86, + 0x230748, + 0x330cc4, + 0x264c86, + 0x2c9745, + 0x25f008, + 0x207503, + 0x266a45, + 0x269b43, + 0x242083, + 0x242084, + 0x26afc3, + 0x522e1202, + 0x52602482, + 0x26dc89, + 0x274985, + 0x283dc4, + 0x3614c5, + 0x210804, + 0x2ed107, + 0x33fac5, + 0x252dc4, + 0x252dc8, + 0x2d3486, + 0x2d5204, + 0x2d5208, + 0x2d5e87, + 0x52a015c2, + 0x2da0c4, + 0x2d3904, + 0x201d47, + 0x52e41384, + 0x22dc82, + 0x53201882, + 0x202b43, + 0x216b84, + 0x222903, + 0x222905, + 0x5362c082, + 0x2e9085, + 0x210fc2, + 0x376445, + 0x35ef05, + 0x53a168c2, + 0x2168c4, + 0x53e08d82, + 0x2c7b06, + 0x2ac106, + 0x268988, + 0x2b7b88, + 0x2e8b04, + 0x35e245, + 0x2f39c9, + 0x29f484, + 0x2d0344, + 0x2513c3, + 0x5420dfc5, + 0x374f07, + 0x2881c4, + 0x35a90d, + 0x35b202, + 0x3858c3, + 0x39a083, + 0x54601082, + 0x3886c5, + 0x31b447, + 0x20f0c4, + 0x20f0c7, + 0x293a49, + 0x2bf249, + 0x214687, + 0x24fa83, + 0x2b52c8, + 0x23dd09, + 0x2e9947, + 0x2e9cc5, + 0x2ea486, + 0x2eaac6, + 0x2eac45, + 0x248905, + 0x54a01282, + 0x228685, + 0x2b9988, + 0x2a79c6, + 0x3a1c87, + 0x2e4b04, + 0x2ab1c7, + 0x2edd06, + 0x54e00242, + 0x212f06, + 0x2f004a, + 0x2f1045, + 0x552d29c2, + 0x55638282, + 0x2da606, + 0x3574c8, + 0x55babf47, + 0x55e00602, + 0x20a503, + 0x3b0306, + 0x30aa04, + 0x3338c6, + 0x341746, + 0x3971ca, + 0x3a1e05, + 0x20d586, + 0x218743, + 0x218744, + 0x207282, + 0x2fe483, + 0x56253e82, + 0x2dd843, + 0x2f7904, + 0x2dca04, + 0x35760a, + 0x245483, + 0x283b08, + 0x36a40a, + 0x278447, + 0x2f4846, + 0x2c79c4, + 0x22abc2, + 0x200e42, + 0x56609202, + 0x244603, + 0x253647, + 0x29f1c7, + 0x38f98b, + 0x3643c4, + 0x349447, + 0x272e86, + 0x213807, + 0x2ad204, + 0x33bb85, + 0x2a96c5, + 0x56a10442, + 0x221a46, + 0x2259c3, + 0x226cc2, + 0x226cc6, + 0x56e0d942, + 0x57203e42, + 0x203e45, + 0x57624982, + 0x57a06ec2, + 0x358845, + 0x2c0f45, + 0x20d645, + 0x264183, + 0x340185, + 0x2d1fc7, + 0x2aa2c5, + 0x3219c5, + 0x38b604, + 0x379bc6, + 0x243c84, + 0x57e00cc2, + 0x276485, + 0x2a4887, + 0x377088, + 0x26a8c6, + 0x26a8cd, + 0x270789, + 0x270792, + 0x322045, + 0x326e03, + 0x58a019c2, + 0x2e6004, + 0x2022c3, + 0x35e145, + 0x2f2605, + 0x58e21e42, + 0x290f03, + 0x59242d42, + 0x59694082, + 0x59a18882, + 0x346e05, + 0x2a1003, + 0x397008, + 0x59e011c2, + 0x5a203282, + 0x29a086, + 0x27f30a, + 0x204983, + 0x256503, + 0x2f3c43, + 0x5ae06202, + 0x692033c2, + 0x69a04cc2, + 0x203dc2, + 0x38bd09, + 0x2bbcc4, + 0x2ae648, + 0x69ee9202, + 0x6a205882, + 0x2e4105, + 0x2355c8, + 0x247d88, + 0x2f334c, + 0x23a183, + 0x25d442, + 0x6a62d742, + 0x2c21c6, + 0x2f56c5, + 0x30f5c3, + 0x3903c6, + 0x2f5806, + 0x22fc43, + 0x2f6a03, + 0x2f6fc6, + 0x2f7d84, + 0x270186, + 0x2c6545, + 0x2f800a, + 0x23d184, + 0x2f8d84, + 0x34b94a, + 0x6aa6cd42, + 0x347a45, + 0x2fa44a, + 0x2fb885, + 0x2fc404, + 0x2fc506, + 0x2fc684, + 0x366dc6, + 0x6ae00282, + 0x38d706, + 0x38e7c5, + 0x204707, + 0x239f46, + 0x22d584, + 0x22d587, + 0x3277c6, + 0x212f45, + 0x2c6c87, + 0x39ae07, + 0x39ae0e, + 0x223ec6, + 0x22ee45, + 0x279a07, + 0x2deb83, + 0x2deb87, + 0x3a8a05, + 0x211204, + 0x2120c2, + 0x37a547, + 0x34aac4, + 0x2ae9c4, + 0x269bcb, + 0x2201c3, + 0x2c3a47, + 0x2201c4, + 0x2ce307, + 0x238943, + 0x32914d, + 0x388f08, + 0x252cc4, + 0x252cc5, + 0x2fca45, + 0x2fd003, + 0x6b224dc2, + 0x2fe443, + 0x2fea03, + 0x365c44, + 0x276e45, + 0x2193c7, + 0x2187c6, + 0x372f83, + 0x226e0b, + 0x29d34b, + 0x267c4b, + 0x276f4a, + 0x2a734b, + 0x2cae0b, + 0x2d2a0c, + 0x2d5711, + 0x33d90a, + 0x34e1cb, + 0x37bd0b, + 0x3ae28a, + 0x3b2eca, + 0x2ff60d, + 0x300d4e, + 0x301b4b, + 0x301e0a, + 0x302d51, + 0x30318a, + 0x30368b, + 0x303bce, + 0x30450c, + 0x30498b, + 0x304c4e, + 0x304fcc, + 0x3087ca, + 0x3098cc, + 0x6b709bca, + 0x30adc9, + 0x30c94a, + 0x30cbca, + 0x30ce4b, + 0x312f8e, + 0x313311, + 0x31bcc9, + 0x31bf0a, + 0x31cb0b, + 0x31e2ca, + 0x31ee56, + 0x32060b, + 0x321e0a, + 0x32220a, + 0x32424b, + 0x326889, + 0x329ac9, + 0x32ae0d, + 0x32c48b, + 0x32d60b, + 0x32dfcb, + 0x32e449, + 0x32ea8e, + 0x32efca, + 0x335e4a, + 0x33648a, + 0x336e4b, + 0x33768b, + 0x33794d, + 0x33904d, + 0x339c90, + 0x33a14b, + 0x33ac8c, + 0x33c3cb, + 0x33e00b, + 0x33f64b, + 0x34490b, + 0x34538f, + 0x34574b, + 0x34600a, + 0x346709, + 0x346b49, + 0x34808b, + 0x34834e, + 0x34bfcb, + 0x34cd8f, + 0x34ed8b, + 0x34f04b, + 0x34f30b, + 0x34f74a, + 0x353249, + 0x35624f, + 0x35ce4c, + 0x35d34c, + 0x35de0e, + 0x35e48f, + 0x35e84e, + 0x35fa90, + 0x35fe8f, + 0x3608ce, + 0x3617cc, + 0x361ad2, + 0x36b751, + 0x36bd0e, + 0x36c14e, 0x36c68e, - 0x36ca13, - 0x36ced1, - 0x36d30e, - 0x36d78c, - 0x36e493, - 0x36fa90, - 0x37070c, - 0x370a0c, - 0x370ecb, - 0x37184e, + 0x36ca0f, + 0x36cdce, + 0x36d153, + 0x36d611, + 0x36da4e, + 0x36decc, + 0x36e2d3, + 0x36f650, + 0x36ff0c, + 0x37020c, + 0x3706cb, + 0x37168e, 0x371f8b, - 0x3727cb, - 0x37378c, - 0x37914a, - 0x37950c, - 0x37980c, - 0x379b09, - 0x37b7cb, - 0x37ba88, - 0x37bc89, - 0x37bc8f, - 0x37d5cb, - 0x37e44a, - 0x37fd4c, - 0x380e09, - 0x381b88, - 0x38214b, - 0x382c0b, - 0x38418a, - 0x38440b, - 0x38488c, - 0x385548, - 0x38958b, - 0x38c04b, - 0x39000b, - 0x39180b, - 0x39c90b, - 0x39cbc9, - 0x39d10d, - 0x3a264a, - 0x3a3597, - 0x3a3dd8, - 0x3a6309, + 0x3723cb, + 0x373b0c, + 0x37acca, + 0x37b50c, + 0x37b80c, + 0x37bb09, + 0x37cf0b, + 0x37d1c8, + 0x37d3c9, + 0x37d3cf, + 0x37ed0b, + 0x37fa0a, + 0x380fcc, + 0x382e49, + 0x383208, + 0x38374b, + 0x383e4b, + 0x384c8a, + 0x384f0b, + 0x38544c, + 0x385e08, + 0x38910b, + 0x38ba0b, + 0x38fc4b, + 0x391a4b, + 0x39a98b, + 0x39ac49, + 0x39b18d, + 0x3a004a, + 0x3a0f97, + 0x3a2898, + 0x3a5bc9, 0x3a7b4b, - 0x3a9554, - 0x3a9a4b, - 0x3a9fca, - 0x3ab70a, - 0x3ab98b, - 0x3ad110, - 0x3ad511, - 0x3ae64a, - 0x3afa8d, - 0x3b018d, - 0x3b508b, - 0x3b5c46, - 0x221b83, - 0x73b76c03, - 0x37f706, - 0x292c85, - 0x396787, - 0x3215c6, - 0x1639f02, - 0x2b3809, - 0x32fd44, - 0x2e0bc8, - 0x24e103, - 0x2f6cc7, - 0x241b82, - 0x2b2c03, - 0x73e06c82, - 0x2cb006, - 0x2cc544, - 0x3b2e84, - 0x2616c3, - 0x2616c5, - 0x746c7282, - 0x74aae504, - 0x279747, - 0x1669e02, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x20abc3, - 0x204cc2, - 0x15f048, - 0x20d1c2, - 0x332ec3, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x213e83, - 0x324156, - 0x325393, - 0x34f849, - 0x2957c8, - 0x364689, - 0x308b06, - 0x336f50, - 0x25c9d3, - 0x3072c8, - 0x344207, - 0x27e407, - 0x2475ca, - 0x373549, - 0x239789, - 0x29258b, - 0x367e06, - 0x314aca, - 0x2221c6, - 0x32f943, - 0x294985, - 0x22b888, - 0x2a920d, - 0x35ab0c, - 0x3a2107, - 0x379f8d, - 0x20c504, - 0x22ef0a, - 0x23064a, - 0x230b0a, - 0x20fe87, - 0x240387, - 0x243084, - 0x26cdc6, - 0x3aab84, - 0x2e26c8, - 0x2267c9, - 0x2b94c6, - 0x2b94c8, - 0x24c34d, - 0x2c9fc9, - 0x207d48, - 0x271647, - 0x2f8e8a, - 0x2539c6, - 0x2642c7, - 0x2c96c4, - 0x28e807, - 0x332eca, - 0x36f5ce, - 0x228fc5, - 0x28e70b, - 0x262089, - 0x2a8909, - 0x2129c7, - 0x29998a, - 0x225707, - 0x2ffd09, - 0x326b48, - 0x35dc4b, - 0x2e0405, - 0x38144a, - 0x223109, - 0x23908a, - 0x2ccb4b, - 0x383a0b, - 0x292315, - 0x2e6185, - 0x2716c5, - 0x2f424a, - 0x25980a, - 0x261e07, - 0x21d743, - 0x2a5c08, - 0x2d828a, - 0x223706, - 0x24ff09, - 0x26ebc8, - 0x2de404, - 0x242649, - 0x2c3608, - 0x2b1c07, - 0x20ce06, - 0x36f447, - 0x293cc7, - 0x242ac5, - 0x228e0c, - 0x258905, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x20d1c2, - 0x2d0783, - 0x204ac3, - 0x20abc3, - 0x200383, - 0x2d0783, - 0x204ac3, - 0x24a843, - 0x200383, - 0x15f048, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x15f048, - 0x20d1c2, - 0x2000c2, - 0x230d42, - 0x202f02, - 0x202382, - 0x261e82, - 0x46d0783, - 0x231b83, - 0x2135c3, - 0x332ec3, - 0x204303, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x201383, - 0x15f048, - 0x32df04, - 0x260087, - 0x263d43, - 0x37aa84, - 0x214543, - 0x212a43, - 0x332ec3, - 0x13ecc7, - 0x204cc2, - 0x168883, - 0x5a0d1c2, - 0x8d54d, - 0x8d88d, - 0x230d42, - 0x964c4, - 0x200382, - 0x5e963c8, - 0xf39c4, - 0x15f048, - 0x14020c2, - 0x1509cc6, - 0x20e443, - 0x26ae03, - 0x66d0783, - 0x22ef04, - 0x6a31b83, - 0x6f32ec3, - 0x20a3c2, - 0x2964c4, - 0x204ac3, - 0x2fc883, - 0x201882, - 0x200383, - 0x21c802, - 0x2f8043, - 0x202602, - 0x203f83, - 0x26ec83, - 0x206d02, - 0x15f048, - 0x20e443, - 0x2fc883, - 0x201882, - 0x2f8043, - 0x202602, - 0x203f83, - 0x26ec83, - 0x206d02, - 0x2f8043, - 0x202602, - 0x203f83, - 0x26ec83, - 0x206d02, - 0x2d0783, - 0x368883, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x2964c4, - 0x204303, - 0x20fbc3, - 0x213184, - 0x204ac3, - 0x200383, - 0x210582, - 0x21aa03, - 0x15f048, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x368883, - 0x20d1c2, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x2964c4, - 0x204ac3, - 0x200383, - 0x370145, - 0x217082, - 0x204cc2, - 0x15f048, - 0x1491b48, - 0x332ec3, - 0x2461c1, - 0x2096c1, - 0x202201, - 0x209441, - 0x24a5c1, - 0x27e081, - 0x24c0c1, - 0x2462c1, - 0x2e7481, - 0x30ed01, + 0x3a9414, + 0x3a990b, + 0x3a9e8a, + 0x3aa30a, + 0x3aa58b, + 0x3ab590, + 0x3ab991, + 0x3ac48a, + 0x3ad88d, + 0x3adf8d, + 0x3b328b, + 0x3b4506, + 0x221b43, + 0x6bb99283, + 0x323dc6, + 0x28b6c5, + 0x2c55c7, + 0x33d7c6, + 0x1617982, + 0x2b0d49, + 0x29ed04, + 0x2cfe48, + 0x242743, + 0x2e5f47, + 0x230902, + 0x2acbc3, + 0x6be006c2, + 0x2c0586, + 0x2c17c4, + 0x307c84, + 0x236c43, + 0x236c45, + 0x6c6ff382, + 0x6caa8004, + 0x26f7c7, + 0x16ce2c2, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x211003, + 0x238483, + 0x2264c3, + 0x2025c3, + 0x200882, + 0x880c8, + 0x216582, + 0x21eb03, + 0x211003, + 0x238483, + 0x2264c3, + 0x217643, + 0x317416, + 0x31a5d3, + 0x3492c9, + 0x3aad88, + 0x3a6389, + 0x2fa5c6, + 0x32c750, + 0x21d6d3, + 0x200b08, + 0x25aa47, + 0x274ec7, + 0x29cb4a, + 0x2f7989, + 0x3336c9, + 0x28a70b, + 0x325506, + 0x31cf8a, + 0x223586, + 0x29e903, + 0x28e085, + 0x217188, + 0x2c7bcd, + 0x357c4c, + 0x38e487, + 0x3025cd, + 0x3a8204, + 0x23214a, + 0x232a8a, + 0x232f4a, + 0x21d9c7, + 0x23cfc7, + 0x23f644, + 0x239506, + 0x3258c4, + 0x2ec848, + 0x25f709, + 0x2b83c6, + 0x2b83c8, + 0x2423cd, + 0x2bf489, + 0x378cc8, + 0x241f07, + 0x2fe78a, + 0x24a4c6, + 0x25a047, + 0x2cdac4, + 0x240d07, + 0x30130a, + 0x3397ce, + 0x255805, + 0x2fcd4b, + 0x277a09, + 0x223349, + 0x2a2087, + 0x358b0a, + 0x201c87, + 0x39fc89, + 0x358108, + 0x369c4b, + 0x2cf145, + 0x2e0e0a, + 0x2a37c9, + 0x30f54a, + 0x2c1dcb, + 0x240c0b, + 0x28a495, + 0x2d5d45, + 0x241f85, + 0x2e2f4a, + 0x215cca, + 0x310c47, + 0x220683, + 0x29b9c8, + 0x2cb14a, + 0x224ec6, + 0x23db49, + 0x25f008, + 0x2d5204, + 0x22fb09, + 0x2b7b88, + 0x32c247, + 0x276486, + 0x2a4887, + 0x28fd87, + 0x23f085, + 0x25564c, + 0x252cc5, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x216582, + 0x22d183, + 0x238483, + 0x2025c3, + 0x2264c3, + 0x22d183, + 0x238483, + 0x223b43, + 0x2264c3, + 0x880c8, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x211003, + 0x238483, + 0x2264c3, + 0x880c8, + 0x216582, + 0x201a42, + 0x233182, + 0x201982, + 0x204c02, + 0x293d42, + 0x462d183, + 0x2343c3, + 0x211cc3, + 0x21eb03, + 0x202243, + 0x211003, + 0x238483, + 0x2264c3, + 0x20b443, + 0x880c8, + 0x335d44, + 0x24f007, + 0x251fc3, + 0x231404, + 0x214bc3, + 0x282343, + 0x21eb03, + 0x16e747, + 0x200882, + 0x123ac3, + 0x5a16582, + 0x86a0d, + 0x233182, + 0x1604, + 0x201502, + 0x5e01508, + 0xe26c4, + 0x880c8, + 0x140de82, + 0x14fa2c6, + 0x230983, + 0x316403, + 0x662d183, + 0x232144, + 0x6a343c3, + 0x6e1eb03, + 0x2082c2, + 0x201604, + 0x238483, + 0x212ec3, + 0x202282, + 0x2264c3, + 0x21ed42, + 0x2e86c3, + 0x201bc2, + 0x29c743, + 0x22d743, + 0x204702, + 0x880c8, + 0x230983, + 0x212ec3, + 0x202282, + 0x2e86c3, + 0x201bc2, + 0x29c743, + 0x22d743, + 0x204702, + 0x2e86c3, + 0x201bc2, + 0x29c743, + 0x22d743, + 0x204702, + 0x22d183, + 0x323ac3, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x201604, + 0x202243, + 0x211003, + 0x212444, + 0x238483, + 0x2264c3, + 0x202002, + 0x21bd03, + 0x880c8, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x211003, + 0x238483, + 0x2264c3, + 0x323ac3, + 0x216582, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x201604, + 0x238483, + 0x2264c3, + 0x2e9cc5, + 0x221e42, + 0x200882, + 0x880c8, + 0x1462d48, + 0x21eb03, + 0x225b41, + 0x20fd41, + 0x20c401, + 0x20c041, + 0x226fc1, + 0x26f541, + 0x252041, + 0x225c41, + 0x2d5901, + 0x2ff8c1, 0x200141, 0x200001, - 0x15f048, - 0x200701, - 0x200101, - 0x2000c1, - 0x201e41, - 0x200181, - 0x200941, - 0x200041, - 0x204ec1, + 0x880c8, + 0x200481, + 0x200741, 0x200081, - 0x201481, - 0x200c01, - 0x2002c1, - 0x200381, - 0x200e81, - 0x21c2c1, - 0x2003c1, - 0x200201, + 0x200c81, + 0x2007c1, + 0x200901, + 0x200041, + 0x204281, + 0x2001c1, + 0x2000c1, + 0x200341, + 0x200ac1, + 0x201501, + 0x2014c1, + 0x204101, + 0x200b81, 0x200241, 0x200a01, - 0x2019c1, - 0x201a81, - 0x2005c1, - 0x2007c1, - 0x200cc1, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x20d1c2, - 0x2d0783, - 0x231b83, - 0x200382, - 0x200383, - 0x13ecc7, - 0xfcc7, - 0x28b86, - 0x3dcca, - 0x8cc48, - 0x58dc8, - 0x59207, - 0x62a46, - 0xde185, - 0x63c85, - 0x177ac6, - 0x125886, - 0x24ae04, - 0x31cdc7, - 0x15f048, - 0x2da904, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x2d0783, - 0x231b83, - 0x2135c3, - 0x332ec3, - 0x204303, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x217082, - 0x2c8dc3, - 0x21fd43, - 0x200603, - 0x202942, - 0x251d43, - 0x205283, - 0x21e743, + 0x2002c1, + 0x200281, + 0x204701, + 0x20dec1, + 0x200781, + 0x200641, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x216582, + 0x22d183, + 0x2343c3, + 0x201502, + 0x2264c3, + 0x16e747, + 0x131ac7, + 0x1e1c6, + 0x1736ca, + 0x85c48, + 0x53188, + 0x53547, + 0x50d06, + 0xce6c5, + 0x51f05, + 0x161186, + 0x155646, + 0x224104, + 0x322707, + 0x880c8, + 0x22d684, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x22d183, + 0x2343c3, + 0x211cc3, + 0x21eb03, + 0x202243, + 0x211003, + 0x238483, + 0x2264c3, + 0x221e42, + 0x2be043, + 0x2f5003, + 0x20b283, + 0x202e02, + 0x248083, + 0x204803, + 0x206e83, 0x200001, - 0x203e43, - 0x225b04, - 0x37f1c3, - 0x318cc3, - 0x21c403, - 0x360383, - 0xaad0783, - 0x23a184, - 0x21c3c3, - 0x22f143, - 0x231b83, - 0x2318c3, - 0x23a943, - 0x2a85c3, - 0x318c43, - 0x233ec3, - 0x201e43, - 0x253f84, - 0x2abc02, - 0x258683, - 0x25eb43, - 0x27bfc3, - 0x262883, - 0x201dc3, - 0x332ec3, - 0x208803, - 0x209e43, - 0x204143, - 0x210203, - 0x2ff083, - 0xae30043, - 0x2b1083, - 0x2113c3, - 0x22d603, - 0x20fbc3, - 0x226302, - 0x201683, - 0x204ac3, - 0x160abc3, - 0x27d643, - 0x20ff03, - 0x216ec3, - 0x200383, - 0x3b37c3, - 0x21aa03, - 0x241f03, - 0x304f43, - 0x2f8203, - 0x30c845, - 0x2202c3, - 0x2f8243, - 0x35ed83, - 0x218c84, - 0x265203, - 0x311883, - 0x2d8fc3, - 0x201383, - 0x217082, - 0x23bd83, - 0x308484, - 0x22fec4, - 0x22a843, - 0x15f048, - 0x4cc2, - 0x1442, - 0x2942, - 0x5ac2, - 0x2302, - 0x702, - 0x4e242, - 0x1c2, - 0x8a42, - 0xc02, - 0xf302, - 0xb602, - 0x73fc2, - 0x4c82, - 0x61e82, - 0x17902, - 0x3cf82, - 0x54c2, - 0x18b82, - 0xfc2, - 0x682, - 0x1bb82, - 0x1f82, - 0xc4c2, - 0x1702, - 0x20c42, - 0xa42, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x20d1c2, - 0x200383, - 0xc2d0783, - 0x332ec3, - 0x20fbc3, - 0x20dc42, - 0x15f048, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x6c82, - 0x2031c2, - 0x24ac42, - 0x15f048, - 0xd1c2, - 0x233482, - 0x208842, - 0x22f942, - 0x204182, - 0x209282, - 0x63c85, - 0x204702, - 0x201882, - 0x211f82, - 0x2034c2, - 0x217902, - 0x384982, - 0x201ac2, - 0x245742, - 0x13ecc7, - 0x169a8d, - 0xde209, - 0x56bcb, - 0xe3888, - 0x55109, - 0x332ec3, - 0x15f048, - 0x15f048, - 0x59b46, - 0x204cc2, - 0x24ae04, - 0x20d1c2, - 0x2d0783, - 0x2000c2, - 0x231b83, - 0x208a42, - 0x2da904, - 0x204303, - 0x2513c2, - 0x204ac3, - 0x200382, - 0x200383, - 0x2716c6, - 0x31c0cf, - 0x70d8c3, - 0x15f048, - 0x20d1c2, - 0x2135c3, - 0x332ec3, - 0x20fbc3, - 0x155afcb, - 0xde548, - 0x14ff507, - 0x13ecc7, - 0x20d1c2, - 0x2d0783, - 0x332ec3, - 0x204ac3, - 0x204cc2, - 0x200902, - 0x207f42, - 0xfad0783, - 0x2416c2, - 0x231b83, - 0x2101c2, - 0x22ad02, - 0x332ec3, - 0x2630c2, - 0x255302, - 0x2ae4c2, - 0x203742, - 0x291e02, - 0x209902, - 0x200b82, - 0x274842, - 0x258142, - 0x251b02, - 0x2b36c2, - 0x242602, - 0x246082, - 0x263c42, - 0x20fbc3, - 0x205f02, - 0x204ac3, - 0x231302, - 0x27de02, - 0x200383, - 0x251dc2, - 0x20c4c2, - 0x209f42, - 0x200b42, - 0x20c842, - 0x2e4742, - 0x220382, - 0x24d082, - 0x234f42, - 0x310c8a, - 0x347d0a, - 0x37e80a, - 0x3b5dc2, - 0x2046c2, - 0x204e82, - 0xff4f589, - 0x10324d0a, - 0x15926c7, - 0x1410c43, - 0x243d0, - 0x9402, - 0x24fe44, - 0x10ad0783, - 0x231b83, - 0x251304, - 0x332ec3, - 0x2964c4, - 0x204303, - 0x20fbc3, - 0x204ac3, - 0x20abc3, - 0x200383, - 0x2202c3, - 0x24abc3, - 0x15f048, - 0x14629c4, - 0x614c5, - 0x5f88a, - 0x1168c2, - 0x1a03c6, - 0x102d11, - 0x1134f589, - 0x61548, - 0x82a08, - 0x5e887, - 0xf82, - 0x19a18a, - 0x2ac47, - 0x15f048, - 0x10b708, - 0xbac7, - 0x16c1b74b, - 0x1082, - 0x15de87, - 0xdb4a, - 0x5e58f, - 0xfd4f, - 0x1c402, - 0xd1c2, - 0xa8508, - 0x185b0a, - 0x1681c8, - 0x3b02, - 0x5e30f, - 0xa3d4b, - 0x1672c8, - 0x13edc7, - 0x15104a, - 0x2f64b, - 0x11dd09, - 0x150f47, - 0x100c4c, - 0x1b3c47, - 0x18d18a, - 0x94b88, - 0x195a8e, - 0x28b8e, - 0x2aa8b, - 0x2b2cb, - 0x2d3cb, - 0x2e209, - 0x3558b, - 0x4a68d, - 0xe984b, - 0xec8cd, - 0xecc4d, - 0x18274a, - 0x2fd0b, - 0x3688b, - 0x42305, - 0x14243d0, - 0x125d8f, - 0x1264cf, - 0x48dcd, - 0x25910, - 0x1742, - 0x17203988, - 0xfb48, - 0x176f4745, - 0x505cb, - 0x117050, - 0x57488, - 0x2b48a, - 0x5f4c9, - 0x695c7, - 0x69907, - 0x69ac7, - 0x6c287, - 0x6d307, - 0x6dd07, - 0x6e487, - 0x6e8c7, - 0x6f487, - 0x6f787, - 0x6ffc7, - 0x70187, - 0x70347, - 0x70507, - 0x70807, - 0x70c47, - 0x718c7, - 0x71d87, - 0x729c7, - 0x72f07, - 0x730c7, - 0x73807, - 0x73e87, - 0x74087, - 0x74347, - 0x74507, - 0x746c7, - 0x75047, - 0x754c7, - 0x75987, - 0x76147, - 0x76407, - 0x76bc7, - 0x76d87, - 0x77107, - 0x77d07, - 0x78987, - 0x78d87, - 0x78f47, - 0x79107, - 0x79547, - 0x7a307, - 0x7a607, - 0x7a907, - 0x7aac7, - 0x7ae47, - 0x7b387, - 0xa9c2, - 0x4c94a, - 0x16dc87, - 0x178d528b, - 0x14d5296, - 0x19151, - 0xf080a, - 0xa838a, - 0x59b46, - 0xd2acb, - 0x642, - 0x2e891, - 0x94609, - 0x9a109, - 0x74842, - 0xa4f4a, - 0xaa689, - 0xab24f, - 0xaca4e, - 0xad708, - 0x18d82, - 0x15da89, - 0x18b88e, - 0xfd08c, - 0xf254f, - 0x146ce, - 0x23b4c, - 0x2ccc9, - 0x2db51, - 0x465c8, - 0x482d2, - 0x49fcd, - 0x82bcd, - 0x19090b, - 0x3d2d5, - 0x4c809, - 0x4ec0a, - 0x4f489, - 0x5ecd0, - 0x72c4b, - 0x79f4f, - 0x7c48b, - 0x8340c, - 0x84610, - 0x8894a, - 0x8dd0d, - 0x16618e, - 0x1ae00a, - 0x8f7cc, - 0x93994, - 0x94291, - 0xa494b, - 0xa578f, - 0xa7bcd, - 0xac3ce, - 0xb1acc, - 0xb220c, - 0xdc90b, - 0xdcc0e, - 0x122110, - 0x11640b, - 0x17a64d, - 0x1af38f, - 0xb798c, - 0xb934e, - 0xbb311, - 0xc3ccc, - 0xc5a47, - 0x15e58d, - 0x12b50c, - 0x14be50, - 0xd1b4d, - 0xd8e47, - 0xe2350, - 0xfa008, - 0xfb08b, - 0x150bcf, - 0x17de88, - 0xf0a0d, - 0x181d50, - 0x17fb1846, - 0xb6003, - 0x1b02, - 0xd0309, - 0x5ac0a, - 0x1084c6, - 0x180dff49, - 0x13203, - 0xdab91, - 0xdafc9, - 0xdc047, - 0x5e40b, - 0xe4a90, - 0xe4f4c, - 0xe5385, - 0x126cc8, - 0x19dc0a, - 0x129607, - 0x1002, - 0x12464a, - 0x25e49, - 0x3a20a, - 0x8eacf, - 0x44f4b, - 0x1b280c, - 0x1b2ad2, - 0xaa085, - 0x2124a, - 0x186f2fc5, - 0x17698c, - 0x121203, - 0x184982, - 0xf86ca, - 0x96b88, - 0xeca88, - 0x14a587, - 0xd42, - 0x2602, - 0x3f390, - 0x1702, - 0x1aa2cf, - 0x177ac6, - 0x301ce, - 0xe7fcb, - 0x1ae208, - 0xd6c09, - 0x17cd92, - 0x7c0d, - 0x56608, - 0x56a89, - 0x5700d, - 0x59c89, - 0x5a28b, - 0x5b088, - 0x5f6c8, - 0x68bc8, - 0x68e49, - 0x6904a, - 0x6c8cc, - 0xe5d0a, - 0x104f87, - 0x16b2cd, - 0xf910b, - 0x12fb4c, - 0x1a05d0, - 0x6902, - 0x1968cd, - 0x16c2, - 0x11fc2, - 0x104eca, - 0xf070a, - 0xf6bcb, - 0x36a4c, - 0x10b48e, - 0x21ccd, - 0x1ab488, - 0x6c82, - 0x1166118e, - 0x11f6a18e, - 0x1266c00a, - 0x12ed0a0e, - 0x137156ce, - 0x13f2a00c, - 0x15926c7, - 0x15926c9, - 0x1410c43, - 0x14731e8c, - 0x14f3a009, - 0x1409402, - 0x610d1, - 0x16a0d1, - 0x6bf4d, - 0xd0951, - 0x11b1d1, - 0x129f4f, - 0x131dcf, - 0x139f4c, - 0x14a94d, - 0x18d555, - 0x1ace0c, - 0x1b41cc, - 0x1b5850, - 0x940c, - 0x5838c, - 0xedc19, - 0x1a6719, - 0x115419, - 0x15c754, - 0x17f854, - 0x198594, - 0x19ae14, - 0x1a9054, - 0x1577fb09, - 0x15d98849, - 0x167b4289, - 0x11b6b089, - 0x9402, - 0x1236b089, - 0x9402, - 0xedc0a, - 0x9402, - 0x12b6b089, - 0x9402, - 0xedc0a, - 0x9402, - 0x1336b089, - 0x9402, - 0x13b6b089, - 0x9402, - 0x1436b089, - 0x9402, - 0xedc0a, - 0x9402, - 0x14b6b089, - 0x9402, - 0xedc0a, - 0x9402, - 0x1536b089, - 0x9402, - 0x15b6b089, - 0x9402, - 0x1636b089, - 0x9402, - 0x16b6b089, - 0x9402, - 0xedc0a, - 0x9402, - 0x102d05, - 0x19a184, - 0x11d644, - 0x1a4884, - 0xbfc04, - 0x2144, - 0x5e884, - 0x1482283, - 0x1420183, - 0xffd84, - 0x1542b83, - 0x1742, - 0x21cc3, - 0x204cc2, - 0x20d1c2, - 0x2000c2, - 0x2041c2, - 0x208a42, - 0x200382, - 0x202602, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204143, - 0x204ac3, - 0x200383, - 0x15f048, - 0x2d0783, - 0x231b83, - 0x204ac3, - 0x200383, - 0x3b943, - 0x332ec3, - 0x204cc2, - 0x368883, - 0x1a2d0783, - 0x20ef47, - 0x332ec3, - 0x205d83, - 0x213184, - 0x204ac3, - 0x200383, - 0x25084a, - 0x2716c5, - 0x21aa03, - 0x205bc2, - 0x15f048, - 0x15f048, - 0xd1c2, - 0x11f0c2, - 0x15dfc5, - 0x15f048, - 0xd0783, - 0x1ae3db07, - 0xcfd46, - 0x1b1acd05, - 0xcfe07, - 0xa54a, - 0xa408, - 0xb747, - 0x5f2c8, - 0x18c407, - 0xed30f, - 0x3ab07, - 0x165bc6, - 0x117050, - 0x122f0f, - 0x108544, - 0x1b4cfece, - 0xafd0c, - 0x11de8a, - 0xac687, - 0x12d54a, - 0x60989, - 0xc2f4a, - 0x77a8a, - 0x1084c6, - 0xac74a, - 0x11a58a, - 0x154009, - 0xda448, - 0xda746, - 0xde74d, - 0xb9905, - 0x5a107, - 0x16df94, - 0xfe58b, - 0x16710a, - 0xa8bcd, - 0x28b83, - 0x28b83, - 0x28b86, - 0x28b83, - 0x168883, - 0x15f048, - 0xd1c2, - 0x51304, - 0x8cdc3, - 0x170145, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x205283, - 0x2d0783, - 0x231b83, - 0x2135c3, - 0x332ec3, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x29a2c3, - 0x24abc3, - 0x205283, - 0x24ae04, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x209103, - 0x2d0783, - 0x231b83, - 0x2041c3, - 0x2135c3, - 0x332ec3, - 0x2964c4, - 0x23a0c3, - 0x22d603, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x21aa03, - 0x38c743, - 0x1d2d0783, - 0x231b83, - 0x2c3ec3, - 0x332ec3, - 0x2075c3, - 0x22d603, - 0x200383, - 0x2054c3, - 0x343c44, - 0x15f048, - 0x1dad0783, - 0x231b83, - 0x2ad7c3, - 0x332ec3, - 0x20fbc3, - 0x213184, - 0x204ac3, - 0x200383, - 0x21d7c3, - 0x15f048, - 0x1e2d0783, - 0x231b83, - 0x2135c3, - 0x20abc3, - 0x200383, - 0x15f048, - 0x15926c7, - 0x368883, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x2964c4, - 0x213184, - 0x204ac3, - 0x200383, - 0x13ecc7, - 0x16e1cb, - 0xdb3c4, - 0xb9905, - 0x1491b48, - 0xae2cd, - 0x1f68a405, - 0x192c4, - 0x1a5c3, - 0x367fc5, - 0x15f048, - 0x1d202, - 0x2803, - 0xf7286, - 0x32f448, - 0x304507, - 0x24ae04, - 0x3b3006, - 0x3b5706, - 0x15f048, - 0x310683, - 0x2384c9, - 0x2bdad5, - 0xbdadf, - 0x2d0783, - 0x39a9d2, - 0xf5806, - 0x10cfc5, - 0x2b48a, - 0x5f4c9, - 0x39a78f, - 0x2da904, - 0x20f345, - 0x2fee50, - 0x2959c7, - 0x20abc3, - 0x2842c8, - 0x1257c6, - 0x2b400a, - 0x200e84, - 0x2f2a03, - 0x2716c6, - 0x205bc2, - 0x26b44b, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x2f74c3, - 0x20d1c2, - 0x204ac3, - 0x200383, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x20fbc3, - 0x200383, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x205d83, - 0x223103, - 0x200383, - 0x20d1c2, - 0x2d0783, - 0x231b83, - 0x204ac3, - 0x200383, - 0x204cc2, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x24ae04, - 0x2d0783, - 0x231b83, - 0x222044, - 0x204ac3, - 0x200383, - 0x15f048, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x2d0783, - 0x231b83, - 0x2135c3, - 0x209e43, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x20d1c2, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x15f048, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x262fc3, - 0x1e303, - 0x5d83, - 0x204ac3, - 0x200383, - 0x310c8a, - 0x32a949, - 0x34184b, - 0x341f8a, - 0x347d0a, - 0x356e8b, - 0x37300a, - 0x37914a, - 0x37e80a, - 0x37ea8b, - 0x39d949, - 0x39f84a, - 0x39fbcb, - 0x3a9d0b, - 0x3b4a8a, - 0x2d0783, - 0x231b83, - 0x2135c3, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x10c9c9, - 0x15f048, - 0x2d0783, - 0x2695c4, - 0x200c82, - 0x213184, - 0x3ac705, - 0x205283, - 0x24ae04, - 0x2d0783, - 0x23a184, - 0x231b83, - 0x251304, - 0x2da904, - 0x2964c4, - 0x22d603, - 0x204ac3, - 0x200383, - 0x293ac5, - 0x209103, - 0x21aa03, - 0x22c6c3, - 0x258a04, - 0x262904, - 0x35d705, - 0x15f048, - 0x306e44, - 0x20e546, - 0x28a8c4, - 0x20d1c2, - 0x361ac7, - 0x253587, - 0x24f0c4, - 0x25d8c5, - 0x2d1d45, - 0x2b0405, - 0x2964c4, - 0x23cfc8, - 0x33f306, - 0x311f48, - 0x227b05, - 0x2e0405, - 0x377004, - 0x200383, - 0x2f39c4, - 0x355f46, - 0x2717c3, - 0x258a04, - 0x291a45, - 0x363644, - 0x234e84, - 0x205bc2, - 0x25e206, - 0x392206, - 0x3022c5, - 0x204cc2, - 0x368883, - 0x24e0d1c2, - 0x232dc4, - 0x208a42, - 0x20fbc3, - 0x25e402, - 0x204ac3, - 0x200382, - 0x213e83, - 0x24abc3, - 0x15f048, - 0x15f048, - 0x332ec3, - 0x204cc2, - 0x25a0d1c2, - 0x332ec3, - 0x2702c3, - 0x23a0c3, - 0x32bc44, - 0x204ac3, - 0x200383, - 0x15f048, - 0x204cc2, - 0x2620d1c2, - 0x2d0783, - 0x204ac3, - 0x200383, - 0x682, - 0x2044c2, - 0x217082, - 0x205d83, - 0x2ec383, - 0x204cc2, - 0x15f048, - 0x13ecc7, - 0x20d1c2, - 0x231b83, - 0x251304, - 0x202743, - 0x332ec3, - 0x209e43, - 0x20fbc3, - 0x204ac3, - 0x2183c3, - 0x200383, - 0x21d743, - 0x1286d3, - 0x12cb54, - 0x13ecc7, - 0x1fd86, - 0x5ae0b, - 0x28b86, - 0x58c07, - 0x130089, - 0xe9cca, - 0x8cb0d, - 0x16978c, - 0x13d64a, - 0x63c85, - 0xa588, - 0x177ac6, - 0x125886, - 0x201742, - 0x827cc, - 0x19a347, - 0x23551, - 0x2d0783, - 0x5f245, - 0x102c4, - 0x274341c6, - 0x19146, - 0x178146, - 0x920ca, - 0xb2f03, - 0x27a5c984, - 0x130045, - 0xa383, - 0xd2b8c, - 0xf6188, - 0xbaf48, - 0xa3bc9, - 0x20c48, - 0x141dd06, - 0xfbc88, - 0x5e884, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x204cc2, - 0x20d1c2, - 0x332ec3, - 0x20a3c2, - 0x204ac3, - 0x200383, - 0x213e83, - 0x36388f, - 0x363c4e, - 0x15f048, - 0x2d0783, - 0x4cd07, - 0x231b83, - 0x332ec3, - 0x204303, - 0x204ac3, - 0x200383, - 0x21d0c3, - 0x239c47, - 0x200142, - 0x2c1949, - 0x201442, - 0x23f68b, - 0x2b5b8a, - 0x2bcfc9, - 0x200282, - 0x262b46, - 0x26d615, - 0x23f7d5, - 0x274a13, - 0x23fd53, - 0x202342, - 0x20d605, - 0x3ab1cc, - 0x24698b, - 0x29a745, - 0x205ac2, - 0x289c02, - 0x386746, - 0x200f82, - 0x25fb86, - 0x294d0d, - 0x255dcc, - 0x224444, - 0x201342, - 0x203782, - 0x248688, - 0x202302, - 0x208886, - 0x303bc4, - 0x26d7d5, - 0x274b93, - 0x210b83, - 0x33070a, - 0x2f0187, - 0x3b2209, - 0x32dc47, - 0x3124c2, - 0x200002, - 0x3a4386, - 0x20a0c2, - 0x15f048, - 0x200802, - 0x211cc2, - 0x27d407, - 0x3b3507, - 0x21c7c5, - 0x201082, - 0x21d707, - 0x21d8c8, - 0x2413c2, - 0x2c2fc2, - 0x22c1c2, - 0x20e542, - 0x23b688, - 0x218443, - 0x2b72c8, - 0x2e078d, - 0x21fe43, - 0x226288, - 0x23e88f, - 0x23ec4e, - 0x24ac8a, - 0x229d11, - 0x22a190, - 0x2bf0cd, - 0x2bf40c, - 0x38c5c7, - 0x330887, - 0x3b30c9, - 0x204f02, - 0x200702, - 0x25a6cc, - 0x25a9cb, - 0x202ac2, - 0x2dcac6, - 0x20db42, - 0x20c502, - 0x21c402, - 0x20d1c2, - 0x384684, - 0x23c7c7, - 0x220802, - 0x242c07, - 0x243c47, - 0x2271c2, - 0x20e482, - 0x24cbc5, - 0x204d02, - 0x20cb4e, - 0x36f1cd, - 0x231b83, - 0x353a0e, - 0x2c0b8d, - 0x3ab643, - 0x201842, - 0x206744, - 0x208182, - 0x220a42, - 0x33e805, - 0x348447, - 0x372202, - 0x2041c2, - 0x250f07, - 0x2543c8, - 0x2abc02, - 0x2aa106, - 0x25a54c, - 0x25a88b, - 0x20da42, - 0x26588f, - 0x265c50, - 0x26604f, - 0x266415, - 0x266954, - 0x266e4e, - 0x2671ce, - 0x26754f, - 0x26790e, - 0x267c94, - 0x268193, - 0x26864d, - 0x27b549, - 0x28dbc3, - 0x200182, - 0x237b85, - 0x206506, - 0x208a42, - 0x21a2c7, - 0x332ec3, - 0x200642, - 0x36edc8, - 0x229f51, - 0x22a390, - 0x200bc2, - 0x28d387, - 0x200b02, - 0x205fc7, - 0x201b02, - 0x32f249, - 0x386707, - 0x281408, - 0x234006, - 0x2cf4c3, - 0x2cf4c5, - 0x231e02, - 0x204842, - 0x3a4785, - 0x376e05, - 0x205e82, - 0x245f43, - 0x3636c7, - 0x210687, - 0x204982, - 0x3aae04, - 0x214183, - 0x2c9209, - 0x2ed188, - 0x205d82, - 0x2032c2, - 0x26e2c7, - 0x282185, - 0x2ab548, - 0x20d2c7, - 0x216143, - 0x372306, - 0x2bef4d, - 0x2bf2cc, - 0x280346, - 0x208842, - 0x2017c2, - 0x201f02, - 0x23e70f, - 0x23eb0e, - 0x2d1dc7, - 0x203cc2, - 0x2c3345, - 0x2c3346, - 0x20bcc2, - 0x205f02, - 0x28f406, - 0x205f03, - 0x205f06, - 0x2ca585, - 0x2ca58d, - 0x2cab55, - 0x2cb38c, - 0x2cc28d, - 0x2cc652, - 0x20b602, - 0x273fc2, - 0x201302, - 0x240fc6, - 0x2fcf46, - 0x201002, - 0x206586, - 0x211f82, - 0x37edc5, - 0x202382, - 0x20cc89, - 0x2df2cc, - 0x2df60b, - 0x200382, - 0x255688, - 0x213a02, - 0x204c82, - 0x246746, - 0x36b005, - 0x235007, - 0x2567c5, - 0x294805, - 0x24cd82, - 0x20a642, - 0x217902, - 0x2f2847, - 0x24410d, - 0x24448c, - 0x2b3387, - 0x2aa082, - 0x23cf82, - 0x24ba48, - 0x2d0488, - 0x2e5f88, - 0x2f09c4, - 0x2dce87, - 0x2ee483, - 0x2b6042, - 0x200e82, - 0x2f11c9, - 0x395e87, - 0x2054c2, - 0x277245, - 0x201202, - 0x26a102, - 0x349c43, - 0x349c46, - 0x2f74c2, - 0x2f7fc2, - 0x201402, - 0x3b3fc6, - 0x206687, - 0x207842, - 0x200e02, - 0x38bc8f, - 0x35384d, - 0x2b714e, - 0x2c0a0c, - 0x2003c2, - 0x205502, - 0x233e45, - 0x3b4e86, - 0x201ec2, - 0x200fc2, - 0x200682, - 0x20d244, - 0x2e0604, - 0x2d29c6, - 0x202602, - 0x27e787, - 0x22d703, - 0x22d708, - 0x24b048, - 0x390787, - 0x240ec6, - 0x20e5c2, - 0x23b383, - 0x23b387, - 0x272846, - 0x2e4385, - 0x2f0d48, - 0x206342, - 0x34a007, - 0x220c42, - 0x33c282, - 0x203b82, - 0x2dbe09, - 0x22fb02, - 0x200242, - 0x240183, - 0x319ac7, - 0x2018c2, - 0x2df44c, - 0x2df74b, - 0x2803c6, - 0x20a2c5, - 0x222e82, - 0x200a42, - 0x2bd306, - 0x235b83, - 0x39c147, - 0x23bb02, - 0x203382, - 0x26d495, - 0x23f995, - 0x2748d3, - 0x23fed3, - 0x2934c7, - 0x2b5948, - 0x2fb310, - 0x30ee4f, - 0x2b5953, - 0x2bcd92, - 0x2c1510, - 0x2ca1cf, - 0x2d57d2, - 0x2d84d1, - 0x2d9513, - 0x2dbbd2, - 0x2dd20f, - 0x2e57ce, - 0x2f5092, - 0x2f6351, - 0x2f754f, - 0x2f834e, - 0x300011, - 0x355810, - 0x35f212, - 0x3702d1, - 0x2f9bc6, - 0x307487, - 0x373387, - 0x204b42, - 0x284e05, - 0x2febc7, - 0x217082, - 0x203142, - 0x2293c5, - 0x21ee43, - 0x35d986, - 0x2442cd, - 0x24460c, - 0x206602, - 0x3ab04b, - 0x24684a, - 0x30be4a, - 0x2bbf49, - 0x2ef68b, - 0x20d40d, - 0x2ff2cc, - 0x24890a, - 0x275b0c, - 0x27afcb, - 0x29a58c, - 0x2fa34b, - 0x2df243, - 0x35ee06, - 0x3a6502, - 0x2f8b82, - 0x2db2c3, - 0x202502, - 0x202503, - 0x245886, - 0x2665c7, - 0x365146, - 0x385cc8, - 0x2d0188, - 0x2d3186, - 0x2019c2, - 0x301c8d, - 0x301fcc, - 0x2da9c7, - 0x306d07, - 0x21fdc2, - 0x21ac02, - 0x23b302, - 0x254782, - 0x20d1c2, - 0x204ac3, - 0x200383, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x20fbc3, - 0x213184, - 0x204ac3, - 0x200383, - 0x213e83, - 0x204cc2, - 0x204e02, - 0x29a94005, - 0x29e02e85, - 0x2a3177c6, - 0x15f048, - 0x2a6b5145, - 0x20d1c2, - 0x2000c2, - 0x2ab9c685, - 0x2ae83305, - 0x2b283e07, - 0x2b68b309, - 0x2ba47ac4, - 0x208a42, - 0x200642, - 0x2bf72245, - 0x2c293149, - 0x2c71db88, - 0x2cab2085, - 0x2cf363c7, - 0x2d219b08, - 0x2d6e8605, - 0x2da5b4c6, - 0x2de346c9, - 0x2e2b8648, - 0x2e6c4b48, - 0x2ea9cf0a, - 0x2ee52104, - 0x2f2d6585, - 0x2f6becc8, - 0x2fb51245, - 0x2184c2, - 0x2fe63b83, - 0x302a7786, - 0x3064ea48, - 0x30a24f06, - 0x30ecec88, - 0x3132d1c6, - 0x316e4444, - 0x202082, - 0x31b630c7, - 0x31eaeb84, - 0x3227dc47, - 0x327a1087, - 0x200382, - 0x32aa0685, - 0x32e03bc4, - 0x332d1807, - 0x3362adc7, - 0x33a87406, - 0x33e36085, - 0x3429b807, - 0x346d2688, - 0x34a37f07, - 0x34eb0689, - 0x3538e6c5, - 0x35719c07, - 0x35a92e46, - 0x35e62d48, - 0x2460cd, - 0x24cf09, - 0x2f484b, - 0x25534b, - 0x27de4b, - 0x2aa88b, - 0x30f20b, - 0x30f4cb, - 0x30fd49, - 0x310f0b, - 0x3111cb, - 0x311ccb, - 0x31284a, - 0x312d8a, - 0x31338c, - 0x31608b, - 0x3166ca, - 0x327eca, - 0x3328ce, - 0x333a4e, - 0x333dca, - 0x335d8a, - 0x3369cb, - 0x336c8b, - 0x337a4b, - 0x34c7cb, - 0x34cdca, - 0x34da8b, - 0x34dd4a, - 0x34dfca, - 0x34e24a, - 0x373ecb, - 0x37a2cb, - 0x37c38e, - 0x37c70b, - 0x383ecb, - 0x38500b, - 0x38984a, - 0x389ac9, - 0x389d0a, - 0x38b38a, - 0x39e50b, - 0x39fe8b, - 0x3a09ca, - 0x3a28cb, - 0x3a588b, - 0x3b44cb, - 0x36285b88, - 0x3668c289, - 0x36aa3a49, - 0x36ee0bc8, - 0x33c685, - 0x202943, - 0x212944, - 0x206885, - 0x247806, - 0x25b245, - 0x28adc4, - 0x21a1c8, - 0x30af85, - 0x297a44, - 0x209907, - 0x2a280a, - 0x361d8a, - 0x3101c7, - 0x211f47, - 0x2fdec7, - 0x255b47, - 0x2fad45, - 0x343d06, - 0x22cb47, - 0x26fec4, - 0x2e6b46, - 0x2e6a46, - 0x208305, - 0x3492c4, - 0x38ec86, - 0x2a1647, - 0x22d046, - 0x351b47, - 0x26a783, - 0x2b4846, - 0x232045, - 0x283f07, - 0x270e0a, - 0x26dfc4, - 0x218ec8, - 0x2affc9, - 0x2cb147, - 0x334646, - 0x255908, - 0x200a49, - 0x3b23c4, - 0x2210c4, - 0x278285, - 0x22c848, - 0x2c7f47, - 0x2a7109, - 0x2f9cc8, - 0x347a86, - 0x24c646, - 0x29de88, - 0x354c46, - 0x202e85, - 0x2874c6, - 0x27e108, - 0x254b86, - 0x25d14b, - 0x29dac6, - 0x29f50d, - 0x3b1785, - 0x2aea46, - 0x20f505, - 0x349909, - 0x2abe87, - 0x3195c8, - 0x292986, - 0x29e709, - 0x364546, - 0x270d85, - 0x2a4dc6, - 0x2c99c6, - 0x2cdb89, - 0x200846, - 0x253087, - 0x277885, - 0x202383, - 0x25d2c5, - 0x29f7c7, - 0x358e06, - 0x3b1689, - 0x3177c6, - 0x287706, - 0x215ec9, - 0x286ec9, - 0x2a5607, - 0x2cf688, - 0x377f89, - 0x284a88, - 0x379386, - 0x2d9dc5, - 0x23cb4a, - 0x287786, - 0x3a8506, - 0x2cbbc5, - 0x272188, - 0x215587, - 0x22e68a, - 0x251746, - 0x24d345, - 0x329cc6, - 0x2d6347, - 0x334507, - 0x2c4145, - 0x270f45, - 0x2b2f86, - 0x351746, - 0x387046, - 0x2b8bc4, - 0x286209, - 0x28d146, - 0x30e50a, - 0x222848, - 0x309148, - 0x361d8a, - 0x2145c5, - 0x2a1585, - 0x37f588, - 0x2b6348, - 0x21b507, - 0x293846, - 0x320d48, - 0x3674c7, - 0x285188, - 0x2b9206, - 0x2885c8, - 0x29ad46, - 0x227c87, - 0x272b06, - 0x38ec86, - 0x25d9ca, - 0x384706, - 0x2d9dc9, - 0x2b5446, - 0x2e3d8a, - 0x2e4449, - 0x362586, - 0x2ba844, - 0x237c4d, - 0x28c507, - 0x3268c6, - 0x2c4a05, - 0x3645c5, - 0x375846, - 0x2d1649, - 0x2b4287, - 0x27f886, - 0x2c9546, - 0x28ae49, - 0x264a04, - 0x2d4a44, - 0x3ac808, - 0x245c46, - 0x277308, - 0x2e66c8, - 0x202fc7, - 0x3a80c9, - 0x387247, - 0x2b500a, - 0x2498cf, - 0x250b0a, - 0x233c45, - 0x27e345, - 0x218745, - 0x303b07, - 0x20e183, - 0x2cf888, - 0x3028c6, - 0x3029c9, - 0x2d4006, - 0x3aeb47, - 0x29e4c9, - 0x3194c8, - 0x2cbc87, - 0x30d803, - 0x33c705, - 0x20e105, - 0x2b8a0b, - 0x351304, - 0x257984, - 0x27cbc6, - 0x30e887, - 0x38b10a, - 0x2757c7, - 0x38c807, - 0x283305, - 0x200045, - 0x240909, - 0x38ec86, - 0x27564d, - 0x35af05, - 0x29f4c3, - 0x20ad83, - 0x34f785, - 0x347845, - 0x255908, - 0x280047, - 0x2d47c6, - 0x2a36c6, - 0x2296c5, - 0x231e47, - 0x202ac7, - 0x33f1c7, - 0x2d660a, - 0x2b4908, - 0x2b8bc4, - 0x254907, - 0x281607, - 0x3400c6, - 0x26f8c7, - 0x2eaa08, - 0x2e9e88, - 0x2abd86, - 0x2d1ec8, - 0x2008c4, - 0x22cb46, - 0x247d86, - 0x216646, - 0x3a8c46, - 0x22d9c4, - 0x255c06, - 0x2c31c6, - 0x29d406, - 0x235ec6, - 0x20ac46, - 0x2ea846, - 0x2d46c8, - 0x3af1c8, - 0x2d6e48, - 0x25b448, - 0x37f506, - 0x212485, - 0x2e2006, - 0x2b2105, - 0x388c87, - 0x216605, - 0x2136c3, - 0x203ec5, - 0x33fb44, - 0x20ad85, - 0x2266c3, - 0x338007, - 0x34bc88, - 0x351c06, - 0x32250d, - 0x27e306, - 0x29c985, - 0x2d9743, - 0x2be689, - 0x264b86, - 0x23c0c6, - 0x2a4ec4, - 0x250a87, - 0x233006, - 0x2b4545, - 0x234a83, - 0x207ac4, - 0x2817c6, - 0x2ded04, - 0x32b8c8, - 0x39ba49, - 0x24d849, - 0x2a4cca, - 0x387acd, - 0x208d07, - 0x224bc6, - 0x20a684, - 0x28b309, - 0x28a088, - 0x28c106, - 0x23dfc6, - 0x26f8c7, - 0x2b9a46, - 0x21f706, - 0x3ac246, - 0x3a110a, - 0x219b08, - 0x2464c5, - 0x26fd09, - 0x28568a, - 0x2fa988, - 0x2a0ec8, - 0x29bd48, - 0x2af08c, - 0x316305, - 0x2a3948, - 0x2e8e06, - 0x319746, - 0x3aea07, - 0x2756c5, - 0x287645, - 0x24d709, - 0x213487, - 0x302985, - 0x227487, - 0x20ad83, - 0x2c8485, - 0x20b8c8, - 0x25d647, - 0x2a0d89, - 0x2de405, - 0x307784, - 0x2a6508, - 0x363207, - 0x2cbe48, - 0x368c48, - 0x2dc805, - 0x304286, - 0x278686, - 0x2ac1c9, - 0x31c407, - 0x2b29c6, - 0x3b3907, - 0x221d03, - 0x247ac4, - 0x2a7885, - 0x231f84, - 0x383c84, - 0x286947, - 0x35bdc7, - 0x27fa44, - 0x2a0bd0, - 0x367c87, - 0x200045, - 0x2536cc, - 0x225344, - 0x2b1588, - 0x227b89, - 0x2b4e06, - 0x220d88, - 0x247344, - 0x247348, - 0x22ec86, - 0x235d48, - 0x2a1c06, - 0x2d328b, - 0x202385, - 0x2cb988, - 0x216ac4, - 0x39be8a, - 0x2a0d89, - 0x381346, - 0x218808, - 0x25ebc5, - 0x2b69c4, - 0x2b1486, - 0x33f088, - 0x285b88, - 0x340bc6, - 0x31d104, - 0x23cac6, - 0x3872c7, - 0x27db47, - 0x26f8cf, - 0x205547, - 0x362647, - 0x38eb45, - 0x352245, - 0x2a52c9, - 0x30e1c6, - 0x284045, - 0x2871c7, - 0x2c1108, - 0x29d505, - 0x272b06, - 0x222688, - 0x224f0a, - 0x2e13c8, - 0x28f187, - 0x249d06, - 0x26fcc6, - 0x20df43, - 0x218303, - 0x285849, - 0x377e09, - 0x2b0586, - 0x2de405, - 0x2163c8, - 0x218808, - 0x354dc8, - 0x3ac2cb, - 0x322747, - 0x30b249, - 0x26fb48, - 0x335844, - 0x349588, - 0x291409, - 0x2b2cc5, - 0x303a07, - 0x247b45, - 0x285a88, - 0x293e8b, - 0x29b550, - 0x2ae605, - 0x216a0c, - 0x2d4985, - 0x283383, - 0x29f386, - 0x2c0984, - 0x203cc6, - 0x2a1647, - 0x222704, - 0x24b388, - 0x2cf74d, - 0x35e245, - 0x208d44, - 0x233984, - 0x287bc9, - 0x2990c8, - 0x317647, - 0x22ed08, - 0x2862c8, - 0x27fb85, - 0x20f747, - 0x27fb07, - 0x238287, - 0x270f49, - 0x232e89, - 0x242d86, - 0x2bf606, - 0x26fb06, - 0x289845, - 0x39b744, - 0x3b0e86, - 0x3b5306, - 0x27fbc8, - 0x2d600b, - 0x26de87, - 0x20a684, - 0x364a46, - 0x367a47, - 0x34f0c5, - 0x263645, - 0x212dc4, - 0x232e06, - 0x3b0f08, - 0x28b309, - 0x252f86, - 0x289a48, - 0x2b4606, - 0x342708, - 0x34c34c, - 0x27fa46, - 0x29c64d, - 0x29cacb, - 0x253145, - 0x202c07, - 0x200946, - 0x3343c8, - 0x242e09, - 0x393c88, - 0x200045, - 0x2e2a87, - 0x284b88, - 0x358649, - 0x344106, - 0x252e8a, - 0x334148, - 0x393acb, - 0x3298cc, - 0x247448, - 0x280e46, - 0x303d08, - 0x3a8347, - 0x363489, - 0x29304d, - 0x29f986, - 0x21e608, - 0x3af089, - 0x2bfd08, - 0x2886c8, - 0x2c3a0c, - 0x2c5047, - 0x2c5507, - 0x270d85, - 0x31e5c7, - 0x2c0fc8, - 0x2b1506, - 0x2aaccc, - 0x2f55c8, - 0x2d0d88, - 0x2ba286, - 0x20de87, - 0x242f84, - 0x25b448, - 0x28f50c, - 0x353d0c, - 0x233cc5, - 0x2d2887, - 0x31d086, - 0x20de06, - 0x349ac8, - 0x2027c4, - 0x22d04b, - 0x27e8cb, - 0x249d06, - 0x2cf5c7, - 0x31a2c5, - 0x276545, - 0x22d186, - 0x25eb85, - 0x3512c5, - 0x2cd5c7, - 0x27d1c9, - 0x351904, - 0x34ee05, - 0x2e6fc5, - 0x2dea88, - 0x2287c5, - 0x2bca49, - 0x37aac7, - 0x37aacb, - 0x244806, - 0x2d4409, - 0x349208, - 0x27c385, - 0x238388, - 0x232ec8, - 0x23a6c7, - 0x2e2f87, - 0x2869c9, - 0x235c87, - 0x289149, - 0x2acf8c, - 0x2b0588, - 0x2b6189, - 0x321f87, - 0x286389, - 0x35bf07, - 0x3299c8, - 0x3a8285, - 0x22cac6, - 0x2c4a48, - 0x2f0fc8, - 0x285549, - 0x351307, - 0x276605, - 0x36b6c9, - 0x2b9ec6, - 0x2323c4, - 0x2323c6, - 0x24e8c8, - 0x252847, - 0x2d6208, - 0x2d1f89, - 0x3a1e07, - 0x2a29c6, - 0x202cc4, - 0x203f49, - 0x20f5c8, - 0x2ba147, - 0x343e06, - 0x20e1c6, - 0x3a8484, - 0x247f86, - 0x201b83, - 0x296789, - 0x202346, - 0x2d2205, - 0x2a36c6, - 0x24f305, - 0x285008, - 0x247187, - 0x244b46, - 0x39c6c6, - 0x309148, - 0x2a5447, - 0x29f9c5, - 0x2a09c8, - 0x3ada88, - 0x334148, - 0x2d4845, - 0x22cb46, - 0x24d609, - 0x2ac044, - 0x24f18b, - 0x21f40b, - 0x2463c9, - 0x20ad83, - 0x25bf05, - 0x213a86, - 0x313788, - 0x249844, - 0x351c06, - 0x2d6749, - 0x2bc545, - 0x2cd506, - 0x363206, - 0x2163c4, - 0x2aec0a, - 0x2d2148, - 0x2f0fc6, - 0x2c2585, - 0x3b1987, - 0x231147, - 0x304284, - 0x21f647, - 0x2165c4, - 0x2165c6, - 0x203c83, - 0x270f45, - 0x350e85, - 0x205788, - 0x254ac5, - 0x27f789, - 0x25b287, - 0x25b28b, - 0x2a758c, - 0x2a810a, - 0x3363c7, - 0x204083, - 0x212188, - 0x2d4a05, - 0x29d585, - 0x20ae44, - 0x3298c6, - 0x227b86, - 0x247fc7, - 0x2349cb, - 0x22d9c4, - 0x2e8f04, - 0x219e04, - 0x2cd786, - 0x222704, - 0x22c948, - 0x33c5c5, - 0x244d85, - 0x354d07, - 0x202d09, - 0x347845, - 0x37584a, - 0x277789, - 0x29810a, - 0x3a1249, - 0x335fc4, - 0x2c9605, - 0x2b9b48, - 0x2d18cb, - 0x278285, - 0x2f0086, - 0x2200c4, - 0x27fcc6, - 0x3a1c89, - 0x364b07, - 0x317988, - 0x387e46, - 0x387247, - 0x285b88, - 0x380946, - 0x37f0c4, - 0x363f87, - 0x366085, - 0x377547, - 0x25b4c4, - 0x2008c6, - 0x2f1e08, - 0x29cc88, - 0x2e88c7, - 0x27d548, - 0x29ae05, - 0x20abc4, - 0x361c88, - 0x27d644, - 0x2186c5, - 0x2fac44, - 0x3675c7, - 0x28d207, - 0x2864c8, - 0x2cbfc6, - 0x254a45, - 0x27f588, - 0x2e15c8, - 0x2a4c09, - 0x21f706, - 0x22e708, - 0x39bd0a, - 0x34f148, - 0x2e8605, - 0x2e2206, - 0x277648, - 0x2e2b4a, - 0x20b387, - 0x28a645, - 0x298888, - 0x2b3c44, - 0x272206, - 0x2c5888, - 0x20ac46, - 0x239a88, - 0x29bfc7, - 0x209806, - 0x2ba844, - 0x28ba07, - 0x2b6804, - 0x3a1c47, - 0x23bf0d, - 0x21b585, - 0x2d144b, - 0x2a1d06, - 0x255788, - 0x24b344, - 0x27bc86, - 0x2817c6, - 0x304047, - 0x29c30d, - 0x226dc7, - 0x2b6d48, - 0x271a05, - 0x27f048, - 0x2c7ec6, - 0x29ae88, - 0x223a06, - 0x26a9c7, - 0x336689, - 0x33d2c7, - 0x28c3c8, - 0x279685, - 0x21c848, - 0x20dd45, - 0x396005, - 0x3a14c5, - 0x221443, - 0x235984, - 0x26fd05, - 0x2346c9, - 0x285f86, - 0x2eab08, - 0x2e2d45, - 0x2b8847, - 0x2aee8a, - 0x2cd449, - 0x2c98ca, - 0x2d6ec8, - 0x2272cc, - 0x28724d, - 0x2ff683, - 0x239988, - 0x207a85, - 0x224cc6, - 0x319346, - 0x2e7f05, - 0x3b3a09, - 0x358f45, - 0x27f588, - 0x2841c6, - 0x348806, - 0x2a63c9, - 0x38f247, - 0x294146, - 0x2aee08, - 0x216548, - 0x2e0dc7, - 0x235ece, - 0x2c8105, - 0x358545, - 0x20ab48, - 0x27f3c7, - 0x20e202, - 0x2c3584, - 0x203bca, - 0x2ba208, - 0x367b46, - 0x29e608, - 0x278686, - 0x31a7c8, - 0x2b29c8, - 0x395fc4, - 0x2b8d85, - 0x68a8c4, - 0x68a8c4, - 0x68a8c4, - 0x202403, - 0x20e046, - 0x27fa46, - 0x2a220c, - 0x209843, - 0x285686, - 0x215344, - 0x264b08, - 0x2d6585, - 0x203cc6, - 0x2bedc8, - 0x2d8206, - 0x244ac6, - 0x381148, - 0x2a7907, - 0x235a49, - 0x2d4bca, - 0x208a84, - 0x216605, - 0x2a70c5, - 0x264886, - 0x208d46, - 0x2a2dc6, - 0x2f9ec6, - 0x235b84, - 0x235b8b, - 0x231144, - 0x2a23c5, - 0x2b19c5, - 0x203086, - 0x3b5548, - 0x287107, - 0x317744, - 0x2453c3, - 0x2b3745, - 0x30a847, - 0x28700b, - 0x205687, - 0x2becc8, - 0x2e8b47, - 0x231646, - 0x24d1c8, - 0x2e318b, - 0x2067c6, - 0x213bc9, - 0x2e3305, - 0x30d803, - 0x2cd506, - 0x29bec8, - 0x214cc3, - 0x200a03, - 0x285b86, - 0x278686, - 0x375dca, - 0x280e85, - 0x28160b, - 0x2a360b, - 0x245103, - 0x202043, - 0x2b4f84, - 0x278447, - 0x247444, - 0x202ec4, - 0x2e8c84, - 0x34f448, - 0x2c24c8, - 0x3b2049, - 0x38e748, - 0x200c07, - 0x235ec6, - 0x2ea74f, - 0x2c8246, - 0x2d6504, - 0x2c230a, - 0x30a747, - 0x208386, - 0x292e89, - 0x3b1fc5, - 0x2058c5, - 0x3b2106, - 0x21c983, - 0x2b3c89, - 0x219c86, - 0x212009, - 0x38b106, - 0x270f45, - 0x2340c5, - 0x205543, - 0x278588, - 0x211607, - 0x3028c4, - 0x264988, - 0x2313c4, - 0x338d86, - 0x29f386, - 0x2419c6, - 0x2cb849, - 0x29d505, - 0x38ec86, - 0x2a2fc9, - 0x2c7606, - 0x2ea846, - 0x386e86, - 0x200b45, - 0x2fac46, - 0x26a9c4, - 0x3a8285, - 0x2c4a44, - 0x2b7846, - 0x35aec4, - 0x20f843, - 0x28a145, - 0x232bc8, - 0x2e9687, - 0x2bd949, - 0x28a548, - 0x29dc51, - 0x36328a, - 0x249c47, - 0x2ea1c6, - 0x215344, - 0x2c4b48, - 0x282f48, - 0x29de0a, - 0x2bc80d, - 0x2a4dc6, - 0x381246, - 0x28bac6, - 0x2c3fc7, - 0x2b6e05, - 0x262c07, - 0x264a45, - 0x37ac04, - 0x2ad586, - 0x216287, - 0x2b398d, - 0x277587, - 0x21a0c8, - 0x27f889, - 0x2e2106, - 0x344085, - 0x226704, - 0x24e9c6, - 0x304186, - 0x2ba386, - 0x29ee88, - 0x2179c3, - 0x203043, - 0x3598c5, - 0x2300c6, - 0x2b2985, - 0x388048, - 0x2a180a, - 0x2cee04, - 0x264b08, - 0x29bd48, - 0x202ec7, - 0x2e2e09, - 0x2be9c8, - 0x28b387, - 0x2936c6, - 0x20ac4a, - 0x24ea48, - 0x396449, - 0x299188, - 0x21cec9, - 0x2ea087, - 0x2effc5, - 0x3ac4c6, - 0x2b1388, - 0x285d08, - 0x2a1048, - 0x249e08, - 0x2a23c5, - 0x20f444, - 0x211308, - 0x208484, - 0x3a1044, - 0x270f45, - 0x297a87, - 0x202ac9, - 0x303e47, - 0x215f45, - 0x27cdc6, - 0x34ebc6, - 0x203d44, - 0x2a6706, - 0x254884, - 0x27ef46, - 0x202886, - 0x214b06, - 0x200045, - 0x387f07, - 0x204083, - 0x206b49, - 0x308f48, - 0x264984, - 0x28b20d, - 0x29cd88, - 0x3053c8, - 0x3963c6, - 0x336789, - 0x2cd449, - 0x3a1985, - 0x2a190a, - 0x2adb4a, - 0x2af7cc, - 0x2af946, - 0x27d9c6, - 0x2c83c6, - 0x273209, - 0x224f06, - 0x262c46, - 0x359006, - 0x25b448, - 0x27d546, - 0x2d36cb, - 0x297c05, - 0x244d85, - 0x27dc45, - 0x366f46, - 0x20ac03, - 0x241946, - 0x277507, - 0x2c4a05, - 0x24c705, - 0x3645c5, - 0x327346, - 0x31da84, - 0x31da86, - 0x3add49, - 0x366dcc, - 0x37a948, - 0x33f004, - 0x2fa886, - 0x2a1e06, - 0x29bec8, - 0x218808, - 0x366cc9, - 0x3b1987, - 0x245989, - 0x254106, - 0x22c2c4, - 0x20bf04, - 0x286cc4, - 0x285b88, - 0x20290a, - 0x3477c6, - 0x352107, - 0x36f007, - 0x2d4505, - 0x2a7084, - 0x2913c6, - 0x2b6e46, - 0x202803, - 0x308d87, - 0x368b48, - 0x3a1aca, - 0x2ce348, - 0x2cec88, - 0x35af05, - 0x253245, - 0x26df85, - 0x2d48c6, - 0x33d4c6, - 0x35bd05, - 0x2969c9, - 0x2a6e8c, - 0x26e047, - 0x29de88, - 0x381a45, - 0x68a8c4, - 0x24df84, - 0x25d784, - 0x214486, - 0x2a450e, - 0x205947, - 0x2c41c5, - 0x2abfcc, - 0x231287, - 0x216207, - 0x218089, - 0x218f89, - 0x28a645, - 0x308f48, - 0x24d609, - 0x334005, - 0x2c4948, - 0x322906, - 0x361f06, - 0x2e4444, - 0x2ae848, - 0x251f43, - 0x303084, - 0x2b37c5, - 0x3ac0c7, - 0x210445, - 0x39bbc9, - 0x28aa8d, - 0x299886, - 0x245404, - 0x2937c8, - 0x27d00a, - 0x224107, - 0x23be45, - 0x203143, - 0x2a37ce, - 0x27868c, - 0x2faa87, - 0x2a46c7, - 0x203c03, - 0x224f45, - 0x25d785, - 0x29e9c8, - 0x29bb89, - 0x33ef06, - 0x247444, - 0x249b86, - 0x21e3cb, - 0x2cd1cc, - 0x221507, - 0x2d5c45, - 0x3ad988, - 0x2e0b85, - 0x2c2307, - 0x3630c7, - 0x251f45, - 0x20ac03, - 0x39a644, - 0x212905, - 0x351805, - 0x351806, - 0x34fd08, - 0x216287, - 0x319646, - 0x35c106, - 0x3a1406, - 0x2d5e89, - 0x20f847, - 0x26a5c6, - 0x2cd346, - 0x252006, - 0x2aeb45, - 0x219646, - 0x3768c5, - 0x228848, - 0x2973cb, - 0x291086, - 0x36f044, - 0x2e2909, - 0x25b284, - 0x322888, - 0x2324c7, - 0x2885c4, - 0x2be288, - 0x2c5304, - 0x2aeb84, - 0x28b145, - 0x35e286, - 0x34f387, - 0x239b43, - 0x2a2a85, - 0x322e84, - 0x358586, - 0x3a1a08, - 0x368885, - 0x297089, - 0x3363c5, - 0x2e1e88, - 0x215207, - 0x388dc8, - 0x2bd787, - 0x362709, - 0x255a86, - 0x32b3c6, - 0x359004, - 0x293605, - 0x30150c, - 0x27dc47, - 0x27e207, - 0x36eec8, - 0x299886, - 0x277444, - 0x32e344, - 0x286849, - 0x2c84c6, - 0x240987, - 0x3a8bc4, - 0x286086, - 0x343905, - 0x2cbb07, - 0x2d3646, - 0x252d49, - 0x2aab07, - 0x26f8c7, - 0x2a6246, - 0x3879c5, - 0x283988, - 0x219b08, - 0x2646c6, - 0x3688c5, - 0x261b06, - 0x209983, - 0x29e849, - 0x2a2b4e, - 0x2bd488, - 0x2314c8, - 0x2644cb, - 0x2972c6, - 0x2089c4, - 0x244ac4, - 0x2a2c4a, - 0x216907, - 0x26a685, - 0x213bc9, - 0x2c3285, - 0x3a1087, - 0x2b4c04, - 0x284487, - 0x2e65c8, - 0x2cb206, - 0x21e789, - 0x2beaca, - 0x216886, - 0x29c8c6, - 0x2b1945, - 0x37ccc5, - 0x31a107, - 0x24dd08, - 0x343848, - 0x395fc6, - 0x234145, - 0x208ace, - 0x2b8bc4, - 0x264645, - 0x27c749, - 0x30dfc8, - 0x28f0c6, - 0x2a04cc, - 0x2a1410, - 0x2a414f, - 0x2a51c8, - 0x3363c7, - 0x200045, - 0x26fd05, - 0x34f209, - 0x298a89, - 0x23cbc6, - 0x278307, - 0x2d2805, - 0x21b509, - 0x340146, - 0x224d4d, - 0x286b89, - 0x202ec4, - 0x2bd208, - 0x2113c9, - 0x347986, - 0x27cec5, - 0x32b3c6, - 0x317849, - 0x26ba08, - 0x212485, - 0x2ae844, - 0x2a068b, - 0x347845, - 0x2a07c6, - 0x287586, - 0x26ed86, - 0x287fcb, - 0x297189, - 0x35c045, - 0x388b87, - 0x363206, - 0x220f06, - 0x25d508, - 0x35e389, - 0x219e8c, - 0x30a648, - 0x360406, - 0x340bc3, - 0x303c06, - 0x287e05, - 0x281948, - 0x233b46, - 0x2cbd48, - 0x275845, - 0x29dfc5, - 0x215348, - 0x31a947, - 0x319287, - 0x247fc7, - 0x220d88, - 0x336508, - 0x31e4c6, - 0x2b7687, - 0x247987, - 0x287cca, - 0x254003, - 0x366f46, - 0x202a45, - 0x203bc4, - 0x27f889, - 0x362684, - 0x2a7e44, - 0x2a1c84, - 0x2a46cb, - 0x211547, - 0x208d05, - 0x29ab08, - 0x27cdc6, - 0x27cdc8, - 0x280dc6, - 0x2900c5, - 0x290385, - 0x291f46, - 0x292b08, - 0x292dc8, - 0x27fa46, - 0x29a94f, - 0x29e310, - 0x3b1785, - 0x204083, - 0x22c385, - 0x30b188, - 0x298989, - 0x334148, - 0x2d5d08, - 0x224788, - 0x211607, - 0x27ca89, - 0x2cbf48, - 0x25bd44, - 0x2a1b08, - 0x2deb49, - 0x2b81c7, - 0x29f904, - 0x303f08, - 0x387cca, - 0x2ebe06, - 0x2a4dc6, - 0x21f5c9, - 0x2a1647, - 0x2ce1c8, - 0x30cc88, - 0x3a8a48, - 0x356245, - 0x37dc45, - 0x244d85, - 0x25d745, - 0x37e287, - 0x20ac05, - 0x2c4a05, - 0x2b5546, - 0x334087, - 0x2d1807, - 0x387fc6, - 0x2d7405, - 0x2a07c6, - 0x212245, - 0x2b84c8, - 0x2f1d84, - 0x2c7686, - 0x343744, - 0x2b69c8, - 0x2c778a, - 0x28004c, - 0x234bc5, - 0x2c4086, - 0x21a046, - 0x368706, - 0x30b384, - 0x343bc5, - 0x280c07, - 0x2a16c9, - 0x2cdc87, - 0x68a8c4, - 0x68a8c4, - 0x3175c5, - 0x32dd04, - 0x29fe8a, - 0x27cc46, - 0x24d404, - 0x208305, - 0x37a545, - 0x2b6d44, - 0x2871c7, - 0x36b847, - 0x2cd788, - 0x368ec8, - 0x212489, - 0x340248, - 0x2a004b, - 0x250b44, - 0x221005, - 0x2840c5, - 0x247f49, - 0x35e389, - 0x2e2808, - 0x232248, - 0x203084, - 0x2a1e45, - 0x202943, - 0x264845, - 0x38ed06, - 0x29b9cc, - 0x20f4c6, - 0x247246, - 0x28f345, - 0x3273c8, - 0x2bd606, - 0x2ea346, - 0x2a4dc6, - 0x2297cc, - 0x2ba544, - 0x3a154a, - 0x28f288, - 0x29b807, - 0x322d86, - 0x33efc7, - 0x2f2185, - 0x343e06, - 0x34af86, - 0x356707, - 0x2be7c4, - 0x3676c5, - 0x27c744, - 0x37ac87, - 0x27c988, - 0x27d84a, - 0x284a07, - 0x2d22c7, - 0x336347, - 0x2e0cc9, - 0x29b9ca, - 0x219e43, - 0x2e9645, - 0x200c83, - 0x2e8cc9, - 0x26ac48, - 0x38eb47, - 0x334249, - 0x219c06, - 0x2d4108, - 0x337f85, - 0x2e16ca, - 0x2d8c49, - 0x2abc49, - 0x3aea07, - 0x283049, - 0x214a08, - 0x3568c6, - 0x2c4248, - 0x217b07, - 0x235c87, - 0x277787, - 0x2d2688, - 0x2fa706, - 0x387a85, - 0x280c07, - 0x29c3c8, - 0x3436c4, - 0x30e3c4, - 0x294047, - 0x2b2d47, - 0x24d48a, - 0x356846, - 0x330f0a, - 0x2c34c7, - 0x2b8987, - 0x257e44, - 0x289204, - 0x2d3546, - 0x3b3d44, - 0x3b3d4c, - 0x203505, - 0x218649, - 0x2dfc44, - 0x2b6e05, - 0x27cf88, - 0x292e85, - 0x375846, - 0x217f84, - 0x3ae3ca, - 0x32b7c6, - 0x2a68ca, - 0x237f07, - 0x2d3385, - 0x21c985, - 0x2d454a, - 0x2a6805, - 0x2a4cc6, - 0x208484, - 0x2b5106, - 0x31a1c5, - 0x233c06, - 0x2e88cc, - 0x2cd90a, - 0x2936c4, - 0x235ec6, - 0x2a1647, - 0x2d5204, - 0x25b448, - 0x38e5c6, - 0x208949, - 0x2bb109, - 0x2b0689, - 0x24f346, - 0x217c06, - 0x2c4387, - 0x296908, - 0x217a09, - 0x211547, - 0x29ac86, - 0x3872c7, - 0x28b985, - 0x2b8bc4, - 0x2c3f47, - 0x247b45, - 0x28b085, - 0x235247, - 0x251e08, - 0x3ad906, - 0x29d24d, - 0x29ebcf, - 0x2a360d, - 0x215f84, - 0x232cc6, - 0x2d91c8, - 0x358fc5, - 0x287e88, - 0x23a58a, - 0x202ec4, - 0x21e946, - 0x239607, - 0x22d9c7, - 0x2a79c9, - 0x2c4205, - 0x2b6d44, - 0x2b8cca, - 0x2be589, - 0x283147, - 0x272086, - 0x347986, - 0x2a1d86, - 0x364046, - 0x2d890f, - 0x2d9089, - 0x27d546, - 0x282e46, - 0x32fd89, - 0x2b7787, - 0x226743, - 0x229946, - 0x218303, - 0x2e7dc8, - 0x387107, - 0x2a53c9, - 0x29f208, - 0x3193c8, - 0x351446, - 0x20f409, - 0x23c1c5, - 0x2b7844, - 0x2a73c7, - 0x273285, - 0x215f84, - 0x208dc8, - 0x216bc4, - 0x2b74c7, - 0x34bc06, - 0x2b3045, - 0x299188, - 0x34784b, - 0x319c07, - 0x2d47c6, - 0x2c82c4, - 0x32d146, - 0x270f45, - 0x247b45, - 0x283709, - 0x286dc9, - 0x235cc4, - 0x235d05, - 0x235f05, - 0x2e1546, - 0x309048, - 0x2c2c46, - 0x36898b, - 0x2b4c8a, - 0x2b6905, - 0x290406, - 0x3025c5, - 0x2e0a45, - 0x2ab6c7, - 0x3ac808, - 0x245984, - 0x26c586, - 0x292e46, - 0x214bc7, - 0x30d7c4, - 0x2817c6, - 0x2b9f85, - 0x2b9f89, - 0x2135c4, - 0x2a7209, - 0x27fa46, - 0x2c5108, - 0x235f05, - 0x36f105, - 0x233c06, - 0x219d89, - 0x218f89, - 0x2472c6, - 0x30e0c8, - 0x28abc8, - 0x302584, - 0x2b9004, - 0x2b9008, - 0x3269c8, - 0x245a89, - 0x38ec86, - 0x2a4dc6, - 0x320c0d, - 0x351c06, - 0x34c209, - 0x23d1c5, - 0x3b2106, - 0x262d48, - 0x31d9c5, - 0x2479c4, - 0x270f45, - 0x2866c8, - 0x29fc49, - 0x27c804, - 0x2008c6, - 0x39660a, - 0x2fa988, - 0x24d609, - 0x244c4a, - 0x3341c6, - 0x29ed88, - 0x2c20c5, - 0x2c0e48, - 0x2bd885, - 0x219ac9, - 0x36bd09, - 0x203602, - 0x2e3305, - 0x276286, - 0x27f987, - 0x295705, - 0x2f0ec6, - 0x306288, - 0x299886, - 0x2b9a09, - 0x27e306, - 0x25d388, - 0x2afb85, - 0x25c586, - 0x26aac8, - 0x285b88, - 0x2e9f88, - 0x347b08, - 0x219644, - 0x209fc3, - 0x2b9c44, - 0x249b06, - 0x28b9c4, - 0x231407, - 0x2ea249, - 0x2c7a05, - 0x30cc86, - 0x229946, - 0x34fb4b, - 0x2b6846, - 0x20edc6, - 0x2cb6c8, - 0x24c646, - 0x2bcb03, - 0x2080c3, - 0x2b8bc4, - 0x22e605, - 0x2b4447, - 0x27c988, - 0x27c98f, - 0x280b0b, - 0x308e48, - 0x200946, - 0x30914e, - 0x233c03, - 0x2b43c4, - 0x2b67c5, - 0x2b6bc6, - 0x2914cb, - 0x297b46, - 0x222709, - 0x2b3045, - 0x38a208, - 0x211d88, - 0x218e4c, - 0x2a4706, - 0x264886, - 0x2de405, - 0x28c188, - 0x26aac5, - 0x335848, - 0x2a084a, - 0x2a3a49, - 0x68a8c4, - 0x3760d1c2, - 0x15f048, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x368883, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x2964c4, - 0x204ac3, - 0x200383, - 0x210e03, - 0x24ae04, - 0x2d0783, - 0x23a184, - 0x231b83, - 0x2da904, - 0x332ec3, - 0x2959c7, - 0x20fbc3, - 0x20abc3, - 0x2842c8, - 0x200383, - 0x2b400b, - 0x2f2a03, - 0x2716c6, - 0x205bc2, - 0x26b44b, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x200383, - 0x200e03, - 0x203383, - 0x204cc2, - 0x15f048, - 0x325b45, - 0x247bc8, - 0x2ec408, - 0x20d1c2, - 0x329dc5, - 0x39c307, - 0x2001c2, - 0x24b587, - 0x208a42, - 0x246f87, - 0x239ec9, - 0x2c1c88, - 0x3a88c9, - 0x338b02, - 0x270647, - 0x2abac4, - 0x39c3c7, - 0x2b4b87, - 0x24ca02, - 0x20fbc3, - 0x20b602, - 0x202082, - 0x200382, - 0x217902, - 0x200e02, - 0x20c4c2, - 0x2af685, - 0x24dec5, - 0xd1c2, - 0x31b83, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x117c3, - 0x701, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x2964c4, - 0x204303, - 0x204ac3, - 0x200383, + 0x207043, + 0x26ff44, + 0x324dc3, + 0x30c683, + 0x21dec3, + 0x379b43, + 0xaa2d183, + 0x2374c4, + 0x21de83, + 0x232383, + 0x2343c3, + 0x234103, + 0x208143, + 0x2a3ec3, + 0x30c603, + 0x228103, + 0x212103, + 0x24c1c4, + 0x23aa82, + 0x252a43, + 0x2585c3, + 0x272bc3, + 0x250b43, + 0x24f8c3, + 0x21eb03, + 0x2db983, + 0x220883, + 0x201603, + 0x210483, + 0x2f2903, + 0xaefe5c3, + 0x385d43, + 0x200983, + 0x2348c3, + 0x211003, + 0x21e442, + 0x286fc3, + 0x238483, + 0x16025c3, + 0x217e83, + 0x21da43, + 0x29af43, + 0x2264c3, + 0x30e803, 0x21bd03, - 0x3a40d686, - 0x5e303, - 0x854c5, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x20d1c2, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x8082, - 0x15f048, - 0x4dcc4, - 0xe0f85, - 0x204cc2, - 0x2cfa44, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x236d03, - 0x2b0405, - 0x204303, - 0x205d83, - 0x204ac3, - 0x2104c3, - 0x200383, - 0x213e83, - 0x24ae83, - 0x24abc3, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x20d1c2, - 0x200383, - 0x15f048, - 0x332ec3, - 0x15f048, - 0x26ae03, - 0x2d0783, - 0x22ef04, - 0x231b83, - 0x332ec3, - 0x20a3c2, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x20a3c2, - 0x22d603, - 0x204ac3, - 0x200383, - 0x2ec383, - 0x213e83, - 0x204cc2, - 0x20d1c2, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x2716c5, - 0x1540c6, - 0x24ae04, - 0x205bc2, - 0x15f048, - 0x204cc2, - 0x1d508, - 0x20d1c2, - 0x97606, - 0x1681c4, - 0x16e1cb, - 0x3dc06, - 0xfcc7, - 0x231b83, - 0x332ec3, - 0x15ae05, - 0x19c804, - 0x221543, - 0x53fc7, - 0xdc304, - 0x204ac3, - 0x94fc4, - 0x200383, - 0x2f39c4, - 0xfe588, - 0x125886, - 0x114f85, - 0x20d1c2, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x20fbc3, - 0x20abc3, - 0x200383, - 0x2f2a03, - 0x205bc2, - 0x15f048, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204143, - 0x213184, - 0x204ac3, - 0x200383, - 0x2d0783, - 0x231b83, - 0x2da904, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x2716c6, - 0x231b83, - 0x332ec3, - 0x178ac3, - 0x200383, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0xfcc7, - 0x15f048, - 0x332ec3, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x40ed0783, - 0x231b83, - 0x204ac3, - 0x200383, - 0x15f048, - 0x204cc2, - 0x20d1c2, - 0x2d0783, - 0x332ec3, - 0x204ac3, - 0x200382, - 0x200383, - 0x316e47, - 0x23860b, - 0x2396c3, - 0x24be08, - 0x296687, - 0x225246, - 0x2c6145, - 0x373549, - 0x20f948, - 0x260d09, - 0x260d10, - 0x35d28b, - 0x385989, - 0x209303, - 0x2b5649, - 0x230806, - 0x23080c, - 0x260f08, - 0x3ae848, - 0x35d7c9, - 0x2a5d0e, - 0x20780b, - 0x2eb20c, - 0x205283, - 0x26cc4c, - 0x205289, - 0x257a87, - 0x231acc, - 0x36aa8a, - 0x24fe44, - 0x393f4d, - 0x26cb08, - 0x210e0d, - 0x272746, - 0x29258b, - 0x31a3c9, - 0x23d087, - 0x339606, - 0x349d89, - 0x38ce8a, - 0x37a0c8, - 0x2f24c4, - 0x34ecc7, - 0x3ac5c7, - 0x3a8dc4, - 0x32d984, - 0x237209, - 0x2ceac9, - 0x237908, - 0x210b85, - 0x392545, - 0x20aa06, - 0x393e09, - 0x23a80d, - 0x2eac88, - 0x20a907, - 0x2c61c8, - 0x382986, - 0x37ed04, - 0x359b85, - 0x202246, - 0x203204, - 0x205187, - 0x206d8a, - 0x211cc4, - 0x2167c6, - 0x2182c9, - 0x2182cf, - 0x2197cd, - 0x21a486, - 0x21d110, - 0x21d506, - 0x21dc47, - 0x21ebc7, - 0x21ebcf, - 0x21f889, - 0x2242c6, - 0x226487, - 0x226488, - 0x227649, - 0x2b3108, - 0x2e7907, - 0x20a203, - 0x378c86, - 0x3abf08, - 0x2a5fca, - 0x21fe49, - 0x20fa83, - 0x39c206, - 0x26c3ca, - 0x2fca47, - 0x2578ca, - 0x26a24e, - 0x21f9c6, - 0x2e3507, - 0x227086, - 0x201806, - 0x37da4b, - 0x30c58a, - 0x317ecd, - 0x217cc7, - 0x359188, - 0x359189, - 0x35918f, - 0x20e28c, - 0x281bc9, - 0x2e928e, - 0x295aca, - 0x3035c6, - 0x2fbbc6, - 0x3b06cc, - 0x3106cc, - 0x311448, - 0x33d1c7, - 0x25b7c5, - 0x2251c4, - 0x2438ce, - 0x38d104, - 0x257bc7, - 0x26d08a, - 0x36e914, - 0x373a4f, - 0x21ed88, - 0x378b48, - 0x357e8d, - 0x357e8e, - 0x3823c9, - 0x3a5b08, - 0x3a5b0f, - 0x2317cc, - 0x2317cf, - 0x232a07, - 0x23acca, - 0x21cc4b, - 0x23bcc8, - 0x23e5c7, - 0x264f4d, - 0x3151c6, - 0x394106, - 0x2417c9, - 0x259888, - 0x24c108, - 0x24c10e, - 0x238707, - 0x226985, - 0x24da85, - 0x205e04, - 0x225506, - 0x237808, - 0x260183, - 0x2efb8e, - 0x265308, - 0x2f198b, - 0x26afc7, - 0x395e05, - 0x26cdc6, - 0x2b0e07, - 0x307048, - 0x319f09, - 0x298fc5, - 0x28a188, - 0x217306, - 0x3a02ca, - 0x2437c9, - 0x231b89, - 0x231b8b, - 0x201148, - 0x3a8c89, - 0x210c46, - 0x22c54a, - 0x2b7f4a, - 0x23aecc, - 0x3acb87, - 0x2c1a8a, - 0x328ecb, - 0x328ed9, - 0x30fa48, - 0x271745, - 0x265106, - 0x258fc9, - 0x261cc6, - 0x21324a, - 0x20fb46, - 0x201e44, - 0x2c9ecd, - 0x201e47, - 0x20b549, - 0x383305, - 0x24e548, - 0x24ee89, - 0x24f0c4, - 0x24fd47, - 0x24fd48, - 0x250287, - 0x26ea08, - 0x2545c7, - 0x35c2c5, - 0x25c70c, - 0x25cf49, - 0x2c4dca, - 0x38f0c9, - 0x2b5749, - 0x2739cc, - 0x263e0b, - 0x2640c8, - 0x265688, - 0x268a44, + 0x2ad283, + 0x2f6a83, + 0x2e8883, + 0x21d445, + 0x215cc3, + 0x2e88c3, + 0x39c083, + 0x218744, + 0x25b343, + 0x22e8c3, + 0x277c03, + 0x20b443, + 0x221e42, + 0x23a183, + 0x2f9b84, + 0x2ae9c4, + 0x244843, + 0x880c8, + 0x882, + 0x1002, + 0x2e02, + 0x1482, + 0x2d42, + 0x4c2, + 0x44682, + 0x202, + 0x1f82, + 0x982, + 0x43742, + 0xe842, + 0xe02, + 0x7a82, + 0x93d42, + 0x6d42, + 0x26282, + 0x7442, + 0x1f882, + 0x8b02, + 0x4b42, + 0x1c882, + 0x13c2, + 0x17642, + 0x1402, + 0xdfc2, + 0x6ec2, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x216582, + 0x2264c3, + 0xc22d183, + 0x21eb03, + 0x211003, + 0x223b42, + 0x880c8, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x6c2, + 0x202f02, + 0x223f42, + 0x880c8, + 0x16582, + 0x235f82, + 0x203142, + 0x23e682, + 0x201642, + 0x208382, + 0x51f05, + 0x2029c2, + 0x202282, + 0x203382, + 0x205d02, + 0x206d42, + 0x385542, + 0x201882, + 0x227642, + 0x16e747, + 0x119d4d, + 0xeafc9, + 0x47b8b, + 0xd1e88, + 0x13bc89, + 0x21eb03, + 0x880c8, + 0x880c8, + 0x53e06, + 0x200882, + 0x224104, + 0x216582, + 0x22d183, + 0x201a42, + 0x2343c3, + 0x201f82, + 0x22d684, + 0x202243, + 0x209782, + 0x238483, + 0x201502, + 0x2264c3, + 0x241f86, + 0x30d40f, + 0x6fef43, + 0x880c8, + 0x216582, + 0x211cc3, + 0x21eb03, + 0x211003, + 0x1568ecb, + 0x16e747, + 0x216582, + 0x22d183, + 0x21eb03, + 0x238483, + 0x200882, + 0x201102, + 0x2093c2, + 0xfa2d183, + 0x23e4c2, + 0x2343c3, + 0x2475c2, + 0x227982, + 0x21eb03, + 0x21c2c2, + 0x301dc2, + 0x2a7fc2, + 0x201142, + 0x289f82, + 0x206982, + 0x200902, + 0x205e82, + 0x26a242, + 0x204d42, + 0x2ad802, + 0x230cc2, + 0x225a02, + 0x228f02, + 0x211003, + 0x203042, + 0x238483, + 0x2425c2, + 0x267c02, + 0x2264c3, + 0x248102, + 0x217642, + 0x20a442, + 0x202482, + 0x2168c2, + 0x2d29c2, + 0x210442, + 0x242d42, + 0x221bc2, + 0x301e0a, + 0x34600a, + 0x38074a, + 0x3b4682, + 0x20d802, + 0x23c282, + 0xff49009, + 0x103a418a, + 0x1042fe87, + 0xc002, + 0x1a418a, + 0x245dc4, + 0x10e2d183, + 0x2343c3, + 0x247344, + 0x21eb03, + 0x201604, + 0x202243, + 0x211003, + 0x238483, + 0x2025c3, + 0x2264c3, + 0x215cc3, + 0x223ec3, + 0x880c8, + 0x1450c84, + 0x50505, + 0x4e80a, + 0x109842, + 0x18b406, + 0x162d51, + 0x11749009, + 0x163187, + 0x4802, + 0x1aa80a, + 0xdb7c7, + 0x880c8, + 0xfd948, + 0xe707, + 0x1281c44b, + 0x15802, + 0x1a6707, + 0x1b1a4a, + 0x10728f, + 0x131b4f, + 0x1dec2, + 0x16582, + 0xa3e08, + 0xea70a, + 0x167408, + 0xf82, + 0x10700f, + 0x124e4b, + 0x2988, + 0x16e847, + 0x16a8a, + 0xae14b, + 0x112089, + 0x173507, + 0xf424c, + 0x10ec87, + 0xd060a, + 0x132d48, + 0x8e28e, + 0x553ce, + 0xdb60b, + 0x110d8b, + 0xead0b, + 0x1e1c9, + 0x1fb8b, + 0x2398d, + 0x260cb, + 0x2708d, + 0x2c90d, + 0x2ec8a, + 0xae80b, + 0xc6fcb, + 0xe82c5, + 0x10a710, + 0x8128f, + 0xb74f, + 0x2a24d, + 0x6fd50, + 0xd82, + 0x12fa2488, + 0x131948, + 0x132e4bc5, + 0x4668b, + 0x52088, + 0x110f4a, + 0x58d89, + 0x60587, + 0x608c7, + 0x60a87, + 0x611c7, + 0x629c7, + 0x62f47, + 0x636c7, + 0x63d47, + 0x64307, + 0x644c7, + 0x66087, + 0x66247, + 0x66407, + 0x665c7, + 0x668c7, + 0x66e07, + 0x67a47, + 0x67f07, + 0x68707, + 0x69207, + 0x693c7, + 0x699c7, + 0x69e87, + 0x6a087, + 0x6a347, + 0x6a507, + 0x6a6c7, + 0x6ac07, + 0x6b4c7, + 0x6bf87, + 0x6c687, + 0x6c947, + 0x6ce07, + 0x6cfc7, + 0x6d347, + 0x6e3c7, + 0x6ea07, + 0x6ee07, + 0x6efc7, + 0x6f187, + 0x6f5c7, + 0x70307, + 0x70607, + 0x70c07, + 0x70dc7, + 0x71147, + 0x71587, + 0xd382, + 0x33d8a, + 0xf9dc7, + 0x134c87cb, + 0x14c87d6, + 0x18351, + 0xdfb8a, + 0xa3c8a, + 0x53e06, + 0xc114b, + 0xb2c2, + 0x31ad1, + 0x959c9, + 0x90ac9, + 0x5e82, + 0x9c34a, + 0xa5449, + 0xa5c8f, + 0xa688e, + 0xa7188, + 0xf1c2, + 0x169a89, + 0x8498e, + 0xac64c, + 0xd400f, + 0x194a8e, + 0x1098c, + 0x15309, + 0x16451, + 0x19a48, + 0x2bd52, + 0x2e5cd, + 0x393cd, + 0x13ff8b, + 0x179d95, + 0x33c49, + 0x5488a, + 0x58749, + 0x5fe90, + 0x60f0b, + 0x6e54f, + 0x71d0b, + 0x756cc, + 0x787d0, + 0x8660a, + 0x86e8d, + 0x14ea0e, + 0x18004a, + 0x8c7cc, + 0x8fa54, + 0x95651, + 0x98f8b, + 0x9b54f, + 0xab6cd, + 0xabfce, + 0x12c10c, + 0x15710c, + 0xdc8cb, + 0xeef8e, + 0xfb250, + 0x10938b, + 0x11270d, + 0x15f28f, + 0xb504c, + 0xb824e, + 0xb8a51, + 0xba84c, + 0x1362c7, + 0x11c60d, + 0xbe94c, + 0xc4d90, + 0xd35cd, + 0xe7847, + 0xec4d0, + 0xf0688, + 0xf124b, + 0x17318f, + 0x2b848, + 0xdfd8d, + 0x1763d0, + 0x13aaf9c6, + 0xb0bc3, + 0x9682, + 0x2cd09, + 0x551ca, + 0xf9bc6, + 0x13cd5389, + 0x124c3, + 0x109f11, + 0x9f89, + 0xcd5c7, + 0x10710b, + 0xd2d10, + 0xd31cc, + 0xd47c5, + 0x11ab08, + 0x19be4a, + 0x122b07, + 0x25c2, + 0x5160a, + 0x1694c9, + 0xa62ca, + 0x1abe8f, + 0x4084b, + 0x10760c, + 0x1078d2, + 0xb5485, + 0x15d98a, + 0x142e1fc5, + 0x19900c, + 0x1157c3, + 0x185542, + 0xe8e4a, + 0x108548, + 0x163407, + 0x4b42, + 0x7982, + 0x1bc2, + 0x129e10, + 0x1402, + 0x3074f, + 0x161186, + 0x1113ce, + 0xe3a4b, + 0x180248, + 0xc9a89, + 0x17e4d2, + 0x178b8d, + 0x45e88, + 0x47a49, + 0x485cd, + 0x4a189, + 0x4a64b, + 0x4ac08, + 0x4e648, + 0x53f48, + 0x559c9, + 0x55bca, + 0x57f4c, + 0xe31ca, + 0xf6ac7, + 0xdfcd, + 0xeb88b, + 0x9eb0c, + 0x18b610, + 0x3282, + 0xc570d, + 0x6202, + 0x33c2, + 0xf6a0a, + 0xdfa8a, + 0xe5e4b, + 0xc718c, + 0xfd6ce, + 0x165d0d, + 0xf3dc8, + 0x6c2, + 0x11a0c0ce, + 0x11c2fe87, + 0x121aa0c9, + 0x11583, + 0x127117cc, + 0xc002, + 0x50111, + 0xc011, + 0xa1091, + 0x81ed1, + 0x11170f, + 0x11dfcc, + 0x121acd, + 0x123f0d, + 0x142615, + 0x14b18c, + 0x159590, + 0xfa8c, + 0x5274c, + 0x47109, + 0xc002, + 0x501ce, + 0xc0ce, + 0xa114e, + 0x81f8e, + 0x1117cc, + 0x11e089, + 0x14b249, + 0x14280d, + 0xfb49, + 0x52809, + 0x1267c3, + 0x940c3, + 0xc002, + 0x162d45, + 0x1aa804, + 0xdf704, + 0x127244, + 0x17f904, + 0x17c084, + 0x163184, + 0x144bdc3, + 0x140de83, + 0x19fd04, + 0x1573dc3, + 0xd82, + 0x165d03, + 0x200882, + 0x216582, + 0x201a42, + 0x206ac2, + 0x201f82, + 0x201502, + 0x201bc2, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x201603, + 0x238483, + 0x2264c3, + 0x880c8, + 0x22d183, + 0x2343c3, + 0x238483, + 0x2264c3, + 0x1d003, + 0x21eb03, + 0x200882, + 0x323ac3, + 0x15e2d183, + 0x330d47, + 0x21eb03, + 0x332683, + 0x212444, + 0x238483, + 0x2264c3, + 0x24690a, + 0x241f85, + 0x21bd03, + 0x203e42, + 0x880c8, + 0x880c8, + 0x16582, + 0x113682, + 0x1a6845, + 0x880c8, + 0x2d183, + 0x77947, + 0x1161cf, + 0xf9c44, + 0x11220a, + 0xac287, + 0xf78a, + 0x93e8a, + 0xa660a, + 0xf9bc6, + 0x27ca, + 0xccd, + 0x123ac3, + 0x880c8, + 0x16582, + 0x47344, + 0x67683, + 0xe9cc5, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x204803, + 0x22d183, + 0x2343c3, + 0x211cc3, + 0x21eb03, + 0x211003, + 0x238483, + 0x2264c3, + 0x290c83, + 0x223ec3, + 0x204803, + 0x224104, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x232dc3, + 0x22d183, + 0x2343c3, + 0x206ac3, + 0x211cc3, + 0x21eb03, + 0x201604, + 0x36b683, + 0x2348c3, + 0x211003, + 0x238483, + 0x2264c3, + 0x21bd03, + 0x3b0343, + 0x1822d183, + 0x2343c3, + 0x244d43, + 0x21eb03, + 0x275803, + 0x2348c3, + 0x2264c3, + 0x207443, + 0x27f5c4, + 0x880c8, + 0x18a2d183, + 0x2343c3, + 0x2a7243, + 0x21eb03, + 0x211003, + 0x212444, + 0x238483, + 0x2264c3, + 0x220703, + 0x880c8, + 0x1922d183, + 0x2343c3, + 0x211cc3, + 0x2025c3, + 0x2264c3, + 0x880c8, + 0x142fe87, + 0x323ac3, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x201604, + 0x212444, + 0x238483, + 0x2264c3, + 0x16e747, + 0x176c84, + 0x1462d48, + 0xa7dcd, + 0x3256c5, + 0x880c8, + 0x742, + 0x35bc3, + 0xe6786, + 0x307e48, + 0x3afd07, + 0x224104, + 0x355346, + 0x359446, + 0x880c8, + 0x301043, + 0x20b149, + 0x2b46d5, + 0xb46df, + 0x22d183, + 0x32f8d2, + 0xfea86, + 0x13af45, + 0x110f4a, + 0x58d89, + 0x32f68f, + 0x22d684, + 0x331145, + 0x2f26d0, + 0x3aaf87, + 0x2025c3, + 0x32d208, + 0x2aeeca, + 0x2014c4, + 0x2e1a03, + 0x241f86, + 0x203e42, + 0x38660b, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x211003, + 0x238483, + 0x2264c3, + 0x2e6a83, + 0x216582, + 0x238483, + 0x2264c3, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x211003, + 0x2264c3, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x332683, + 0x203043, + 0x2264c3, + 0x216582, + 0x22d183, + 0x2343c3, + 0x238483, + 0x2264c3, + 0x200882, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x224104, + 0x22d183, + 0x2343c3, + 0x307b04, + 0x238483, + 0x2264c3, + 0x880c8, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x22d183, + 0x2343c3, + 0x211cc3, + 0x220883, + 0x211003, + 0x238483, + 0x2264c3, + 0x216582, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x880c8, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x251283, + 0x2efc3, + 0x132683, + 0x238483, + 0x2264c3, + 0x301e0a, + 0x31ec09, + 0x33e6cb, + 0x33ed4a, + 0x34600a, + 0x3543cb, + 0x372d8a, + 0x37acca, + 0x38074a, + 0x3809cb, + 0x39bb89, + 0x39d94a, + 0x39e38b, + 0x3a9bcb, + 0x3b2c8a, + 0x22d183, + 0x2343c3, + 0x211cc3, + 0x211003, + 0x238483, + 0x2264c3, + 0x37549, + 0x880c8, + 0x22d183, + 0x260584, + 0x214a02, + 0x212444, + 0x226bc5, + 0x204803, + 0x224104, + 0x22d183, + 0x2374c4, + 0x2343c3, + 0x247344, + 0x22d684, + 0x201604, + 0x2348c3, + 0x238483, + 0x2264c3, + 0x28fb85, + 0x232dc3, + 0x21bd03, + 0x25b743, + 0x252dc4, + 0x250bc4, + 0x26dfc5, + 0x880c8, + 0x2f88c4, + 0x208606, + 0x283c04, + 0x216582, + 0x360307, + 0x249c07, + 0x2455c4, + 0x257a05, + 0x2d37c5, + 0x2a9c05, + 0x201604, + 0x318348, + 0x36ed86, + 0x2dbb08, + 0x236f45, + 0x2cf145, + 0x240584, + 0x2264c3, + 0x2e26c4, + 0x353586, + 0x242083, + 0x252dc4, + 0x262c45, + 0x2cfbc4, + 0x365b84, + 0x203e42, + 0x245206, + 0x392446, + 0x2f56c5, + 0x200882, + 0x323ac3, + 0x1f216582, + 0x2358c4, + 0x201f82, + 0x211003, + 0x209f82, + 0x238483, + 0x201502, + 0x217643, + 0x223ec3, + 0x880c8, + 0x880c8, + 0x21eb03, + 0x200882, + 0x1fe16582, + 0x21eb03, + 0x266383, + 0x36b683, + 0x31f984, + 0x238483, + 0x2264c3, + 0x880c8, + 0x200882, + 0x20616582, + 0x22d183, + 0x238483, + 0x2264c3, + 0x4b42, + 0x2019c2, + 0x221e42, + 0x332683, + 0x2db083, + 0x200882, + 0x880c8, + 0x16e747, + 0x216582, + 0x2343c3, + 0x247344, + 0x208f43, + 0x21eb03, + 0x220883, + 0x211003, + 0x238483, + 0x21ab43, + 0x2264c3, + 0x220683, + 0x1244d3, + 0x12f214, + 0x16e747, + 0x15686, + 0x1e1c6, + 0x52fc7, + 0x9f049, + 0x2654a, + 0x85b0d, + 0x119a4c, + 0x29e8a, + 0x51f05, + 0x18bec8, + 0x161186, + 0x155646, + 0x200d82, + 0xde40c, + 0x1aa9c7, + 0x24d11, + 0x22d183, + 0xd0585, + 0x1b4284, + 0x18346, + 0x19f046, + 0x8a24a, + 0xacec3, + 0x9f005, + 0xce83, + 0xc120c, + 0xe5408, + 0x1ad408, + 0xa0288, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x211003, + 0x238483, + 0x2264c3, + 0x200882, + 0x216582, + 0x21eb03, + 0x2082c2, + 0x238483, + 0x2264c3, + 0x217643, + 0x35e48f, + 0x35e84e, + 0x880c8, + 0x22d183, + 0x429c7, + 0x2343c3, + 0x21eb03, + 0x202243, + 0x238483, + 0x2264c3, + 0x220003, + 0x36b047, + 0x204642, + 0x2a9849, + 0x201002, + 0x32a10b, + 0x28c14a, + 0x2a4209, + 0x201902, + 0x250e06, + 0x248f95, + 0x32a255, + 0x24de93, + 0x32a7d3, + 0x2056c2, + 0x214605, + 0x27ff4c, + 0x219e0b, + 0x269005, + 0x201482, + 0x2040c2, + 0x377506, + 0x204802, + 0x24eb06, + 0x332ecd, + 0x36288c, + 0x30a784, + 0x2009c2, + 0x219f02, + 0x22c108, + 0x202d42, + 0x29d5c6, + 0x3345c4, + 0x249155, + 0x24e013, + 0x20a583, + 0x34868a, + 0x30e547, + 0x2e6089, + 0x20f507, + 0x24f882, + 0x200002, + 0x200006, + 0x202f42, + 0x880c8, + 0x211302, + 0x211d42, + 0x273cc7, + 0x3a8ac7, + 0x21ed05, + 0x215802, + 0x220647, + 0x220808, + 0x279a82, + 0x293f02, + 0x22f802, + 0x202ec2, + 0x239c48, + 0x21abc3, + 0x267848, + 0x2cf4cd, + 0x215743, + 0x369908, + 0x234a4f, + 0x234e0e, + 0x223f8a, + 0x36a611, + 0x36aa90, + 0x2b348d, + 0x2b37cc, + 0x3b2447, + 0x348807, + 0x355409, + 0x23c302, + 0x2004c2, + 0x254c8c, + 0x254f8b, + 0x2008c2, + 0x2dca86, + 0x206c02, + 0x2131c2, + 0x21dec2, + 0x216582, + 0x392904, + 0x23b147, + 0x200bc2, + 0x23f1c7, + 0x240447, + 0x214ec2, + 0x230542, + 0x242885, + 0x200682, + 0x26380e, + 0x27620d, + 0x2343c3, + 0x28268e, + 0x356b8d, + 0x2de803, + 0x2058c2, + 0x27cac4, + 0x2446c2, + 0x20ddc2, + 0x346905, + 0x34f587, + 0x372642, + 0x206ac2, + 0x246cc7, + 0x24c608, + 0x23aa82, + 0x2b5506, + 0x254b0c, + 0x254e4b, + 0x221842, + 0x25bccf, + 0x25c090, + 0x25c48f, + 0x25c855, + 0x25cd94, + 0x25d28e, + 0x25d60e, + 0x25d98f, + 0x25dd4e, + 0x25e0d4, + 0x25e5d3, + 0x25ea8d, + 0x271749, + 0x286d43, + 0x2007c2, + 0x20a805, + 0x208f46, + 0x201f82, + 0x26bdc7, + 0x21eb03, + 0x20b2c2, + 0x2c7448, + 0x36a851, + 0x36ac90, + 0x200942, + 0x22a647, + 0x2074c2, + 0x3328c7, + 0x209682, + 0x305dc9, + 0x3774c7, + 0x3615c8, + 0x228246, + 0x2daf83, + 0x34ad45, + 0x234642, + 0x200402, + 0x200405, + 0x399485, + 0x202102, + 0x24a503, + 0x2cfc47, + 0x208a07, + 0x203f42, + 0x2fec04, + 0x214803, + 0x2be489, + 0x2db488, + 0x20b402, + 0x2061c2, + 0x22f2c7, + 0x24bcc5, + 0x2a5f88, + 0x3b0e87, + 0x2047c3, + 0x27df86, + 0x2b330d, + 0x2b368c, + 0x276a06, + 0x203142, + 0x29a1c2, + 0x206742, + 0x2348cf, + 0x234cce, + 0x2d3847, + 0x200342, + 0x39e205, + 0x39e206, + 0x250042, + 0x203042, + 0x217c86, + 0x2a9a83, + 0x332806, + 0x2bfb05, + 0x2bfb0d, + 0x2c00d5, + 0x2c0c0c, + 0x2c150d, + 0x2c18d2, + 0x20e842, + 0x200e02, + 0x200ac2, + 0x2d6646, + 0x2ac506, + 0x2025c2, + 0x208fc6, + 0x203382, + 0x2249c5, + 0x204c02, + 0x263949, + 0x34700c, + 0x34734b, + 0x201502, + 0x24ca48, + 0x2042c2, + 0x207a82, + 0x219bc6, + 0x36c005, + 0x3a1687, + 0x24a385, + 0x28df05, + 0x242a42, + 0x202042, + 0x206d42, + 0x26e847, + 0x2d094d, + 0x2d0ccc, + 0x2229c7, + 0x2b5482, + 0x226282, + 0x36f088, + 0x22ce88, + 0x2d5b48, + 0x2dfd44, + 0x2ef207, + 0x2dbf83, + 0x280b82, + 0x2014c2, + 0x2e0489, + 0x3a3247, + 0x207442, + 0x26d485, + 0x241542, + 0x22ff42, + 0x297fc3, + 0x297fc6, + 0x2e6a82, + 0x2e8642, + 0x200c02, + 0x30f006, + 0x29dc87, + 0x200b82, + 0x208782, + 0x26768f, + 0x2824cd, + 0x284d8e, + 0x356a0c, + 0x20d342, + 0x207482, + 0x228085, + 0x3b3086, + 0x212182, + 0x208b02, + 0x204b42, + 0x282844, + 0x2cf344, + 0x338a86, + 0x201bc2, + 0x275247, + 0x214343, + 0x21cb88, + 0x224348, + 0x239247, + 0x33fbc6, + 0x2015c2, + 0x239bc3, + 0x35bf87, + 0x266c86, + 0x2d6585, + 0x2d8e88, + 0x208d82, + 0x3211c7, + 0x20dfc2, + 0x35b202, + 0x20ad82, + 0x2bf8c9, + 0x200242, + 0x200a02, + 0x222c43, + 0x321887, + 0x201a02, + 0x34718c, + 0x34748b, + 0x276a86, + 0x20cdc5, + 0x224982, + 0x206ec2, + 0x2b3006, + 0x229083, + 0x340d07, + 0x246002, + 0x200cc2, + 0x248e15, + 0x32a415, + 0x24dd53, + 0x32a953, + 0x264dc7, 0x288288, - 0x289389, - 0x36ab47, - 0x218506, - 0x317287, - 0x21e1c9, + 0x288290, + 0x289b0f, + 0x28bf13, + 0x2a3fd2, + 0x2a9410, + 0x2e79cf, + 0x2f14d2, + 0x351551, + 0x2afb13, + 0x2bf692, + 0x2c8d0f, + 0x2cb38e, + 0x2cc152, + 0x2cd191, + 0x2cdd8f, + 0x2ced4e, + 0x2d4c11, + 0x2e0090, + 0x2e4452, + 0x2e55d1, + 0x2e6b06, + 0x2e89c7, + 0x2f77c7, + 0x201582, + 0x27a485, + 0x2f2447, + 0x221e42, + 0x203c42, + 0x22c605, + 0x221303, + 0x26e246, + 0x2d0b0d, + 0x2d0e4c, + 0x203dc2, + 0x27fdcb, + 0x219cca, + 0x31b28a, + 0x2b22c9, + 0x2dd20b, + 0x3b0fcd, + 0x2f2b4c, + 0x2144ca, + 0x221e8c, + 0x24d10b, + 0x268e4c, + 0x26c10b, + 0x346f83, + 0x287e86, + 0x326e82, + 0x2e9202, + 0x208943, + 0x205882, + 0x205883, + 0x238406, + 0x25ca07, + 0x271406, + 0x2ea8c8, + 0x22cb88, + 0x2f0206, + 0x22d742, + 0x2f508d, + 0x2f53cc, + 0x22d747, + 0x2f8787, + 0x2156c2, + 0x21bf02, + 0x21eb82, + 0x24b982, + 0x216582, + 0x238483, + 0x2264c3, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x211003, + 0x212444, + 0x238483, + 0x2264c3, + 0x217643, + 0x200882, + 0x200702, + 0x2368c545, + 0x23a03985, + 0x23f0b146, + 0x880c8, + 0x242b0185, + 0x216582, + 0x201a42, + 0x24755c45, + 0x24a786c5, + 0x24e79547, + 0x2527b109, + 0x2564b084, + 0x201f82, + 0x20b2c2, + 0x25a43785, + 0x25e8bb89, + 0x26311f08, + 0x266abe45, + 0x26b0bc07, + 0x26e18948, + 0x272d8045, + 0x27604606, + 0x27b47b09, + 0x27f25348, + 0x282b8888, + 0x2869310a, + 0x28a48444, + 0x28ec9405, + 0x292b5dc8, + 0x29616c85, + 0x21ac42, + 0x29a00343, + 0x29ea2f86, + 0x2a233a88, + 0x2a69e2c6, + 0x2aa9ddc8, + 0x2ae09c86, + 0x2b2f6284, + 0x205902, + 0x2b73b7c7, + 0x2baa8444, + 0x2be746c7, + 0x2c333a07, + 0x201502, + 0x2c696ec5, + 0x2ca31504, + 0x2cf7fd07, + 0x2d211e47, + 0x2d67c906, + 0x2da29585, + 0x2de91bc7, + 0x2e2d1a48, + 0x2e60ab87, + 0x2eb12b09, + 0x2eec0f45, + 0x2f32bb87, + 0x2f68b886, + 0x2fa51008, + 0x225a4d, + 0x242bc9, + 0x2e4ccb, + 0x3726cb, + 0x26f30b, + 0x2a564b, + 0x2ffd0b, + 0x2fffcb, + 0x300849, + 0x30208b, + 0x30234b, + 0x30290b, + 0x30340a, + 0x30394a, + 0x303f4c, + 0x308e0b, + 0x30964a, + 0x31c18a, + 0x32734e, + 0x3282ce, + 0x32864a, + 0x32b14a, + 0x32cb4b, + 0x32ce0b, + 0x32dd0b, + 0x34c50b, + 0x34cb0a, + 0x34d7cb, + 0x34da8a, + 0x34dd0a, + 0x34df8a, + 0x373f4b, + 0x37c18b, + 0x37dace, + 0x37de4b, + 0x3849cb, + 0x38598b, + 0x3893ca, + 0x389649, + 0x38988a, + 0x38af0a, + 0x39c60b, + 0x39e64b, + 0x39f24a, + 0x3a02cb, + 0x3a4f0b, + 0x3b26cb, + 0x2fe7ab48, + 0x30285289, + 0x30626809, + 0x30acfe48, + 0x338805, + 0x203443, + 0x204204, + 0x327145, + 0x24adc6, + 0x259145, + 0x284404, + 0x26bcc8, + 0x3739c5, + 0x28d904, + 0x3b3f87, + 0x2996ca, + 0x3605ca, + 0x336947, + 0x203347, + 0x2f10c7, + 0x362607, + 0x2b9d05, + 0x306d46, + 0x2fb0c7, + 0x3a2784, + 0x376b06, + 0x376a06, + 0x3a3745, + 0x280584, + 0x2d3d46, + 0x298387, + 0x225d46, + 0x2c7ec7, + 0x28d6c3, + 0x268446, + 0x2328c5, + 0x279647, + 0x266fca, + 0x263204, + 0x2180c8, + 0x2fb649, + 0x2ce487, + 0x3aed06, + 0x29f988, + 0x306409, + 0x2e6244, + 0x35d804, + 0x2f9685, + 0x2fadc8, + 0x2bd1c7, + 0x2aa009, + 0x327c48, + 0x2fc706, + 0x379bc6, + 0x2943c8, + 0x375fc6, + 0x203985, + 0x27c9c6, + 0x274bc8, + 0x2347c6, + 0x25708b, + 0x233406, + 0x295d4d, + 0x358a45, + 0x2a8306, + 0x218a05, + 0x297c89, + 0x2f1d07, + 0x382048, + 0x2db2c6, + 0x294ac9, + 0x3a6246, + 0x266f45, + 0x29c1c6, + 0x2a8e86, + 0x2c2909, + 0x306206, + 0x279247, + 0x33cf05, + 0x205703, + 0x257205, + 0x296007, + 0x323446, + 0x358949, + 0x30b146, + 0x27cc06, + 0x365389, + 0x27c3c9, + 0x29ca07, + 0x369fc8, + 0x39ee89, + 0x27a108, + 0x31f686, + 0x2cc9c5, + 0x30a44a, + 0x27cc86, + 0x330bc6, + 0x2a3145, + 0x24d588, + 0x206847, + 0x2318ca, + 0x247786, + 0x243005, + 0x2a0e06, + 0x265b47, + 0x3aebc7, + 0x2bacc5, + 0x267105, + 0x2acf46, + 0x383446, + 0x2ad886, + 0x328cc4, + 0x27b489, + 0x286146, + 0x2a5a0a, + 0x214048, + 0x32b888, + 0x3605ca, + 0x202145, + 0x2982c5, + 0x323c48, + 0x2c9188, + 0x320d47, + 0x265146, + 0x315308, + 0x202b87, + 0x279788, + 0x35f146, + 0x27dd08, + 0x2b3b86, + 0x2370c7, + 0x295506, + 0x2d3d46, + 0x23628a, + 0x392986, + 0x2cc9c9, + 0x2b0486, + 0x2d238a, + 0x2f6289, + 0x2f0306, + 0x37c504, + 0x20a8cd, + 0x285507, + 0x317906, + 0x2b8745, + 0x3a62c5, + 0x305546, + 0x26d9c9, + 0x3ad5c7, + 0x275cc6, + 0x2cd946, + 0x284489, + 0x212a44, + 0x228dc4, + 0x204308, + 0x2387c6, + 0x26d548, + 0x2d6b88, + 0x203ac7, + 0x200849, + 0x2ada87, + 0x2b004a, + 0x22decf, + 0x2377ca, + 0x227e85, + 0x274e05, + 0x216005, + 0x334507, + 0x277283, + 0x36a1c8, + 0x334d86, + 0x334e89, + 0x2c6a06, + 0x2c2747, + 0x294889, + 0x381f48, + 0x2a3207, + 0x2fee83, + 0x338885, + 0x3b2005, 0x328b0b, - 0x32cfc7, - 0x200407, - 0x238047, - 0x210d84, - 0x210d85, - 0x2ac905, - 0x33c00b, - 0x399404, - 0x369d08, - 0x26f08a, - 0x2173c7, - 0x341dc7, - 0x290c12, - 0x27ee46, - 0x22e886, - 0x35898e, - 0x281346, - 0x298708, - 0x29938f, - 0x2111c8, - 0x38bb08, - 0x3af64a, - 0x3af651, - 0x2a6b4e, - 0x254e4a, - 0x254e4c, - 0x2014c7, - 0x3a5d10, - 0x3b5388, - 0x2a6d45, - 0x2b114a, - 0x20324c, - 0x29afcd, - 0x2fce06, - 0x2fce07, - 0x2fce0c, - 0x305c8c, - 0x32814c, - 0x28f98b, - 0x289b84, - 0x21f744, - 0x374149, - 0x2fe3c7, - 0x23e389, - 0x2b7d89, - 0x35a587, - 0x36a906, - 0x36a909, - 0x39d403, - 0x2129ca, - 0x32f807, - 0x238acb, - 0x317d4a, - 0x2abb44, - 0x39c546, - 0x284c89, - 0x3b3bc4, - 0x2035ca, - 0x2d4ac5, - 0x2c0005, - 0x2c000d, - 0x2c034e, - 0x378205, - 0x323506, - 0x2712c7, - 0x38684a, - 0x38d406, - 0x35ecc4, - 0x2f8987, - 0x2da18b, - 0x382a47, - 0x282ac4, - 0x24f706, - 0x24f70d, - 0x21de8c, - 0x204986, - 0x2eae8a, - 0x235806, - 0x2f3248, - 0x28bf47, - 0x33f88a, - 0x23d986, - 0x217bc3, - 0x262ec6, - 0x3abd88, - 0x2a024a, - 0x2766c7, - 0x2766c8, - 0x27dd84, - 0x2cc0c7, - 0x23ccc8, - 0x29e008, - 0x288b48, - 0x33110a, - 0x2e0405, - 0x2e0687, - 0x254c93, - 0x2d0806, - 0x26f288, - 0x222c09, - 0x24b448, - 0x3514cb, - 0x2cddc8, - 0x273704, - 0x215446, - 0x3b4f06, - 0x35e0c9, - 0x2c72c7, - 0x25c808, - 0x29e186, - 0x235144, - 0x2ce085, - 0x2c8a08, - 0x2c900a, - 0x2c9b48, - 0x2ce746, - 0x29ef8a, - 0x351988, - 0x2d5008, + 0x216d44, + 0x2c5044, + 0x273486, + 0x2ff447, + 0x39794a, + 0x245807, + 0x3b0407, + 0x2786c5, + 0x205285, + 0x2196c9, + 0x2d3d46, + 0x24568d, + 0x358045, + 0x2a2d43, + 0x205d03, + 0x349205, + 0x350005, + 0x29f988, + 0x276707, + 0x228b46, + 0x29a646, + 0x22d905, + 0x234687, + 0x2035c7, + 0x36ec47, + 0x2c948a, + 0x268508, + 0x328cc4, + 0x2ade47, + 0x277cc7, + 0x32d086, + 0x264607, + 0x2b2a08, + 0x226708, + 0x26b786, + 0x367f08, + 0x2c32c4, + 0x2fb0c6, + 0x3a9146, + 0x2c0a86, + 0x349c06, + 0x29abc4, + 0x3626c6, + 0x2b76c6, + 0x293606, + 0x2293c6, + 0x205bc6, + 0x2b2846, + 0x228a48, + 0x39de08, + 0x2c9cc8, + 0x259348, + 0x323bc6, + 0x210785, + 0x275386, + 0x2abec5, + 0x388807, + 0x28ae45, + 0x213d43, + 0x364605, + 0x22fd84, + 0x205d05, + 0x210143, + 0x39a7c7, + 0x31c448, + 0x2c7f86, + 0x2c514d, + 0x274dc6, + 0x292b85, + 0x2afd43, + 0x2b5789, + 0x212bc6, + 0x231246, + 0x29c2c4, + 0x237747, + 0x235b06, + 0x243245, + 0x216ec3, + 0x378a44, + 0x277e86, + 0x2b15c4, + 0x30d748, + 0x324a89, + 0x2f2209, + 0x29c0ca, + 0x23f88d, + 0x29da47, + 0x330a46, + 0x20ec44, + 0x27b109, + 0x283588, + 0x285106, + 0x263bc6, + 0x264607, + 0x2c3c06, + 0x21b606, + 0x38c346, + 0x333a8a, + 0x218948, + 0x22bc45, + 0x27d649, + 0x279c8a, + 0x2c54c8, + 0x2979c8, + 0x292108, + 0x2a864c, + 0x2dc7c5, + 0x29a8c8, + 0x39e106, + 0x2d1d06, + 0x37af07, + 0x245705, + 0x27cb45, + 0x2f20c9, + 0x212747, + 0x2b2ec5, + 0x21e9c7, + 0x205d03, + 0x2bd705, + 0x366548, + 0x2d1687, + 0x297889, + 0x2d7985, + 0x2f4504, + 0x2a1788, + 0x2cf787, + 0x2a33c8, + 0x2740c8, + 0x32c005, + 0x334c86, + 0x257706, + 0x2e7649, + 0x315b87, + 0x2ac986, + 0x30e947, + 0x217d43, + 0x24b084, + 0x298c45, + 0x2ae0c4, + 0x236844, + 0x27adc7, + 0x3affc7, + 0x239a04, + 0x2976d0, + 0x3056c7, + 0x205285, + 0x22ae8c, + 0x2018c4, + 0x2bee08, + 0x236fc9, + 0x2ffb86, + 0x2a03c8, + 0x25a7c4, + 0x25a7c8, + 0x231ec6, + 0x229248, + 0x298946, + 0x2c828b, + 0x205705, + 0x2c3248, + 0x21a3c4, + 0x27c04a, + 0x297889, + 0x2e0d06, + 0x2160c8, + 0x258645, + 0x301944, + 0x2bed06, + 0x36eb08, + 0x27ab48, + 0x345d06, + 0x31d6c4, + 0x30a3c6, + 0x2adb07, + 0x2745c7, + 0x26460f, + 0x2074c7, + 0x2f03c7, + 0x2d1bc5, + 0x2ed845, + 0x29c6c9, + 0x28ae86, + 0x278fc5, + 0x27c6c7, + 0x37b188, + 0x293705, + 0x295506, + 0x213e88, + 0x29e2ca, + 0x282988, + 0x287947, + 0x22e306, + 0x27d606, + 0x21f283, + 0x2042c3, + 0x279e49, + 0x39ed09, + 0x2bec06, + 0x2d7985, + 0x2a84c8, + 0x2160c8, + 0x387808, + 0x38c3cb, + 0x2c5387, + 0x2fd189, + 0x264888, + 0x33c7c4, + 0x2c2a08, + 0x2895c9, + 0x2acc85, + 0x334407, + 0x24b105, + 0x27aa48, + 0x28c3cb, + 0x291910, + 0x2a8105, + 0x21a30c, + 0x228d05, + 0x2032c3, + 0x2a2c06, + 0x2b6e04, + 0x231606, + 0x298387, + 0x213f04, + 0x2415c8, + 0x36a08d, + 0x2d9685, + 0x23fd84, + 0x219904, + 0x27d0c9, + 0x297408, + 0x30afc7, + 0x231f48, + 0x27b548, + 0x275fc5, + 0x331547, + 0x275f47, + 0x20af07, + 0x267109, + 0x235989, + 0x23f346, + 0x2b39c6, + 0x264846, + 0x25b8c5, + 0x3af344, + 0x204506, + 0x204a46, + 0x276008, + 0x26580b, + 0x2630c7, + 0x20ec44, + 0x317d86, + 0x203107, + 0x348b45, + 0x318f05, + 0x201e84, + 0x235906, + 0x204588, + 0x27b109, + 0x257c86, + 0x282f08, + 0x243306, + 0x33ce48, + 0x2d8a8c, + 0x275e86, + 0x29284d, + 0x292ccb, + 0x279305, + 0x203707, + 0x306306, + 0x3aea88, + 0x23f3c9, + 0x2e7288, + 0x205285, + 0x2ecc07, + 0x27a208, + 0x384789, + 0x2a05c6, + 0x33bfca, + 0x3ae808, + 0x2e70cb, + 0x2c608c, + 0x25a8c8, + 0x277506, + 0x334708, + 0x29df47, + 0x2cfa09, + 0x28ba8d, + 0x2961c6, + 0x3017c8, + 0x39dcc9, + 0x2b6188, + 0x27de08, + 0x2b7f8c, + 0x2b9347, + 0x2b9f07, + 0x266f45, + 0x3a4d47, + 0x37b048, + 0x2bed86, + 0x257b0c, + 0x2e4988, + 0x2c44c8, + 0x24b5c6, + 0x3b1d87, + 0x23f544, + 0x259348, + 0x356e4c, + 0x3a1a0c, + 0x227f05, + 0x393d47, + 0x31d646, + 0x3b1d06, + 0x297e48, + 0x38c284, + 0x225d4b, + 0x22844b, + 0x22e306, + 0x369f07, + 0x307d45, + 0x26ca85, + 0x225e86, + 0x258605, + 0x216d05, + 0x3accc7, + 0x273a89, + 0x233504, + 0x2722c5, + 0x2d7645, + 0x254448, + 0x22b4c5, + 0x2a7809, + 0x2af2c7, + 0x2af2cb, + 0x2d1046, + 0x228789, + 0x2804c8, + 0x271c05, + 0x20b008, + 0x2359c8, + 0x207ec7, + 0x27d4c7, + 0x27ae49, + 0x229187, + 0x32d3c9, + 0x2aaf4c, + 0x312a08, + 0x2b9b49, + 0x2be7c7, + 0x27b609, + 0x3b0107, + 0x2c6188, + 0x3afac5, + 0x2fb046, + 0x2b8788, + 0x2f8b88, + 0x279b49, + 0x216d47, + 0x26cb45, + 0x20e3c9, + 0x2c4086, + 0x28b884, + 0x2e6f46, + 0x233908, + 0x2426c7, + 0x265a08, + 0x367fc9, + 0x261a47, + 0x299886, + 0x2037c4, + 0x364689, + 0x3313c8, + 0x24b487, + 0x306e46, + 0x3b20c6, + 0x330b44, + 0x27f886, + 0x205c83, + 0x308149, + 0x2056c6, + 0x2a61c5, + 0x29a646, + 0x2a3505, + 0x27a688, + 0x25a607, + 0x362446, + 0x355c86, + 0x32b888, + 0x29c847, + 0x296205, + 0x29ab48, + 0x39ea48, + 0x3ae808, + 0x228bc5, + 0x2fb0c6, + 0x2f1fc9, + 0x257584, + 0x3760cb, + 0x21b30b, + 0x22bb49, + 0x205d03, + 0x256385, + 0x205986, + 0x229908, + 0x22de44, + 0x2c7f86, + 0x2c95c9, + 0x2c5b05, + 0x3acc06, + 0x2cf786, + 0x2160c4, + 0x2a1b4a, + 0x2a6108, + 0x2f8b86, + 0x368a05, + 0x204887, + 0x301547, + 0x334c84, + 0x21b547, + 0x2b0044, + 0x2c0a06, + 0x202e03, + 0x267105, + 0x373445, + 0x207708, + 0x2ae005, + 0x275bc9, + 0x259187, + 0x25918b, + 0x2a2d8c, + 0x2a3a0a, + 0x30bc07, + 0x200a83, + 0x2d3948, + 0x228d85, + 0x293785, + 0x338944, + 0x2c6086, + 0x236fc6, + 0x27f8c7, + 0x3656cb, + 0x29abc4, + 0x3821c4, + 0x26b904, + 0x2c25c6, + 0x213f04, + 0x2faec8, + 0x338745, + 0x23fec5, + 0x387747, + 0x203809, + 0x350005, + 0x375a4a, + 0x37b2c9, + 0x290f8a, + 0x333bc9, + 0x353144, + 0x2cda05, + 0x2c3d08, + 0x37fdcb, + 0x2f9685, + 0x38d4c6, + 0x2159c4, + 0x276106, + 0x2618c9, + 0x317e47, + 0x30b308, + 0x23fc06, + 0x2ada87, + 0x27ab48, + 0x38f586, + 0x280204, + 0x35eb87, + 0x34e905, + 0x360c07, + 0x204604, + 0x306286, + 0x218bc8, + 0x292e88, + 0x3a4ac7, + 0x217d88, + 0x2b3c45, + 0x205b44, + 0x3604c8, + 0x217e84, + 0x207ec5, + 0x2ed984, + 0x202c87, + 0x286207, + 0x27b748, + 0x2a3546, + 0x2adf85, + 0x2759c8, + 0x282b88, + 0x29c009, + 0x21b606, + 0x231948, + 0x27beca, + 0x348bc8, + 0x2d8045, + 0x275586, + 0x26d888, + 0x2eccca, + 0x341107, + 0x283985, + 0x28ef48, + 0x2b1184, + 0x24d606, + 0x2ba688, + 0x205bc6, + 0x380dc8, + 0x2573c7, + 0x3b3e86, + 0x37c504, + 0x29ce07, + 0x2fac04, + 0x261887, + 0x23108d, + 0x22bbc5, + 0x2d148b, + 0x298a46, + 0x24cb48, + 0x241584, + 0x272086, + 0x277e86, + 0x334a47, + 0x29250d, + 0x25fd07, + 0x300248, + 0x29fb05, + 0x284008, + 0x2bd146, + 0x2b3cc8, + 0x20e886, + 0x367707, + 0x368189, + 0x33f9c7, + 0x2853c8, + 0x26f705, + 0x21ed88, + 0x3b1c45, + 0x23b2c5, + 0x333e45, + 0x226743, + 0x27ca44, + 0x27d645, + 0x347b09, + 0x31b646, + 0x2b2b08, + 0x2ecec5, + 0x312447, + 0x249dca, + 0x3acb49, + 0x2a8d8a, + 0x2c9d48, + 0x21e80c, + 0x27c74d, + 0x2f86c3, + 0x380cc8, + 0x378a05, + 0x29e086, + 0x381dc6, + 0x2e3985, + 0x30ea49, + 0x310045, + 0x2759c8, + 0x279146, + 0x33f4c6, + 0x2a1649, + 0x38ed87, + 0x28c686, + 0x249d48, + 0x2c0988, + 0x2d0047, + 0x2293ce, + 0x2bd385, + 0x384685, + 0x205ac8, + 0x322d07, + 0x214782, + 0x2b7b04, + 0x23150a, + 0x24b548, + 0x203206, + 0x2949c8, + 0x257706, + 0x335988, + 0x2ac988, + 0x23b284, + 0x328945, + 0x683c04, + 0x683c04, + 0x683c04, + 0x203983, + 0x3b1f46, + 0x275e86, + 0x29924c, + 0x205b03, + 0x279c86, + 0x213f84, + 0x212b48, + 0x2c9405, + 0x231606, + 0x2b5ec8, + 0x2cb0c6, + 0x3623c6, + 0x29f788, + 0x298cc7, + 0x228f49, + 0x2e96ca, + 0x20abc4, + 0x28ae45, + 0x2a9fc5, + 0x2128c6, + 0x29da86, + 0x299c86, + 0x2ec386, + 0x229084, + 0x22908b, + 0x233904, + 0x204905, + 0x2ab5c5, + 0x203b86, + 0x359288, + 0x27c607, + 0x30b0c4, + 0x259cc3, + 0x2b0c85, + 0x2e6e07, + 0x2a4449, + 0x27c50b, + 0x27f8c7, + 0x207607, + 0x2b5dc8, + 0x312587, + 0x2a4686, + 0x242e88, + 0x299e8b, + 0x327086, + 0x213a89, + 0x29a005, + 0x2fee83, + 0x3acc06, + 0x2572c8, + 0x20e943, + 0x2e6f03, + 0x27ab46, + 0x257706, + 0x38ac8a, + 0x277545, + 0x277ccb, + 0x29a58b, + 0x240a03, + 0x20f943, + 0x2affc4, + 0x367b47, + 0x257344, + 0x2039c4, + 0x39df84, + 0x348ec8, + 0x368948, + 0x30e389, + 0x2c0fc8, + 0x3065c7, + 0x2293c6, + 0x2b274f, + 0x2bd4c6, + 0x2c9384, + 0x36878a, + 0x2e6d07, + 0x3a37c6, + 0x28b8c9, + 0x30e305, + 0x207845, + 0x30e446, + 0x21eec3, + 0x2b11c9, + 0x218ac6, + 0x367d89, + 0x397946, + 0x267105, + 0x228305, + 0x2074c3, + 0x367c88, + 0x2df587, + 0x334d84, + 0x2129c8, + 0x2d3ac4, + 0x2d4646, + 0x2a2c06, + 0x23e7c6, + 0x2c3109, + 0x293705, + 0x2d3d46, + 0x264ac9, + 0x3ac846, + 0x2b2846, + 0x387c46, + 0x2119c5, + 0x2ed986, + 0x367704, + 0x3afac5, + 0x2b8784, + 0x309246, + 0x358004, + 0x202c83, + 0x283645, + 0x2356c8, + 0x21e007, + 0x2b4549, + 0x283888, + 0x294191, + 0x2cf80a, + 0x22e247, + 0x2ee8c6, + 0x213f84, + 0x2b8888, + 0x239748, + 0x29434a, + 0x2a75cd, + 0x29c1c6, + 0x29f886, + 0x29cec6, + 0x2bab47, + 0x300305, + 0x250ec7, + 0x212a85, + 0x2af404, + 0x2a7006, + 0x27f707, + 0x2b0ecd, + 0x26d7c7, + 0x26bbc8, + 0x275cc9, + 0x275486, + 0x2a0545, + 0x210184, + 0x233a06, + 0x334b86, + 0x24b6c6, + 0x297088, + 0x211883, + 0x203b43, + 0x323585, + 0x3112c6, + 0x2ac945, + 0x23fe08, + 0x29854a, + 0x2f5cc4, + 0x212b48, + 0x292108, + 0x2039c7, + 0x2ecf89, + 0x2b5ac8, + 0x27b187, + 0x264fc6, + 0x205bca, + 0x233a88, + 0x2c5ec9, + 0x2974c8, + 0x21adc9, + 0x2e7387, + 0x2d9005, + 0x226986, + 0x2bec08, + 0x24ccc8, + 0x30bec8, + 0x22e408, + 0x204905, + 0x200884, + 0x2df288, + 0x20bdc4, + 0x3339c4, + 0x267105, + 0x28d947, + 0x2035c9, + 0x334847, + 0x231985, + 0x273686, + 0x346d46, + 0x213bc4, + 0x2a1986, + 0x2addc4, + 0x283f06, + 0x3b0586, + 0x2150c6, + 0x205285, + 0x23fcc7, + 0x200a83, + 0x3334c9, + 0x32b688, + 0x2129c4, + 0x27b00d, + 0x292f88, + 0x2f0848, + 0x2c5e46, + 0x368289, + 0x3acb49, + 0x2615c5, + 0x29864a, + 0x2863ca, + 0x28b24c, + 0x28b3c6, + 0x274446, + 0x2bd646, + 0x269509, + 0x29e2c6, + 0x250f06, + 0x310106, + 0x259348, + 0x217d86, + 0x2c344b, + 0x28dac5, + 0x23fec5, + 0x2746c5, + 0x202606, + 0x205b83, + 0x23e746, + 0x26d747, + 0x2b8745, + 0x379c85, + 0x3a62c5, + 0x2eb2c6, + 0x261684, + 0x311e06, + 0x28f789, + 0x20248c, + 0x2af148, + 0x28f8c4, + 0x2ed746, + 0x298b46, + 0x2572c8, + 0x2160c8, + 0x202389, + 0x204887, + 0x238509, + 0x24c346, + 0x22f904, + 0x20edc4, + 0x27a944, + 0x27ab48, + 0x20340a, + 0x34ff86, + 0x353d47, + 0x2c7687, + 0x228885, + 0x2a9f84, + 0x289586, + 0x300346, + 0x235bc3, + 0x32b4c7, + 0x273fc8, + 0x26170a, + 0x30fa88, + 0x29ddc8, + 0x358045, + 0x279405, + 0x2631c5, + 0x228c46, + 0x229d06, + 0x3aff05, + 0x308389, + 0x2a9d8c, + 0x263287, + 0x2943c8, + 0x258945, + 0x683c04, + 0x2e3d84, + 0x2d17c4, + 0x214b06, + 0x29b10e, + 0x2078c7, + 0x2bad45, + 0x25750c, + 0x2c0847, + 0x27f687, + 0x2806c9, + 0x218189, + 0x283985, + 0x32b688, + 0x2f1fc9, + 0x2f3d05, + 0x2b8688, + 0x2c2c06, + 0x360746, + 0x2f6284, + 0x33c1c8, + 0x248283, + 0x3630c4, + 0x2b0d05, + 0x305547, + 0x201ec5, + 0x27bd89, + 0x38040d, + 0x2a1f86, + 0x2e9644, + 0x2650c8, + 0x2738ca, + 0x21fe87, + 0x23a245, + 0x203c43, + 0x29a74e, + 0x25770c, + 0x2f99c7, + 0x29b2c7, + 0x204643, + 0x29e305, + 0x2d17c5, + 0x294d88, + 0x291f49, + 0x36e986, + 0x257344, + 0x22e186, + 0x32ffcb, + 0x3a694c, + 0x35dc47, + 0x2c90c5, + 0x39e948, + 0x2cfe05, + 0x368787, + 0x33b7c7, + 0x248285, + 0x205b83, + 0x371284, + 0x2041c5, + 0x383505, + 0x383506, + 0x28e848, + 0x27f707, + 0x3820c6, + 0x200a06, + 0x333d86, + 0x265689, + 0x331647, + 0x378186, + 0x3a6ac6, + 0x248346, + 0x2a8405, + 0x399a86, + 0x398f45, + 0x22b548, + 0x29154b, + 0x289386, + 0x2c76c4, + 0x2eca89, + 0x259184, + 0x2c2b88, + 0x2aab47, + 0x27dd04, + 0x2b4e88, + 0x2b9904, + 0x2a8444, + 0x3a26c5, + 0x2d96c6, + 0x348e07, + 0x23fd43, + 0x299945, + 0x316144, + 0x3846c6, + 0x261648, + 0x323ac5, + 0x28d3c9, + 0x20e5c5, + 0x2d6288, + 0x34a5c7, + 0x388948, + 0x2b4387, + 0x2f0489, + 0x362546, + 0x336186, + 0x310104, + 0x264f05, + 0x2f490c, + 0x2746c7, + 0x274cc7, + 0x2c7548, + 0x2a1f86, + 0x26d684, + 0x31b184, + 0x27acc9, + 0x2bd746, + 0x219747, + 0x349b84, + 0x31b746, + 0x27f285, + 0x2a3087, + 0x2c33c6, + 0x33be89, + 0x28b087, + 0x264607, + 0x2a14c6, + 0x23f785, + 0x278e48, + 0x218948, + 0x23acc6, + 0x323b05, + 0x251a46, + 0x206583, + 0x294c09, + 0x299a0e, + 0x2b3188, + 0x2d3bc8, + 0x23aacb, + 0x28d606, + 0x209c84, + 0x27c344, + 0x299b0a, + 0x21a207, + 0x378245, + 0x213a89, + 0x2b7785, + 0x333a07, + 0x2ff984, + 0x324c07, 0x2d6a88, - 0x2d70c6, - 0x2d93c6, - 0x20168c, - 0x2d99d0, - 0x28de45, - 0x210fc8, - 0x306790, - 0x210fd0, - 0x260b8e, - 0x20130e, - 0x201314, - 0x31abcf, - 0x31af86, - 0x3319d1, - 0x339793, - 0x339c08, - 0x3aafc5, - 0x35b6c8, - 0x385785, - 0x22854c, - 0x229489, - 0x282449, - 0x245d47, - 0x377009, - 0x243d87, - 0x2fadc6, - 0x359987, - 0x261245, - 0x211803, - 0x260349, - 0x222ec9, - 0x378ac3, - 0x39a544, - 0x35c40d, - 0x3b1b0f, - 0x235185, - 0x35b5c6, - 0x211b07, - 0x325987, - 0x28cd86, - 0x28cd8b, - 0x2a82c5, - 0x25f106, - 0x2fba47, - 0x276ec9, - 0x2290c6, - 0x22e405, - 0x31190b, - 0x23bb46, - 0x3724c5, + 0x2ce546, + 0x34a889, + 0x2b5bca, + 0x21a186, + 0x292ac6, + 0x2ab545, + 0x37e405, + 0x3261c7, + 0x244208, + 0x27f1c8, + 0x23b286, + 0x228385, + 0x29d80e, + 0x328cc4, + 0x23ac45, + 0x273009, + 0x28ac88, + 0x287886, + 0x296d0c, + 0x298150, + 0x29ad4f, + 0x29c5c8, + 0x30bc07, + 0x205285, + 0x27d645, + 0x348c89, + 0x28f149, + 0x30a4c6, + 0x2f9707, + 0x393cc5, + 0x320d49, + 0x32d106, + 0x29e10d, + 0x27a809, + 0x2039c4, + 0x2b2f08, + 0x2df349, + 0x350146, + 0x273785, + 0x336186, + 0x30b1c9, + 0x38e148, + 0x210785, + 0x27bfc4, + 0x296ecb, + 0x350005, + 0x226786, + 0x27ca86, + 0x25f1c6, + 0x38c5cb, + 0x28d4c9, + 0x3b0245, + 0x388707, + 0x2cf786, + 0x231346, + 0x27bc48, + 0x2d97c9, + 0x26b98c, + 0x2e6c08, + 0x350246, + 0x345d03, + 0x334606, + 0x27d305, + 0x278008, + 0x227d86, + 0x2a32c8, + 0x245885, + 0x294505, + 0x2a1d48, + 0x301687, + 0x381d07, + 0x27f8c7, + 0x2a03c8, + 0x30bd48, + 0x262286, + 0x309087, + 0x24af47, + 0x27d1ca, + 0x24c243, + 0x202606, + 0x203545, + 0x231504, + 0x275cc9, + 0x2f0404, + 0x21e084, + 0x2989c4, + 0x29b2cb, + 0x2df4c7, + 0x29da45, + 0x2913c8, + 0x273686, + 0x273688, + 0x277486, + 0x287d45, + 0x288685, + 0x28a0c6, 0x28b548, - 0x321d88, - 0x2d75cc, - 0x2d75d0, - 0x2e0149, - 0x2e7107, - 0x30860b, - 0x2e6186, - 0x2e77ca, - 0x2ea4cb, - 0x2eb74a, - 0x2eb9c6, - 0x2ec245, - 0x32f546, - 0x27e4c8, - 0x245e0a, - 0x357b1c, - 0x2f2acc, - 0x2f2dc8, - 0x2716c5, - 0x2f4f07, - 0x26a106, - 0x27d385, - 0x21c2c6, - 0x28cf48, - 0x2be807, - 0x2a5c08, - 0x2e360a, - 0x34a10c, - 0x34a389, - 0x37ee87, - 0x20d244, - 0x24db46, - 0x38b68a, - 0x2b7e85, - 0x20734c, - 0x20b088, - 0x377648, - 0x20d98c, - 0x21be8c, - 0x2206c9, - 0x220907, - 0x342c0c, - 0x3aa644, - 0x23c54a, - 0x2580cc, - 0x278acb, - 0x24140b, - 0x241f46, - 0x383847, - 0x2ddb07, - 0x3a5f4f, - 0x2fda11, - 0x2ddb12, - 0x30d0cd, - 0x30d0ce, - 0x30d40e, - 0x31ad88, - 0x31ad92, - 0x252288, - 0x2962c7, - 0x25260a, - 0x204748, - 0x281305, - 0x37e0ca, - 0x21da47, - 0x305304, - 0x21b083, - 0x2b0fc5, - 0x3af8c7, - 0x2fea07, - 0x29b1ce, - 0x30ff4d, - 0x313c49, - 0x220c45, - 0x33aa03, - 0x25fac6, - 0x36ffc5, - 0x2f1bc8, - 0x30c009, - 0x265145, - 0x26514f, - 0x2ec087, - 0x373485, - 0x21b2ca, - 0x299b86, - 0x2f33c9, - 0x384d0c, - 0x2f99c9, - 0x207b06, - 0x26ee8c, - 0x340cc6, - 0x2fc548, - 0x2fc746, - 0x30fbc6, - 0x349344, - 0x264443, - 0x2b270a, - 0x35b211, - 0x281d8a, - 0x255d05, - 0x277947, - 0x259307, - 0x23cdc4, - 0x23cdcb, - 0x3a8748, - 0x2bd306, - 0x36ef45, - 0x3a05c4, - 0x291949, - 0x330304, - 0x25cd87, - 0x332705, - 0x332707, - 0x358bc5, - 0x2af743, - 0x296188, - 0x34398a, - 0x239b43, - 0x325b8a, - 0x3b4086, - 0x264ecf, - 0x353689, - 0x2efb10, - 0x2dee88, - 0x2d0e89, - 0x29d087, - 0x24f68f, - 0x334604, - 0x2da984, - 0x21d386, - 0x2b3546, - 0x256dca, - 0x383586, - 0x32a787, - 0x3055c8, - 0x3057c7, - 0x306047, - 0x307a4a, - 0x309b4b, - 0x3a2445, - 0x2dd748, - 0x2166c3, - 0x3b120c, - 0x37140f, - 0x25b5cd, - 0x2c4607, - 0x313d89, - 0x217687, - 0x23e148, - 0x36eb0c, - 0x273608, - 0x258908, - 0x3188ce, - 0x32bad4, - 0x32bfe4, - 0x3424ca, - 0x35ea8b, - 0x243e44, - 0x243e49, - 0x21e9c8, - 0x24e105, - 0x25fc8a, - 0x239d87, - 0x2957c4, - 0x368883, - 0x2d0783, - 0x23a184, - 0x231b83, - 0x332ec3, - 0x2964c4, - 0x204303, - 0x20fbc3, - 0x201686, - 0x213184, - 0x204ac3, - 0x200383, - 0x21aa03, - 0x204cc2, - 0x368883, - 0x20d1c2, - 0x2d0783, - 0x23a184, - 0x231b83, - 0x332ec3, - 0x204303, - 0x201686, - 0x204ac3, - 0x200383, - 0x15f048, - 0x2d0783, - 0x231b83, - 0x2135c3, - 0x204ac3, - 0x200383, - 0x15f048, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x20fbc3, - 0x213184, - 0x204ac3, - 0x200383, - 0x204cc2, - 0x21fd43, - 0x20d1c2, - 0x231b83, - 0x332ec3, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x20e542, - 0x20d882, - 0x20d1c2, - 0x2d0783, - 0x209c02, - 0x201d42, - 0x2964c4, - 0x222044, - 0x223342, - 0x213184, - 0x200382, - 0x200383, - 0x21aa03, - 0x241f46, - 0x217082, - 0x2016c2, - 0x201a82, - 0x436111c3, - 0x43a014c3, - 0x59a86, - 0x59a86, - 0x24ae04, - 0x143768a, - 0x2608c, - 0x21ecc, - 0x852cd, - 0x2ac47, - 0x1a608, - 0x218c8, - 0x19834a, - 0x446db445, - 0x12b089, - 0x103008, - 0x8ed4a, - 0x14a60e, - 0x144b24b, - 0x1681c4, - 0x1672c8, - 0x13edc7, - 0x16f07, - 0x11dd09, - 0x1b3c47, - 0x94b88, - 0x61f49, - 0x4bfc5, - 0x12494e, - 0xafbcd, - 0xfb48, - 0x44a37046, - 0x45437048, - 0x79c88, - 0x117050, - 0x69c87, - 0x6cf47, - 0x71187, - 0x75f87, - 0xa9c2, - 0x62507, - 0x10c74c, - 0x3b9c7, - 0xa9f46, - 0xaa689, - 0xad708, - 0x18d82, - 0x1d42, - 0x24a0b, - 0x2ccc9, - 0x4c809, - 0x17de88, - 0xb5e02, - 0x104389, - 0xd2fca, - 0xdb9c9, - 0xdd048, - 0xddfc7, - 0xe0389, - 0xe4685, - 0xe4a90, - 0x1a8e86, - 0x63c85, - 0x4a84d, - 0x1b3806, - 0xee547, - 0xf39d8, - 0x96b88, - 0xba9ca, - 0x53b4d, - 0x1702, - 0x177ac6, - 0x91788, - 0x1ae208, - 0x15ef09, - 0x56608, - 0x5dece, - 0xd68d, - 0xf8805, - 0x62288, - 0x59688, - 0x6902, - 0x125886, - 0x6c82, - 0x3c1, - 0x8b4c3, - 0x44ef4244, - 0x4529a283, + 0x28b808, + 0x275e86, + 0x29120f, + 0x2946d0, + 0x358a45, + 0x200a83, + 0x24a985, + 0x2fd0c8, + 0x28f049, + 0x3ae808, + 0x34a708, + 0x330608, + 0x2df587, + 0x273349, + 0x2a34c8, + 0x2785c4, + 0x298848, + 0x254509, + 0x30aac7, + 0x296144, + 0x334908, + 0x23fa8a, + 0x2c2446, + 0x29c1c6, + 0x21b4c9, + 0x298387, + 0x2c2f88, + 0x332348, + 0x349a08, + 0x353885, + 0x37f385, + 0x23fec5, + 0x2d1785, + 0x371dc7, + 0x205b85, + 0x2b8745, + 0x36fd86, + 0x3ae747, + 0x37fd07, + 0x23fd86, + 0x2ca285, + 0x226786, + 0x25a685, + 0x2c06c8, + 0x31b5c4, + 0x3ac8c6, + 0x358844, + 0x301948, + 0x22534a, + 0x27670c, + 0x3658c5, + 0x2bac06, + 0x26bb46, + 0x323946, + 0x2fd2c4, + 0x27f545, + 0x2772c7, + 0x298409, + 0x2a4547, + 0x683c04, + 0x683c04, + 0x30af45, + 0x20f5c4, + 0x2966ca, + 0x273506, + 0x2e7044, + 0x3a3745, + 0x2eee85, + 0x300244, + 0x27c6c7, + 0x20e547, + 0x2c25c8, + 0x319188, + 0x210789, + 0x2994c8, + 0x29688b, + 0x2128c4, + 0x35d745, + 0x279045, + 0x27f849, + 0x2d97c9, + 0x2ec988, + 0x327ac8, + 0x203b84, + 0x298b85, + 0x203443, + 0x212885, + 0x2d3dc6, + 0x291d8c, + 0x2189c6, + 0x25a6c6, + 0x287b05, + 0x2eb348, + 0x3a6bc6, + 0x2eea46, + 0x29c1c6, + 0x21f40c, + 0x24b884, + 0x333eca, + 0x287a48, + 0x291bc7, + 0x316046, + 0x36ea47, + 0x2e12c5, + 0x306e46, + 0x352386, + 0x381bc7, + 0x21e0c4, + 0x202d85, + 0x273004, + 0x2af487, + 0x273248, + 0x2742ca, + 0x27a087, + 0x23ae47, + 0x30bb87, + 0x2cff49, + 0x291d8a, + 0x229043, + 0x21dfc5, + 0x215103, + 0x39dfc9, + 0x24b308, + 0x2d1bc7, + 0x3ae909, + 0x218a46, + 0x2c6b08, + 0x39a745, + 0x282c8a, + 0x216249, + 0x26b649, + 0x37af07, + 0x239849, + 0x214fc8, + 0x2edb06, + 0x2badc8, + 0x2119c7, + 0x229187, + 0x37b2c7, + 0x2d1a48, + 0x2ed5c6, + 0x23f845, + 0x2772c7, + 0x2925c8, + 0x3587c4, + 0x2a58c4, + 0x28c587, + 0x2acd07, + 0x2f1e4a, + 0x2eda86, + 0x2f984a, + 0x2b7a47, + 0x328a87, + 0x23b384, + 0x32d484, + 0x2272c6, + 0x30ed84, + 0x30ed8c, + 0x3a2005, + 0x215f09, + 0x2d6404, + 0x300305, + 0x273848, + 0x28b8c5, + 0x305546, + 0x207c84, + 0x29044a, + 0x2b14c6, + 0x29228a, + 0x20ab87, + 0x265b45, + 0x21eec5, + 0x2288ca, + 0x2a1a85, + 0x29c0c6, + 0x20bdc4, + 0x2b0146, + 0x326285, + 0x227e46, + 0x3a4acc, + 0x2cba4a, + 0x264fc4, + 0x2293c6, + 0x298387, + 0x2c8744, + 0x259348, + 0x38d3c6, + 0x29d689, + 0x2c4b89, + 0x312b09, + 0x376286, + 0x211ac6, + 0x2baf07, + 0x3082c8, + 0x2118c9, + 0x2df4c7, + 0x2b3ac6, + 0x2adb07, + 0x29cd85, + 0x328cc4, + 0x2baac7, + 0x24b105, + 0x2846c5, + 0x2fe0c7, + 0x248148, + 0x39e8c6, + 0x29344d, + 0x294f8f, + 0x29a58d, + 0x21b3c4, + 0x2357c6, + 0x2cbe08, + 0x3100c5, + 0x27d388, + 0x207d8a, + 0x2039c4, + 0x330206, + 0x27e487, + 0x33fe07, + 0x298d89, + 0x2bad85, + 0x300244, + 0x32888a, + 0x2b5689, + 0x239947, + 0x268206, + 0x350146, + 0x298ac6, + 0x35ec46, + 0x2cb70f, + 0x2cbcc9, + 0x217d86, + 0x239646, + 0x29ed49, + 0x309187, + 0x2101c3, + 0x21f586, + 0x2042c3, + 0x2e3848, + 0x2ad947, + 0x29c7c9, + 0x2a2a88, + 0x381e48, + 0x216e86, + 0x331209, + 0x33b905, + 0x2a33c4, + 0x2d90c7, + 0x269585, + 0x21b3c4, + 0x29db08, + 0x21a4c4, + 0x302b87, + 0x31c3c6, + 0x2ad005, + 0x2974c8, + 0x35000b, + 0x32bb87, + 0x228b46, + 0x2bd544, + 0x209c06, + 0x267105, + 0x24b105, + 0x278bc9, + 0x27c2c9, + 0x2291c4, + 0x229205, + 0x229405, + 0x282b06, + 0x32b788, + 0x2b7186, + 0x273e0b, + 0x2ffa0a, + 0x2fad05, + 0x288706, + 0x2f59c5, + 0x3b2585, + 0x297b47, + 0x204308, + 0x238504, + 0x2614c6, + 0x28b886, + 0x215187, + 0x2fee44, + 0x277e86, + 0x239d85, + 0x239d89, + 0x211cc4, + 0x2aa109, + 0x275e86, + 0x2b9408, + 0x229405, + 0x2c7785, + 0x227e46, + 0x26b889, + 0x218189, + 0x25a746, + 0x28ad88, + 0x257608, + 0x2f5984, + 0x32e244, + 0x32e248, + 0x317a08, + 0x238609, + 0x2d3d46, + 0x29c1c6, + 0x3151cd, + 0x2c7f86, + 0x2d8949, + 0x254785, + 0x30e446, + 0x251008, + 0x311d45, + 0x24af84, + 0x267105, + 0x27b948, + 0x296489, + 0x2730c4, + 0x306286, + 0x2e74ca, + 0x2c54c8, + 0x2f1fc9, + 0x2d114a, + 0x3ae886, + 0x295148, + 0x368545, + 0x30f908, + 0x2b4485, + 0x218909, + 0x36c449, + 0x228e82, + 0x29a005, + 0x26c7c6, + 0x275dc7, + 0x3aacc5, + 0x2f8a86, + 0x2f7e08, + 0x2a1f86, + 0x2c3bc9, + 0x274dc6, + 0x27bac8, + 0x2a90c5, + 0x244046, + 0x367808, + 0x27ab48, + 0x3b0608, + 0x2fc788, + 0x399a84, + 0x22d8c3, + 0x2c3e04, + 0x22e106, + 0x29cdc4, + 0x2d3b07, + 0x2ee949, + 0x2bcd45, + 0x332346, + 0x21f586, + 0x28e68b, + 0x2fac46, + 0x318546, + 0x3ac9c8, + 0x379bc6, + 0x265943, + 0x396f83, + 0x328cc4, + 0x231845, + 0x243147, + 0x273248, + 0x27324f, + 0x2771cb, + 0x32b588, + 0x306306, + 0x32b88e, + 0x227e43, + 0x2430c4, + 0x2fabc5, + 0x33db46, + 0x28968b, + 0x28da06, + 0x213f09, + 0x2ad005, + 0x389d88, + 0x206408, + 0x21804c, + 0x29b306, + 0x2128c6, + 0x2d7985, + 0x285188, + 0x276705, + 0x33c7c8, + 0x29a9ca, + 0x226809, + 0x683c04, + 0x31216582, + 0x880c8, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x211003, + 0x238483, + 0x2264c3, + 0x323ac3, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x201604, + 0x238483, + 0x2264c3, + 0x224103, + 0x224104, + 0x22d183, + 0x2374c4, + 0x2343c3, + 0x22d684, + 0x21eb03, + 0x3aaf87, + 0x211003, + 0x2025c3, + 0x32d208, + 0x2264c3, + 0x2aeecb, + 0x2e1a03, + 0x241f86, + 0x203e42, + 0x38660b, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x2264c3, + 0x280ec3, + 0x200cc3, + 0x200882, + 0x880c8, + 0x281045, + 0x2db108, + 0x2e7e08, + 0x216582, + 0x2a0f05, + 0x340ec7, + 0x200202, + 0x2417c7, + 0x201f82, + 0x23a887, + 0x36b2c9, + 0x318908, + 0x349889, + 0x32ed82, + 0x266707, + 0x25a4c4, + 0x340f87, + 0x2ff907, + 0x233e42, + 0x211003, + 0x20e842, + 0x205902, + 0x201502, + 0x206d42, + 0x208782, + 0x217642, + 0x2a8c45, + 0x2e3cc5, + 0x16582, + 0x343c3, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x211003, + 0x238483, + 0x2264c3, + 0x12003, + 0x481, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x201604, + 0x202243, + 0x238483, + 0x2264c3, + 0x21ca03, + 0x340f2d86, + 0x107003, + 0x79ac5, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x216582, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x9502, + 0x880c8, + 0x441c4, + 0xd0205, + 0x200882, + 0x2ba384, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x35bb03, + 0x2a9c05, + 0x202243, + 0x332683, + 0x238483, + 0x201f43, + 0x2264c3, + 0x217643, + 0x224183, + 0x223ec3, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x216582, + 0x2264c3, + 0x880c8, + 0x21eb03, + 0x880c8, + 0x316403, + 0x22d183, + 0x232144, + 0x2343c3, + 0x21eb03, + 0x2082c2, + 0x211003, + 0x238483, + 0x2264c3, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x2082c2, + 0x2348c3, + 0x238483, + 0x2264c3, + 0x2db083, + 0x217643, + 0x200882, + 0x216582, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x241f85, + 0x1835c6, + 0x224104, + 0x203e42, + 0x880c8, + 0x200882, + 0x20448, + 0x216582, + 0xee46, + 0x167404, + 0x10f2cb, + 0x173606, + 0x131ac7, + 0x2343c3, + 0x21eb03, + 0x157f45, + 0x155dc4, + 0x202c43, + 0x4c207, + 0xcd884, + 0x238483, + 0x133184, + 0x2264c3, + 0x2e26c4, + 0x149708, + 0x155646, + 0x216582, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x211003, + 0x2025c3, + 0x2264c3, + 0x2e1a03, + 0x203e42, + 0x880c8, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x201603, + 0x212444, + 0x238483, + 0x2264c3, + 0x22d183, + 0x2343c3, + 0x22d684, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x241f86, + 0x2343c3, + 0x21eb03, + 0x179ac3, + 0x2264c3, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x131ac7, + 0x880c8, + 0x21eb03, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x3aa2d183, + 0x2343c3, + 0x238483, + 0x2264c3, + 0x880c8, + 0x200882, + 0x216582, + 0x22d183, + 0x21eb03, + 0x238483, + 0x201502, + 0x2264c3, + 0x309dc7, + 0x20b28b, + 0x200b03, + 0x2a06c8, + 0x308047, + 0x2017c6, + 0x2bba05, + 0x2f7989, + 0x20bc48, + 0x20bc49, + 0x20bc50, + 0x359fcb, + 0x2ea589, + 0x20c783, + 0x221749, + 0x232c46, + 0x232c4c, + 0x20be48, + 0x3ac688, + 0x26e089, + 0x29bace, + 0x37cc4b, + 0x38db4c, + 0x204803, + 0x2582cc, + 0x207209, + 0x2de107, + 0x23430c, + 0x39b60a, + 0x245dc4, + 0x3b08cd, + 0x258188, + 0x2ded8d, + 0x266b86, + 0x28a70b, + 0x209dc9, + 0x318407, + 0x31d846, + 0x320f49, + 0x332a4a, + 0x302708, + 0x2e1604, + 0x272187, + 0x226a87, + 0x349d84, + 0x20f244, + 0x27e989, + 0x326ec9, + 0x20a588, + 0x2114c5, + 0x392785, + 0x20d3c6, + 0x3b0789, + 0x20800d, + 0x38d5c8, + 0x20d2c7, + 0x2bba88, + 0x22eec6, + 0x3a1504, + 0x37f645, + 0x2055c6, + 0x206104, + 0x207107, + 0x20914a, + 0x2139c4, + 0x21a0c6, + 0x21aa49, + 0x21aa4f, + 0x21b00d, + 0x21b786, + 0x220050, + 0x220446, + 0x220b87, + 0x221087, + 0x22108f, + 0x222309, + 0x227746, + 0x229747, + 0x229748, + 0x229b09, + 0x28d708, + 0x2d7d07, + 0x20cd03, + 0x3852c6, + 0x204008, + 0x29bd8a, + 0x215749, + 0x20bd83, + 0x340dc6, + 0x26130a, + 0x2ef8c7, + 0x2ddf4a, + 0x377e0e, + 0x222446, + 0x29a207, + 0x214d86, + 0x2072c6, + 0x37f18b, + 0x21d18a, + 0x21768d, + 0x211b87, + 0x310288, + 0x310289, + 0x31028f, + 0x3b218c, + 0x278289, + 0x33948e, + 0x3ab08a, + 0x368dc6, + 0x37bf86, + 0x30420c, + 0x31370c, + 0x327688, + 0x33f8c7, + 0x2131c5, + 0x29e584, + 0x24fb0e, + 0x332cc4, + 0x238a87, + 0x26274a, + 0x382554, + 0x3839cf, + 0x221248, + 0x385188, + 0x370e8d, + 0x370e8e, + 0x38fec9, + 0x22fe88, + 0x22fe8f, + 0x23400c, + 0x23400f, + 0x235507, + 0x237bca, + 0x21f18b, + 0x23a0c8, + 0x23bb47, + 0x25b08d, + 0x252506, + 0x3b0a86, + 0x23e5c9, + 0x215d48, + 0x242188, + 0x24218e, + 0x20b387, + 0x25f8c5, + 0x243a85, + 0x202084, + 0x201a86, + 0x20a488, + 0x24f103, + 0x3b154e, + 0x25b448, + 0x29ff0b, + 0x366947, + 0x3a31c5, + 0x239506, + 0x2aa947, + 0x39a248, + 0x27efc9, + 0x28f685, + 0x283688, + 0x213446, + 0x38b30a, + 0x24fa09, + 0x2343c9, + 0x2343cb, + 0x364b88, + 0x349c49, + 0x211586, + 0x2b074a, + 0x35904a, + 0x237dcc, + 0x367287, + 0x2a998a, + 0x27258b, + 0x272599, + 0x2da488, + 0x242005, + 0x25b246, + 0x2ed389, + 0x318e06, + 0x21250a, + 0x2f31c6, + 0x212104, + 0x2bf38d, + 0x3412c7, + 0x212109, + 0x244d45, + 0x244e88, + 0x245389, + 0x2455c4, + 0x245cc7, + 0x245cc8, + 0x246347, + 0x263e88, + 0x24c807, + 0x36f505, + 0x2567cc, + 0x256e89, + 0x2d9a8a, + 0x38ec09, + 0x221849, + 0x26b00c, + 0x259b8b, + 0x259e48, + 0x25bac8, + 0x25ee84, + 0x27d9c8, + 0x282309, + 0x39b6c7, + 0x21ac86, + 0x399907, + 0x325e89, + 0x366ecb, + 0x324907, + 0x3714c7, + 0x20acc7, + 0x2ded04, + 0x2ded05, + 0x2a81c5, + 0x337ecb, + 0x3981c4, + 0x319fc8, + 0x25f4ca, + 0x213507, + 0x346547, + 0x288f12, + 0x283e06, + 0x231ac6, + 0x322fce, + 0x361506, + 0x28edc8, + 0x28ff4f, + 0x2df148, + 0x284c08, + 0x35f54a, + 0x35f551, + 0x2a274e, + 0x23be4a, + 0x23be4c, + 0x230087, + 0x230090, + 0x204ac8, + 0x2a2945, + 0x2aad0a, + 0x20614c, + 0x2b3e0d, + 0x2ac3c6, + 0x2ac3c7, + 0x2ac3cc, + 0x2efc8c, + 0x2da98c, + 0x28c98b, + 0x283044, + 0x21b644, + 0x3741c9, + 0x2d72c7, + 0x2e94c9, + 0x358e89, + 0x36bb47, + 0x39b486, + 0x39b489, + 0x3a4a43, + 0x2a208a, + 0x29e7c7, + 0x30b6cb, + 0x21750a, + 0x23a9c4, + 0x353e86, + 0x27a309, + 0x30ec04, + 0x3a20ca, + 0x228e45, + 0x2b6485, + 0x2b648d, + 0x2b67ce, + 0x39f105, + 0x3167c6, + 0x241b87, + 0x26748a, + 0x39a446, + 0x35a2c4, + 0x35e2c7, + 0x210ecb, + 0x22ef87, + 0x202104, + 0x265d46, + 0x265d4d, + 0x325b4c, + 0x32fd86, + 0x38d7ca, + 0x225806, + 0x210288, + 0x263507, + 0x23660a, + 0x23c3c6, + 0x211a83, + 0x251186, + 0x203e88, + 0x296a8a, + 0x24aa47, + 0x24aa48, + 0x267b84, + 0x27b2c7, + 0x2c4108, + 0x2a3648, + 0x286808, + 0x27fa0a, + 0x2cf145, + 0x2cf3c7, + 0x23bc93, + 0x22d206, + 0x2b1648, + 0x224709, + 0x241688, + 0x216f0b, + 0x2b7848, + 0x211004, + 0x2a1e46, + 0x3b3106, + 0x2d9509, + 0x385c07, + 0x2568c8, + 0x287bc6, + 0x3a17c4, + 0x2c2e45, + 0x2bdc88, + 0x2be28a, + 0x2bf008, + 0x2c3906, + 0x29718a, + 0x233588, + 0x2c8548, + 0x2c9908, + 0x2c9f46, + 0x2cc006, + 0x31098c, + 0x2cc5d0, + 0x286fc5, + 0x2def48, + 0x2f8310, + 0x2def50, + 0x20bace, + 0x31060e, + 0x310614, + 0x31d9cf, + 0x31dd86, + 0x342211, + 0x349e53, + 0x34a2c8, + 0x27fd45, + 0x358288, + 0x20f985, + 0x22b24c, + 0x24bf89, + 0x2388c9, + 0x399687, + 0x240589, + 0x215a47, + 0x2b9d86, + 0x37f447, + 0x20c185, + 0x212043, + 0x24f2c9, + 0x217a49, + 0x379ac3, + 0x3aabc4, + 0x34ae4d, + 0x3558cf, + 0x2fe005, + 0x31aa06, + 0x20cfc7, + 0x21d5c7, + 0x285d86, + 0x285d8b, + 0x2a3bc5, + 0x258ac6, + 0x208487, + 0x26d109, + 0x2de6c6, + 0x364505, + 0x21c08b, + 0x22e946, + 0x246045, + 0x27e148, + 0x2d8748, + 0x2ca44c, + 0x2ca450, + 0x2ce7c9, + 0x2d5587, + 0x2f6c4b, + 0x2d5d46, + 0x2d7bca, + 0x2d928b, + 0x2d9d0a, + 0x2d9f86, + 0x2daf45, + 0x307f46, + 0x274f88, + 0x39974a, + 0x370b1c, + 0x2e1acc, + 0x2e1dc8, + 0x241f85, + 0x2e42c7, + 0x29b706, + 0x273c45, + 0x21dd86, + 0x285f48, + 0x2b5907, + 0x29b9c8, + 0x29a30a, + 0x3212cc, + 0x321549, + 0x224a87, + 0x282844, + 0x244386, + 0x28478a, + 0x358f85, + 0x3637cc, + 0x364f08, + 0x360d08, + 0x3b188c, + 0x20c8cc, + 0x20da49, + 0x20dc87, + 0x22d34c, + 0x29d284, + 0x2e83ca, + 0x2ad2cc, + 0x26eb4b, + 0x39070b, + 0x3a5946, + 0x23c107, + 0x2302c7, + 0x2302cf, + 0x2f0c11, + 0x3b3a12, + 0x23c90d, + 0x23c90e, + 0x23cc4e, + 0x31db88, + 0x31db92, + 0x23ea88, + 0x201407, + 0x248bca, + 0x20d888, + 0x3614c5, + 0x371c0a, + 0x220987, + 0x2da0c4, + 0x202b43, + 0x311185, + 0x35f7c7, + 0x39fe87, + 0x2b400e, + 0x3366cd, + 0x338149, + 0x20dfc5, + 0x35d103, + 0x24ea46, + 0x36fb85, + 0x271a48, + 0x2b2449, + 0x25b285, + 0x25b28f, + 0x2dad87, + 0x2f78c5, + 0x306b0a, + 0x27fc06, + 0x23dd09, + 0x2ea18c, + 0x2ebe09, + 0x378a86, + 0x25f2cc, + 0x2ec206, + 0x2ef3c8, + 0x2ef5c6, + 0x2da606, + 0x280604, + 0x25a1c3, + 0x35760a, + 0x369111, + 0x38c04a, + 0x3627c5, + 0x2a64c7, + 0x253647, + 0x2c4204, + 0x2c420b, + 0x318788, + 0x2b3006, + 0x2c75c5, + 0x38b604, + 0x262b49, + 0x29f2c4, + 0x21da87, + 0x322045, + 0x322047, + 0x323205, + 0x2a8d03, + 0x2012c8, + 0x27f30a, + 0x23fd43, + 0x28108a, + 0x26db46, + 0x25b00f, + 0x356849, + 0x3b14d0, + 0x2e22c8, + 0x2c45c9, + 0x293287, + 0x265ccf, + 0x3aecc4, + 0x22d704, + 0x219f46, + 0x222b86, + 0x3a5dca, + 0x3903c6, + 0x33eb87, + 0x2f6fc8, + 0x2f71c7, + 0x2f7bc7, + 0x34b94a, + 0x2fa14b, + 0x38e7c5, + 0x3b3648, + 0x238b83, + 0x261d0c, + 0x212f4f, + 0x2594cd, + 0x2bb187, + 0x338289, + 0x22f4c7, + 0x25a288, + 0x38274c, + 0x2a6c48, + 0x252cc8, + 0x30c28e, + 0x31f814, + 0x31fd24, + 0x33f28a, + 0x35a54b, + 0x215b04, + 0x215b09, + 0x330288, + 0x244545, + 0x24ec0a, + 0x36b187, + 0x307e44, + 0x323ac3, + 0x22d183, + 0x2374c4, + 0x2343c3, + 0x21eb03, + 0x201604, + 0x202243, + 0x211003, + 0x2cc5c6, + 0x212444, + 0x238483, + 0x2264c3, + 0x21bd03, + 0x200882, + 0x323ac3, + 0x216582, + 0x22d183, + 0x2374c4, + 0x2343c3, + 0x21eb03, + 0x202243, + 0x2cc5c6, + 0x238483, + 0x2264c3, + 0x880c8, + 0x22d183, + 0x2343c3, + 0x211cc3, + 0x238483, + 0x2264c3, + 0x880c8, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x211003, + 0x212444, + 0x238483, + 0x2264c3, + 0x200882, + 0x2f5003, + 0x216582, + 0x2343c3, + 0x21eb03, + 0x211003, + 0x238483, + 0x2264c3, + 0x202ec2, + 0x200482, + 0x216582, + 0x22d183, + 0x22b782, + 0x200a82, + 0x201604, + 0x307b04, + 0x219382, + 0x212444, + 0x201502, + 0x2264c3, + 0x21bd03, + 0x3a5946, + 0x221e42, + 0x206202, + 0x224dc2, + 0x3d224643, + 0x3d626703, + 0x53d46, + 0x53d46, + 0x224104, + 0x140a30a, + 0x16970c, + 0x165f0c, + 0x798cd, + 0xdb7c7, + 0x1b908, + 0x22f08, + 0x1a7eca, + 0x3e31f345, + 0x11f349, + 0x163048, + 0x1ac10a, + 0x16348e, + 0x144148b, + 0x167404, + 0x2988, + 0x16e847, + 0x178587, + 0x112089, + 0x10ec87, + 0x132d48, + 0x1a2f89, + 0x17a845, + 0x5074e, + 0xa910d, + 0x131948, + 0x3e6d7e86, + 0x60c47, + 0x62607, + 0x67347, + 0x6c4c7, + 0xd382, + 0x141807, + 0x1d34c, + 0xeaec7, + 0x8ddc6, + 0xa5449, + 0xa7188, + 0xf1c2, + 0xa82, + 0x13088b, + 0x15309, + 0x33c49, + 0x2b848, + 0xb09c2, + 0x1afb89, + 0xccf89, + 0xcdbc8, + 0xce147, + 0xcf0c9, + 0xd2905, + 0xd2d10, + 0x164d46, + 0x51f05, + 0x23b4d, + 0x10e846, + 0xdc047, + 0xe26d8, + 0x108548, + 0x19104a, + 0x4114d, + 0x1402, + 0x161186, + 0x89948, + 0x180248, + 0x87f89, + 0x45e88, + 0x4da0e, + 0xe8f85, + 0x539c8, + 0x3282, + 0x155646, + 0x6c2, + 0xb81, + 0x3eae2f44, + 0x3ee90c43, 0x141, - 0x15c06, + 0x1650c6, 0x141, 0x1, - 0x15c06, - 0x8b4c3, - 0x14e4285, - 0x24fe44, - 0x2d0783, - 0x251304, - 0x2964c4, - 0x204ac3, - 0x222ac5, - 0x21bd03, - 0x2202c3, - 0x370145, - 0x24abc3, - 0x466d0783, - 0x231b83, - 0x332ec3, + 0x1650c6, + 0x14f60c5, + 0x245dc4, + 0x22d183, + 0x247344, + 0x201604, + 0x238483, + 0x2245c5, + 0x21ca03, + 0x215cc3, + 0x2e9cc5, + 0x223ec3, + 0x3fe2d183, + 0x2343c3, + 0x21eb03, 0x200041, - 0x20fbc3, - 0x222044, - 0x213184, - 0x204ac3, - 0x200383, - 0x213e83, - 0x15f048, - 0x204cc2, - 0x368883, - 0x20d1c2, - 0x2d0783, - 0x231b83, - 0x2135c3, - 0x201d42, - 0x2964c4, - 0x204303, - 0x20fbc3, - 0x204ac3, - 0x20abc3, - 0x200383, - 0x24abc3, - 0x15f048, - 0x371182, - 0xd1c2, - 0x1491b48, - 0x10598e, - 0x47608c42, - 0x32f9c8, - 0x233d86, - 0x210186, - 0x233707, - 0x47a00902, - 0x47f53508, - 0x20ebca, - 0x269708, - 0x201442, - 0x32f649, - 0x3a2487, - 0x218486, - 0x295ec9, - 0x247ec4, - 0x2e4186, - 0x2e1bc4, - 0x26bdc4, - 0x25bf49, - 0x326286, - 0x24df85, - 0x291285, - 0x390387, - 0x2c3747, - 0x2911c4, - 0x233946, - 0x2ffb45, - 0x367445, - 0x302505, - 0x392307, - 0x26ae05, - 0x315e49, - 0x32d305, - 0x307184, - 0x38d347, - 0x32ecce, - 0x330a09, - 0x358849, - 0x3ac9c6, - 0x2fe248, - 0x2b520b, - 0x2e3b0c, - 0x2898c6, - 0x2076c7, - 0x37b305, - 0x32d98a, - 0x237a09, - 0x3aa989, - 0x257646, - 0x2fb805, - 0x2aabc5, - 0x348f89, - 0x30268b, - 0x280f46, - 0x338346, - 0x20a904, - 0x2908c6, - 0x226a08, - 0x3abc06, - 0x20c5c6, - 0x206188, - 0x207f47, - 0x208649, - 0x209705, - 0x15f048, - 0x216e84, - 0x33d5c4, - 0x369f05, - 0x204f49, - 0x222347, - 0x22234b, - 0x223e4a, - 0x228485, - 0x4820a002, - 0x238987, - 0x48629248, - 0x27be07, - 0x2bf945, - 0x3aac0a, - 0xd1c2, - 0x38740b, - 0x25470a, - 0x222dc6, - 0x395e03, - 0x29538d, - 0x3582cc, - 0x37f24d, - 0x381085, - 0x227dc5, - 0x2601c7, - 0x209c09, - 0x20eac6, - 0x383405, - 0x2d8008, - 0x2907c3, - 0x2ec708, - 0x2907c8, - 0x2c6c47, - 0x3b2448, - 0x39b7c9, - 0x2c9747, - 0x238187, - 0x302b88, - 0x38ca44, - 0x38ca47, - 0x272648, - 0x2024c6, - 0x206fcf, - 0x2118c7, - 0x2e7a86, - 0x23e2c5, - 0x223783, - 0x365a47, - 0x36da03, - 0x250446, - 0x251c46, - 0x252a06, - 0x296e85, - 0x26ea03, - 0x388a48, - 0x370c89, - 0x37ffcb, - 0x252b88, - 0x254285, - 0x256405, - 0x48aabc02, - 0x359a49, - 0x296547, - 0x25f185, - 0x25be47, - 0x25dd86, - 0x363f05, - 0x36fe0b, - 0x2640c4, - 0x2692c5, - 0x269407, - 0x27b786, - 0x27bbc5, - 0x288487, + 0x211003, + 0x307b04, + 0x212444, + 0x238483, + 0x2264c3, + 0x217643, + 0x880c8, + 0x200882, + 0x323ac3, + 0x216582, + 0x22d183, + 0x2343c3, + 0x211cc3, + 0x200a82, + 0x201604, + 0x202243, + 0x211003, + 0x238483, + 0x2025c3, + 0x2264c3, + 0x223ec3, + 0x880c8, + 0x38bcc2, + 0x16582, + 0x1462d48, + 0xf738e, + 0x40e00142, + 0x29e988, + 0x227fc6, + 0x2bb546, + 0x227947, + 0x41201102, + 0x417566c8, + 0x3af8ca, + 0x2606c8, + 0x201002, + 0x29e609, + 0x38e807, + 0x21ac06, + 0x201009, + 0x254704, + 0x2f5fc6, + 0x2d5fc4, + 0x273a04, + 0x2563c9, + 0x281786, + 0x2e3d85, + 0x220e45, + 0x3a5287, + 0x2b7cc7, + 0x243884, + 0x227b86, + 0x39fac5, + 0x202b05, + 0x2f5905, + 0x392547, + 0x366785, + 0x308bc9, + 0x2808c5, + 0x2d07c4, + 0x39a387, + 0x30584e, + 0x30fc49, + 0x322e89, + 0x348986, + 0x31e708, + 0x2b024b, + 0x2d210c, + 0x25b946, + 0x37cb07, + 0x209805, + 0x20f24a, + 0x20a689, + 0x252249, + 0x293d86, + 0x2ee6c5, + 0x28b145, + 0x361f09, + 0x2f5a8b, + 0x277606, + 0x32e5c6, + 0x20d2c4, + 0x288bc6, + 0x25f948, + 0x203d06, + 0x3a82c6, + 0x208bc8, + 0x2093c7, + 0x209589, + 0x20c445, + 0x880c8, + 0x378504, + 0x229e04, + 0x212d45, + 0x395589, + 0x223707, + 0x22370b, + 0x2255ca, + 0x22b185, + 0x41a0b602, + 0x2173c7, + 0x41e2c488, + 0x2833c7, + 0x281ac5, + 0x32594a, + 0x16582, + 0x24b90b, + 0x2adc4a, + 0x2248c6, + 0x3a31c3, + 0x230dcd, + 0x3320cc, + 0x36210d, + 0x3845c5, + 0x237205, + 0x24f147, + 0x3a8e89, + 0x3af7c6, + 0x390245, + 0x2ee3c8, + 0x288ac3, + 0x2e8108, + 0x288ac8, + 0x2bc507, + 0x2e62c8, + 0x3af3c9, + 0x236107, + 0x20ae07, + 0x335048, + 0x253384, + 0x253387, + 0x266a88, + 0x205846, + 0x3661cf, + 0x215507, + 0x2e3506, + 0x25a405, + 0x224f43, + 0x372207, + 0x36e143, + 0x246506, + 0x247f86, + 0x249686, + 0x28d1c5, + 0x263e83, + 0x3885c8, + 0x370489, + 0x38124b, + 0x249808, + 0x24c4c5, + 0x24d4c5, + 0x4223aa82, + 0x37f509, + 0x201687, + 0x258b45, + 0x2562c7, + 0x257e06, + 0x35eb05, + 0x36f9cb, + 0x259e44, + 0x260285, + 0x2603c7, + 0x271986, + 0x271fc5, + 0x27dbc7, + 0x27e647, + 0x26db04, + 0x2871ca, + 0x287688, + 0x3685c9, + 0x3a65c5, + 0x333386, + 0x25fb0a, + 0x220d46, + 0x24bb47, + 0x318a8d, + 0x2273c9, + 0x30ff45, + 0x24ff87, + 0x335608, + 0x3675c8, + 0x341b87, + 0x34a486, + 0x2116c7, + 0x247883, + 0x337ec4, + 0x35c385, + 0x38cac7, + 0x391f49, + 0x21a6c8, + 0x22fd05, + 0x382a04, + 0x240e85, + 0x2448cd, + 0x201142, + 0x3006c6, + 0x3610c6, + 0x2bde4a, + 0x3791c6, + 0x37fc45, + 0x319285, + 0x319287, + 0x38b14c, + 0x26fb8a, + 0x288886, + 0x29e445, + 0x288a06, 0x288d47, - 0x2d1784, - 0x28e04a, - 0x28e508, - 0x2c2149, - 0x3648c5, - 0x2951c6, - 0x226bca, - 0x387646, - 0x26f5c7, - 0x2c1e0d, - 0x2a1f09, - 0x3597c5, - 0x339dc7, - 0x368388, - 0x26a888, - 0x314d07, - 0x20b246, - 0x217807, - 0x221143, - 0x33c004, - 0x3607c5, - 0x38dcc7, - 0x391d09, - 0x22a8c8, - 0x33fac5, - 0x242844, - 0x2f5bc5, - 0x38174d, - 0x203742, - 0x386ac6, - 0x377a06, - 0x2c8bca, - 0x37e686, - 0x38b5c5, - 0x368fc5, - 0x368fc7, - 0x3a010c, - 0x279b0a, - 0x290586, - 0x225085, - 0x290706, - 0x290a47, - 0x292846, - 0x296d8c, - 0x296009, - 0x48e16087, - 0x299745, - 0x299746, - 0x299d08, - 0x236785, - 0x2a8b45, - 0x2a9548, - 0x2a974a, - 0x49258142, - 0x4960c2c2, - 0x2e8f85, - 0x28b9c3, - 0x22b108, - 0x241d03, - 0x2a99c4, - 0x2f350b, - 0x34ef48, - 0x305148, - 0x49b67ec9, - 0x2af389, - 0x2afac6, - 0x2b0a88, - 0x2b0c89, - 0x2b1786, - 0x2b1905, - 0x372a86, - 0x2b1e49, - 0x319d87, - 0x25c446, - 0x233147, - 0x20e947, - 0x362e04, - 0x49f453c9, - 0x2cd008, - 0x353408, - 0x383d07, - 0x2c8686, - 0x235389, - 0x210147, - 0x34970a, - 0x330d48, - 0x349407, - 0x3b1546, - 0x2e834a, - 0x2733c8, - 0x30de45, - 0x36dac5, - 0x2f9807, - 0x371d49, - 0x3097cb, - 0x31e0c8, - 0x32d389, - 0x253487, - 0x2bad4c, - 0x2bb74c, - 0x2bba4a, - 0x2bbccc, - 0x2c5c08, - 0x2c5e08, - 0x2c6004, - 0x2c63c9, - 0x2c6609, - 0x2c684a, - 0x2c6ac9, - 0x2c6e07, - 0x3a448c, - 0x24b946, - 0x35d588, - 0x387706, - 0x330c06, - 0x3596c7, - 0x238ec8, - 0x2618cb, - 0x303207, - 0x359c49, - 0x251489, - 0x25bbc7, - 0x2e1e04, - 0x3643c7, - 0x2e1246, - 0x214046, - 0x2eb045, - 0x2c7408, - 0x2976c4, - 0x2976c6, - 0x2799cb, - 0x212cc9, - 0x209e06, - 0x20c709, - 0x392486, - 0x3aae08, - 0x214183, - 0x2fb985, - 0x215a09, - 0x224085, - 0x2f9644, - 0x27acc6, - 0x2ed005, - 0x2f7346, - 0x309ec7, - 0x328dc6, - 0x3a174b, - 0x22c447, - 0x234886, - 0x3742c6, - 0x390446, - 0x291189, - 0x240aca, - 0x2b8ec5, - 0x21898d, - 0x2a9846, - 0x2babc6, - 0x2ded86, - 0x2f31c5, - 0x2e4d87, - 0x29fa87, - 0x22bd4e, - 0x20fbc3, - 0x2c8649, - 0x263709, - 0x32dd87, - 0x2804c7, - 0x2a2ec5, - 0x343f05, - 0x4a23734f, - 0x2d10c7, - 0x2d1288, - 0x2d25c4, - 0x2d2e86, - 0x4a64db02, - 0x2d7346, - 0x201686, - 0x2638ce, - 0x2ec54a, - 0x28b6c6, - 0x22d88a, - 0x209a09, - 0x323d05, - 0x393948, - 0x3aef46, - 0x359508, - 0x2392c8, - 0x34434b, - 0x233805, - 0x26ae88, - 0x2062cc, - 0x2bf807, - 0x252546, - 0x281fc8, - 0x2253c8, - 0x4aa09282, - 0x25604b, - 0x37b489, - 0x2cf2c9, - 0x2f02c7, - 0x3b3648, - 0x4ae289c8, - 0x20e64b, - 0x37dd09, - 0x33f58d, - 0x27d648, - 0x290188, - 0x4b201882, - 0x3b2f44, - 0x4b60dc42, - 0x2f9486, - 0x4ba038c2, - 0x2448ca, - 0x210546, - 0x22d208, - 0x289e88, - 0x2e4086, - 0x2eb5c6, - 0x2f7106, - 0x2f1b45, - 0x23c804, - 0x4be1de04, - 0x20ae86, - 0x29a787, - 0x4c2f7d07, - 0x2dc60b, - 0x32f089, - 0x227e0a, - 0x263144, - 0x369108, - 0x25c20d, - 0x2f1509, - 0x2f1748, - 0x2f2009, - 0x2f39c4, - 0x20ce44, - 0x283cc5, - 0x317b0b, - 0x34eec6, - 0x33c645, - 0x21fb89, - 0x233a08, - 0x263844, - 0x32db09, - 0x208f45, - 0x2c3788, - 0x238847, - 0x358c48, - 0x284e86, - 0x22b987, - 0x2984c9, - 0x311a89, - 0x372545, - 0x295645, - 0x4c626a82, - 0x306f44, - 0x30ce05, - 0x2c1846, - 0x327285, - 0x2b4707, - 0x20af85, - 0x27b7c4, - 0x3aca86, - 0x383487, - 0x232106, - 0x21e105, - 0x202608, - 0x233f85, - 0x205d07, - 0x20bc49, - 0x212e0a, - 0x2494c7, - 0x2494cc, - 0x24df46, - 0x2e9ac9, - 0x230505, - 0x2366c8, - 0x210c03, - 0x210c05, - 0x2f7b45, - 0x26e707, - 0x4ca27202, - 0x227a07, - 0x2e5206, - 0x345306, - 0x2e62c6, - 0x225306, - 0x2091c8, - 0x35b805, - 0x2e7b47, - 0x2e7b4d, - 0x21b083, - 0x21f305, - 0x21b087, - 0x26b308, - 0x21ac45, - 0x2281c8, - 0x2ab9c6, - 0x32b247, - 0x2c7bc5, - 0x233886, - 0x2cfac5, - 0x22dfca, - 0x2efec6, - 0x25dbc7, - 0x2bc605, - 0x2f44c7, - 0x2f8904, - 0x2f95c6, - 0x3624c5, - 0x32608b, - 0x2e10c9, - 0x23d74a, - 0x3725c8, - 0x3007c8, - 0x300f0c, - 0x306b47, - 0x308c48, - 0x30aa88, - 0x30dac5, - 0x338b4a, - 0x33aa09, - 0x4ce00202, - 0x200206, - 0x20d684, - 0x2ef889, - 0x275d49, - 0x27b1c7, - 0x2fa547, - 0x2b7c09, - 0x331308, - 0x33130f, - 0x2dfa86, - 0x2db10b, - 0x361545, - 0x361547, - 0x374c89, - 0x2171c6, - 0x32da87, - 0x2dde85, - 0x22f544, - 0x26e186, - 0x211984, - 0x2e6c47, - 0x34c5c8, - 0x4d2fb708, - 0x2fbe85, - 0x2fbfc7, - 0x245709, - 0x208444, - 0x208448, - 0x4d7190c8, - 0x23cdc4, - 0x230c88, - 0x3396c4, - 0x220389, - 0x333105, - 0x4da05bc2, - 0x2dfac5, - 0x2e6845, - 0x271b88, - 0x232847, - 0x4de03382, - 0x30cbc5, - 0x2d4e86, - 0x27a786, - 0x306f08, - 0x318308, - 0x327246, - 0x32e246, - 0x249009, - 0x345246, - 0x21708b, - 0x2a12c5, - 0x204686, - 0x382588, - 0x3152c6, - 0x298e46, - 0x21b94a, - 0x22f9ca, - 0x2e8245, - 0x35b8c7, - 0x2f0cc6, - 0x4e206602, - 0x21b1c7, - 0x2a9085, - 0x226b44, - 0x226b45, - 0x263046, - 0x27a447, - 0x20d405, - 0x22fb44, - 0x365008, - 0x298f05, - 0x33c8c7, - 0x39fa85, - 0x22df05, - 0x256b44, - 0x28fbc9, - 0x2ff988, - 0x2ecec6, - 0x2de9c6, - 0x2b9d46, - 0x4e700448, - 0x300647, - 0x3009cd, - 0x30120c, - 0x301809, - 0x301a49, - 0x4eb546c2, - 0x3a5503, - 0x20b303, - 0x2e1305, - 0x38ddca, - 0x327106, - 0x307905, - 0x30a084, - 0x30a08b, - 0x31bdcc, - 0x31c5cc, - 0x31c8d5, - 0x31d74d, - 0x31f44f, - 0x31f812, - 0x31fc8f, - 0x320052, - 0x3204d3, - 0x32098d, - 0x320f4d, - 0x3212ce, - 0x322a8e, - 0x3232cc, - 0x32368c, - 0x323acb, - 0x323e4e, - 0x324f92, - 0x326ecc, - 0x327610, - 0x3335d2, - 0x3347cc, - 0x334e8d, - 0x3351cc, - 0x337611, - 0x3384cd, - 0x33ac4d, - 0x33b24a, - 0x33b4cc, - 0x33bdcc, - 0x33c34c, - 0x33cbcc, - 0x33fc53, - 0x340450, - 0x340850, - 0x340e4d, - 0x34144c, - 0x342209, - 0x342f0d, - 0x343253, - 0x344911, - 0x344d53, - 0x34560f, - 0x3459cc, - 0x345ccf, - 0x34608d, - 0x34668f, - 0x346a50, - 0x3474ce, - 0x34ac8e, - 0x34b590, - 0x34ca8d, - 0x34d40e, - 0x34d78c, - 0x34e753, - 0x351e0e, - 0x352390, - 0x352791, - 0x352bcf, - 0x352f93, - 0x35424d, - 0x35458f, - 0x35494e, - 0x354fd0, - 0x3553c9, - 0x356390, - 0x356acf, - 0x35714f, - 0x357512, - 0x359e8e, - 0x35a74d, - 0x35cc4d, - 0x35cf8d, - 0x35f68d, - 0x35f9cd, - 0x35fd10, - 0x36010b, - 0x36058c, - 0x36090c, - 0x360c0c, - 0x360f0e, - 0x372c10, - 0x374452, - 0x3748cb, - 0x374ece, - 0x37524e, - 0x375ace, - 0x37604b, - 0x4ef76396, - 0x37724d, - 0x378354, - 0x378e0d, - 0x37ae55, - 0x37c04d, - 0x37c9cf, - 0x37d20f, - 0x38028f, - 0x38064e, - 0x380acd, - 0x382f11, - 0x385ecc, - 0x3861cc, - 0x3864cb, - 0x386c4c, - 0x38824f, - 0x388612, - 0x388fcd, + 0x28a9c6, + 0x28d0cc, + 0x201149, + 0x42765547, + 0x290305, + 0x290306, + 0x2906c8, + 0x2b1f05, + 0x2a4805, + 0x2a4a48, + 0x2a4c4a, + 0x42a6a242, + 0x42e0ff82, + 0x382245, + 0x29cdc3, + 0x37a688, + 0x21d083, + 0x2a4ec4, + 0x23de4b, + 0x272408, + 0x2d77c8, + 0x433255c9, + 0x2a8949, + 0x2a9006, + 0x2aa5c8, + 0x2aa7c9, + 0x2ab386, + 0x2ab505, + 0x383086, + 0x2abc09, + 0x2802c7, + 0x243f06, + 0x235c47, + 0x3af647, + 0x33b504, + 0x43743909, + 0x2c2288, + 0x3565c8, + 0x2368c7, + 0x2bd906, + 0x2fe209, + 0x331f47, + 0x2f1b0a, + 0x376848, + 0x3237c7, + 0x326086, + 0x33aa0a, + 0x249fc8, + 0x28ab05, + 0x21bf85, + 0x2bcb87, + 0x2d26c9, + 0x2d6e0b, + 0x2dd8c8, + 0x280949, + 0x249b07, + 0x3ad20c, + 0x2b1acc, + 0x2b1dca, + 0x2b204c, + 0x2bb4c8, + 0x2bb6c8, + 0x2bb8c4, + 0x2bbc89, + 0x2bbec9, + 0x2bc10a, + 0x2bc389, + 0x2bc6c7, + 0x20010c, + 0x36ef86, + 0x26de48, + 0x220e06, + 0x387346, + 0x30fe47, + 0x341d08, + 0x25180b, + 0x283287, + 0x2aeb49, + 0x2474c9, + 0x255f87, + 0x2d6204, + 0x35efc7, + 0x29f606, + 0x219006, + 0x38d985, + 0x2ccd88, + 0x20ef04, + 0x20ef06, + 0x26fa4b, + 0x2a2389, + 0x364086, + 0x3a8409, + 0x3926c6, + 0x2fec08, + 0x214803, + 0x2083c5, + 0x219149, + 0x21fe05, + 0x3a6084, + 0x270fc6, + 0x3a5a85, + 0x2e6846, + 0x2fbc07, + 0x367186, + 0x2952cb, + 0x2b0647, + 0x2d2586, + 0x374346, + 0x3a5346, + 0x243849, + 0x26238a, + 0x2b6045, + 0x21f68d, + 0x2a4d46, + 0x391246, + 0x2e21c6, + 0x210205, + 0x2d3007, + 0x2962c7, + 0x23b68e, + 0x211003, + 0x2bd8c9, + 0x318fc9, + 0x20f647, + 0x276b87, + 0x299d85, + 0x306f45, + 0x43a7eacf, + 0x2c4807, + 0x2c49c8, + 0x2c5a44, + 0x2c5d06, + 0x43e43b02, + 0x2ca1c6, + 0x2cc5c6, + 0x251b4e, + 0x2e7f4a, + 0x21cd06, + 0x33fcca, + 0x3b4089, + 0x316fc5, + 0x393b48, + 0x3ad0c6, + 0x34ab88, + 0x30f788, + 0x25ab8b, + 0x227a45, + 0x366808, + 0x208d0c, + 0x281987, + 0x248b06, + 0x22f108, + 0x201948, + 0x44208382, + 0x362b0b, + 0x280bc9, + 0x363e89, + 0x209987, + 0x30e688, + 0x4460c648, + 0x3a8c0b, + 0x22b6c9, + 0x20870d, + 0x217e88, + 0x22c288, + 0x44a02282, + 0x31d784, + 0x44e23b42, + 0x2ebc06, + 0x452016c2, + 0x3a180a, + 0x201fc6, + 0x225f08, + 0x31ea08, + 0x2b7546, + 0x386986, + 0x2e6606, + 0x2a00c5, + 0x23b184, + 0x456feb84, + 0x338986, + 0x269047, + 0x45a2ab47, + 0x32be0b, + 0x305c09, + 0x23724a, + 0x251404, + 0x3193c8, + 0x243ccd, + 0x2e07c9, + 0x2e0a08, + 0x2e1149, + 0x2e26c4, + 0x200f04, + 0x269885, + 0x30b48b, + 0x272386, + 0x3387c5, + 0x281c49, + 0x227c48, + 0x29ca84, + 0x20f3c9, + 0x2b0585, + 0x2b7d08, + 0x20b4c7, + 0x323288, + 0x27a506, + 0x217287, + 0x28eb89, + 0x21c209, + 0x2460c5, + 0x231445, + 0x45e25242, + 0x39a144, + 0x2fd585, + 0x2a9746, + 0x2f89c5, + 0x268307, + 0x243405, + 0x243484, + 0x348a46, + 0x3902c7, + 0x243b46, + 0x325dc5, + 0x31d488, + 0x2281c5, + 0x332607, + 0x397409, + 0x2a24ca, + 0x22dac7, + 0x22dacc, + 0x2e3d46, + 0x226349, + 0x2ad585, + 0x2c6e08, + 0x211543, + 0x211545, + 0x2e9405, + 0x256cc7, + 0x46214f02, + 0x236e47, + 0x2d6786, + 0x343846, + 0x2e8cc6, + 0x201886, + 0x347e88, + 0x3583c5, + 0x2e35c7, + 0x2e35cd, + 0x202b43, + 0x3a35c5, + 0x3068c7, + 0x3864c8, + 0x386085, + 0x366c88, + 0x22a946, + 0x31f507, + 0x2bcf05, + 0x227ac6, + 0x3711c5, + 0x2ba40a, + 0x2eb1c6, + 0x236487, + 0x2c5bc5, + 0x35a387, + 0x35e244, + 0x3a6006, + 0x2f61c5, + 0x28158b, + 0x29f489, + 0x37a20a, + 0x246148, + 0x2ff148, + 0x300a4c, + 0x3047c7, + 0x32b388, + 0x32edc8, + 0x336085, + 0x2bc94a, + 0x35d109, + 0x46601082, + 0x205446, + 0x214684, + 0x3b1249, + 0x2220c9, + 0x24d307, + 0x26c307, + 0x358d09, + 0x210408, + 0x21040f, + 0x3477c6, + 0x20a0cb, + 0x2e9b05, + 0x2e9b07, + 0x2e9f49, + 0x20f346, + 0x20f347, + 0x3b3d85, + 0x232784, + 0x2633c6, + 0x201284, + 0x30ac07, + 0x345e08, + 0x46aee5c8, + 0x2eebc5, + 0x2eed07, + 0x238289, + 0x2740c4, + 0x3a3888, + 0x46f20b88, + 0x2c4204, + 0x2330c8, + 0x31d904, + 0x21f989, + 0x2230c5, + 0x47203e42, + 0x347805, + 0x220c85, + 0x29fc88, + 0x235347, + 0x47600cc2, + 0x2c81c5, + 0x246b46, + 0x256646, + 0x39a108, + 0x2ec008, + 0x2f8986, + 0x31b086, + 0x22a489, + 0x343786, + 0x37870b, + 0x30c145, + 0x20d7c6, + 0x390088, + 0x252606, + 0x28f506, + 0x21c64a, + 0x2ae4ca, + 0x24ce85, + 0x358487, + 0x2d8e06, + 0x47a03dc2, + 0x306a07, + 0x2c7a45, + 0x25fa84, + 0x25fa85, + 0x251306, + 0x270447, + 0x2144c5, + 0x222184, + 0x2712c8, + 0x28f5c5, + 0x2cebc7, + 0x39c105, + 0x216805, + 0x247b04, + 0x28cbc9, + 0x39f908, + 0x2f5ec6, + 0x36fcc6, + 0x2c3f06, + 0x47ef3648, + 0x2f3847, + 0x2f3fcd, + 0x2f460c, + 0x2f4c09, + 0x2f4e49, + 0x48351e02, + 0x3a4803, + 0x24cf03, + 0x29f6c5, + 0x38cbca, + 0x31af46, + 0x2f8e05, + 0x2fc144, + 0x2fc14b, + 0x30d10c, + 0x30d94c, + 0x30dc55, + 0x311acd, + 0x313a0f, + 0x313dd2, + 0x31424f, + 0x314612, + 0x314a93, + 0x314f4d, + 0x31550d, + 0x31588e, + 0x315d4e, + 0x31658c, + 0x31694c, + 0x316d8b, + 0x31710e, + 0x31a1d2, + 0x31ad0c, + 0x31b8d0, + 0x327e52, + 0x328dcc, + 0x32948d, + 0x3297cc, + 0x32d8d1, + 0x32e74d, + 0x336b0d, + 0x33710a, + 0x33738c, + 0x337c8c, + 0x3384cc, + 0x338d4c, + 0x33c9d3, + 0x33d050, + 0x33d450, + 0x33dccd, + 0x33e2cc, + 0x33efc9, + 0x3402cd, + 0x340613, + 0x342e51, + 0x343293, + 0x343b4f, + 0x343f0c, + 0x34420f, + 0x3445cd, + 0x344bcf, + 0x344f90, + 0x345a0e, + 0x34b48e, + 0x34bbd0, + 0x34c7cd, + 0x34d14e, + 0x34d4cc, + 0x34e493, + 0x34fc8e, + 0x3503d0, + 0x3507d1, + 0x350c0f, + 0x350fd3, + 0x35198d, + 0x351ccf, + 0x35208e, + 0x352990, + 0x352d89, + 0x3539d0, + 0x35400f, + 0x35468f, + 0x354a52, + 0x355ece, + 0x35788d, + 0x35998d, + 0x359ccd, + 0x35ac4d, + 0x35af8d, + 0x35b2d0, + 0x35b6cb, + 0x35c14c, + 0x35c4cc, + 0x35c7cc, + 0x35cace, + 0x372990, + 0x3744d2, + 0x37494b, + 0x3750ce, + 0x37544e, + 0x375cce, + 0x37728b, + 0x48777856, + 0x378ecd, + 0x379354, + 0x37a98d, + 0x37c655, + 0x37d78d, + 0x37e10f, + 0x37e94f, + 0x38150f, + 0x3818ce, + 0x382b0d, + 0x384151, + 0x386b0c, + 0x386e0c, + 0x38710b, + 0x387a0c, + 0x387dcf, + 0x388192, + 0x388b4d, + 0x389b0c, 0x389f8c, - 0x38a40c, - 0x38a70d, - 0x38aa4f, - 0x38ae0e, - 0x38da8c, - 0x38e04d, - 0x38e38b, - 0x38ee8c, - 0x38f40d, - 0x38f74e, - 0x38fac9, - 0x390c53, - 0x39118d, - 0x3914cd, - 0x391acc, - 0x391f4e, - 0x39290f, - 0x392ccc, - 0x392fcd, - 0x39330f, - 0x3936cc, - 0x3943cc, - 0x39484c, - 0x394b4c, - 0x39520d, - 0x395552, - 0x396c0c, - 0x396f0c, - 0x397211, - 0x39764f, - 0x397a0f, - 0x397dd3, - 0x398a8e, - 0x398e0f, - 0x3991cc, - 0x4f39950e, - 0x39988f, - 0x399c56, - 0x39b312, - 0x39d64c, - 0x39e14f, - 0x39e7cd, - 0x39eb0f, - 0x39eecc, - 0x39f1cd, - 0x39f50d, - 0x3a0c4e, - 0x3a2b8c, - 0x3a2e8c, - 0x3a3190, - 0x3a4991, - 0x3a4dcb, - 0x3a510c, - 0x3a540e, + 0x38a28d, + 0x38a5cf, + 0x38a98e, + 0x38c88c, + 0x38ce4d, + 0x38d18b, + 0x38e9cc, + 0x38ef4d, + 0x38f28e, + 0x38f709, + 0x3909d3, + 0x3913cd, + 0x39170d, + 0x391d0c, + 0x39218e, + 0x392b0f, + 0x392ecc, + 0x3931cd, + 0x39350f, + 0x3938cc, + 0x393fcc, + 0x39444c, + 0x39474c, + 0x394e0d, + 0x395152, + 0x3957cc, + 0x395acc, + 0x395dd1, + 0x39620f, + 0x3965cf, + 0x396993, + 0x39764e, + 0x397bcf, + 0x397f8c, + 0x48b982ce, + 0x39864f, + 0x398a16, + 0x399c12, + 0x39b88c, + 0x39c24f, + 0x39c8cd, + 0x39cc0f, + 0x39cfcc, + 0x39d2cd, + 0x39d60d, + 0x39f4ce, + 0x3a058c, + 0x3a088c, + 0x3a0b90, + 0x3a3a91, + 0x3a3ecb, + 0x3a440c, + 0x3a470e, 0x3a7051, 0x3a748e, 0x3a780d, - 0x3aed0b, - 0x3afdcf, - 0x3b09d4, - 0x2630c2, - 0x2630c2, - 0x202583, - 0x2630c2, - 0x202583, - 0x2630c2, - 0x20ae82, - 0x372ac5, + 0x3ace8b, + 0x3adbcf, + 0x3aee94, + 0x21c2c2, + 0x21c2c2, + 0x205903, + 0x21c2c2, + 0x205903, + 0x21c2c2, + 0x205e02, + 0x3830c5, 0x3a6d4c, - 0x2630c2, - 0x2630c2, - 0x20ae82, - 0x2630c2, - 0x29a385, - 0x212e05, - 0x2630c2, - 0x2630c2, - 0x211cc2, - 0x29a385, - 0x31e789, - 0x34460c, - 0x2630c2, - 0x2630c2, - 0x2630c2, - 0x2630c2, - 0x372ac5, - 0x2630c2, - 0x2630c2, - 0x2630c2, - 0x2630c2, - 0x211cc2, - 0x31e789, - 0x2630c2, - 0x2630c2, - 0x2630c2, - 0x212e05, - 0x2630c2, - 0x212e05, - 0x34460c, + 0x21c2c2, + 0x21c2c2, + 0x205e02, + 0x21c2c2, + 0x290d45, + 0x2a24c5, + 0x21c2c2, + 0x21c2c2, + 0x211d42, + 0x290d45, + 0x312d49, + 0x342b4c, + 0x21c2c2, + 0x21c2c2, + 0x21c2c2, + 0x21c2c2, + 0x3830c5, + 0x21c2c2, + 0x21c2c2, + 0x21c2c2, + 0x21c2c2, + 0x211d42, + 0x312d49, + 0x21c2c2, + 0x21c2c2, + 0x21c2c2, + 0x2a24c5, + 0x21c2c2, + 0x2a24c5, + 0x342b4c, 0x3a6d4c, - 0x368883, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x2964c4, - 0x204ac3, - 0x200383, - 0x1f08, - 0x15444, - 0xc1348, - 0x204cc2, - 0x5020d1c2, - 0x243403, - 0x24c944, - 0x202743, - 0x38e8c4, - 0x22e886, - 0x213843, - 0x31aa84, - 0x288845, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x25084a, - 0x241f46, - 0x3755cc, - 0x15f048, - 0x20d1c2, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x22d603, - 0x201686, - 0x204ac3, - 0x200383, - 0x21aa03, - 0xaa288, - 0x3942, - 0x513856c5, - 0x2ac47, - 0xd7a88, - 0xc0ce, - 0x8c792, - 0x16780b, - 0x516db445, - 0x51adb44c, - 0xf207, - 0x13ecc7, - 0x1698ca, - 0x3efd0, - 0x1acd05, - 0x16e1cb, - 0x1672c8, - 0x13edc7, - 0x2f64b, - 0x11dd09, - 0x150f47, - 0x1b3c47, - 0x81187, - 0x20586, - 0x94b88, - 0x52028b86, - 0xafbcd, - 0x169290, - 0x52401742, - 0xfb48, - 0x71f47, - 0x7f149, - 0x59b46, - 0x99f08, - 0x74842, - 0xa4f4a, - 0x2d587, - 0x3b9c7, - 0xaa689, - 0xad708, - 0x15ae05, - 0x194e8e, - 0x14d4e, - 0x26f4f, - 0x2ccc9, - 0x4c809, - 0x77e8b, - 0x878cf, - 0x8fdcc, - 0xadd8b, - 0xc4d08, - 0xdc507, - 0x162908, - 0xfe04b, - 0x12a54c, - 0x141acc, - 0x147f4c, - 0x14b0cd, - 0x17de88, - 0x42602, - 0x104389, - 0x18528b, - 0xc8886, - 0x116f8b, - 0xdd5ca, - 0xde185, - 0xe4a90, - 0x1294c6, - 0x63c85, - 0xe6448, - 0xee547, - 0xee807, - 0x5e987, - 0xf92ca, - 0xd790a, - 0x177ac6, - 0x97ccd, - 0x1ae208, - 0x56608, - 0x56a89, - 0xb9905, - 0x19de4c, - 0x14b2cb, - 0x171c84, - 0xff749, - 0x8146, - 0x16c2, - 0x125886, - 0x10d947, - 0x6c82, - 0xcb605, - 0x29b04, - 0x701, - 0x2bc43, - 0x51fadbc6, - 0x9a283, - 0x8a42, - 0x2d584, - 0x1442, - 0x4ae04, - 0x1342, - 0x2f82, - 0x3682, - 0x1124c2, - 0xe542, - 0xdb442, - 0x2ac2, - 0x1c402, - 0x26982, - 0x4d02, - 0x3b02, - 0x34682, - 0x31b83, - 0x7d02, - 0x1c2, - 0x41c2, - 0xda42, - 0x642, - 0xdc2, - 0x18d82, - 0x1a02, - 0x2282, - 0x1d42, - 0x4303, - 0xb02, - 0x2f02, - 0xb5e02, - 0x1b02, - 0x5d82, - 0x32c2, - 0x73c2, - 0x17c2, - 0x1f02, - 0x173102, - 0x73fc2, - 0x5e402, - 0x4ac3, - 0x2c2, - 0x9282, - 0x1002, - 0x14602, - 0x1724c5, - 0x6ec2, - 0x1202, - 0x41703, - 0x682, - 0xd42, - 0x1702, - 0xe5c2, - 0x1ac2, - 0x3382, - 0x6902, - 0x16c2, - 0x73c07, - 0x213dc3, - 0x204cc2, - 0x2d0783, - 0x231b83, - 0x2135c3, - 0x201d43, - 0x22d603, - 0x204ac3, - 0x20abc3, - 0x200383, - 0x29a2c3, - 0x1a5c3, - 0x15f048, - 0x2d0783, - 0x231b83, - 0x2135c3, - 0x20fbc3, - 0x204ac3, - 0x20abc3, - 0x200383, - 0x2d0783, - 0x231b83, - 0x200383, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x200041, - 0x20fbc3, - 0x204ac3, - 0x2104c3, - 0x200383, - 0x368883, - 0x2d0783, - 0x231b83, - 0x20fb43, - 0x2135c3, - 0x2300c3, - 0x287703, - 0x210503, - 0x234743, - 0x332ec3, - 0x2964c4, - 0x204ac3, - 0x200383, - 0x24abc3, - 0x200604, - 0x250c83, - 0x5283, - 0x3abd03, - 0x329b88, - 0x2e8384, - 0x2c264a, - 0x224906, - 0x10f9c4, - 0x38c2c7, - 0x21eeca, - 0x2df949, - 0x3a3b07, - 0x3a7dca, - 0x368883, - 0x2e900b, - 0x303349, - 0x2b9e45, - 0x2d7187, - 0xd1c2, - 0x2d0783, - 0x204d07, - 0x248d45, - 0x2e1cc9, - 0x231b83, - 0x233606, - 0x2c56c3, - 0xe1183, - 0x109686, - 0x60546, - 0x137c7, - 0x217546, - 0x222645, - 0x2cf187, - 0x2da587, - 0x54b32ec3, - 0x334a07, - 0x3642c3, - 0x3a2385, - 0x2964c4, - 0x32e3c8, - 0x2751cc, - 0x3a5745, - 0x2a2086, - 0x204bc7, - 0x37ef47, - 0x25b8c7, - 0x31f248, - 0x307ecf, - 0x2dfb85, - 0x243507, - 0x2394c7, - 0x2a9b0a, - 0x2d7e49, - 0x30bc85, - 0x32194a, - 0x1b06, - 0x2c5745, - 0x376284, - 0x289dc6, - 0x2f8cc7, - 0x242507, - 0x38cbc8, - 0x214185, - 0x248c46, - 0x20c545, - 0x387845, - 0x212c04, - 0x2e3f87, - 0x20900a, - 0x234d48, - 0x356946, - 0x2d603, - 0x2e0405, - 0x26c686, - 0x3a46c6, - 0x263b86, - 0x20fbc3, - 0x389247, - 0x239445, - 0x204ac3, - 0x2dd88d, - 0x20abc3, - 0x38ccc8, - 0x39a5c4, - 0x27ba85, - 0x2a9a06, - 0x2362c6, - 0x204587, - 0x2ae707, - 0x270b05, - 0x200383, - 0x27f2c7, - 0x329709, - 0x22b689, - 0x2f590a, - 0x24cd82, - 0x3a2344, - 0x2e76c4, - 0x261787, - 0x2278c8, - 0x2ef309, - 0x21f1c9, - 0x2f0487, - 0x303806, - 0xf22c6, - 0x2f39c4, - 0x2f3fca, - 0x2f6a08, - 0x2f6fc9, - 0x2bfe86, - 0x2b6ec5, - 0x234c08, - 0x2c9c4a, - 0x22c6c3, - 0x200786, - 0x2f0587, - 0x217f85, - 0x39a485, - 0x2717c3, - 0x258a04, - 0x36da85, - 0x288e47, - 0x2ffac5, - 0x2ed686, - 0xfff05, - 0x264a03, - 0x28b789, - 0x27b84c, - 0x2a7e0c, - 0x2d3bc8, - 0x3ade87, - 0x2fc8c8, - 0x2fcc0a, - 0x2fd84b, - 0x303488, - 0x33f408, - 0x2363c6, - 0x262685, - 0x200f4a, - 0x219545, - 0x205bc2, - 0x2c7a87, - 0x2a32c6, - 0x355ec5, - 0x38e989, - 0x26b785, - 0x285ec5, - 0x3a1f49, - 0x257cc6, - 0x3b1088, - 0x23e0c3, - 0x3b3306, - 0x27ac06, - 0x30ba85, - 0x30ba89, - 0x2bc289, - 0x24d0c7, - 0x10b904, - 0x30b907, - 0x21f0c9, - 0x23c905, - 0x4bbc8, - 0x3b3205, - 0x339505, - 0x376c89, - 0x205ac2, - 0x2e95c4, - 0x20d782, - 0x200b02, - 0x2ce985, - 0x30f748, - 0x2b9845, - 0x2c6fc3, - 0x2c6fc5, - 0x2d7543, - 0x210882, - 0x2e30c4, - 0x351903, - 0x204c82, - 0x35bb44, - 0x2e85c3, - 0x200e82, - 0x25e903, - 0x291704, - 0x2e7083, - 0x246f04, - 0x202602, - 0x21a903, - 0x215b43, - 0x206342, - 0x33c282, - 0x2bc0c9, - 0x202d82, - 0x28d304, - 0x201782, - 0x234a84, - 0x3037c4, - 0x2bcc44, - 0x2016c2, - 0x241a02, - 0x220883, - 0x225f83, - 0x387944, - 0x269e44, - 0x2bc484, - 0x2ce884, - 0x30b143, - 0x34f743, - 0x201a84, - 0x30d784, - 0x30e786, - 0x2e7782, - 0x20d1c2, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x204cc2, - 0x368883, - 0x2d0783, - 0x231b83, - 0x2001c3, - 0x332ec3, - 0x2964c4, - 0x2bc384, - 0x213184, - 0x204ac3, - 0x200383, - 0x21aa03, - 0x2f4684, - 0x32f983, - 0x2bf3c3, - 0x345184, - 0x3b3006, - 0x211503, - 0x13ecc7, - 0x234fc3, - 0x23a943, - 0x2b6703, - 0x265383, - 0x22d603, - 0x2db6c5, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x2ed143, - 0x2ab343, - 0x15f048, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204303, - 0x204ac3, - 0x23ee04, - 0x200383, - 0x26a104, - 0x2c2d45, - 0x13ecc7, - 0x20d1c2, - 0x2000c2, - 0x208a42, - 0x202082, - 0x200382, - 0x2d0783, - 0x23a184, - 0x231b83, - 0x332ec3, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x15f048, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x20fbc3, - 0x213184, - 0x204ac3, - 0x200383, - 0x213e83, - 0x24ae04, - 0x15f048, - 0x2d0783, - 0x20abc3, - 0x1a5c3, - 0x24fe44, - 0x15f048, - 0x2d0783, - 0x251304, - 0x2964c4, - 0x20abc3, - 0x201882, - 0x200383, - 0x2202c3, - 0x58a04, - 0x370145, - 0x205bc2, - 0x30d8c3, - 0x204cc2, - 0x15f048, - 0x20d1c2, - 0x231b83, - 0x332ec3, - 0x201d42, - 0x200383, - 0x204cc2, - 0x15f048, - 0x231b83, - 0x332ec3, - 0x204303, - 0x20fbc3, - 0x30b544, - 0x204cc2, - 0x20d1c2, - 0x2d0783, - 0x231b83, - 0x2da904, - 0x332ec3, - 0x204303, - 0x20fbc3, - 0x204ac3, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x22d603, - 0x204ac3, - 0x200383, - 0x26a103, - 0x213e83, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x1a5c3, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x2964c4, - 0x22d603, - 0x204ac3, - 0x200383, - 0x217082, - 0x200141, - 0x204cc2, - 0x200001, - 0x31f542, - 0x15f048, - 0x21d105, - 0x200701, - 0xd0783, - 0x200101, - 0x2000c1, - 0x201e41, - 0x29da82, - 0x36da04, - 0x372a43, - 0x200181, - 0x200941, - 0x200041, - 0x200081, - 0x2ed7c7, - 0x2eeccf, - 0x2fc146, - 0x201481, - 0x289786, - 0x200c01, - 0x2002c1, - 0x33168e, - 0x200381, - 0x200383, - 0x200e81, - 0x279e45, - 0x210582, - 0x2716c5, - 0x2003c1, - 0x200201, - 0x200241, - 0x205bc2, - 0x200a01, - 0x201a81, - 0x2005c1, - 0x2007c1, - 0x200cc1, - 0x15f048, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, + 0x323ac3, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x201604, + 0x238483, + 0x2264c3, + 0x141388, + 0x4db44, + 0xed208, + 0x200882, + 0x49a16582, + 0x240003, + 0x22b944, + 0x208f43, + 0x21eb04, + 0x231ac6, + 0x31d243, + 0x34aa44, + 0x26cc05, + 0x211003, + 0x238483, + 0x2264c3, + 0x24690a, + 0x3a5946, + 0x3757cc, + 0x880c8, + 0x216582, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x2348c3, + 0x2cc5c6, + 0x238483, + 0x2264c3, 0x21bd03, - 0x2d0783, - 0x332ec3, - 0x91d48, - 0x20fbc3, - 0x204ac3, - 0x48803, - 0x200383, - 0x14ebc48, - 0x15f048, - 0x4dcc4, - 0x15f048, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x204ac3, - 0x200383, - 0x205283, - 0x15f048, - 0x2d0783, - 0x231b83, - 0x2da904, - 0x200383, - 0x293ac5, - 0x343984, - 0x2d0783, - 0x204ac3, - 0x200383, - 0x16b18a, - 0x20d1c2, - 0x2d0783, - 0x22f489, - 0x231b83, - 0x2d2389, - 0x332ec3, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x2f37c8, - 0x226647, - 0x370145, - 0x3a7f87, - 0x26b0cb, - 0x215cc8, - 0x32eac9, - 0x228087, - 0x200108, - 0x36f906, - 0x2344c7, - 0x29c108, - 0x2ab806, - 0x31d407, - 0x2aa449, - 0x2ba749, - 0x2c2ac6, - 0x2c38c5, - 0x2cce08, - 0x2b4783, - 0x2d7c88, - 0x231d87, - 0x206583, - 0x31d287, - 0x217905, - 0x2eeb08, - 0x359105, - 0x2cea43, - 0x23c289, - 0x2b0e87, - 0x35d504, - 0x2ff244, - 0x307ccb, - 0x308288, - 0x309587, - 0x2d0783, - 0x231b83, - 0x2135c3, - 0x200383, - 0x236ec3, - 0x332ec3, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x77fcb, + 0xd42, + 0xdb7c7, + 0xca908, + 0xfd8e, + 0x85792, + 0x2ecb, + 0x4a71f345, + 0x4ab76d0c, + 0x131007, + 0x16e747, + 0x119b8a, + 0x3c550, + 0x2988, + 0x16e847, + 0xae14b, + 0x112089, + 0x173507, + 0x10ec87, + 0x77847, + 0x169c6, + 0x132d48, + 0x4b01e1c6, + 0xa910d, + 0x119550, + 0x4b400d82, + 0x131948, + 0x680c7, + 0x84109, + 0x53e06, + 0x908c8, + 0x5e82, + 0x9c34a, + 0x8e507, + 0xeaec7, + 0xa5449, + 0xa7188, + 0x157f45, + 0xe168e, + 0xe9ce, + 0x14c4f, + 0x15309, + 0x33c49, + 0x6528b, + 0x7cdcf, + 0x8cdcc, + 0xdcbcb, + 0xd99c8, + 0x12bd07, + 0xede48, + 0x11e50b, + 0x13e94c, + 0x14624c, + 0x14f98c, + 0x1524cd, + 0x2b848, + 0x30cc2, + 0x1afb89, + 0x14c24b, + 0xbdb06, + 0xce6c5, + 0xd2d10, + 0x1229c6, + 0x51f05, + 0xd6908, + 0xdc047, + 0xdc307, + 0x163287, + 0xeba4a, + 0xca78a, + 0x161186, + 0x8db8d, + 0x180248, + 0x45e88, + 0x47a49, + 0xeb58c, + 0x1526cb, + 0x171ac4, + 0xf3109, + 0x44bc6, + 0x6202, + 0x155646, + 0xfefc7, + 0x6c2, + 0xc0e85, + 0x481, + 0x3b583, + 0x4af9eb86, + 0x90c43, + 0x1f82, + 0x3a4c4, + 0x1002, + 0x24104, + 0x9c2, + 0x1182, + 0x3182, + 0x4f882, + 0x2ec2, + 0x104e82, + 0x8c2, + 0x1dec2, + 0x37e42, + 0x682, + 0xf82, + 0xb1d82, + 0x343c3, + 0x8042, + 0x202, + 0x6ac2, + 0x21842, + 0xb2c2, + 0x32a02, + 0xf1c2, + 0x42, + 0x5602, + 0xa82, + 0x2243, + 0x74c2, + 0x1982, + 0xb09c2, + 0x9682, + 0xb402, + 0x61c2, + 0xa242, + 0x9a1c2, + 0x6742, + 0x172e82, + 0xe02, + 0x9f82, + 0x38483, + 0x1dc2, + 0x8382, + 0x25c2, + 0x2182, + 0x46045, + 0x6a42, + 0x41542, + 0x3e503, + 0x4b42, + 0x7982, + 0x1402, + 0x15c2, + 0x1882, + 0xcc2, + 0x3282, + 0x6202, + 0x6b247, + 0x212d03, + 0x200882, + 0x22d183, + 0x2343c3, + 0x211cc3, + 0x201d83, + 0x2348c3, + 0x238483, + 0x2025c3, + 0x2264c3, + 0x290c83, + 0x880c8, + 0x22d183, + 0x2343c3, + 0x211cc3, + 0x211003, + 0x238483, + 0x2025c3, + 0x2264c3, + 0x22d183, + 0x2343c3, + 0x2264c3, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x200041, + 0x211003, + 0x238483, + 0x201f43, + 0x2264c3, + 0x323ac3, + 0x22d183, + 0x2343c3, + 0x25f643, + 0x211cc3, + 0x3112c3, + 0x27cc03, + 0x201f83, + 0x25a603, + 0x21eb03, + 0x201604, + 0x238483, + 0x2264c3, + 0x223ec3, + 0x305fc4, + 0x21e143, + 0x4803, + 0x203e03, + 0x2a0cc8, + 0x332a44, + 0x317f8a, + 0x330786, + 0xda404, + 0x3a2e47, + 0x22138a, + 0x347689, + 0x3b3507, + 0x20054a, + 0x323ac3, + 0x3822cb, + 0x368b49, + 0x2c4005, + 0x2ca007, + 0x16582, + 0x22d183, + 0x326647, + 0x22a1c5, + 0x2d60c9, + 0x2343c3, + 0x227846, + 0x2ba0c3, + 0x9f543, + 0xfaa86, + 0x4f4c6, + 0x11d1c7, + 0x3a8786, + 0x213e45, + 0x20c507, + 0x338b87, + 0x4d61eb03, + 0x329007, + 0x35eec3, + 0x38e705, + 0x201604, + 0x221c08, + 0x2af6cc, + 0x2ad6c5, + 0x363c06, + 0x326507, + 0x224b47, + 0x205087, + 0x206e48, + 0x2597cf, + 0x280b05, + 0x240107, + 0x27e347, + 0x2a500a, + 0x2ee209, + 0x2d7185, + 0x2d830a, + 0xdea46, + 0x2ba145, + 0x374b84, + 0x2b7486, + 0x2fe5c7, + 0x230bc7, + 0x2a0a08, + 0x214805, + 0x22a0c6, + 0x3a8245, + 0x37a445, + 0x21fd44, + 0x31e907, + 0x347cca, + 0x365a48, + 0x2edb86, + 0x348c3, + 0x2cf145, + 0x238d06, + 0x200346, + 0x251e06, + 0x211003, + 0x388dc7, + 0x27e2c5, + 0x238483, + 0x3b378d, + 0x2025c3, + 0x2a0b08, + 0x3aac44, + 0x205fc5, + 0x2a4f06, + 0x236b06, + 0x20d6c7, + 0x355747, + 0x2641c5, + 0x2264c3, + 0x322c07, + 0x33b009, + 0x258f49, + 0x2434ca, + 0x242a42, + 0x38e6c4, + 0x2d7ac4, + 0x210d87, + 0x236d08, + 0x2dce89, + 0x3a3489, + 0x2df807, + 0x334206, + 0xe1406, + 0x2e26c4, + 0x2e2cca, + 0x2e5c88, + 0x2e64c9, + 0x2b6306, + 0x3003c5, + 0x365908, + 0x2bf10a, + 0x25b743, + 0x306146, + 0x2df907, + 0x207c85, + 0x3aab05, + 0x242083, + 0x252dc4, + 0x21bf45, + 0x27e747, + 0x39fa45, + 0x2f3bc6, + 0xfa705, + 0x212a43, + 0x21cdc9, + 0x238dcc, + 0x2ab90c, + 0x2c65c8, + 0x28f8c7, + 0x2ef748, + 0x2efa8a, + 0x2f0a4b, + 0x368c88, + 0x363d08, + 0x36ee86, + 0x341985, + 0x36498a, + 0x21ebc5, + 0x203e42, + 0x2bcdc7, + 0x26a8c6, + 0x353505, + 0x2f1949, + 0x38dec5, + 0x376785, + 0x38e2c9, + 0x238b86, + 0x261b88, + 0x2d1343, + 0x3a88c6, + 0x270f06, + 0x2fdcc5, + 0x2fdcc9, + 0x2dd5c9, + 0x242d87, + 0xfdb44, + 0x2fdb47, + 0x3a3389, + 0x221585, + 0x16f208, + 0x355545, + 0x355245, + 0x399309, + 0x201482, + 0x21df44, + 0x202e82, + 0x2074c2, + 0x293c45, + 0x2da188, + 0x374e45, + 0x2bc883, + 0x2bc885, + 0x2ca3c3, + 0x2111c2, + 0x264a04, + 0x233503, + 0x207a82, + 0x358704, + 0x2d8003, + 0x2014c2, + 0x293cc3, + 0x2898c4, + 0x2d7703, + 0x23a804, + 0x201bc2, + 0x21bc03, + 0x219283, + 0x208d82, + 0x35b202, + 0x2dd409, + 0x2011c2, + 0x286304, + 0x200dc2, + 0x365784, + 0x3341c4, + 0x3a1cc4, + 0x206202, + 0x23e802, + 0x20dc03, + 0x2f0083, + 0x23f704, + 0x27e8c4, + 0x2d13c4, + 0x2dd7c4, + 0x2fd083, + 0x3491c3, + 0x2de9c4, + 0x2fee04, + 0x2ff346, + 0x260dc2, + 0x216582, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x200882, + 0x323ac3, + 0x22d183, + 0x2343c3, + 0x205403, + 0x21eb03, + 0x201604, + 0x2dd6c4, + 0x212444, + 0x238483, + 0x2264c3, + 0x21bd03, + 0x2e3444, + 0x29e943, + 0x2b3783, + 0x3436c4, + 0x355346, + 0x20ca03, + 0x16e747, + 0x219b83, + 0x208143, + 0x2b1a03, + 0x206003, + 0x2348c3, + 0x376f85, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x2db443, + 0x230743, + 0x880c8, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x202243, + 0x238483, + 0x234fc4, + 0x2264c3, + 0x29b704, + 0x2b7285, + 0x16e747, + 0x216582, + 0x201a42, + 0x201f82, + 0x205902, + 0x201502, + 0x22d183, + 0x2374c4, + 0x2343c3, + 0x21eb03, + 0x211003, + 0x238483, + 0x2264c3, + 0x880c8, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x211003, + 0x212444, + 0x238483, + 0x2264c3, + 0x217643, + 0x224104, + 0x880c8, + 0x22d183, + 0x2025c3, + 0x245dc4, + 0x880c8, + 0x22d183, + 0x247344, + 0x201604, + 0x2025c3, + 0x202282, + 0x2264c3, + 0x215cc3, + 0x52dc4, + 0x2e9cc5, + 0x203e42, + 0x2fef43, + 0x200882, + 0x880c8, + 0x216582, + 0x2343c3, + 0x21eb03, + 0x200a82, + 0x2264c3, + 0x200882, + 0x200707, + 0x254705, + 0x29f844, + 0x385f86, + 0x366a4b, + 0x263a49, + 0x363b46, + 0x340a89, + 0x2b2c88, + 0x207103, + 0x880c8, + 0x22a807, + 0x364288, + 0x24f843, + 0x21d184, + 0x2226cb, + 0x259145, + 0x24b188, + 0x2f2ec9, + 0x25a203, + 0x22d183, + 0x205348, + 0x2ee787, + 0x24fe46, + 0x2343c3, + 0x24f947, + 0x21eb03, + 0x339b06, + 0x202243, + 0x22f9c7, + 0x33a6c7, + 0x390e87, + 0x31e885, + 0x209403, + 0x205dcb, + 0x36b4c8, + 0x227548, + 0x33b1c6, + 0x367989, + 0x335b07, + 0x2f9145, + 0x339444, + 0x3478c8, + 0x23d54a, + 0x23d789, + 0x346f03, + 0x2696c5, + 0x21bb83, + 0x3ad706, + 0x387704, + 0x2fdec8, + 0x38748b, + 0x346dc5, + 0x2b7006, + 0x2b8e85, + 0x2b9608, + 0x2ba287, + 0x206cc7, + 0x317b87, + 0x294544, + 0x30a5c7, + 0x294546, + 0x211003, + 0x2c2088, + 0x268383, + 0x2cab08, + 0x2d3f45, + 0x3251c8, + 0x2345c7, + 0x238483, + 0x2447c3, + 0x287dc4, + 0x323647, + 0x208fc3, + 0x33a78b, + 0x205003, + 0x268344, + 0x2e9d48, + 0x2264c3, + 0x2f3d45, + 0x311145, + 0x3250c6, + 0x2117c5, + 0x2d4304, + 0x202002, + 0x2e69c3, + 0x374c0a, + 0x3a1583, + 0x306709, + 0x30a2c6, + 0x204e48, + 0x289406, + 0x214347, + 0x2db948, + 0x39a588, + 0x2ebd43, + 0x293d03, + 0x272c09, + 0x2f4c83, + 0x2d8d06, + 0x254386, + 0x39f7c6, + 0x3a1e09, + 0x2fd784, + 0x20e3c3, + 0x2d6d05, + 0x349589, + 0x206dc3, + 0x35a244, + 0x2f2ac4, + 0x36fc84, + 0x35f906, + 0x3b4303, + 0x3b4308, + 0x256a08, + 0x39db86, + 0x2f8f4b, + 0x2f9288, + 0x2f948b, + 0x2fb949, + 0x2fa987, + 0x2fbdc8, + 0x2fc983, + 0x22ad86, + 0x3a9247, + 0x295245, + 0x34b789, + 0x33530d, + 0x204c91, + 0x22eb85, + 0x200882, + 0x216582, + 0x22d183, + 0x2343c3, + 0x22d684, + 0x21eb03, + 0x202243, + 0x211003, + 0x238483, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x2348c3, + 0x238483, + 0x2264c3, + 0x265903, + 0x217643, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x201604, + 0x2348c3, + 0x238483, + 0x2264c3, + 0x221e42, + 0x200141, + 0x200882, + 0x200001, + 0x313b02, + 0x880c8, + 0x220045, + 0x200481, + 0x2d183, + 0x200741, + 0x200081, + 0x200c81, + 0x2333c2, + 0x36e144, + 0x383043, + 0x2007c1, + 0x200901, + 0x200041, + 0x2001c1, + 0x2dda87, + 0x2b8f8f, + 0x2cacc6, + 0x2000c1, + 0x25b806, + 0x200341, + 0x200ac1, + 0x341ece, + 0x201501, + 0x2264c3, + 0x2014c1, + 0x260e05, + 0x202002, + 0x241f85, + 0x200b81, + 0x200241, + 0x200a01, + 0x203e42, + 0x2002c1, + 0x204701, + 0x20dec1, + 0x200781, + 0x200641, + 0x880c8, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x21ca03, + 0x22d183, + 0x21eb03, + 0x89ec8, + 0x211003, + 0x238483, + 0x2264c3, + 0x14da788, + 0x880c8, + 0x441c4, + 0x880c8, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x238483, + 0x2264c3, + 0x204803, + 0x880c8, + 0x22d183, + 0x2343c3, + 0x22d684, + 0x2264c3, + 0x28fb85, + 0x27f304, + 0x22d183, + 0x238483, + 0x2264c3, + 0xa014a, + 0x216582, + 0x22d183, + 0x2326c9, + 0x2343c3, + 0x23af09, + 0x21eb03, + 0x211003, + 0x238483, + 0x2264c3, + 0x2e24c8, + 0x2100c7, + 0x2e9cc5, + 0x200707, + 0x366a4b, + 0x365188, + 0x340a89, + 0x22a807, + 0x205348, + 0x339b06, + 0x33a6c7, + 0x227548, + 0x33b1c6, + 0x335b07, + 0x23d789, + 0x37c409, + 0x2b7006, + 0x2b7e45, + 0x2c2088, + 0x268383, + 0x2cab08, + 0x2345c7, + 0x208fc3, + 0x326387, + 0x2117c5, + 0x2dc608, + 0x310205, + 0x293d03, + 0x33b9c9, + 0x2aa9c7, + 0x35a244, + 0x2f2ac4, + 0x2f8f4b, + 0x2f9288, + 0x2fa987, + 0x22d183, + 0x2343c3, + 0x211cc3, + 0x2264c3, + 0x21e503, + 0x21eb03, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x211003, + 0x238483, + 0x2264c3, + 0x653cb, + 0x200882, + 0x216582, + 0x2264c3, + 0x880c8, + 0x200882, + 0x216582, + 0x201f82, + 0x200a82, + 0x200342, + 0x238483, + 0x201502, + 0x200882, + 0x323ac3, + 0x216582, + 0x22d183, + 0x2343c3, + 0x201f82, + 0x21eb03, + 0x202243, + 0x211003, + 0x212444, + 0x238483, + 0x21ab43, + 0x2264c3, + 0x2fd784, + 0x223ec3, + 0x21eb03, + 0x216582, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x211003, + 0x238483, + 0x2025c3, + 0x2264c3, + 0x39bd47, + 0x22d183, + 0x256b87, + 0x2edfc6, + 0x219203, + 0x206ac3, + 0x21eb03, + 0x220883, + 0x201604, + 0x284804, + 0x2d43c6, + 0x20bac3, + 0x238483, + 0x2264c3, + 0x28fb85, + 0x20d4c4, + 0x31a083, + 0x217a03, + 0x2bcdc7, + 0x20b445, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x211003, + 0x238483, + 0x2264c3, + 0x219f02, + 0x380383, + 0x2b2c83, + 0x323ac3, + 0x5822d183, + 0x22b782, + 0x2343c3, + 0x208f43, + 0x21eb03, + 0x201604, + 0x36b683, + 0x280b03, + 0x211003, + 0x212444, + 0x58606bc2, + 0x238483, + 0x2264c3, + 0x232dc3, + 0x245483, + 0x221e42, + 0x223ec3, + 0x880c8, + 0x21eb03, + 0x307e44, + 0x323ac3, + 0x216582, + 0x22d183, + 0x2374c4, + 0x2343c3, + 0x21eb03, + 0x201604, + 0x202243, + 0x2f5d44, + 0x307b04, + 0x2cc5c6, + 0x212444, + 0x238483, + 0x2264c3, + 0x21bd03, + 0x26a8c6, + 0x1737cb, + 0x1e1c6, + 0x23d0a, + 0xfcb8a, + 0x880c8, + 0x3a8204, + 0x22d183, + 0x323a84, + 0x2343c3, + 0x247b84, + 0x21eb03, + 0x251283, + 0x211003, + 0x238483, + 0x2264c3, + 0x32248b, + 0x39d94a, + 0x3b298c, + 0x200882, + 0x216582, + 0x201f82, + 0x2a9c05, + 0x201604, + 0x206742, + 0x211003, + 0x307b04, + 0x205902, + 0x201502, + 0x217642, + 0x221e42, + 0x123ac3, + 0x357309, + 0x254208, + 0x301189, + 0x33a509, + 0x35bd8a, + 0x23808a, + 0x20cc82, + 0x21dec2, + 0x16582, + 0x22d183, + 0x200bc2, + 0x2402c6, + 0x354502, + 0x202982, + 0x3861ce, + 0x21bc4e, + 0x278107, + 0x32fe47, + 0x26b302, + 0x2343c3, + 0x21eb03, + 0x202842, + 0x200a82, + 0x23d1cf, + 0x204ec2, + 0x33b3c7, + 0x24cf87, + 0x256107, + 0x26204c, + 0x268b4c, + 0x2057c4, + 0x2696ca, + 0x21bb82, + 0x209682, + 0x2b2684, + 0x215bc2, + 0x2bb4c2, + 0x268d84, + 0x21ac42, + 0x20b402, + 0x33b247, + 0x233285, + 0x20a242, + 0x23d144, + 0x372e82, + 0x2cea08, + 0x238483, + 0x3a2308, + 0x203082, + 0x235885, + 0x3a25c6, + 0x2264c3, + 0x206a42, + 0x2dd0c7, + 0x2002, + 0x26ccc5, + 0x393e85, + 0x2166c2, + 0x226442, + 0x31864a, + 0x26404a, + 0x210fc2, + 0x376c04, + 0x201a02, + 0x38e588, 0x204cc2, - 0x20d1c2, - 0x200383, - 0x15f048, - 0x204cc2, - 0x20d1c2, - 0x208a42, - 0x201d42, - 0x203cc2, - 0x204ac3, - 0x200382, - 0x204cc2, - 0x368883, - 0x20d1c2, - 0x2d0783, - 0x231b83, - 0x208a42, - 0x332ec3, - 0x204303, - 0x20fbc3, - 0x213184, - 0x204ac3, - 0x2183c3, - 0x200383, - 0x30b544, - 0x24abc3, - 0x332ec3, - 0x20d1c2, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x20fbc3, - 0x204ac3, - 0x20abc3, - 0x200383, - 0x39db07, - 0x2d0783, - 0x26e5c7, - 0x362a86, - 0x215ac3, - 0x2041c3, - 0x332ec3, - 0x209e43, - 0x2964c4, - 0x38b704, - 0x30dbc6, - 0x201303, - 0x204ac3, - 0x200383, - 0x293ac5, - 0x318244, - 0x369dc3, - 0x37ed83, - 0x2c7a87, - 0x2387c5, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x203782, - 0x3ae343, - 0x2c2d43, - 0x368883, - 0x5fed0783, - 0x209c02, - 0x231b83, - 0x202743, - 0x332ec3, - 0x2964c4, - 0x23a0c3, - 0x2dfb83, - 0x20fbc3, - 0x213184, - 0x6020c002, - 0x204ac3, - 0x200383, - 0x209103, - 0x229b03, - 0x217082, - 0x24abc3, - 0x15f048, - 0x332ec3, - 0x1a5c3, - 0x2957c4, - 0x368883, - 0x20d1c2, - 0x2d0783, - 0x23a184, - 0x231b83, - 0x332ec3, - 0x2964c4, - 0x204303, - 0x2cee84, - 0x222044, - 0x201686, - 0x213184, - 0x204ac3, - 0x200383, - 0x21aa03, - 0x2a32c6, - 0x3ddcb, - 0x28b86, - 0x4aa0a, - 0x10adca, - 0x15f048, - 0x20c504, - 0x2d0783, - 0x368844, - 0x231b83, - 0x256bc4, - 0x332ec3, - 0x262fc3, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x32e84b, - 0x39f84a, - 0x3b478c, - 0x204cc2, - 0x20d1c2, - 0x208a42, - 0x2b0405, - 0x2964c4, - 0x201f02, - 0x20fbc3, - 0x222044, - 0x202082, - 0x200382, - 0x20c4c2, - 0x217082, - 0x168883, - 0xd882, - 0x2b2409, - 0x259f88, - 0x332d49, - 0x234309, - 0x23b18a, - 0x24550a, - 0x20a182, - 0x21c402, - 0xd1c2, - 0x2d0783, - 0x220802, - 0x2436c6, - 0x356fc2, - 0x20a542, - 0x21ad8e, - 0x21a94e, - 0x281a47, - 0x204a47, - 0x221202, - 0x231b83, - 0x332ec3, - 0x20b502, - 0x201d42, - 0x4143, - 0x24058f, - 0x26b142, - 0x362cc7, - 0x2fa1c7, - 0x39d487, - 0x31e28c, - 0x364d0c, - 0x202444, - 0x283b0a, - 0x21a882, - 0x201b02, - 0x2bc744, - 0x22b1c2, - 0x2c5c02, - 0x364f44, - 0x2184c2, - 0x205d82, - 0x5d83, - 0x2ab887, - 0x33d885, - 0x2073c2, - 0x240504, - 0x373102, - 0x2df088, - 0x204ac3, - 0x203808, - 0x203ac2, - 0x232d85, - 0x203ac6, - 0x200383, - 0x206ec2, - 0x2ef547, - 0x10582, - 0x350845, - 0x31d185, - 0x207c82, - 0x236b82, - 0x3a860a, - 0x27098a, - 0x212bc2, - 0x353f84, - 0x2018c2, - 0x3a2208, - 0x219682, - 0x2a2588, - 0x304987, - 0x304c89, - 0x2037c2, - 0x309e45, - 0x247e85, - 0x21424b, - 0x2ca84c, - 0x22c208, - 0x3186c8, - 0x2e7782, - 0x204642, - 0x204cc2, - 0x15f048, - 0x20d1c2, - 0x2d0783, - 0x208a42, - 0x202082, - 0x200382, - 0x200383, - 0x20c4c2, - 0x204cc2, - 0x6260d1c2, - 0x62b32ec3, - 0x205d83, - 0x201f02, - 0x204ac3, - 0x3a8fc3, - 0x200383, - 0x2ec383, - 0x273d06, - 0x1613e83, - 0x15f048, - 0x63c85, - 0xae2cd, - 0xaafca, - 0x6ebc7, - 0x63201b82, - 0x63601442, - 0x63a00f82, - 0x63e02e02, - 0x642125c2, - 0x6460e542, - 0x13ecc7, - 0x64a0d1c2, - 0x64e0e482, - 0x6520fe42, - 0x65603b02, - 0x21a943, - 0x102c4, - 0x220a43, - 0x65a14002, - 0x65e023c2, - 0x51847, - 0x66214502, - 0x66600b82, - 0x66a00542, - 0x66e0a3c2, - 0x67202282, - 0x67601d42, - 0xbe445, - 0x221443, - 0x3b3bc4, - 0x67a2b1c2, - 0x67e42682, - 0x68202682, - 0x7e5cb, - 0x68600c02, - 0x68e513c2, - 0x69201f02, - 0x69603cc2, - 0x69a0bcc2, - 0x69e05f02, - 0x6a20b602, - 0x6a673fc2, - 0x6aa0c002, - 0x6ae04a02, - 0x6b202082, - 0x6b603702, - 0x6ba12982, - 0x6be31302, - 0x94fc4, - 0x358183, - 0x6c2126c2, - 0x6c61a582, - 0x6ca098c2, - 0x6ce00982, - 0x6d200382, - 0x6d604c82, - 0x78147, - 0x6da054c2, - 0x6de05502, - 0x6e20c4c2, - 0x6e609f42, - 0x19de4c, - 0x6ea22e82, - 0x6ee79242, - 0x6f200a02, - 0x6f606602, - 0x6fa019c2, - 0x6fe3b302, - 0x70206d02, - 0x70613882, - 0x70a7af82, - 0x70e43e02, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x75c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x68a3a0c3, - 0x2075c3, - 0x2db744, - 0x259e86, - 0x2f74c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x20d882, - 0x20d882, - 0x23a0c3, - 0x2075c3, - 0x716d0783, - 0x231b83, - 0x329e83, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x15f048, - 0x20d1c2, - 0x2d0783, - 0x204ac3, - 0x200383, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x24fe44, - 0x20d1c2, - 0x2d0783, - 0x3303c3, - 0x231b83, - 0x251304, - 0x2135c3, - 0x332ec3, - 0x2964c4, - 0x204303, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x2202c3, - 0x370145, - 0x2b2703, - 0x24abc3, - 0x20d1c2, - 0x2d0783, - 0x23a0c3, - 0x204ac3, - 0x200383, - 0x204cc2, - 0x368883, - 0x15f048, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x22e886, - 0x2964c4, - 0x204303, - 0x213184, - 0x204ac3, - 0x200383, - 0x21aa03, - 0x2d0783, - 0x231b83, - 0x204ac3, - 0x200383, - 0x2d0783, - 0x28b86, - 0x231b83, - 0x332ec3, - 0xe1946, - 0x204ac3, - 0x200383, - 0x315cc8, - 0x318509, - 0x327a09, - 0x332548, - 0x37d888, - 0x37d889, - 0x9da85, - 0x204cc2, - 0x238605, - 0x205d43, - 0x7420d1c2, - 0x231b83, - 0x332ec3, - 0x33e387, - 0x265383, - 0x20fbc3, - 0x204ac3, - 0x2104c3, - 0x212483, - 0x20abc3, - 0x200383, - 0x241f46, - 0x205bc2, - 0x24abc3, - 0x15f048, - 0x204cc2, - 0x368883, - 0x20d1c2, - 0x2d0783, - 0x231b83, - 0x332ec3, - 0x2964c4, - 0x20fbc3, - 0x204ac3, - 0x200383, - 0x213e83, - 0x153ca46, + 0x2fd448, + 0x2f64c7, + 0x2f67c9, + 0x26cd42, + 0x2fbb85, + 0x2546c5, + 0x2148cb, + 0x2bfdcc, + 0x22f848, + 0x2fbf48, + 0x260dc2, + 0x20d782, + 0x200882, + 0x880c8, + 0x216582, + 0x22d183, + 0x201f82, + 0x205902, + 0x201502, + 0x2264c3, + 0x217642, + 0x200882, + 0x5a616582, + 0x5aa1eb03, + 0x332683, + 0x206742, + 0x238483, + 0x364e83, + 0x2264c3, + 0x2db083, + 0x26b346, + 0x1617643, + 0x880c8, + 0x51f05, + 0xa7dcd, + 0x5f007, + 0x5b200182, + 0x5b601002, + 0x5ba04802, + 0x5be01842, + 0x5c2108c2, + 0x5c602ec2, + 0x16e747, + 0x5ca16582, + 0x5ce30542, + 0x5d21e582, + 0x5d600f82, + 0x21bc43, + 0x1b4284, + 0x20ddc3, + 0x5da18fc2, + 0x5de038c2, + 0x47887, + 0x5e214b82, + 0x5e600902, + 0x5ea02ac2, + 0x5ee082c2, + 0x5f205602, + 0x5f600a82, + 0xb97c5, + 0x226743, + 0x30ec04, + 0x5fa15bc2, + 0x5fe16c82, + 0x60200102, + 0x7508b, + 0x60600982, + 0x60e09782, + 0x61206742, + 0x61600342, + 0x61a50042, + 0x61e03042, + 0x6220e842, + 0x62600e02, + 0x62a06bc2, + 0x62e01302, + 0x63205902, + 0x6361d302, + 0x63a04242, + 0x63e425c2, + 0x133184, + 0x371183, + 0x64206602, + 0x64613942, + 0x64a06942, + 0x64e03742, + 0x65201502, + 0x65607a82, + 0x65547, + 0x65a07442, + 0x65e07482, + 0x66217642, + 0x6660a442, + 0xeb58c, + 0x66a24982, + 0x66e6f2c2, + 0x6721dcc2, + 0x67603dc2, + 0x67a2d742, + 0x67e1eb82, + 0x68204702, + 0x68606f42, + 0x68a71282, + 0x68e15ac2, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x75803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x60b6b683, + 0x275803, + 0x377004, + 0x254106, + 0x2e6a83, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x36b683, + 0x275803, + 0x200482, + 0x200482, + 0x36b683, + 0x275803, + 0x6962d183, + 0x2343c3, + 0x2a0fc3, + 0x211003, + 0x238483, + 0x2264c3, + 0x880c8, + 0x216582, + 0x22d183, + 0x238483, + 0x2264c3, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x211003, + 0x238483, + 0x2264c3, + 0x245dc4, + 0x216582, + 0x22d183, + 0x308703, + 0x2343c3, + 0x247344, + 0x211cc3, + 0x21eb03, + 0x201604, + 0x202243, + 0x211003, + 0x238483, + 0x2264c3, + 0x215cc3, + 0x2e9cc5, + 0x241403, + 0x223ec3, + 0x216582, + 0x22d183, + 0x36b683, + 0x238483, + 0x2264c3, + 0x200882, + 0x323ac3, + 0x880c8, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x231ac6, + 0x201604, + 0x202243, + 0x212444, + 0x238483, + 0x2264c3, + 0x21bd03, + 0x22d183, + 0x2343c3, + 0x238483, + 0x2264c3, + 0x22d183, + 0x1e1c6, + 0x2343c3, + 0x21eb03, + 0xd1906, + 0x238483, + 0x2264c3, + 0x308a48, + 0x30b989, + 0x31bcc9, + 0x326c48, + 0x37efc8, + 0x37efc9, + 0x333c5, + 0x200882, + 0x20b285, + 0x231b43, + 0x6c216582, + 0x2343c3, + 0x21eb03, + 0x22f647, + 0x206003, + 0x211003, + 0x238483, + 0x201f43, + 0x210783, + 0x2025c3, + 0x2264c3, + 0x3a5946, + 0x203e42, + 0x223ec3, + 0x880c8, + 0x200882, + 0x323ac3, + 0x216582, + 0x22d183, + 0x2343c3, + 0x21eb03, + 0x201604, + 0x211003, + 0x238483, + 0x2264c3, + 0x217643, + 0x14fa806, } // children is the list of nodes' children, the parent's wildcard bit and the @@ -8623,471 +8636,439 @@ var children = [...]uint32{ 0x40000000, 0x50000000, 0x60000000, - 0x1860612, - 0x1864618, - 0x1884619, - 0x19e0621, - 0x19f4678, - 0x1a0867d, - 0x1a18682, - 0x1a34686, - 0x1a3868d, - 0x1a5068e, - 0x1a74694, - 0x1a7869d, - 0x1a9069e, + 0x185c611, + 0x1860617, + 0x1880618, + 0x19dc620, + 0x19f0677, + 0x1a0467c, + 0x1a14681, + 0x1a30685, + 0x1a3468c, + 0x1a4c68d, + 0x1a70693, + 0x1a7469c, + 0x1a8c69d, + 0x1a906a3, 0x1a946a4, - 0x1a986a5, - 0x1ac06a6, - 0x1ac46b0, - 0x21acc6b1, - 0x1b146b3, - 0x1b186c5, - 0x1b386c6, - 0x1b4c6ce, - 0x1b506d3, - 0x1b806d4, - 0x1b9c6e0, - 0x1bc46e7, - 0x1bd06f1, - 0x1bd46f4, - 0x1c686f5, - 0x1c7c71a, - 0x1c9071f, - 0x1cc0724, - 0x1cd0730, - 0x1ce4734, - 0x1d08739, - 0x1e20742, - 0x1e24788, - 0x1e90789, - 0x1ea47a4, - 0x1eb87a9, - 0x1ec07ae, - 0x1ed07b0, - 0x1ed47b4, - 0x1eec7b5, - 0x1f347bb, - 0x1f4c7cd, - 0x1f507d3, - 0x1f547d4, - 0x1f5c7d5, - 0x1f987d7, - 0x61f9c7e6, - 0x1fb07e7, - 0x1fbc7ec, - 0x1fc07ef, - 0x1fd07f0, - 0x20807f4, + 0x1ab86a5, + 0x1abc6ae, + 0x21ac46af, + 0x1b0c6b1, + 0x1b106c3, + 0x1b306c4, + 0x1b446cc, + 0x1b486d1, + 0x1b786d2, + 0x1b946de, + 0x1bbc6e5, + 0x1bc86ef, + 0x1bcc6f2, + 0x1c606f3, + 0x1c74718, + 0x1c8871d, + 0x1cb8722, + 0x1cc872e, + 0x1cdc732, + 0x1d00737, + 0x1e18740, + 0x1e1c786, + 0x1e88787, + 0x1e9c7a2, + 0x1eb07a7, + 0x1eb87ac, + 0x1ec87ae, + 0x1ecc7b2, + 0x1ee47b3, + 0x1f2c7b9, + 0x1f447cb, + 0x1f487d1, + 0x1f4c7d2, + 0x1f547d3, + 0x1f907d5, + 0x61f947e4, + 0x1fa87e5, + 0x1fac7ea, + 0x1fb07eb, + 0x1fc07ec, + 0x20707f0, + 0x207481c, + 0x2207c81d, + 0x2208081f, 0x2084820, - 0x22090821, - 0x22098824, - 0x20cc826, - 0x20d0833, - 0x2514834, - 0x225ac945, + 0x20b8821, + 0x20bc82e, + 0x24f482f, + 0x2254493d, + 0x22548951, + 0x2570952, + 0x257895c, + 0x2257c95e, + 0x258495f, + 0x22594961, + 0x22598965, + 0x25a4966, + 0x225a8969, + 0x25ac96a, 0x225b096b, - 0x225b496c, - 0x225c096d, - 0x225c4970, - 0x225d0971, - 0x225d4974, - 0x225d8975, - 0x225dc976, - 0x225e0977, - 0x225e4978, - 0x225f0979, - 0x225f497c, - 0x2260097d, - 0x22604980, - 0x22608981, - 0x2260c982, - 0x22610983, - 0x22614984, - 0x2618985, - 0x2261c986, - 0x22628987, - 0x2262c98a, - 0x263498b, - 0x2264498d, - 0x22648991, - 0x2654992, - 0x22658995, - 0x265c996, - 0x22660997, - 0x267c998, + 0x25cc96c, + 0x25e4973, + 0x25e8979, + 0x25f897a, + 0x260097e, + 0x22634980, + 0x263898d, + 0x264898e, + 0x267c992, 0x269499f, - 0x26989a5, - 0x26a89a6, - 0x26b09aa, - 0x26e49ac, - 0x26e89b9, - 0x26f89ba, - 0x27909be, - 0x227949e4, - 0x279c9e5, - 0x27a09e7, - 0x27b89e8, - 0x27cc9ee, - 0x27f49f3, - 0x28149fd, - 0x2844a05, - 0x286ca11, - 0x2870a1b, - 0x2894a1c, - 0x2898a25, - 0x28aca26, - 0x28b0a2b, - 0x28b4a2c, - 0x28d4a2d, - 0x28eca35, - 0x28f0a3b, - 0x228f4a3c, - 0x28f8a3d, - 0x2908a3e, - 0x290ca42, - 0x2984a43, - 0x29a0a61, - 0x29aca68, - 0x29c0a6b, - 0x29d8a70, - 0x29eca76, - 0x2a04a7b, - 0x2a1ca81, - 0x2a34a87, - 0x2a50a8d, - 0x2a68a94, - 0x2ac8a9a, - 0x2ae0ab2, - 0x2ae4ab8, - 0x2af8ab9, - 0x2b3cabe, - 0x2bbcacf, - 0x2be8aef, - 0x2becafa, - 0x2bf4afb, - 0x2c14afd, - 0x2c18b05, - 0x2c38b06, - 0x2c40b0e, - 0x2c78b10, - 0x2cb8b1e, - 0x2cbcb2e, - 0x2d0cb2f, - 0x2d10b43, - 0x22d14b44, - 0x2d2cb45, - 0x2d50b4b, - 0x2d70b54, - 0x3334b5c, - 0x3340ccd, - 0x3360cd0, - 0x351ccd8, - 0x35ecd47, - 0x365cd7b, - 0x36b4d97, - 0x379cdad, - 0x37f4de7, - 0x3830dfd, - 0x392ce0c, - 0x39f8e4b, - 0x3a90e7e, - 0x3b20ea4, - 0x3b84ec8, - 0x3dbcee1, - 0x3e74f6f, - 0x3f40f9d, - 0x3f8cfd0, - 0x4014fe3, - 0x4051005, - 0x40a1014, - 0x4119028, - 0x6411d046, - 0x64121047, - 0x64125048, - 0x41a1049, - 0x41fd068, - 0x427907f, - 0x42f109e, - 0x43710bc, - 0x43dd0dc, - 0x45090f7, - 0x4561142, - 0x64565158, - 0x45fd159, - 0x468517f, - 0x46d11a1, - 0x47391b4, - 0x47e11ce, - 0x48a91f8, - 0x491122a, - 0x4a25244, - 0x64a29289, - 0x64a2d28a, - 0x4a8928b, - 0x4ae52a2, - 0x4b752b9, - 0x4bf12dd, - 0x4c352fc, - 0x4d1930d, - 0x4d4d346, - 0x4dad353, - 0x4e2136b, - 0x4ea9388, - 0x4ee93aa, - 0x4f593ba, - 0x64f5d3d6, - 0x64f613d7, - 0x24f653d8, - 0x4f7d3d9, - 0x4f993df, - 0x4fdd3e6, - 0x4fed3f7, - 0x50053fb, - 0x507d401, - 0x508541f, - 0x5099421, - 0x50b1426, - 0x50d942c, - 0x50dd436, - 0x50e5437, - 0x50f9439, - 0x511543e, - 0x5119445, - 0x5121446, - 0x515d448, - 0x5171457, - 0x517945c, - 0x518145e, - 0x5185460, - 0x51a9461, - 0x51cd46a, - 0x51e5473, - 0x51e9479, - 0x51f147a, - 0x51f547c, - 0x524d47d, - 0x5271493, - 0x529149c, - 0x52ad4a4, - 0x52bd4ab, - 0x52d14af, - 0x52d54b4, - 0x52dd4b5, - 0x52f14b7, - 0x53014bc, - 0x53054c0, - 0x53214c1, - 0x5bb14c8, - 0x5be96ec, - 0x5c156fa, - 0x5c2d705, - 0x5c4d70b, - 0x5c6d713, - 0x5cb171b, - 0x5cb972c, - 0x25cbd72e, - 0x25cc172f, - 0x5cc5730, - 0x5e01731, - 0x25e05780, - 0x25e11781, - 0x25e19784, - 0x25e25786, - 0x5e29789, - 0x5e2d78a, - 0x5e5578b, - 0x5e7d795, - 0x5e8179f, - 0x5eb97a0, - 0x5ecd7ae, - 0x6a257b3, - 0x6a29a89, - 0x6a2da8a, - 0x26a31a8b, - 0x6a35a8c, - 0x26a39a8d, - 0x6a3da8e, - 0x26a49a8f, - 0x6a4da92, - 0x6a51a93, - 0x26a55a94, - 0x6a59a95, - 0x26a61a96, - 0x6a65a98, - 0x6a69a99, - 0x26a79a9a, - 0x6a7da9e, - 0x6a81a9f, - 0x6a85aa0, - 0x6a89aa1, - 0x26a8daa2, - 0x6a91aa3, - 0x6a95aa4, - 0x6a99aa5, - 0x6a9daa6, - 0x26aa5aa7, - 0x6aa9aa9, - 0x6aadaaa, - 0x6ab1aab, - 0x26ab5aac, - 0x6ab9aad, - 0x26ac1aae, - 0x26ac5ab0, - 0x6ae1ab1, - 0x6aedab8, - 0x6b2dabb, - 0x6b31acb, - 0x6b55acc, - 0x6b59ad5, - 0x6cc1ad6, - 0x26cc5b30, - 0x26ccdb31, - 0x26cd1b33, - 0x26cd5b34, - 0x6cddb35, - 0x6db9b37, - 0x6dbdb6e, - 0x6de9b6f, - 0x6dedb7a, - 0x6e0db7b, - 0x6e19b83, - 0x6e39b86, - 0x6e71b8e, - 0x7109b9c, - 0x71c5c42, - 0x71d9c71, - 0x720dc76, - 0x723dc83, - 0x7259c8f, - 0x727dc96, - 0x7299c9f, - 0x72b5ca6, - 0x72d9cad, - 0x72e9cb6, - 0x72edcba, - 0x7321cbb, - 0x733dcc8, - 0x7359ccf, - 0x737dcd6, - 0x739dcdf, - 0x73b1ce7, - 0x73c5cec, - 0x73c9cf1, - 0x73e9cf2, - 0x748dcfa, - 0x74a9d23, - 0x74c9d2a, - 0x74cdd32, - 0x74d1d33, - 0x74d5d34, - 0x74e9d35, - 0x7509d3a, - 0x7515d42, + 0x26a89a5, + 0x26d09aa, + 0x26f09b4, + 0x27209bc, + 0x27489c8, + 0x274c9d2, + 0x27709d3, + 0x27749dc, + 0x27889dd, + 0x278c9e2, + 0x27909e3, + 0x27b09e4, + 0x27c09ec, + 0x27d09f0, + 0x27d49f4, + 0x28489f5, + 0x2864a12, + 0x2870a19, + 0x2884a1c, + 0x289ca21, + 0x28b0a27, + 0x28c8a2c, + 0x28e0a32, + 0x28f8a38, + 0x2914a3e, + 0x292ca45, + 0x298ca4b, + 0x29a4a63, + 0x29a8a69, + 0x29bca6a, + 0x2a00a6f, + 0x2a80a80, + 0x2aacaa0, + 0x2ab0aab, + 0x2ab8aac, + 0x2ad8aae, + 0x2adcab6, + 0x2afcab7, + 0x2b04abf, + 0x2b3cac1, + 0x2b78acf, + 0x2b7cade, + 0x2bbcadf, + 0x2bd4aef, + 0x2bf8af5, + 0x2c18afe, + 0x31dcb06, + 0x31e8c77, + 0x3208c7a, + 0x33c4c82, + 0x3494cf1, + 0x3504d25, + 0x355cd41, + 0x3644d57, + 0x369cd91, + 0x36d8da7, + 0x37d4db6, + 0x38a0df5, + 0x3938e28, + 0x39c8e4e, + 0x3a2ce72, + 0x3c64e8b, + 0x3d1cf19, + 0x3de8f47, + 0x3e34f7a, + 0x3ebcf8d, + 0x3ef8faf, + 0x3f48fbe, + 0x3fc0fd2, + 0x63fc4ff0, + 0x63fc8ff1, + 0x63fccff2, + 0x4048ff3, + 0x40ad012, + 0x412902b, + 0x41a104a, + 0x4221068, + 0x428d088, + 0x43b90a3, + 0x44110ee, + 0x64415104, + 0x44ad105, + 0x453512b, + 0x458114d, + 0x45e9160, + 0x469117a, + 0x47591a4, + 0x47c11d6, + 0x48d51f0, + 0x648d9235, + 0x648dd236, + 0x4939237, + 0x499524e, + 0x4a25265, + 0x4aa1289, + 0x4ae52a8, + 0x4bc92b9, + 0x4bfd2f2, + 0x4c5d2ff, + 0x4cd1317, + 0x4d59334, + 0x4d99356, + 0x4e09366, + 0x64e0d382, + 0x64e11383, + 0x24e15384, + 0x4e2d385, + 0x4e4938b, + 0x4e8d392, + 0x4e9d3a3, + 0x4eb53a7, + 0x4f2d3ad, + 0x4f353cb, + 0x4f493cd, + 0x4f613d2, + 0x4f893d8, + 0x4f8d3e2, + 0x4f953e3, + 0x4fa93e5, + 0x4fc53ea, + 0x4fc93f1, + 0x4fd13f2, + 0x500d3f4, + 0x5021403, + 0x5029408, + 0x503140a, + 0x503540c, + 0x505940d, + 0x507d416, + 0x509541f, + 0x5099425, + 0x50a1426, + 0x50a5428, + 0x50f9429, + 0x511d43e, + 0x513d447, + 0x515944f, + 0x5169456, + 0x517d45a, + 0x518145f, + 0x5189460, + 0x519d462, + 0x51ad467, + 0x51b146b, + 0x51cd46c, + 0x5a5d473, + 0x5a95697, + 0x5ac16a5, + 0x5ad96b0, + 0x5af96b6, + 0x5b196be, + 0x5b5d6c6, + 0x5b656d7, + 0x25b696d9, + 0x25b6d6da, + 0x5b716db, + 0x5c956dc, + 0x25c99725, + 0x25ca1726, + 0x25ca9728, + 0x25cb572a, + 0x5cb972d, + 0x5ce172e, + 0x5d09738, + 0x5d0d742, + 0x25d45743, + 0x5d59751, + 0x68b1756, + 0x68b5a2c, + 0x68b9a2d, + 0x268bda2e, + 0x68c1a2f, + 0x268c5a30, + 0x68c9a31, + 0x268d5a32, + 0x68d9a35, + 0x68dda36, + 0x268e1a37, + 0x68e5a38, + 0x268eda39, + 0x68f1a3b, + 0x68f5a3c, + 0x26905a3d, + 0x6909a41, + 0x690da42, + 0x6911a43, + 0x6915a44, + 0x26919a45, + 0x691da46, + 0x6921a47, + 0x6925a48, + 0x6929a49, + 0x26931a4a, + 0x6935a4c, + 0x6939a4d, + 0x693da4e, + 0x26941a4f, + 0x6945a50, + 0x2694da51, + 0x26951a53, + 0x696da54, + 0x6979a5b, + 0x69b9a5e, + 0x69bda6e, + 0x69e1a6f, + 0x6b31a78, + 0x26b39acc, + 0x26b3dace, + 0x26b41acf, + 0x6b49ad0, + 0x6c25ad2, + 0x6c29b09, + 0x6c55b0a, + 0x6c75b15, + 0x6c81b1d, + 0x6ca1b20, + 0x6cd9b28, + 0x6f71b36, + 0x702dbdc, + 0x7041c0b, + 0x7075c10, + 0x70a5c1d, + 0x70c1c29, + 0x70e5c30, + 0x7101c39, + 0x711dc40, + 0x7141c47, + 0x7151c50, + 0x7185c54, + 0x71a1c61, + 0x73adc68, + 0x73d1ceb, + 0x73f1cf4, + 0x7405cfc, + 0x7419d01, + 0x7439d06, + 0x74ddd0e, + 0x74f9d37, + 0x7515d3e, 0x7519d45, - 0x7549d46, - 0x75c9d52, - 0x75ddd72, - 0x75e1d77, - 0x75f9d78, - 0x75fdd7e, - 0x7609d7f, - 0x760dd82, - 0x7629d83, - 0x7665d8a, - 0x7669d99, - 0x7689d9a, - 0x76d9da2, - 0x76f1db6, - 0x7745dbc, - 0x7749dd1, - 0x774ddd2, - 0x7751dd3, - 0x7795dd4, - 0x77a5de5, - 0x77ddde9, - 0x780ddf7, - 0x7955e03, - 0x7979e55, - 0x79a5e5e, - 0x79b1e69, - 0x79b9e6c, - 0x7ac9e6e, - 0x7ad5eb2, - 0x7ae1eb5, - 0x7aedeb8, - 0x7af9ebb, - 0x7b05ebe, - 0x7b11ec1, - 0x7b1dec4, - 0x7b29ec7, - 0x7b35eca, - 0x7b41ecd, - 0x7b4ded0, - 0x7b59ed3, - 0x7b65ed6, - 0x7b6ded9, + 0x751dd46, + 0x7521d47, + 0x7535d48, + 0x7555d4d, + 0x7561d55, + 0x7565d58, + 0x7595d59, + 0x7615d65, + 0x7629d85, + 0x762dd8a, + 0x7645d8b, + 0x7649d91, + 0x7655d92, + 0x7659d95, + 0x7675d96, + 0x76b1d9d, + 0x76b5dac, + 0x76d5dad, + 0x7725db5, + 0x773ddc9, + 0x7791dcf, + 0x7795de4, + 0x7799de5, + 0x77ddde6, + 0x77eddf7, + 0x7825dfb, + 0x7855e09, + 0x7991e15, + 0x79b5e64, + 0x79e1e6d, + 0x79ede78, + 0x79f1e7b, + 0x7b01e7c, + 0x7b0dec0, + 0x7b19ec3, + 0x7b25ec6, + 0x7b31ec9, + 0x7b3decc, + 0x7b49ecf, + 0x7b55ed2, + 0x7b61ed5, + 0x7b6ded8, 0x7b79edb, 0x7b85ede, 0x7b91ee1, 0x7b9dee4, - 0x7ba9ee7, - 0x7bb5eea, - 0x7bc1eed, - 0x7bcdef0, - 0x7bd9ef3, - 0x7be5ef6, - 0x7bf1ef9, - 0x7bfdefc, - 0x7c09eff, - 0x7c15f02, - 0x7c21f05, - 0x7c2df08, - 0x7c39f0b, - 0x7c41f0e, + 0x7ba5ee7, + 0x7bb1ee9, + 0x7bbdeec, + 0x7bc9eef, + 0x7bd5ef2, + 0x7be1ef5, + 0x7bedef8, + 0x7bf9efb, + 0x7c05efe, + 0x7c11f01, + 0x7c1df04, + 0x7c29f07, + 0x7c35f0a, + 0x7c41f0d, 0x7c4df10, 0x7c59f13, 0x7c65f16, 0x7c71f19, - 0x7c7df1c, - 0x7c89f1f, - 0x7c95f22, - 0x7ca1f25, - 0x7cadf28, - 0x7cb9f2b, - 0x7cc5f2e, - 0x7cd1f31, - 0x7cddf34, - 0x7ce5f37, + 0x7c79f1c, + 0x7c85f1e, + 0x7c91f21, + 0x7c9df24, + 0x7ca9f27, + 0x7cb5f2a, + 0x7cc1f2d, + 0x7ccdf30, + 0x7cd9f33, + 0x7ce5f36, 0x7cf1f39, 0x7cfdf3c, 0x7d09f3f, 0x7d15f42, - 0x7d21f45, - 0x7d2df48, - 0x7d39f4b, - 0x7d45f4e, - 0x7d49f51, - 0x7d55f52, - 0x7d6df55, - 0x7d71f5b, - 0x7d81f5c, - 0x7d99f60, - 0x7dddf66, - 0x7df1f77, - 0x7e25f7c, - 0x7e35f89, - 0x7e51f8d, - 0x7e69f94, - 0x7e6df9a, - 0x27eb1f9b, - 0x7eb5fac, - 0x7ee1fad, - 0x7ee5fb8, + 0x7d1df45, + 0x7d29f47, + 0x7d35f4a, + 0x7d41f4d, + 0x7d4df50, + 0x7d59f53, + 0x7d65f56, + 0x7d71f59, + 0x7d7df5c, + 0x7d81f5f, + 0x7d8df60, + 0x7da5f63, + 0x7da9f69, + 0x7db9f6a, + 0x7dd1f6e, + 0x7e15f74, + 0x7e29f85, + 0x7e5df8a, + 0x7e6df97, + 0x7e89f9b, + 0x7ea1fa2, + 0x7ea5fa8, + 0x27ee9fa9, + 0x7eedfba, + 0x7f19fbb, + 0x7f1dfc6, } -// max children 466 (capacity 511) -// max text offset 28023 (capacity 32767) +// max children 434 (capacity 511) +// max text offset 27930 (capacity 32767) // max text length 36 (capacity 63) -// max hi 8121 (capacity 16383) -// max lo 8120 (capacity 16383) +// max hi 8135 (capacity 16383) +// max lo 8134 (capacity 16383) diff --git a/vendor/golang.org/x/net/publicsuffix/table_test.go b/vendor/golang.org/x/net/publicsuffix/table_test.go index f60c80e..5433f3b 100644 --- a/vendor/golang.org/x/net/publicsuffix/table_test.go +++ b/vendor/golang.org/x/net/publicsuffix/table_test.go @@ -541,7 +541,6 @@ var rules = [...]string{ "org.cw", "cx", "gov.cx", - "cy", "ac.cy", "biz.cy", "com.cy", @@ -2208,7 +2207,9 @@ var rules = [...]string{ "aso.kumamoto.jp", "choyo.kumamoto.jp", "gyokuto.kumamoto.jp", + "hitoyoshi.kumamoto.jp", "kamiamakusa.kumamoto.jp", + "kashima.kumamoto.jp", "kikuchi.kumamoto.jp", "kumamoto.kumamoto.jp", "mashiki.kumamoto.jp", @@ -3967,21 +3968,20 @@ var rules = [...]string{ "net.ng", "org.ng", "sch.ng", - "ni", - "ac.ni", - "biz.ni", - "co.ni", "com.ni", - "edu.ni", "gob.ni", + "edu.ni", + "org.ni", + "nom.ni", + "net.ni", + "mil.ni", + "co.ni", + "biz.ni", + "web.ni", + "int.ni", + "ac.ni", "in.ni", "info.ni", - "int.ni", - "mil.ni", - "net.ni", - "nom.ni", - "org.ni", - "web.ni", "nl", "bv.nl", "no", @@ -4775,7 +4775,6 @@ var rules = [...]string{ "net.om", "org.om", "pro.om", - "onion", "org", "pa", "ac.pa", @@ -5127,9 +5126,133 @@ var rules = [...]string{ "org.rs", "ru", "ac.ru", + "com.ru", "edu.ru", - "gov.ru", "int.ru", + "net.ru", + "org.ru", + "pp.ru", + "adygeya.ru", + "altai.ru", + "amur.ru", + "arkhangelsk.ru", + "astrakhan.ru", + "bashkiria.ru", + "belgorod.ru", + "bir.ru", + "bryansk.ru", + "buryatia.ru", + "cbg.ru", + "chel.ru", + "chelyabinsk.ru", + "chita.ru", + "chukotka.ru", + "chuvashia.ru", + "dagestan.ru", + "dudinka.ru", + "e-burg.ru", + "grozny.ru", + "irkutsk.ru", + "ivanovo.ru", + "izhevsk.ru", + "jar.ru", + "joshkar-ola.ru", + "kalmykia.ru", + "kaluga.ru", + "kamchatka.ru", + "karelia.ru", + "kazan.ru", + "kchr.ru", + "kemerovo.ru", + "khabarovsk.ru", + "khakassia.ru", + "khv.ru", + "kirov.ru", + "koenig.ru", + "komi.ru", + "kostroma.ru", + "krasnoyarsk.ru", + "kuban.ru", + "kurgan.ru", + "kursk.ru", + "lipetsk.ru", + "magadan.ru", + "mari.ru", + "mari-el.ru", + "marine.ru", + "mordovia.ru", + "msk.ru", + "murmansk.ru", + "nalchik.ru", + "nnov.ru", + "nov.ru", + "novosibirsk.ru", + "nsk.ru", + "omsk.ru", + "orenburg.ru", + "oryol.ru", + "palana.ru", + "penza.ru", + "perm.ru", + "ptz.ru", + "rnd.ru", + "ryazan.ru", + "sakhalin.ru", + "samara.ru", + "saratov.ru", + "simbirsk.ru", + "smolensk.ru", + "spb.ru", + "stavropol.ru", + "stv.ru", + "surgut.ru", + "tambov.ru", + "tatarstan.ru", + "tom.ru", + "tomsk.ru", + "tsaritsyn.ru", + "tsk.ru", + "tula.ru", + "tuva.ru", + "tver.ru", + "tyumen.ru", + "udm.ru", + "udmurtia.ru", + "ulan-ude.ru", + "vladikavkaz.ru", + "vladimir.ru", + "vladivostok.ru", + "volgograd.ru", + "vologda.ru", + "voronezh.ru", + "vrn.ru", + "vyatka.ru", + "yakutia.ru", + "yamal.ru", + "yaroslavl.ru", + "yekaterinburg.ru", + "yuzhno-sakhalinsk.ru", + "amursk.ru", + "baikal.ru", + "cmw.ru", + "fareast.ru", + "jamal.ru", + "kms.ru", + "k-uralsk.ru", + "kustanai.ru", + "kuzbass.ru", + "mytis.ru", + "nakhodka.ru", + "nkz.ru", + "norilsk.ru", + "oskol.ru", + "pyatigorsk.ru", + "rubtsovsk.ru", + "snz.ru", + "syzran.ru", + "vdonsk.ru", + "zgrad.ru", + "gov.ru", "mil.ru", "test.ru", "rw", @@ -6256,6 +6379,7 @@ var rules = [...]string{ "education", "email", "emerck", + "emerson", "energy", "engineer", "engineering", @@ -6418,7 +6542,6 @@ var rules = [...]string{ "honda", "honeywell", "horse", - "hospital", "host", "hosting", "hot", @@ -7170,64 +7293,43 @@ var rules = [...]string{ "*.alces.network", "*.alwaysdata.net", "cloudfront.net", - "*.compute.amazonaws.com", - "*.compute-1.amazonaws.com", - "*.compute.amazonaws.com.cn", + "compute.amazonaws.com", + "ap-northeast-1.compute.amazonaws.com", + "ap-northeast-2.compute.amazonaws.com", + "ap-southeast-1.compute.amazonaws.com", + "ap-southeast-2.compute.amazonaws.com", + "eu-central-1.compute.amazonaws.com", + "eu-west-1.compute.amazonaws.com", + "sa-east-1.compute.amazonaws.com", + "us-gov-west-1.compute.amazonaws.com", + "us-west-1.compute.amazonaws.com", + "us-west-2.compute.amazonaws.com", + "compute-1.amazonaws.com", + "z-1.compute-1.amazonaws.com", + "z-2.compute-1.amazonaws.com", "us-east-1.amazonaws.com", - "elasticbeanstalk.cn-north-1.amazonaws.com.cn", - "*.elasticbeanstalk.com", - "*.elb.amazonaws.com", - "*.elb.amazonaws.com.cn", - "*.s3.amazonaws.com", + "compute.amazonaws.com.cn", + "cn-north-1.compute.amazonaws.com.cn", + "elasticbeanstalk.com", + "elb.amazonaws.com", + "s3.amazonaws.com", "s3-ap-northeast-1.amazonaws.com", "s3-ap-northeast-2.amazonaws.com", - "s3-ap-south-1.amazonaws.com", "s3-ap-southeast-1.amazonaws.com", "s3-ap-southeast-2.amazonaws.com", - "s3-ca-central-1.amazonaws.com", "s3-eu-central-1.amazonaws.com", "s3-eu-west-1.amazonaws.com", "s3-external-1.amazonaws.com", + "s3-external-2.amazonaws.com", "s3-fips-us-gov-west-1.amazonaws.com", "s3-sa-east-1.amazonaws.com", "s3-us-gov-west-1.amazonaws.com", - "s3-us-east-2.amazonaws.com", "s3-us-west-1.amazonaws.com", "s3-us-west-2.amazonaws.com", "s3.ap-northeast-2.amazonaws.com", - "s3.ap-south-1.amazonaws.com", "s3.cn-north-1.amazonaws.com.cn", - "s3.ca-central-1.amazonaws.com", "s3.eu-central-1.amazonaws.com", - "s3.us-east-2.amazonaws.com", - "s3.dualstack.ap-northeast-1.amazonaws.com", - "s3.dualstack.ap-northeast-2.amazonaws.com", - "s3.dualstack.ap-south-1.amazonaws.com", - "s3.dualstack.ap-southeast-1.amazonaws.com", - "s3.dualstack.ap-southeast-2.amazonaws.com", - "s3.dualstack.ca-central-1.amazonaws.com", - "s3.dualstack.eu-central-1.amazonaws.com", - "s3.dualstack.eu-west-1.amazonaws.com", - "s3.dualstack.sa-east-1.amazonaws.com", - "s3.dualstack.us-east-1.amazonaws.com", - "s3.dualstack.us-east-2.amazonaws.com", - "s3-website-us-east-1.amazonaws.com", - "s3-website-us-west-1.amazonaws.com", - "s3-website-us-west-2.amazonaws.com", - "s3-website-ap-northeast-1.amazonaws.com", - "s3-website-ap-southeast-1.amazonaws.com", - "s3-website-ap-southeast-2.amazonaws.com", - "s3-website-eu-west-1.amazonaws.com", - "s3-website-sa-east-1.amazonaws.com", - "s3-website.ap-northeast-2.amazonaws.com", - "s3-website.ap-south-1.amazonaws.com", - "s3-website.ca-central-1.amazonaws.com", - "s3-website.eu-central-1.amazonaws.com", - "s3-website.us-east-2.amazonaws.com", - "t3l3p0rt.net", - "tele.amune.org", "on-aptible.com", - "user.party.eus", "pimienta.org", "poivron.org", "potager.org", @@ -7300,15 +7402,6 @@ var rules = [...]string{ "co.nl", "co.no", "*.platform.sh", - "dyn.cosidns.de", - "dynamisches-dns.de", - "dnsupdater.de", - "internet-dns.de", - "l-o-g-i-n.de", - "dynamic-dns.info", - "feste-ip.net", - "knx-server.net", - "static-access.net", "realm.cz", "*.cryptonomic.net", "cupcake.is", @@ -7608,19 +7701,8 @@ var rules = [...]string{ "webhop.org", "worse-than.tv", "writesthisblog.com", - "ddnss.de", - "dyn.ddnss.de", - "dyndns.ddnss.de", - "dyndns1.de", - "dyn-ip24.de", - "home-webserver.de", - "dyn.home-webserver.de", - "myhome-server.de", - "ddnss.org", "dynv6.net", "e4.cz", - "enonic.io", - "customer.enonic.io", "eu.org", "al.eu.org", "asso.eu.org", @@ -7682,14 +7764,11 @@ var rules = [...]string{ "us-1.evennode.com", "us-2.evennode.com", "apps.fbsbx.com", - "map.fastly.net", - "a.prod.fastly.net", - "global.prod.fastly.net", "a.ssl.fastly.net", "b.ssl.fastly.net", "global.ssl.fastly.net", - "fastlylb.net", - "map.fastlylb.net", + "a.prod.fastly.net", + "global.prod.fastly.net", "fhapp.xyz", "firebaseapp.com", "flynnhub.com", @@ -7699,12 +7778,9 @@ var rules = [...]string{ "fbxos.fr", "freebox-os.fr", "freeboxos.fr", - "myfusion.cloud", - "futurehosting.at", "futuremailing.at", "*.ex.ortsinfo.at", "*.kunden.ortsinfo.at", - "*.statics.cloud", "service.gov.uk", "github.io", "githubusercontent.com", @@ -7714,7 +7790,7 @@ var rules = [...]string{ "gist.githubcloud.com", "*.githubcloudusercontent.com", "gitlab.io", - "homeoffice.gov.uk", + "ro.com", "ro.im", "shop.ro", "goip.de", @@ -7960,7 +8036,6 @@ var rules = [...]string{ "pantheonsite.io", "gotpantheon.com", "mypep.link", - "on-web.fr", "xen.prgmr.com", "priv.at", "protonet.io", @@ -7979,34 +8054,19 @@ var rules = [...]string{ "sandcats.io", "logoip.de", "logoip.com", - "firewall-gateway.com", - "firewall-gateway.de", - "my-gateway.de", - "my-router.de", - "spdns.de", - "spdns.eu", - "firewall-gateway.net", - "my-firewall.org", - "myfirewall.org", - "spdns.org", "biz.ua", "co.ua", "pp.ua", - "shiftedit.io", "myshopblocks.com", - "1kapp.com", - "appchizi.com", - "applinzi.com", "sinaapp.com", "vipsinaapp.com", + "1kapp.com", "bounty-full.com", "alpha.bounty-full.com", "beta.bounty-full.com", "static.land", "dev.static.land", "sites.static.land", - "apps.lair.io", - "*.stolos.io", "spacekit.io", "stackspace.space", "diskstation.me", @@ -8034,41 +8094,16 @@ var rules = [...]string{ "*.transurl.eu", "*.transurl.nl", "tuxfamily.org", - "dd-dns.de", - "diskstation.eu", - "diskstation.org", - "dray-dns.de", - "draydns.de", - "dyn-vpn.de", - "dynvpn.de", - "mein-vigor.de", - "my-vigor.de", - "my-wan.de", - "syno-ds.de", - "synology-diskstation.de", - "synology-ds.de", "hk.com", "hk.org", "ltd.hk", "inc.hk", "lib.de.us", "router.management", - "remotewd.com", "wmflabs.org", "yolasite.com", - "ybo.faith", - "yombo.me", - "homelink.one", - "ybo.party", - "ybo.review", - "ybo.science", - "ybo.trade", "za.net", "za.org", - "now.sh", - "cc.ua", - "inf.ua", - "ltd.ua", } var nodeLabels = [...]string{ @@ -8462,6 +8497,7 @@ var nodeLabels = [...]string{ "eg", "email", "emerck", + "emerson", "energy", "engineer", "engineering", @@ -8657,7 +8693,6 @@ var nodeLabels = [...]string{ "honda", "honeywell", "horse", - "hospital", "host", "hosting", "hot", @@ -8999,7 +9034,6 @@ var nodeLabels = [...]string{ "omega", "one", "ong", - "onion", "onl", "online", "onyourside", @@ -9777,7 +9811,6 @@ var nodeLabels = [...]string{ "ac", "biz", "co", - "futurehosting", "futuremailing", "gv", "info", @@ -10101,8 +10134,6 @@ var nodeLabels = [...]string{ "gov", "mil", "magentosite", - "myfusion", - "statics", "cloudns", "co", "com", @@ -10155,9 +10186,8 @@ var nodeLabels = [...]string{ "amazonaws", "cn-north-1", "compute", - "elb", - "elasticbeanstalk", "s3", + "cn-north-1", "arts", "com", "edu", @@ -10179,8 +10209,6 @@ var nodeLabels = [...]string{ "africa", "alpha-myqnapcloud", "amazonaws", - "appchizi", - "applinzi", "appspot", "ar", "betainabox", @@ -10237,7 +10265,6 @@ var nodeLabels = [...]string{ "familyds", "fbsbx", "firebaseapp", - "firewall-gateway", "flynnhub", "freebox-os", "freeboxos", @@ -10402,8 +10429,8 @@ var nodeLabels = [...]string{ "qc", "quicksytes", "rackmaze", - "remotewd", "rhcloud", + "ro", "ru", "sa", "saves-the-whales", @@ -10445,75 +10472,39 @@ var nodeLabels = [...]string{ "xenapponazure", "yolasite", "za", - "ap-northeast-1", "ap-northeast-2", - "ap-south-1", - "ap-southeast-1", - "ap-southeast-2", - "ca-central-1", "compute", "compute-1", "elb", "eu-central-1", - "eu-west-1", "s3", "s3-ap-northeast-1", "s3-ap-northeast-2", - "s3-ap-south-1", "s3-ap-southeast-1", "s3-ap-southeast-2", - "s3-ca-central-1", "s3-eu-central-1", "s3-eu-west-1", "s3-external-1", + "s3-external-2", "s3-fips-us-gov-west-1", "s3-sa-east-1", - "s3-us-east-2", "s3-us-gov-west-1", "s3-us-west-1", "s3-us-west-2", - "s3-website-ap-northeast-1", - "s3-website-ap-southeast-1", - "s3-website-ap-southeast-2", - "s3-website-eu-west-1", - "s3-website-sa-east-1", - "s3-website-us-east-1", - "s3-website-us-west-1", - "s3-website-us-west-2", - "sa-east-1", "us-east-1", - "us-east-2", - "dualstack", "s3", - "dualstack", - "s3", - "s3-website", - "s3", - "dualstack", - "s3", - "s3-website", - "s3", - "dualstack", - "s3", - "dualstack", - "s3", - "dualstack", - "s3", - "s3-website", - "s3", - "dualstack", - "s3", - "s3-website", - "s3", - "dualstack", - "s3", - "dualstack", - "s3", - "dualstack", - "s3", - "dualstack", - "s3", - "s3-website", + "ap-northeast-1", + "ap-northeast-2", + "ap-southeast-1", + "ap-southeast-2", + "eu-central-1", + "eu-west-1", + "sa-east-1", + "us-gov-west-1", + "us-west-1", + "us-west-2", + "z-1", + "z-2", "s3", "alpha", "beta", @@ -10568,46 +10559,17 @@ var nodeLabels = [...]string{ "realm", "blogspot", "com", - "cosidns", - "dd-dns", - "ddnss", "dnshome", - "dnsupdater", - "dray-dns", - "draydns", - "dyn-ip24", - "dyn-vpn", - "dynamisches-dns", - "dyndns1", - "dynvpn", - "firewall-gateway", "fuettertdasnetz", "goip", - "home-webserver", - "internet-dns", "isteingeek", "istmein", "keymachine", - "l-o-g-i-n", "lebtimnetz", "leitungsen", "logoip", - "mein-vigor", - "my-gateway", - "my-router", - "my-vigor", - "my-wan", - "myhome-server", - "spdns", - "syno-ds", - "synology-diskstation", - "synology-ds", "taifun-dns", "traeumtgerade", - "dyn", - "dyn", - "dyndns", - "dyn", "biz", "blogspot", "co", @@ -10686,14 +10648,9 @@ var nodeLabels = [...]string{ "net", "org", "cloudns", - "diskstation", "mycd", - "spdns", "transurl", "wellbeingzone", - "party", - "user", - "ybo", "aland", "blogspot", "dy", @@ -10722,7 +10679,6 @@ var nodeLabels = [...]string{ "medecin", "nom", "notaires", - "on-web", "pharmacien", "port", "prd", @@ -10922,7 +10878,6 @@ var nodeLabels = [...]string{ "barrell-of-knowledge", "cloudns", "dvrcam", - "dynamic-dns", "dyndns", "for-our", "groks-the", @@ -10941,22 +10896,16 @@ var nodeLabels = [...]string{ "com", "dedyn", "drud", - "enonic", "github", "gitlab", "hasura-app", "hzc", - "lair", "ngrok", "nid", "pantheonsite", "protonet", "sandcats", - "shiftedit", "spacekit", - "stolos", - "customer", - "apps", "com", "edu", "gov", @@ -12277,7 +12226,9 @@ var nodeLabels = [...]string{ "aso", "choyo", "gyokuto", + "hitoyoshi", "kamiamakusa", + "kashima", "kikuchi", "kumamoto", "mashiki", @@ -13338,7 +13289,6 @@ var nodeLabels = [...]string{ "priv", "synology", "webhop", - "yombo", "co", "com", "edu", @@ -14036,9 +13986,6 @@ var nodeLabels = [...]string{ "endofinternet", "familyds", "fastly", - "fastlylb", - "feste-ip", - "firewall-gateway", "from-az", "from-co", "from-la", @@ -14058,7 +14005,6 @@ var nodeLabels = [...]string{ "isa-geek", "jp", "kicks-ass", - "knx-server", "mydissent", "myeffect", "myfritz", @@ -14081,15 +14027,12 @@ var nodeLabels = [...]string{ "serveblog", "serveftp", "serveminecraft", - "static-access", "sytes", - "t3l3p0rt", "thruhere", "uk", "webhop", "za", "r", - "map", "prod", "ssl", "a", @@ -14097,7 +14040,6 @@ var nodeLabels = [...]string{ "a", "b", "global", - "map", "alces", "arts", "com", @@ -14941,9 +14883,7 @@ var nodeLabels = [...]string{ "net", "org", "pro", - "homelink", "ae", - "amune", "blogdns", "blogsite", "bmoattachments", @@ -14955,8 +14895,6 @@ var nodeLabels = [...]string{ "cloudns", "collegefan", "couchpotatofries", - "ddnss", - "diskstation", "dnsalias", "dnsdojo", "doesntexist", @@ -15004,8 +14942,6 @@ var nodeLabels = [...]string{ "kicks-ass", "misconfused", "mlbfan", - "my-firewall", - "myfirewall", "myftp", "mysecuritycamera", "nflfan", @@ -15021,7 +14957,6 @@ var nodeLabels = [...]string{ "servebbs", "serveftp", "servegame", - "spdns", "stuff-4-sale", "sweetpepper", "tunk", @@ -15032,7 +14967,6 @@ var nodeLabels = [...]string{ "wmflabs", "za", "zapto", - "tele", "c", "rsc", "origin", @@ -15106,7 +15040,6 @@ var nodeLabels = [...]string{ "nom", "org", "sld", - "ybo", "blogspot", "com", "edu", @@ -15426,7 +15359,6 @@ var nodeLabels = [...]string{ "blogspot", "com", "nom", - "ybo", "arts", "blogspot", "com", @@ -15448,12 +15380,136 @@ var nodeLabels = [...]string{ "in", "org", "ac", + "adygeya", + "altai", + "amur", + "amursk", + "arkhangelsk", + "astrakhan", + "baikal", + "bashkiria", + "belgorod", + "bir", "blogspot", + "bryansk", + "buryatia", + "cbg", + "chel", + "chelyabinsk", + "chita", + "chukotka", + "chuvashia", + "cmw", + "com", + "dagestan", + "dudinka", + "e-burg", "edu", + "fareast", "gov", + "grozny", "int", + "irkutsk", + "ivanovo", + "izhevsk", + "jamal", + "jar", + "joshkar-ola", + "k-uralsk", + "kalmykia", + "kaluga", + "kamchatka", + "karelia", + "kazan", + "kchr", + "kemerovo", + "khabarovsk", + "khakassia", + "khv", + "kirov", + "kms", + "koenig", + "komi", + "kostroma", + "krasnoyarsk", + "kuban", + "kurgan", + "kursk", + "kustanai", + "kuzbass", + "lipetsk", + "magadan", + "mari", + "mari-el", + "marine", "mil", + "mordovia", + "msk", + "murmansk", + "mytis", + "nakhodka", + "nalchik", + "net", + "nkz", + "nnov", + "norilsk", + "nov", + "novosibirsk", + "nsk", + "omsk", + "orenburg", + "org", + "oryol", + "oskol", + "palana", + "penza", + "perm", + "pp", + "ptz", + "pyatigorsk", + "rnd", + "rubtsovsk", + "ryazan", + "sakhalin", + "samara", + "saratov", + "simbirsk", + "smolensk", + "snz", + "spb", + "stavropol", + "stv", + "surgut", + "syzran", + "tambov", + "tatarstan", "test", + "tom", + "tomsk", + "tsaritsyn", + "tsk", + "tula", + "tuva", + "tver", + "tyumen", + "udm", + "udmurtia", + "ulan-ude", + "vdonsk", + "vladikavkaz", + "vladimir", + "vladivostok", + "volgograd", + "vologda", + "voronezh", + "vrn", + "vyatka", + "yakutia", + "yamal", + "yaroslavl", + "yekaterinburg", + "yuzhno-sakhalinsk", + "zgrad", "ac", "co", "com", @@ -15481,7 +15537,6 @@ var nodeLabels = [...]string{ "gov", "net", "org", - "ybo", "com", "edu", "gov", @@ -15543,7 +15598,6 @@ var nodeLabels = [...]string{ "hashbang", "mil", "net", - "now", "org", "platform", "blogspot", @@ -15707,7 +15761,6 @@ var nodeLabels = [...]string{ "web", "blogspot", "gov", - "ybo", "aero", "biz", "co", @@ -15756,7 +15809,6 @@ var nodeLabels = [...]string{ "sc", "tv", "biz", - "cc", "cherkassy", "cherkasy", "chernigov", @@ -15780,7 +15832,6 @@ var nodeLabels = [...]string{ "gov", "if", "in", - "inf", "ivano-frankivsk", "kh", "kharkiv", @@ -15798,7 +15849,6 @@ var nodeLabels = [...]string{ "kyiv", "lg", "lt", - "ltd", "lugansk", "lutsk", "lv", @@ -15860,7 +15910,6 @@ var nodeLabels = [...]string{ "blogspot", "no-ip", "wellbeingzone", - "homeoffice", "service", "ak", "al", diff --git a/vendor/golang.org/x/net/route/address.go b/vendor/golang.org/x/net/route/address.go index e6bfa39..a56909c 100644 --- a/vendor/golang.org/x/net/route/address.go +++ b/vendor/golang.org/x/net/route/address.go @@ -24,39 +24,6 @@ type LinkAddr struct { // Family implements the Family method of Addr interface. func (a *LinkAddr) Family() int { return sysAF_LINK } -func (a *LinkAddr) lenAndSpace() (int, int) { - l := 8 + len(a.Name) + len(a.Addr) - return l, roundup(l) -} - -func (a *LinkAddr) marshal(b []byte) (int, error) { - l, ll := a.lenAndSpace() - if len(b) < ll { - return 0, errShortBuffer - } - nlen, alen := len(a.Name), len(a.Addr) - if nlen > 255 || alen > 255 { - return 0, errInvalidAddr - } - b[0] = byte(l) - b[1] = sysAF_LINK - if a.Index > 0 { - nativeEndian.PutUint16(b[2:4], uint16(a.Index)) - } - data := b[8:] - if nlen > 0 { - b[5] = byte(nlen) - copy(data[:nlen], a.Addr) - data = data[nlen:] - } - if alen > 0 { - b[6] = byte(alen) - copy(data[:alen], a.Name) - data = data[alen:] - } - return ll, nil -} - func parseLinkAddr(b []byte) (Addr, error) { if len(b) < 8 { return nil, errInvalidAddr @@ -123,21 +90,6 @@ type Inet4Addr struct { // Family implements the Family method of Addr interface. func (a *Inet4Addr) Family() int { return sysAF_INET } -func (a *Inet4Addr) lenAndSpace() (int, int) { - return sizeofSockaddrInet, roundup(sizeofSockaddrInet) -} - -func (a *Inet4Addr) marshal(b []byte) (int, error) { - l, ll := a.lenAndSpace() - if len(b) < ll { - return 0, errShortBuffer - } - b[0] = byte(l) - b[1] = sysAF_INET - copy(b[4:8], a.IP[:]) - return ll, nil -} - // An Inet6Addr represents an internet address for IPv6. type Inet6Addr struct { IP [16]byte // IP address @@ -147,36 +99,18 @@ type Inet6Addr struct { // Family implements the Family method of Addr interface. func (a *Inet6Addr) Family() int { return sysAF_INET6 } -func (a *Inet6Addr) lenAndSpace() (int, int) { - return sizeofSockaddrInet6, roundup(sizeofSockaddrInet6) -} - -func (a *Inet6Addr) marshal(b []byte) (int, error) { - l, ll := a.lenAndSpace() - if len(b) < ll { - return 0, errShortBuffer - } - b[0] = byte(l) - b[1] = sysAF_INET6 - copy(b[8:24], a.IP[:]) - if a.ZoneID > 0 { - nativeEndian.PutUint32(b[24:28], uint32(a.ZoneID)) - } - return ll, nil -} - // parseInetAddr parses b as an internet address for IPv4 or IPv6. func parseInetAddr(af int, b []byte) (Addr, error) { switch af { case sysAF_INET: - if len(b) < sizeofSockaddrInet { + if len(b) < 16 { return nil, errInvalidAddr } a := &Inet4Addr{} copy(a.IP[:], b[4:8]) return a, nil case sysAF_INET6: - if len(b) < sizeofSockaddrInet6 { + if len(b) < 28 { return nil, errInvalidAddr } a := &Inet6Addr{ZoneID: int(nativeEndian.Uint32(b[24:28]))} @@ -240,7 +174,7 @@ func parseKernelInetAddr(af int, b []byte) (int, Addr, error) { off6 = 8 // offset of in6_addr ) switch { - case b[0] == sizeofSockaddrInet6: + case b[0] == 28: // size of sockaddr_in6 a := &Inet6Addr{} copy(a.IP[:], b[off6:off6+16]) return int(b[0]), a, nil @@ -252,7 +186,7 @@ func parseKernelInetAddr(af int, b []byte) (int, Addr, error) { copy(a.IP[:], b[l-off6:l]) } return int(b[0]), a, nil - case b[0] == sizeofSockaddrInet: + case b[0] == 16: // size of sockaddr_in a := &Inet4Addr{} copy(a.IP[:], b[off4:off4+4]) return int(b[0]), a, nil @@ -277,24 +211,6 @@ type DefaultAddr struct { // Family implements the Family method of Addr interface. func (a *DefaultAddr) Family() int { return a.af } -func (a *DefaultAddr) lenAndSpace() (int, int) { - l := len(a.Raw) - return l, roundup(l) -} - -func (a *DefaultAddr) marshal(b []byte) (int, error) { - l, ll := a.lenAndSpace() - if len(b) < ll { - return 0, errShortBuffer - } - if l > 255 { - return 0, errInvalidAddr - } - b[1] = byte(l) - copy(b[:l], a.Raw) - return ll, nil -} - func parseDefaultAddr(b []byte) (Addr, error) { if len(b) < 2 || len(b) < int(b[0]) { return nil, errInvalidAddr @@ -303,66 +219,6 @@ func parseDefaultAddr(b []byte) (Addr, error) { return a, nil } -func addrsSpace(as []Addr) int { - var l int - for _, a := range as { - switch a := a.(type) { - case *LinkAddr: - _, ll := a.lenAndSpace() - l += ll - case *Inet4Addr: - _, ll := a.lenAndSpace() - l += ll - case *Inet6Addr: - _, ll := a.lenAndSpace() - l += ll - case *DefaultAddr: - _, ll := a.lenAndSpace() - l += ll - } - } - return l -} - -// marshalAddrs marshals as and returns a bitmap indicating which -// address is stored in b. -func marshalAddrs(b []byte, as []Addr) (uint, error) { - var attrs uint - for i, a := range as { - switch a := a.(type) { - case *LinkAddr: - l, err := a.marshal(b) - if err != nil { - return 0, err - } - b = b[l:] - attrs |= 1 << uint(i) - case *Inet4Addr: - l, err := a.marshal(b) - if err != nil { - return 0, err - } - b = b[l:] - attrs |= 1 << uint(i) - case *Inet6Addr: - l, err := a.marshal(b) - if err != nil { - return 0, err - } - b = b[l:] - attrs |= 1 << uint(i) - case *DefaultAddr: - l, err := a.marshal(b) - if err != nil { - return 0, err - } - b = b[l:] - attrs |= 1 << uint(i) - } - } - return attrs, nil -} - func parseAddrs(attrs uint, fn func(int, []byte) (int, Addr, error), b []byte) ([]Addr, error) { var as [sysRTAX_MAX]Addr af := int(sysAF_UNSPEC) diff --git a/vendor/golang.org/x/net/route/binary.go b/vendor/golang.org/x/net/route/binary.go index 6910520..4c56163 100644 --- a/vendor/golang.org/x/net/route/binary.go +++ b/vendor/golang.org/x/net/route/binary.go @@ -9,7 +9,7 @@ package route // This file contains duplicates of encoding/binary package. // // This package is supposed to be used by the net package of standard -// library. Therefore the package set used in the package must be the +// library. Therefore a package set used in the package must be the // same as net package. var ( diff --git a/vendor/golang.org/x/net/route/defs_darwin.go b/vendor/golang.org/x/net/route/defs_darwin.go index e771644..f452ad1 100644 --- a/vendor/golang.org/x/net/route/defs_darwin.go +++ b/vendor/golang.org/x/net/route/defs_darwin.go @@ -13,8 +13,6 @@ package route #include #include #include - -#include */ import "C" @@ -25,8 +23,6 @@ const ( sysAF_LINK = C.AF_LINK sysAF_INET6 = C.AF_INET6 - sysSOCK_RAW = C.SOCK_RAW - sysNET_RT_DUMP = C.NET_RT_DUMP sysNET_RT_FLAGS = C.NET_RT_FLAGS sysNET_RT_IFLIST = C.NET_RT_IFLIST @@ -107,8 +103,4 @@ const ( sizeofRtMsghdrDarwin15 = C.sizeof_struct_rt_msghdr sizeofRtMsghdr2Darwin15 = C.sizeof_struct_rt_msghdr2 sizeofRtMetricsDarwin15 = C.sizeof_struct_rt_metrics - - sizeofSockaddrStorage = C.sizeof_struct_sockaddr_storage - sizeofSockaddrInet = C.sizeof_struct_sockaddr_in - sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 ) diff --git a/vendor/golang.org/x/net/route/defs_dragonfly.go b/vendor/golang.org/x/net/route/defs_dragonfly.go index dd31de2..c737751 100644 --- a/vendor/golang.org/x/net/route/defs_dragonfly.go +++ b/vendor/golang.org/x/net/route/defs_dragonfly.go @@ -13,8 +13,6 @@ package route #include #include #include - -#include */ import "C" @@ -25,8 +23,6 @@ const ( sysAF_LINK = C.AF_LINK sysAF_INET6 = C.AF_INET6 - sysSOCK_RAW = C.SOCK_RAW - sysNET_RT_DUMP = C.NET_RT_DUMP sysNET_RT_FLAGS = C.NET_RT_FLAGS sysNET_RT_IFLIST = C.NET_RT_IFLIST @@ -106,8 +102,4 @@ const ( sizeofRtMsghdrDragonFlyBSD4 = C.sizeof_struct_rt_msghdr sizeofRtMetricsDragonFlyBSD4 = C.sizeof_struct_rt_metrics - - sizeofSockaddrStorage = C.sizeof_struct_sockaddr_storage - sizeofSockaddrInet = C.sizeof_struct_sockaddr_in - sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 ) diff --git a/vendor/golang.org/x/net/route/defs_freebsd.go b/vendor/golang.org/x/net/route/defs_freebsd.go index d95594d..8f834e8 100644 --- a/vendor/golang.org/x/net/route/defs_freebsd.go +++ b/vendor/golang.org/x/net/route/defs_freebsd.go @@ -14,8 +14,6 @@ package route #include #include -#include - struct if_data_freebsd7 { u_char ifi_type; u_char ifi_physical; @@ -224,8 +222,6 @@ const ( sysAF_LINK = C.AF_LINK sysAF_INET6 = C.AF_INET6 - sysSOCK_RAW = C.SOCK_RAW - sysNET_RT_DUMP = C.NET_RT_DUMP sysNET_RT_FLAGS = C.NET_RT_FLAGS sysNET_RT_IFLIST = C.NET_RT_IFLIST @@ -330,8 +326,4 @@ const ( sizeofIfDataFreeBSD9Emu = C.sizeof_struct_if_data_freebsd9 sizeofIfDataFreeBSD10Emu = C.sizeof_struct_if_data_freebsd10 sizeofIfDataFreeBSD11Emu = C.sizeof_struct_if_data_freebsd11 - - sizeofSockaddrStorage = C.sizeof_struct_sockaddr_storage - sizeofSockaddrInet = C.sizeof_struct_sockaddr_in - sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 ) diff --git a/vendor/golang.org/x/net/route/defs_netbsd.go b/vendor/golang.org/x/net/route/defs_netbsd.go index b0abd54..b18d85e 100644 --- a/vendor/golang.org/x/net/route/defs_netbsd.go +++ b/vendor/golang.org/x/net/route/defs_netbsd.go @@ -13,8 +13,6 @@ package route #include #include #include - -#include */ import "C" @@ -25,8 +23,6 @@ const ( sysAF_LINK = C.AF_LINK sysAF_INET6 = C.AF_INET6 - sysSOCK_RAW = C.SOCK_RAW - sysNET_RT_DUMP = C.NET_RT_DUMP sysNET_RT_FLAGS = C.NET_RT_FLAGS sysNET_RT_IFLIST = C.NET_RT_IFLIST @@ -105,8 +101,4 @@ const ( sizeofRtMsghdrNetBSD7 = C.sizeof_struct_rt_msghdr sizeofRtMetricsNetBSD7 = C.sizeof_struct_rt_metrics - - sizeofSockaddrStorage = C.sizeof_struct_sockaddr_storage - sizeofSockaddrInet = C.sizeof_struct_sockaddr_in - sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 ) diff --git a/vendor/golang.org/x/net/route/defs_openbsd.go b/vendor/golang.org/x/net/route/defs_openbsd.go index 0f66d36..5df7a43 100644 --- a/vendor/golang.org/x/net/route/defs_openbsd.go +++ b/vendor/golang.org/x/net/route/defs_openbsd.go @@ -13,8 +13,6 @@ package route #include #include #include - -#include */ import "C" @@ -25,8 +23,6 @@ const ( sysAF_LINK = C.AF_LINK sysAF_INET6 = C.AF_INET6 - sysSOCK_RAW = C.SOCK_RAW - sysNET_RT_DUMP = C.NET_RT_DUMP sysNET_RT_FLAGS = C.NET_RT_FLAGS sysNET_RT_IFLIST = C.NET_RT_IFLIST @@ -95,11 +91,3 @@ const ( sysRTAX_LABEL = C.RTAX_LABEL sysRTAX_MAX = C.RTAX_MAX ) - -const ( - sizeofRtMsghdr = C.sizeof_struct_rt_msghdr - - sizeofSockaddrStorage = C.sizeof_struct_sockaddr_storage - sizeofSockaddrInet = C.sizeof_struct_sockaddr_in - sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 -) diff --git a/vendor/golang.org/x/net/route/message.go b/vendor/golang.org/x/net/route/message.go index 0fa7e09..d7ae0eb 100644 --- a/vendor/golang.org/x/net/route/message.go +++ b/vendor/golang.org/x/net/route/message.go @@ -7,6 +7,9 @@ package route // A Message represents a routing message. +// +// Note: This interface will be changed to support Marshal method in +// future version. type Message interface { // Sys returns operating system-specific information. Sys() []Sys @@ -49,10 +52,11 @@ func ParseRIB(typ RIBType, b []byte) ([]Message, error) { b = b[l:] continue } - if w, ok := wireFormats[int(b[3])]; !ok { + mtyp := int(b[3]) + if fn, ok := parseFns[mtyp]; !ok { nskips++ } else { - m, err := w.parse(typ, b) + m, err := fn(typ, b) if err != nil { return nil, err } diff --git a/vendor/golang.org/x/net/route/message_test.go b/vendor/golang.org/x/net/route/message_test.go index b3bc60c..c0c7c57 100644 --- a/vendor/golang.org/x/net/route/message_test.go +++ b/vendor/golang.org/x/net/route/message_test.go @@ -33,28 +33,11 @@ func TestFetchAndParseRIB(t *testing.T) { } } -var ( - rtmonSock int - rtmonErr error -) - -func init() { - // We need to keep rtmonSock alive to avoid treading on - // recycled socket descriptors. - rtmonSock, rtmonErr = syscall.Socket(sysAF_ROUTE, sysSOCK_RAW, sysAF_UNSPEC) -} - -// TestMonitorAndParseRIB leaks a worker goroutine and a socket -// descriptor but that's intentional. func TestMonitorAndParseRIB(t *testing.T) { if testing.Short() || os.Getuid() != 0 { t.Skip("must be root") } - if rtmonErr != nil { - t.Fatal(rtmonErr) - } - // We suppose that using an IPv4 link-local address and the // dot1Q ID for Token Ring and FDDI doesn't harm anyone. pv := &propVirtual{addr: "169.254.0.1", mask: "255.255.255.0"} @@ -66,18 +49,16 @@ func TestMonitorAndParseRIB(t *testing.T) { } pv.teardown() + s, err := syscall.Socket(syscall.AF_ROUTE, syscall.SOCK_RAW, syscall.AF_UNSPEC) + if err != nil { + t.Fatal(err) + } + defer syscall.Close(s) + go func() { b := make([]byte, os.Getpagesize()) for { - // There's no easy way to unblock this read - // call because the routing message exchange - // over routing socket is a connectionless - // message-oriented protocol, no control plane - // for signaling connectivity, and we cannot - // use the net package of standard library due - // to the lack of support for routing socket - // and circular dependency. - n, err := syscall.Read(rtmonSock, b) + n, err := syscall.Read(s, b) if err != nil { return } @@ -135,99 +116,3 @@ func TestParseRIBWithFuzz(t *testing.T) { } } } - -func TestRouteMessage(t *testing.T) { - s, err := syscall.Socket(sysAF_ROUTE, sysSOCK_RAW, sysAF_UNSPEC) - if err != nil { - t.Fatal(err) - } - defer syscall.Close(s) - - var ms []RouteMessage - for _, af := range []int{sysAF_INET, sysAF_INET6} { - rs, err := fetchAndParseRIB(af, sysNET_RT_DUMP) - if err != nil || len(rs) == 0 { - continue - } - switch af { - case sysAF_INET: - ms = append(ms, []RouteMessage{ - { - Type: sysRTM_GET, - Addrs: []Addr{ - &Inet4Addr{IP: [4]byte{127, 0, 0, 1}}, - nil, - nil, - nil, - &LinkAddr{}, - &Inet4Addr{}, - nil, - &Inet4Addr{}, - }, - }, - { - Type: sysRTM_GET, - Addrs: []Addr{ - &Inet4Addr{IP: [4]byte{127, 0, 0, 1}}, - }, - }, - }...) - case sysAF_INET6: - ms = append(ms, []RouteMessage{ - { - Type: sysRTM_GET, - Addrs: []Addr{ - &Inet6Addr{IP: [16]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}, - nil, - nil, - nil, - &LinkAddr{}, - &Inet6Addr{}, - nil, - &Inet6Addr{}, - }, - }, - { - Type: sysRTM_GET, - Addrs: []Addr{ - &Inet6Addr{IP: [16]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}, - }, - }, - }...) - } - } - for i, m := range ms { - m.ID = uintptr(os.Getpid()) - m.Seq = i + 1 - wb, err := m.Marshal() - if err != nil { - t.Fatalf("%v: %v", m, err) - } - if _, err := syscall.Write(s, wb); err != nil { - t.Fatalf("%v: %v", m, err) - } - rb := make([]byte, os.Getpagesize()) - n, err := syscall.Read(s, rb) - if err != nil { - t.Fatalf("%v: %v", m, err) - } - rms, err := ParseRIB(0, rb[:n]) - if err != nil { - t.Fatalf("%v: %v", m, err) - } - for _, rm := range rms { - err := rm.(*RouteMessage).Err - if err != nil { - t.Errorf("%v: %v", m, err) - } - } - ss, err := msgs(rms).validate() - if err != nil { - t.Fatalf("%v: %v", m, err) - } - for _, s := range ss { - t.Log(s) - } - - } -} diff --git a/vendor/golang.org/x/net/route/route.go b/vendor/golang.org/x/net/route/route.go index 081da0d..c986e29 100644 --- a/vendor/golang.org/x/net/route/route.go +++ b/vendor/golang.org/x/net/route/route.go @@ -24,70 +24,21 @@ var ( errMessageTooShort = errors.New("message too short") errInvalidMessage = errors.New("invalid message") errInvalidAddr = errors.New("invalid address") - errShortBuffer = errors.New("short buffer") ) // A RouteMessage represents a message conveying an address prefix, a // nexthop address and an output interface. -// -// Unlike other messages, this message can be used to query adjacency -// information for the given address prefix, to add a new route, and -// to delete or modify the existing route from the routing information -// base inside the kernel by writing and reading route messages on a -// routing socket. -// -// For the manipulation of routing information, the route message must -// contain appropriate fields that include: -// -// Version = -// Type = -// Flags = -// Index = -// ID = -// Seq = -// Addrs = -// -// The Type field specifies a type of manipulation, the Flags field -// specifies a class of target information and the Addrs field -// specifies target information like the following: -// -// route.RouteMessage{ -// Version: RTM_VERSION, -// Type: RTM_GET, -// Flags: RTF_UP | RTF_HOST, -// ID: uintptr(os.Getpid()), -// Seq: 1, -// Addrs: []route.Addrs{ -// RTAX_DST: &route.Inet4Addr{ ... }, -// RTAX_IFP: &route.LinkAddr{ ... }, -// RTAX_BRD: &route.Inet4Addr{ ... }, -// }, -// } -// -// The values for the above fields depend on the implementation of -// each operating system. -// -// The Err field on a response message contains an error value on the -// requested operation. If non-nil, the requested operation is failed. type RouteMessage struct { - Version int // message version - Type int // message type - Flags int // route flags - Index int // interface index when atatched - ID uintptr // sender's identifier; usually process ID - Seq int // sequence number - Err error // error on requested operation - Addrs []Addr // addresses + Version int // message version + Type int // message type + Flags int // route flags + Index int // interface index when atatched + Addrs []Addr // addresses extOff int // offset of header extension raw []byte // raw message } -// Marshal returns the binary encoding of m. -func (m *RouteMessage) Marshal() ([]byte, error) { - return m.marshal() -} - // A RIBType reprensents a type of routing information base. type RIBType int diff --git a/vendor/golang.org/x/net/route/route_classic.go b/vendor/golang.org/x/net/route/route_classic.go index 61b2bb4..d333c6a 100644 --- a/vendor/golang.org/x/net/route/route_classic.go +++ b/vendor/golang.org/x/net/route/route_classic.go @@ -6,36 +6,6 @@ package route -import "syscall" - -func (m *RouteMessage) marshal() ([]byte, error) { - w, ok := wireFormats[m.Type] - if !ok { - return nil, errUnsupportedMessage - } - l := w.bodyOff + addrsSpace(m.Addrs) - b := make([]byte, l) - nativeEndian.PutUint16(b[:2], uint16(l)) - if m.Version == 0 { - b[2] = sysRTM_VERSION - } else { - b[2] = byte(m.Version) - } - b[3] = byte(m.Type) - nativeEndian.PutUint32(b[8:12], uint32(m.Flags)) - nativeEndian.PutUint16(b[4:6], uint16(m.Index)) - nativeEndian.PutUint32(b[16:20], uint32(m.ID)) - nativeEndian.PutUint32(b[20:24], uint32(m.Seq)) - attrs, err := marshalAddrs(b[w.bodyOff:], m.Addrs) - if err != nil { - return nil, err - } - if attrs > 0 { - nativeEndian.PutUint32(b[12:16], uint32(attrs)) - } - return b, nil -} - func (w *wireFormat) parseRouteMessage(typ RIBType, b []byte) (Message, error) { if len(b) < w.bodyOff { return nil, errMessageTooShort @@ -49,15 +19,9 @@ func (w *wireFormat) parseRouteMessage(typ RIBType, b []byte) (Message, error) { Type: int(b[3]), Flags: int(nativeEndian.Uint32(b[8:12])), Index: int(nativeEndian.Uint16(b[4:6])), - ID: uintptr(nativeEndian.Uint32(b[16:20])), - Seq: int(nativeEndian.Uint32(b[20:24])), extOff: w.extOff, raw: b[:l], } - errno := syscall.Errno(nativeEndian.Uint32(b[28:32])) - if errno != 0 { - m.Err = errno - } var err error m.Addrs, err = parseAddrs(uint(nativeEndian.Uint32(b[12:16])), parseKernelInetAddr, b[w.bodyOff:]) if err != nil { diff --git a/vendor/golang.org/x/net/route/route_openbsd.go b/vendor/golang.org/x/net/route/route_openbsd.go index daf2e90..76eae40 100644 --- a/vendor/golang.org/x/net/route/route_openbsd.go +++ b/vendor/golang.org/x/net/route/route_openbsd.go @@ -4,35 +4,8 @@ package route -import "syscall" - -func (m *RouteMessage) marshal() ([]byte, error) { - l := sizeofRtMsghdr + addrsSpace(m.Addrs) - b := make([]byte, l) - nativeEndian.PutUint16(b[:2], uint16(l)) - if m.Version == 0 { - b[2] = sysRTM_VERSION - } else { - b[2] = byte(m.Version) - } - b[3] = byte(m.Type) - nativeEndian.PutUint16(b[4:6], uint16(sizeofRtMsghdr)) - nativeEndian.PutUint32(b[16:20], uint32(m.Flags)) - nativeEndian.PutUint16(b[6:8], uint16(m.Index)) - nativeEndian.PutUint32(b[24:28], uint32(m.ID)) - nativeEndian.PutUint32(b[28:32], uint32(m.Seq)) - attrs, err := marshalAddrs(b[sizeofRtMsghdr:], m.Addrs) - if err != nil { - return nil, err - } - if attrs > 0 { - nativeEndian.PutUint32(b[12:16], uint32(attrs)) - } - return b, nil -} - func (*wireFormat) parseRouteMessage(_ RIBType, b []byte) (Message, error) { - if len(b) < sizeofRtMsghdr { + if len(b) < 40 { return nil, errMessageTooShort } l := int(nativeEndian.Uint16(b[:2])) @@ -44,18 +17,12 @@ func (*wireFormat) parseRouteMessage(_ RIBType, b []byte) (Message, error) { Type: int(b[3]), Flags: int(nativeEndian.Uint32(b[16:20])), Index: int(nativeEndian.Uint16(b[6:8])), - ID: uintptr(nativeEndian.Uint32(b[24:28])), - Seq: int(nativeEndian.Uint32(b[28:32])), raw: b[:l], } ll := int(nativeEndian.Uint16(b[4:6])) if len(b) < ll { return nil, errInvalidMessage } - errno := syscall.Errno(nativeEndian.Uint32(b[32:36])) - if errno != 0 { - m.Err = errno - } as, err := parseAddrs(uint(nativeEndian.Uint32(b[12:16])), parseKernelInetAddr, b[ll:]) if err != nil { return nil, err diff --git a/vendor/golang.org/x/net/route/sys.go b/vendor/golang.org/x/net/route/sys.go index 3d0ee9b..80ca83a 100644 --- a/vendor/golang.org/x/net/route/sys.go +++ b/vendor/golang.org/x/net/route/sys.go @@ -11,7 +11,7 @@ import "unsafe" var ( nativeEndian binaryByteOrder kernelAlign int - wireFormats map[int]*wireFormat + parseFns map[int]parseFn ) func init() { @@ -22,7 +22,7 @@ func init() { } else { nativeEndian = bigEndian } - kernelAlign, wireFormats = probeRoutingStack() + kernelAlign, parseFns = probeRoutingStack() } func roundup(l int) int { @@ -32,8 +32,9 @@ func roundup(l int) int { return (l + kernelAlign - 1) & ^(kernelAlign - 1) } +type parseFn func(RIBType, []byte) (Message, error) + type wireFormat struct { extOff int // offset of header extension bodyOff int // offset of message body - parse func(RIBType, []byte) (Message, error) } diff --git a/vendor/golang.org/x/net/route/sys_darwin.go b/vendor/golang.org/x/net/route/sys_darwin.go index e742c91..fff3a0f 100644 --- a/vendor/golang.org/x/net/route/sys_darwin.go +++ b/vendor/golang.org/x/net/route/sys_darwin.go @@ -49,39 +49,32 @@ func (m *InterfaceMessage) Sys() []Sys { } } -func probeRoutingStack() (int, map[int]*wireFormat) { +func probeRoutingStack() (int, map[int]parseFn) { rtm := &wireFormat{extOff: 36, bodyOff: sizeofRtMsghdrDarwin15} - rtm.parse = rtm.parseRouteMessage rtm2 := &wireFormat{extOff: 36, bodyOff: sizeofRtMsghdr2Darwin15} - rtm2.parse = rtm2.parseRouteMessage ifm := &wireFormat{extOff: 16, bodyOff: sizeofIfMsghdrDarwin15} - ifm.parse = ifm.parseInterfaceMessage ifm2 := &wireFormat{extOff: 32, bodyOff: sizeofIfMsghdr2Darwin15} - ifm2.parse = ifm2.parseInterfaceMessage ifam := &wireFormat{extOff: sizeofIfaMsghdrDarwin15, bodyOff: sizeofIfaMsghdrDarwin15} - ifam.parse = ifam.parseInterfaceAddrMessage ifmam := &wireFormat{extOff: sizeofIfmaMsghdrDarwin15, bodyOff: sizeofIfmaMsghdrDarwin15} - ifmam.parse = ifmam.parseInterfaceMulticastAddrMessage ifmam2 := &wireFormat{extOff: sizeofIfmaMsghdr2Darwin15, bodyOff: sizeofIfmaMsghdr2Darwin15} - ifmam2.parse = ifmam2.parseInterfaceMulticastAddrMessage // Darwin kernels require 32-bit aligned access to routing facilities. - return 4, map[int]*wireFormat{ - sysRTM_ADD: rtm, - sysRTM_DELETE: rtm, - sysRTM_CHANGE: rtm, - sysRTM_GET: rtm, - sysRTM_LOSING: rtm, - sysRTM_REDIRECT: rtm, - sysRTM_MISS: rtm, - sysRTM_LOCK: rtm, - sysRTM_RESOLVE: rtm, - sysRTM_NEWADDR: ifam, - sysRTM_DELADDR: ifam, - sysRTM_IFINFO: ifm, - sysRTM_NEWMADDR: ifmam, - sysRTM_DELMADDR: ifmam, - sysRTM_IFINFO2: ifm2, - sysRTM_NEWMADDR2: ifmam2, - sysRTM_GET2: rtm2, + return 4, map[int]parseFn{ + sysRTM_ADD: rtm.parseRouteMessage, + sysRTM_DELETE: rtm.parseRouteMessage, + sysRTM_CHANGE: rtm.parseRouteMessage, + sysRTM_GET: rtm.parseRouteMessage, + sysRTM_LOSING: rtm.parseRouteMessage, + sysRTM_REDIRECT: rtm.parseRouteMessage, + sysRTM_MISS: rtm.parseRouteMessage, + sysRTM_LOCK: rtm.parseRouteMessage, + sysRTM_RESOLVE: rtm.parseRouteMessage, + sysRTM_NEWADDR: ifam.parseInterfaceAddrMessage, + sysRTM_DELADDR: ifam.parseInterfaceAddrMessage, + sysRTM_IFINFO: ifm.parseInterfaceMessage, + sysRTM_NEWMADDR: ifmam.parseInterfaceMulticastAddrMessage, + sysRTM_DELMADDR: ifmam.parseInterfaceMulticastAddrMessage, + sysRTM_IFINFO2: ifm2.parseInterfaceMessage, + sysRTM_NEWMADDR2: ifmam2.parseInterfaceMulticastAddrMessage, + sysRTM_GET2: rtm2.parseRouteMessage, } } diff --git a/vendor/golang.org/x/net/route/sys_dragonfly.go b/vendor/golang.org/x/net/route/sys_dragonfly.go index b175cb1..da848b3 100644 --- a/vendor/golang.org/x/net/route/sys_dragonfly.go +++ b/vendor/golang.org/x/net/route/sys_dragonfly.go @@ -44,33 +44,28 @@ func (m *InterfaceMessage) Sys() []Sys { } } -func probeRoutingStack() (int, map[int]*wireFormat) { +func probeRoutingStack() (int, map[int]parseFn) { var p uintptr rtm := &wireFormat{extOff: 40, bodyOff: sizeofRtMsghdrDragonFlyBSD4} - rtm.parse = rtm.parseRouteMessage ifm := &wireFormat{extOff: 16, bodyOff: sizeofIfMsghdrDragonFlyBSD4} - ifm.parse = ifm.parseInterfaceMessage ifam := &wireFormat{extOff: sizeofIfaMsghdrDragonFlyBSD4, bodyOff: sizeofIfaMsghdrDragonFlyBSD4} - ifam.parse = ifam.parseInterfaceAddrMessage ifmam := &wireFormat{extOff: sizeofIfmaMsghdrDragonFlyBSD4, bodyOff: sizeofIfmaMsghdrDragonFlyBSD4} - ifmam.parse = ifmam.parseInterfaceMulticastAddrMessage ifanm := &wireFormat{extOff: sizeofIfAnnouncemsghdrDragonFlyBSD4, bodyOff: sizeofIfAnnouncemsghdrDragonFlyBSD4} - ifanm.parse = ifanm.parseInterfaceAnnounceMessage - return int(unsafe.Sizeof(p)), map[int]*wireFormat{ - sysRTM_ADD: rtm, - sysRTM_DELETE: rtm, - sysRTM_CHANGE: rtm, - sysRTM_GET: rtm, - sysRTM_LOSING: rtm, - sysRTM_REDIRECT: rtm, - sysRTM_MISS: rtm, - sysRTM_LOCK: rtm, - sysRTM_RESOLVE: rtm, - sysRTM_NEWADDR: ifam, - sysRTM_DELADDR: ifam, - sysRTM_IFINFO: ifm, - sysRTM_NEWMADDR: ifmam, - sysRTM_DELMADDR: ifmam, - sysRTM_IFANNOUNCE: ifanm, + return int(unsafe.Sizeof(p)), map[int]parseFn{ + sysRTM_ADD: rtm.parseRouteMessage, + sysRTM_DELETE: rtm.parseRouteMessage, + sysRTM_CHANGE: rtm.parseRouteMessage, + sysRTM_GET: rtm.parseRouteMessage, + sysRTM_LOSING: rtm.parseRouteMessage, + sysRTM_REDIRECT: rtm.parseRouteMessage, + sysRTM_MISS: rtm.parseRouteMessage, + sysRTM_LOCK: rtm.parseRouteMessage, + sysRTM_RESOLVE: rtm.parseRouteMessage, + sysRTM_NEWADDR: ifam.parseInterfaceAddrMessage, + sysRTM_DELADDR: ifam.parseInterfaceAddrMessage, + sysRTM_IFINFO: ifm.parseInterfaceMessage, + sysRTM_NEWMADDR: ifmam.parseInterfaceMulticastAddrMessage, + sysRTM_DELMADDR: ifmam.parseInterfaceMulticastAddrMessage, + sysRTM_IFANNOUNCE: ifanm.parseInterfaceAnnounceMessage, } } diff --git a/vendor/golang.org/x/net/route/sys_freebsd.go b/vendor/golang.org/x/net/route/sys_freebsd.go index 010d4ae..7b05c1a 100644 --- a/vendor/golang.org/x/net/route/sys_freebsd.go +++ b/vendor/golang.org/x/net/route/sys_freebsd.go @@ -54,7 +54,7 @@ func (m *InterfaceMessage) Sys() []Sys { } } -func probeRoutingStack() (int, map[int]*wireFormat) { +func probeRoutingStack() (int, map[int]parseFn) { var p uintptr wordSize := int(unsafe.Sizeof(p)) align := int(unsafe.Sizeof(p)) @@ -130,26 +130,21 @@ func probeRoutingStack() (int, map[int]*wireFormat) { ifm.bodyOff = sizeofIfMsghdrFreeBSD11 } } - rtm.parse = rtm.parseRouteMessage - ifm.parse = ifm.parseInterfaceMessage - ifam.parse = ifam.parseInterfaceAddrMessage - ifmam.parse = ifmam.parseInterfaceMulticastAddrMessage - ifanm.parse = ifanm.parseInterfaceAnnounceMessage - return align, map[int]*wireFormat{ - sysRTM_ADD: rtm, - sysRTM_DELETE: rtm, - sysRTM_CHANGE: rtm, - sysRTM_GET: rtm, - sysRTM_LOSING: rtm, - sysRTM_REDIRECT: rtm, - sysRTM_MISS: rtm, - sysRTM_LOCK: rtm, - sysRTM_RESOLVE: rtm, - sysRTM_NEWADDR: ifam, - sysRTM_DELADDR: ifam, - sysRTM_IFINFO: ifm, - sysRTM_NEWMADDR: ifmam, - sysRTM_DELMADDR: ifmam, - sysRTM_IFANNOUNCE: ifanm, + return align, map[int]parseFn{ + sysRTM_ADD: rtm.parseRouteMessage, + sysRTM_DELETE: rtm.parseRouteMessage, + sysRTM_CHANGE: rtm.parseRouteMessage, + sysRTM_GET: rtm.parseRouteMessage, + sysRTM_LOSING: rtm.parseRouteMessage, + sysRTM_REDIRECT: rtm.parseRouteMessage, + sysRTM_MISS: rtm.parseRouteMessage, + sysRTM_LOCK: rtm.parseRouteMessage, + sysRTM_RESOLVE: rtm.parseRouteMessage, + sysRTM_NEWADDR: ifam.parseInterfaceAddrMessage, + sysRTM_DELADDR: ifam.parseInterfaceAddrMessage, + sysRTM_IFINFO: ifm.parseInterfaceMessage, + sysRTM_NEWMADDR: ifmam.parseInterfaceMulticastAddrMessage, + sysRTM_DELMADDR: ifmam.parseInterfaceMulticastAddrMessage, + sysRTM_IFANNOUNCE: ifanm.parseInterfaceAnnounceMessage, } } diff --git a/vendor/golang.org/x/net/route/sys_netbsd.go b/vendor/golang.org/x/net/route/sys_netbsd.go index b4e3301..4d8076b 100644 --- a/vendor/golang.org/x/net/route/sys_netbsd.go +++ b/vendor/golang.org/x/net/route/sys_netbsd.go @@ -42,30 +42,26 @@ func (m *InterfaceMessage) Sys() []Sys { } } -func probeRoutingStack() (int, map[int]*wireFormat) { +func probeRoutingStack() (int, map[int]parseFn) { rtm := &wireFormat{extOff: 40, bodyOff: sizeofRtMsghdrNetBSD7} - rtm.parse = rtm.parseRouteMessage ifm := &wireFormat{extOff: 16, bodyOff: sizeofIfMsghdrNetBSD7} - ifm.parse = ifm.parseInterfaceMessage ifam := &wireFormat{extOff: sizeofIfaMsghdrNetBSD7, bodyOff: sizeofIfaMsghdrNetBSD7} - ifam.parse = ifam.parseInterfaceAddrMessage ifanm := &wireFormat{extOff: sizeofIfAnnouncemsghdrNetBSD7, bodyOff: sizeofIfAnnouncemsghdrNetBSD7} - ifanm.parse = ifanm.parseInterfaceAnnounceMessage // NetBSD 6 and above kernels require 64-bit aligned access to // routing facilities. - return 8, map[int]*wireFormat{ - sysRTM_ADD: rtm, - sysRTM_DELETE: rtm, - sysRTM_CHANGE: rtm, - sysRTM_GET: rtm, - sysRTM_LOSING: rtm, - sysRTM_REDIRECT: rtm, - sysRTM_MISS: rtm, - sysRTM_LOCK: rtm, - sysRTM_RESOLVE: rtm, - sysRTM_NEWADDR: ifam, - sysRTM_DELADDR: ifam, - sysRTM_IFANNOUNCE: ifanm, - sysRTM_IFINFO: ifm, + return 8, map[int]parseFn{ + sysRTM_ADD: rtm.parseRouteMessage, + sysRTM_DELETE: rtm.parseRouteMessage, + sysRTM_CHANGE: rtm.parseRouteMessage, + sysRTM_GET: rtm.parseRouteMessage, + sysRTM_LOSING: rtm.parseRouteMessage, + sysRTM_REDIRECT: rtm.parseRouteMessage, + sysRTM_MISS: rtm.parseRouteMessage, + sysRTM_LOCK: rtm.parseRouteMessage, + sysRTM_RESOLVE: rtm.parseRouteMessage, + sysRTM_NEWADDR: ifam.parseInterfaceAddrMessage, + sysRTM_DELADDR: ifam.parseInterfaceAddrMessage, + sysRTM_IFANNOUNCE: ifanm.parseInterfaceAnnounceMessage, + sysRTM_IFINFO: ifm.parseInterfaceMessage, } } diff --git a/vendor/golang.org/x/net/route/sys_openbsd.go b/vendor/golang.org/x/net/route/sys_openbsd.go index 8798dc4..26d0438 100644 --- a/vendor/golang.org/x/net/route/sys_openbsd.go +++ b/vendor/golang.org/x/net/route/sys_openbsd.go @@ -51,29 +51,22 @@ func (m *InterfaceMessage) Sys() []Sys { } } -func probeRoutingStack() (int, map[int]*wireFormat) { +func probeRoutingStack() (int, map[int]parseFn) { var p uintptr - rtm := &wireFormat{extOff: -1, bodyOff: -1} - rtm.parse = rtm.parseRouteMessage - ifm := &wireFormat{extOff: -1, bodyOff: -1} - ifm.parse = ifm.parseInterfaceMessage - ifam := &wireFormat{extOff: -1, bodyOff: -1} - ifam.parse = ifam.parseInterfaceAddrMessage - ifanm := &wireFormat{extOff: -1, bodyOff: -1} - ifanm.parse = ifanm.parseInterfaceAnnounceMessage - return int(unsafe.Sizeof(p)), map[int]*wireFormat{ - sysRTM_ADD: rtm, - sysRTM_DELETE: rtm, - sysRTM_CHANGE: rtm, - sysRTM_GET: rtm, - sysRTM_LOSING: rtm, - sysRTM_REDIRECT: rtm, - sysRTM_MISS: rtm, - sysRTM_LOCK: rtm, - sysRTM_RESOLVE: rtm, - sysRTM_NEWADDR: ifam, - sysRTM_DELADDR: ifam, - sysRTM_IFINFO: ifm, - sysRTM_IFANNOUNCE: ifanm, + nooff := &wireFormat{extOff: -1, bodyOff: -1} + return int(unsafe.Sizeof(p)), map[int]parseFn{ + sysRTM_ADD: nooff.parseRouteMessage, + sysRTM_DELETE: nooff.parseRouteMessage, + sysRTM_CHANGE: nooff.parseRouteMessage, + sysRTM_GET: nooff.parseRouteMessage, + sysRTM_LOSING: nooff.parseRouteMessage, + sysRTM_REDIRECT: nooff.parseRouteMessage, + sysRTM_MISS: nooff.parseRouteMessage, + sysRTM_LOCK: nooff.parseRouteMessage, + sysRTM_RESOLVE: nooff.parseRouteMessage, + sysRTM_NEWADDR: nooff.parseInterfaceAddrMessage, + sysRTM_DELADDR: nooff.parseInterfaceAddrMessage, + sysRTM_IFINFO: nooff.parseInterfaceMessage, + sysRTM_IFANNOUNCE: nooff.parseInterfaceAnnounceMessage, } } diff --git a/vendor/golang.org/x/net/route/syscall.go b/vendor/golang.org/x/net/route/syscall.go index c211188..d136325 100644 --- a/vendor/golang.org/x/net/route/syscall.go +++ b/vendor/golang.org/x/net/route/syscall.go @@ -11,6 +11,10 @@ import ( "unsafe" ) +// TODO: replace with runtime.KeepAlive when available +//go:noescape +func keepAlive(p unsafe.Pointer) + var zero uintptr func sysctl(mib []int32, old *byte, oldlen *uintptr, new *byte, newlen uintptr) error { @@ -21,6 +25,7 @@ func sysctl(mib []int32, old *byte, oldlen *uintptr, new *byte, newlen uintptr) p = unsafe.Pointer(&zero) } _, _, errno := syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(p), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + keepAlive(p) if errno != 0 { return error(errno) } diff --git a/vendor/golang.org/x/net/route/syscall.s b/vendor/golang.org/x/net/route/syscall.s new file mode 100644 index 0000000..fa6297f --- /dev/null +++ b/vendor/golang.org/x/net/route/syscall.s @@ -0,0 +1,8 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "textflag.h" + +TEXT ·keepAlive(SB),NOSPLIT,$0 + RET diff --git a/vendor/golang.org/x/net/route/zsys_darwin.go b/vendor/golang.org/x/net/route/zsys_darwin.go index 4e2e1ab..265b81c 100644 --- a/vendor/golang.org/x/net/route/zsys_darwin.go +++ b/vendor/golang.org/x/net/route/zsys_darwin.go @@ -10,8 +10,6 @@ const ( sysAF_LINK = 0x12 sysAF_INET6 = 0x1e - sysSOCK_RAW = 0x3 - sysNET_RT_DUMP = 0x1 sysNET_RT_FLAGS = 0x2 sysNET_RT_IFLIST = 0x3 @@ -92,8 +90,4 @@ const ( sizeofRtMsghdrDarwin15 = 0x5c sizeofRtMsghdr2Darwin15 = 0x5c sizeofRtMetricsDarwin15 = 0x38 - - sizeofSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/route/zsys_dragonfly.go b/vendor/golang.org/x/net/route/zsys_dragonfly.go index 719c88d..dd36dec 100644 --- a/vendor/golang.org/x/net/route/zsys_dragonfly.go +++ b/vendor/golang.org/x/net/route/zsys_dragonfly.go @@ -10,8 +10,6 @@ const ( sysAF_LINK = 0x12 sysAF_INET6 = 0x1c - sysSOCK_RAW = 0x3 - sysNET_RT_DUMP = 0x1 sysNET_RT_FLAGS = 0x2 sysNET_RT_IFLIST = 0x3 @@ -91,8 +89,4 @@ const ( sizeofRtMsghdrDragonFlyBSD4 = 0x98 sizeofRtMetricsDragonFlyBSD4 = 0x70 - - sizeofSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/route/zsys_freebsd_386.go b/vendor/golang.org/x/net/route/zsys_freebsd_386.go index b03bc01..9bac2e3 100644 --- a/vendor/golang.org/x/net/route/zsys_freebsd_386.go +++ b/vendor/golang.org/x/net/route/zsys_freebsd_386.go @@ -10,8 +10,6 @@ const ( sysAF_LINK = 0x12 sysAF_INET6 = 0x1c - sysSOCK_RAW = 0x3 - sysNET_RT_DUMP = 0x1 sysNET_RT_FLAGS = 0x2 sysNET_RT_IFLIST = 0x3 @@ -119,8 +117,4 @@ const ( sizeofIfDataFreeBSD9Emu = 0x98 sizeofIfDataFreeBSD10Emu = 0x98 sizeofIfDataFreeBSD11Emu = 0x98 - - sizeofSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/route/zsys_freebsd_amd64.go b/vendor/golang.org/x/net/route/zsys_freebsd_amd64.go index 0b675b3..b1920d7 100644 --- a/vendor/golang.org/x/net/route/zsys_freebsd_amd64.go +++ b/vendor/golang.org/x/net/route/zsys_freebsd_amd64.go @@ -10,8 +10,6 @@ const ( sysAF_LINK = 0x12 sysAF_INET6 = 0x1c - sysSOCK_RAW = 0x3 - sysNET_RT_DUMP = 0x1 sysNET_RT_FLAGS = 0x2 sysNET_RT_IFLIST = 0x3 @@ -116,8 +114,4 @@ const ( sizeofIfDataFreeBSD9Emu = 0x98 sizeofIfDataFreeBSD10Emu = 0x98 sizeofIfDataFreeBSD11Emu = 0x98 - - sizeofSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/route/zsys_freebsd_arm.go b/vendor/golang.org/x/net/route/zsys_freebsd_arm.go index 58f8ea1..a034d6f 100644 --- a/vendor/golang.org/x/net/route/zsys_freebsd_arm.go +++ b/vendor/golang.org/x/net/route/zsys_freebsd_arm.go @@ -10,8 +10,6 @@ const ( sysAF_LINK = 0x12 sysAF_INET6 = 0x1c - sysSOCK_RAW = 0x3 - sysNET_RT_DUMP = 0x1 sysNET_RT_FLAGS = 0x2 sysNET_RT_IFLIST = 0x3 @@ -116,8 +114,4 @@ const ( sizeofIfDataFreeBSD9Emu = 0x60 sizeofIfDataFreeBSD10Emu = 0x60 sizeofIfDataFreeBSD11Emu = 0x98 - - sizeofSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/route/zsys_netbsd.go b/vendor/golang.org/x/net/route/zsys_netbsd.go index e0df45e..aa4aad1 100644 --- a/vendor/golang.org/x/net/route/zsys_netbsd.go +++ b/vendor/golang.org/x/net/route/zsys_netbsd.go @@ -10,8 +10,6 @@ const ( sysAF_LINK = 0x12 sysAF_INET6 = 0x18 - sysSOCK_RAW = 0x3 - sysNET_RT_DUMP = 0x1 sysNET_RT_FLAGS = 0x2 sysNET_RT_IFLIST = 0x5 @@ -90,8 +88,4 @@ const ( sizeofRtMsghdrNetBSD7 = 0x78 sizeofRtMetricsNetBSD7 = 0x50 - - sizeofSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/route/zsys_openbsd.go b/vendor/golang.org/x/net/route/zsys_openbsd.go index f5a1ff9..4fadc4e 100644 --- a/vendor/golang.org/x/net/route/zsys_openbsd.go +++ b/vendor/golang.org/x/net/route/zsys_openbsd.go @@ -10,8 +10,6 @@ const ( sysAF_LINK = 0x12 sysAF_INET6 = 0x18 - sysSOCK_RAW = 0x3 - sysNET_RT_DUMP = 0x1 sysNET_RT_FLAGS = 0x2 sysNET_RT_IFLIST = 0x3 @@ -80,11 +78,3 @@ const ( sysRTAX_LABEL = 0xa sysRTAX_MAX = 0xb ) - -const ( - sizeofRtMsghdr = 0x60 - - sizeofSockaddrStorage = 0x100 - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/trace/events.go b/vendor/golang.org/x/net/trace/events.go index d8daec1..e66c7e3 100644 --- a/vendor/golang.org/x/net/trace/events.go +++ b/vendor/golang.org/x/net/trace/events.go @@ -21,6 +21,11 @@ import ( "time" ) +var eventsTmpl = template.Must(template.New("events").Funcs(template.FuncMap{ + "elapsed": elapsed, + "trimSpace": strings.TrimSpace, +}).Parse(eventsHTML)) + const maxEventsPerLog = 100 type bucket struct { @@ -96,7 +101,7 @@ func RenderEvents(w http.ResponseWriter, req *http.Request, sensitive bool) { famMu.RLock() defer famMu.RUnlock() - if err := eventsTmpl().Execute(w, data); err != nil { + if err := eventsTmpl.Execute(w, data); err != nil { log.Printf("net/trace: Failed executing template: %v", err) } } @@ -416,19 +421,6 @@ func freeEventLog(el *eventLog) { } } -var eventsTmplCache *template.Template -var eventsTmplOnce sync.Once - -func eventsTmpl() *template.Template { - eventsTmplOnce.Do(func() { - eventsTmplCache = template.Must(template.New("events").Funcs(template.FuncMap{ - "elapsed": elapsed, - "trimSpace": strings.TrimSpace, - }).Parse(eventsHTML)) - }) - return eventsTmplCache -} - const eventsHTML = ` diff --git a/vendor/golang.org/x/net/trace/histogram.go b/vendor/golang.org/x/net/trace/histogram.go index 9bf4286..bb42aa5 100644 --- a/vendor/golang.org/x/net/trace/histogram.go +++ b/vendor/golang.org/x/net/trace/histogram.go @@ -12,7 +12,6 @@ import ( "html/template" "log" "math" - "sync" "golang.org/x/net/internal/timeseries" ) @@ -321,20 +320,15 @@ func (h *histogram) newData() *data { func (h *histogram) html() template.HTML { buf := new(bytes.Buffer) - if err := distTmpl().Execute(buf, h.newData()); err != nil { + if err := distTmpl.Execute(buf, h.newData()); err != nil { buf.Reset() log.Printf("net/trace: couldn't execute template: %v", err) } return template.HTML(buf.String()) } -var distTmplCache *template.Template -var distTmplOnce sync.Once - -func distTmpl() *template.Template { - distTmplOnce.Do(func() { - // Input: data - distTmplCache = template.Must(template.New("distTmpl").Parse(` +// Input: data +var distTmpl = template.Must(template.New("distTmpl").Parse(` @@ -360,6 +354,3 @@ func distTmpl() *template.Template { {{end}}
    Count: {{.Count}}
    `)) - }) - return distTmplCache -} diff --git a/vendor/golang.org/x/net/trace/trace.go b/vendor/golang.org/x/net/trace/trace.go index 64f56a3..ecd766e 100644 --- a/vendor/golang.org/x/net/trace/trace.go +++ b/vendor/golang.org/x/net/trace/trace.go @@ -238,7 +238,7 @@ func Render(w io.Writer, req *http.Request, sensitive bool) { completedMu.RLock() defer completedMu.RUnlock() - if err := pageTmpl().ExecuteTemplate(w, "Page", data); err != nil { + if err := pageTmpl.ExecuteTemplate(w, "Page", data); err != nil { log.Printf("net/trace: Failed executing template: %v", err) } } @@ -902,18 +902,10 @@ func elapsed(d time.Duration) string { return string(b) } -var pageTmplCache *template.Template -var pageTmplOnce sync.Once - -func pageTmpl() *template.Template { - pageTmplOnce.Do(func() { - pageTmplCache = template.Must(template.New("Page").Funcs(template.FuncMap{ - "elapsed": elapsed, - "add": func(a, b int) int { return a + b }, - }).Parse(pageHTML)) - }) - return pageTmplCache -} +var pageTmpl = template.Must(template.New("Page").Funcs(template.FuncMap{ + "elapsed": elapsed, + "add": func(a, b int) int { return a + b }, +}).Parse(pageHTML)) const pageHTML = ` {{template "Prolog" .}} diff --git a/vendor/golang.org/x/net/trace/trace_test.go b/vendor/golang.org/x/net/trace/trace_test.go index bfd9dfe..c6aad86 100644 --- a/vendor/golang.org/x/net/trace/trace_test.go +++ b/vendor/golang.org/x/net/trace/trace_test.go @@ -70,20 +70,6 @@ func TestAuthRequest(t *testing.T) { } } -// TestParseTemplate checks that all templates used by this package are valid -// as they are parsed on first usage -func TestParseTemplate(t *testing.T) { - if tmpl := distTmpl(); tmpl == nil { - t.Error("invalid template returned from distTmpl()") - } - if tmpl := pageTmpl(); tmpl == nil { - t.Error("invalid template returned from pageTmpl()") - } - if tmpl := eventsTmpl(); tmpl == nil { - t.Error("invalid template returned from eventsTmpl()") - } -} - func benchmarkTrace(b *testing.B, maxEvents, numEvents int) { numSpans := (b.N + numEvents + 1) / numEvents diff --git a/vendor/golang.org/x/net/webdav/internal/xml/marshal.go b/vendor/golang.org/x/net/webdav/internal/xml/marshal.go index cb82ec2..3c3b6ac 100644 --- a/vendor/golang.org/x/net/webdav/internal/xml/marshal.go +++ b/vendor/golang.org/x/net/webdav/internal/xml/marshal.go @@ -26,9 +26,9 @@ const ( // // Marshal handles an array or slice by marshalling each of the elements. // Marshal handles a pointer by marshalling the value it points at or, if the -// pointer is nil, by writing nothing. Marshal handles an interface value by +// pointer is nil, by writing nothing. Marshal handles an interface value by // marshalling the value it contains or, if the interface value is nil, by -// writing nothing. Marshal handles all other data by writing one or more XML +// writing nothing. Marshal handles all other data by writing one or more XML // elements containing the data. // // The name for the XML elements is taken from, in order of preference: @@ -61,7 +61,7 @@ const ( // value were part of the outer struct. // // If a field uses a tag "a>b>c", then the element c will be nested inside -// parent elements a and b. Fields that appear next to each other that name +// parent elements a and b. Fields that appear next to each other that name // the same parent will be enclosed in one XML element. // // See MarshalIndent for an example. @@ -222,7 +222,7 @@ func (enc *Encoder) EncodeToken(t Token) error { return p.cachedWriteError() case ProcInst: // First token to be encoded which is also a ProcInst with target of xml - // is the xml declaration. The only ProcInst where target of xml is allowed. + // is the xml declaration. The only ProcInst where target of xml is allowed. if t.Target == "xml" && p.Buffered() != 0 { return fmt.Errorf("xml: EncodeToken of ProcInst xml target only valid for xml declaration, first token encoded") } diff --git a/vendor/golang.org/x/net/webdav/internal/xml/read.go b/vendor/golang.org/x/net/webdav/internal/xml/read.go index 4089056..3ece08c 100644 --- a/vendor/golang.org/x/net/webdav/internal/xml/read.go +++ b/vendor/golang.org/x/net/webdav/internal/xml/read.go @@ -27,7 +27,7 @@ import ( // discarded. // // Because Unmarshal uses the reflect package, it can only assign -// to exported (upper case) fields. Unmarshal uses a case-sensitive +// to exported (upper case) fields. Unmarshal uses a case-sensitive // comparison to match XML element names to tag values and struct // field names. // @@ -37,7 +37,7 @@ import ( // // * If the struct has a field of type []byte or string with tag // ",innerxml", Unmarshal accumulates the raw XML nested inside the -// element in that field. The rest of the rules still apply. +// element in that field. The rest of the rules still apply. // // * If the struct has a field named XMLName of type xml.Name, // Unmarshal records the element name in that field. @@ -59,7 +59,7 @@ import ( // // * If the XML element contains comments, they are accumulated in // the first struct field that has tag ",comment". The struct -// field may have type []byte or string. If there is no such +// field may have type []byte or string. If there is no such // field, the comments are discarded. // // * If the XML element contains a sub-element whose name matches @@ -102,7 +102,7 @@ import ( // // Unmarshal maps an XML element or attribute value to an integer or // floating-point field by setting the field to the result of -// interpreting the string value in decimal. There is no check for +// interpreting the string value in decimal. There is no check for // overflow. // // Unmarshal maps an XML element to an xml.Name by recording the diff --git a/vendor/golang.org/x/net/webdav/internal/xml/xml.go b/vendor/golang.org/x/net/webdav/internal/xml/xml.go index 5b79cbe..ffab4a7 100644 --- a/vendor/golang.org/x/net/webdav/internal/xml/xml.go +++ b/vendor/golang.org/x/net/webdav/internal/xml/xml.go @@ -252,7 +252,7 @@ func NewDecoder(r io.Reader) *Decoder { // // Slices of bytes in the returned token data refer to the // parser's internal buffer and remain valid only until the next -// call to Token. To acquire a copy of the bytes, call CopyToken +// call to Token. To acquire a copy of the bytes, call CopyToken // or the token's Copy method. // // Token expands self-closing elements such as
    @@ -360,7 +360,7 @@ func (d *Decoder) switchToReader(r io.Reader) { } // Parsing state - stack holds old name space translations -// and the current set of open elements. The translations to pop when +// and the current set of open elements. The translations to pop when // ending a given tag are *below* it on the stack, which is // more work but forced on us by XML. type stack struct { @@ -1253,7 +1253,7 @@ func isNameString(s string) bool { // These tables were generated by cut and paste from Appendix B of // the XML spec at http://www.xml.com/axml/testaxml.htm -// and then reformatting. First corresponds to (Letter | '_' | ':') +// and then reformatting. First corresponds to (Letter | '_' | ':') // and second corresponds to NameChar. var first = &unicode.RangeTable{ diff --git a/vendor/golang.org/x/text/.gitignore b/vendor/golang.org/x/text/.gitignore index b2de568..782aa6b 100644 --- a/vendor/golang.org/x/text/.gitignore +++ b/vendor/golang.org/x/text/.gitignore @@ -1,6 +1,3 @@ # Add no patterns to .gitignore except for files generated by the build. last-change /DATA -# This file is rather large and the tests really only need to be run -# after generation. -/unicode/norm/data_test.go \ No newline at end of file diff --git a/vendor/golang.org/x/text/cases/tables.go b/vendor/golang.org/x/text/cases/tables.go index e6e95a6..32ee8fa 100644 --- a/vendor/golang.org/x/text/cases/tables.go +++ b/vendor/golang.org/x/text/cases/tables.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package cases diff --git a/vendor/golang.org/x/text/cases/tables_test.go b/vendor/golang.org/x/text/cases/tables_test.go index 85ae237..7bfc5b3 100644 --- a/vendor/golang.org/x/text/cases/tables_test.go +++ b/vendor/golang.org/x/text/cases/tables_test.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package cases diff --git a/vendor/golang.org/x/text/cases/trieval.go b/vendor/golang.org/x/text/cases/trieval.go index fb221f8..a2edb10 100644 --- a/vendor/golang.org/x/text/cases/trieval.go +++ b/vendor/golang.org/x/text/cases/trieval.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package cases diff --git a/vendor/golang.org/x/text/collate/collate.go b/vendor/golang.org/x/text/collate/collate.go index 2ce9689..885ab80 100644 --- a/vendor/golang.org/x/text/collate/collate.go +++ b/vendor/golang.org/x/text/collate/collate.go @@ -7,7 +7,8 @@ //go:generate go run maketables.go -cldr=23 -unicode=6.2.0 // Package collate contains types for comparing and sorting Unicode strings -// according to a given collation order. +// according to a given collation order. Package locale provides a high-level +// interface to collation. Users should typically use that package instead. package collate // import "golang.org/x/text/collate" import ( diff --git a/vendor/golang.org/x/text/collate/tables.go b/vendor/golang.org/x/text/collate/tables.go index 9ec4f3d..525d852 100644 --- a/vendor/golang.org/x/text/collate/tables.go +++ b/vendor/golang.org/x/text/collate/tables.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package collate diff --git a/vendor/golang.org/x/text/currency/common.go b/vendor/golang.org/x/text/currency/common.go index 250cb8c..0c567f9 100644 --- a/vendor/golang.org/x/text/currency/common.go +++ b/vendor/golang.org/x/text/currency/common.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package currency diff --git a/vendor/golang.org/x/text/currency/tables.go b/vendor/golang.org/x/text/currency/tables.go index a34c7cb..c9a8f4e 100644 --- a/vendor/golang.org/x/text/currency/tables.go +++ b/vendor/golang.org/x/text/currency/tables.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package currency diff --git a/vendor/golang.org/x/text/encoding/charmap/charmap.go b/vendor/golang.org/x/text/encoding/charmap/charmap.go index e89ff07..6e62a83 100644 --- a/vendor/golang.org/x/text/encoding/charmap/charmap.go +++ b/vendor/golang.org/x/text/encoding/charmap/charmap.go @@ -33,32 +33,32 @@ var ( ISO8859_8I encoding.Encoding = &iso8859_8I iso8859_6E = internal.Encoding{ - Encoding: ISO8859_6, - Name: "ISO-8859-6E", - MIB: identifier.ISO88596E, + ISO8859_6, + "ISO-8859-6E", + identifier.ISO88596E, } iso8859_6I = internal.Encoding{ - Encoding: ISO8859_6, - Name: "ISO-8859-6I", - MIB: identifier.ISO88596I, + ISO8859_6, + "ISO-8859-6I", + identifier.ISO88596I, } iso8859_8E = internal.Encoding{ - Encoding: ISO8859_8, - Name: "ISO-8859-8E", - MIB: identifier.ISO88598E, + ISO8859_8, + "ISO-8859-8E", + identifier.ISO88598E, } iso8859_8I = internal.Encoding{ - Encoding: ISO8859_8, - Name: "ISO-8859-8I", - MIB: identifier.ISO88598I, + ISO8859_8, + "ISO-8859-8I", + identifier.ISO88598I, } ) // All is a list of all defined encodings in this package. -var All []encoding.Encoding = listAll +var All = listAll // TODO: implement these encodings, in order of importance. // ASCII, ISO8859_1: Rather common. Close to Windows 1252. @@ -70,8 +70,8 @@ type utf8Enc struct { data [3]byte } -// Charmap is an 8-bit character set encoding. -type Charmap struct { +// charmap describes an 8-bit character set encoding. +type charmap struct { // name is the encoding's name. name string // mib is the encoding type of this encoder. @@ -79,7 +79,7 @@ type Charmap struct { // asciiSuperset states whether the encoding is a superset of ASCII. asciiSuperset bool // low is the lower bound of the encoded byte for a non-ASCII rune. If - // Charmap.asciiSuperset is true then this will be 0x80, otherwise 0x00. + // charmap.asciiSuperset is true then this will be 0x80, otherwise 0x00. low uint8 // replacement is the encoded replacement character. replacement byte @@ -91,30 +91,26 @@ type Charmap struct { encode [256]uint32 } -// NewDecoder implements the encoding.Encoding interface. -func (m *Charmap) NewDecoder() *encoding.Decoder { +func (m *charmap) NewDecoder() *encoding.Decoder { return &encoding.Decoder{Transformer: charmapDecoder{charmap: m}} } -// NewEncoder implements the encoding.Encoding interface. -func (m *Charmap) NewEncoder() *encoding.Encoder { +func (m *charmap) NewEncoder() *encoding.Encoder { return &encoding.Encoder{Transformer: charmapEncoder{charmap: m}} } -// String returns the Charmap's name. -func (m *Charmap) String() string { +func (m *charmap) String() string { return m.name } -// ID implements an internal interface. -func (m *Charmap) ID() (mib identifier.MIB, other string) { +func (m *charmap) ID() (mib identifier.MIB, other string) { return m.mib, "" } // charmapDecoder implements transform.Transformer by decoding to UTF-8. type charmapDecoder struct { transform.NopResetter - charmap *Charmap + charmap *charmap } func (m charmapDecoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { @@ -146,22 +142,10 @@ func (m charmapDecoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, return nDst, nSrc, err } -// DecodeByte returns the Charmap's rune decoding of the byte b. -func (m *Charmap) DecodeByte(b byte) rune { - switch x := &m.decode[b]; x.len { - case 1: - return rune(x.data[0]) - case 2: - return rune(x.data[0]&0x1f)<<6 | rune(x.data[1]&0x3f) - default: - return rune(x.data[0]&0x0f)<<12 | rune(x.data[1]&0x3f)<<6 | rune(x.data[2]&0x3f) - } -} - // charmapEncoder implements transform.Transformer by encoding from UTF-8. type charmapEncoder struct { transform.NopResetter - charmap *Charmap + charmap *charmap } func (m charmapEncoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { @@ -223,27 +207,3 @@ loop: } return nDst, nSrc, err } - -// EncodeRune returns the Charmap's byte encoding of the rune r. ok is whether -// r is in the Charmap's repertoire. If not, b is set to the Charmap's -// replacement byte. This is often the ASCII substitute character '\x1a'. -func (m *Charmap) EncodeRune(r rune) (b byte, ok bool) { - if r < utf8.RuneSelf && m.asciiSuperset { - return byte(r), true - } - for low, high := int(m.low), 0x100; ; { - if low >= high { - return m.replacement, false - } - mid := (low + high) / 2 - got := m.encode[mid] - gotRune := rune(got & (1<<24 - 1)) - if gotRune < r { - low = mid + 1 - } else if gotRune > r { - high = mid - } else { - return byte(got >> 24), true - } - } -} diff --git a/vendor/golang.org/x/text/encoding/charmap/charmap_test.go b/vendor/golang.org/x/text/encoding/charmap/charmap_test.go index 03dd76e..aa54fe2 100644 --- a/vendor/golang.org/x/text/encoding/charmap/charmap_test.go +++ b/vendor/golang.org/x/text/encoding/charmap/charmap_test.go @@ -9,22 +9,16 @@ import ( "golang.org/x/text/encoding" "golang.org/x/text/encoding/internal" - "golang.org/x/text/encoding/internal/enctest" "golang.org/x/text/transform" ) func dec(e encoding.Encoding) (dir string, t transform.Transformer, err error) { return "Decode", e.NewDecoder(), nil } - -func encASCIISuperset(e encoding.Encoding) (dir string, t transform.Transformer, err error) { +func enc(e encoding.Encoding) (dir string, t transform.Transformer, err error) { return "Encode", e.NewEncoder(), internal.ErrASCIIReplacement } -func encEBCDIC(e encoding.Encoding) (dir string, t transform.Transformer, err error) { - return "Encode", e.NewEncoder(), internal.RepertoireError(0x3f) -} - func TestNonRepertoire(t *testing.T) { testCases := []struct { init func(e encoding.Encoding) (string, transform.Transformer, error) @@ -33,17 +27,9 @@ func TestNonRepertoire(t *testing.T) { }{ {dec, Windows1252, "\x81", "\ufffd"}, - {encEBCDIC, CodePage037, "갂", ""}, - - {encEBCDIC, CodePage1047, "갂", ""}, - {encEBCDIC, CodePage1047, "a¤갂", "\x81\x9F"}, - - {encEBCDIC, CodePage1140, "갂", ""}, - {encEBCDIC, CodePage1140, "a€갂", "\x81\x9F"}, - - {encASCIISuperset, Windows1252, "갂", ""}, - {encASCIISuperset, Windows1252, "a갂", "a"}, - {encASCIISuperset, Windows1252, "\u00E9갂", "\xE9"}, + {enc, Windows1252, "갂", ""}, + {enc, Windows1252, "a갂", "a"}, + {enc, Windows1252, "\u00E9갂", "\xE9"}, } for _, tc := range testCases { dir, tr, wantErr := tc.init(tc.e) @@ -57,202 +43,3 @@ func TestNonRepertoire(t *testing.T) { } } } - -func TestBasics(t *testing.T) { - testCases := []struct { - e encoding.Encoding - encoded string - utf8 string - }{{ - e: CodePage037, - encoded: "\xc8\x51\xba\x93\xcf", - utf8: "Hé[lõ", - }, { - e: CodePage437, - encoded: "H\x82ll\x93 \x9d\xa7\xf4\x9c\xbe", - utf8: "Héllô ¥º⌠£╛", - }, { - e: CodePage866, - encoded: "H\xf3\xd3o \x98\xfd\x9f\xdd\xa1", - utf8: "Hє╙o Ш¤Я▌б", - }, { - e: CodePage1047, - encoded: "\xc8\x54\x93\x93\x9f", - utf8: "Hèll¤", - }, { - e: CodePage1140, - encoded: "\xc8\x9f\x93\x93\xcf", - utf8: "H€llõ", - }, { - e: ISO8859_2, - encoded: "Hel\xe5\xf5", - utf8: "Helĺő", - }, { - e: ISO8859_3, - encoded: "He\xbd\xd4", - utf8: "He½Ô", - }, { - e: ISO8859_4, - encoded: "Hel\xb6\xf8", - utf8: "Helļø", - }, { - e: ISO8859_5, - encoded: "H\xd7\xc6o", - utf8: "HзЦo", - }, { - e: ISO8859_6, - encoded: "Hel\xc2\xc9", - utf8: "Helآة", - }, { - e: ISO8859_7, - encoded: "H\xeel\xebo", - utf8: "Hξlλo", - }, { - e: ISO8859_8, - encoded: "Hel\xf5\xed", - utf8: "Helץם", - }, { - e: ISO8859_9, - encoded: "\xdeayet", - utf8: "Şayet", - }, { - e: ISO8859_10, - encoded: "H\xea\xbfo", - utf8: "Hęŋo", - }, { - e: ISO8859_13, - encoded: "H\xe6l\xf9o", - utf8: "Hęlło", - }, { - e: ISO8859_14, - encoded: "He\xfe\xd0o", - utf8: "HeŷŴo", - }, { - e: ISO8859_15, - encoded: "H\xa4ll\xd8", - utf8: "H€llØ", - }, { - e: ISO8859_16, - encoded: "H\xe6ll\xbd", - utf8: "Hællœ", - }, { - e: KOI8R, - encoded: "He\x93\xad\x9c", - utf8: "He⌠╜°", - }, { - e: KOI8U, - encoded: "He\x93\xad\x9c", - utf8: "He⌠ґ°", - }, { - e: Macintosh, - encoded: "He\xdf\xd7", - utf8: "Hefl◊", - }, { - e: MacintoshCyrillic, - encoded: "He\xbe\x94", - utf8: "HeЊФ", - }, { - e: Windows874, - encoded: "He\xb7\xf0", - utf8: "Heท๐", - }, { - e: Windows1250, - encoded: "He\xe5\xe5o", - utf8: "Heĺĺo", - }, { - e: Windows1251, - encoded: "H\xball\xfe", - utf8: "Hєllю", - }, { - e: Windows1252, - encoded: "H\xe9ll\xf4 \xa5\xbA\xae\xa3\xd0", - utf8: "Héllô ¥º®£Ð", - }, { - e: Windows1253, - encoded: "H\xe5ll\xd6", - utf8: "HεllΦ", - }, { - e: Windows1254, - encoded: "\xd0ello", - utf8: "Ğello", - }, { - e: Windows1255, - encoded: "He\xd4o", - utf8: "Heװo", - }, { - e: Windows1256, - encoded: "H\xdbllo", - utf8: "Hغllo", - }, { - e: Windows1257, - encoded: "He\xeflo", - utf8: "Heļlo", - }, { - e: Windows1258, - encoded: "Hell\xf5", - utf8: "Hellơ", - }, { - e: XUserDefined, - encoded: "\x00\x40\x7f\x80\xab\xff", - utf8: "\u0000\u0040\u007f\uf780\uf7ab\uf7ff", - }} - - for _, tc := range testCases { - enctest.TestEncoding(t, tc.e, tc.encoded, tc.utf8, "", "") - } -} - -var windows1255TestCases = []struct { - b byte - ok bool - r rune -}{ - {'\x00', true, '\u0000'}, - {'\x1a', true, '\u001a'}, - {'\x61', true, '\u0061'}, - {'\x7f', true, '\u007f'}, - {'\x80', true, '\u20ac'}, - {'\x95', true, '\u2022'}, - {'\xa0', true, '\u00a0'}, - {'\xc0', true, '\u05b0'}, - {'\xfc', true, '\ufffd'}, - {'\xfd', true, '\u200e'}, - {'\xfe', true, '\u200f'}, - {'\xff', true, '\ufffd'}, - {encoding.ASCIISub, false, '\u0400'}, - {encoding.ASCIISub, false, '\u2603'}, - {encoding.ASCIISub, false, '\U0001f4a9'}, -} - -func TestDecodeByte(t *testing.T) { - for _, tc := range windows1255TestCases { - if !tc.ok { - continue - } - - got := Windows1255.DecodeByte(tc.b) - want := tc.r - if got != want { - t.Errorf("DecodeByte(%#02x): got %#08x, want %#08x", tc.b, got, want) - } - } -} - -func TestEncodeRune(t *testing.T) { - for _, tc := range windows1255TestCases { - // There can be multiple tc.b values that map to tc.r = '\ufffd'. - if tc.r == '\ufffd' { - continue - } - - gotB, gotOK := Windows1255.EncodeRune(tc.r) - wantB, wantOK := tc.b, tc.ok - if gotB != wantB || gotOK != wantOK { - t.Errorf("EncodeRune(%#08x): got (%#02x, %t), want (%#02x, %t)", tc.r, gotB, gotOK, wantB, wantOK) - } - } -} - -func TestFiles(t *testing.T) { enctest.TestFile(t, Windows1252) } - -func BenchmarkEncoding(b *testing.B) { enctest.Benchmark(b, Windows1252) } diff --git a/vendor/golang.org/x/text/encoding/charmap/maketables.go b/vendor/golang.org/x/text/encoding/charmap/maketables.go index f794170..9672c55 100644 --- a/vendor/golang.org/x/text/encoding/charmap/maketables.go +++ b/vendor/golang.org/x/text/encoding/charmap/maketables.go @@ -33,14 +33,6 @@ var encodings = []struct { replacement byte mapping string }{ - { - "IBM Code Page 037", - "IBM037", - "", - "CodePage037", - 0x3f, - "http://source.icu-project.org/repos/icu/data/trunk/charset/data/ucm/glibc-IBM037-2.1.2.ucm", - }, { "IBM Code Page 437", "PC8CodePage437", @@ -121,22 +113,6 @@ var encodings = []struct { encoding.ASCIISub, "http://encoding.spec.whatwg.org/index-ibm866.txt", }, - { - "IBM Code Page 1047", - "IBM1047", - "", - "CodePage1047", - 0x3f, - "http://source.icu-project.org/repos/icu/data/trunk/charset/data/ucm/glibc-IBM1047-2.1.2.ucm", - }, - { - "IBM Code Page 1140", - "IBM01140", - "", - "CodePage1140", - 0x3f, - "http://source.icu-project.org/repos/icu/data/trunk/charset/data/ucm/ibm-1140_P100-1997.ucm", - }, { "ISO 8859-1", "ISOLatin1", @@ -201,14 +177,6 @@ var encodings = []struct { encoding.ASCIISub, "http://encoding.spec.whatwg.org/index-iso-8859-8.txt", }, - { - "ISO 8859-9", - "ISOLatin5", - "", - "ISO8859_9", - encoding.ASCIISub, - "http://source.icu-project.org/repos/icu/data/trunk/charset/data/ucm/iso-8859_9-1999.ucm", - }, { "ISO 8859-10", "ISOLatin6", @@ -494,7 +462,7 @@ func main() { if e.comment != "" { printf("//\n// %s\n", e.comment) } - printf("var %s *Charmap = &%s\n\nvar %s = Charmap{\nname: %q,\n", + printf("var %s encoding.Encoding = &%s\n\nvar %s = charmap{\nname: %q,\n", varName, lowerVarName, lowerVarName, e.name) if mibs[e.mib] { log.Fatalf("MIB type %q declared multiple times.", e.mib) @@ -540,7 +508,7 @@ func main() { } printf("},\n}\n") - // Add an estimate of the size of a single Charmap{} struct value, which + // Add an estimate of the size of a single charmap{} struct value, which // includes two 256 elem arrays of 4 bytes and some extra fields, which // align to 3 uint64s on 64-bit architectures. w.Size += 2*4*256 + 3*8 diff --git a/vendor/golang.org/x/text/encoding/charmap/tables.go b/vendor/golang.org/x/text/encoding/charmap/tables.go index cf7281e..5ae8dbc 100644 --- a/vendor/golang.org/x/text/encoding/charmap/tables.go +++ b/vendor/golang.org/x/text/encoding/charmap/tables.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package charmap @@ -7,185 +7,10 @@ import ( "golang.org/x/text/encoding/internal/identifier" ) -// CodePage037 is the IBM Code Page 037 encoding. -var CodePage037 *Charmap = &codePage037 - -var codePage037 = Charmap{ - name: "IBM Code Page 037", - mib: identifier.IBM037, - asciiSuperset: false, - low: 0x00, - replacement: 0x3f, - decode: [256]utf8Enc{ - {1, [3]byte{0x00, 0x00, 0x00}}, {1, [3]byte{0x01, 0x00, 0x00}}, - {1, [3]byte{0x02, 0x00, 0x00}}, {1, [3]byte{0x03, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x9c, 0x00}}, {1, [3]byte{0x09, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x86, 0x00}}, {1, [3]byte{0x7f, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x97, 0x00}}, {2, [3]byte{0xc2, 0x8d, 0x00}}, - {2, [3]byte{0xc2, 0x8e, 0x00}}, {1, [3]byte{0x0b, 0x00, 0x00}}, - {1, [3]byte{0x0c, 0x00, 0x00}}, {1, [3]byte{0x0d, 0x00, 0x00}}, - {1, [3]byte{0x0e, 0x00, 0x00}}, {1, [3]byte{0x0f, 0x00, 0x00}}, - {1, [3]byte{0x10, 0x00, 0x00}}, {1, [3]byte{0x11, 0x00, 0x00}}, - {1, [3]byte{0x12, 0x00, 0x00}}, {1, [3]byte{0x13, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x9d, 0x00}}, {2, [3]byte{0xc2, 0x85, 0x00}}, - {1, [3]byte{0x08, 0x00, 0x00}}, {2, [3]byte{0xc2, 0x87, 0x00}}, - {1, [3]byte{0x18, 0x00, 0x00}}, {1, [3]byte{0x19, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x92, 0x00}}, {2, [3]byte{0xc2, 0x8f, 0x00}}, - {1, [3]byte{0x1c, 0x00, 0x00}}, {1, [3]byte{0x1d, 0x00, 0x00}}, - {1, [3]byte{0x1e, 0x00, 0x00}}, {1, [3]byte{0x1f, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x80, 0x00}}, {2, [3]byte{0xc2, 0x81, 0x00}}, - {2, [3]byte{0xc2, 0x82, 0x00}}, {2, [3]byte{0xc2, 0x83, 0x00}}, - {2, [3]byte{0xc2, 0x84, 0x00}}, {1, [3]byte{0x0a, 0x00, 0x00}}, - {1, [3]byte{0x17, 0x00, 0x00}}, {1, [3]byte{0x1b, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x88, 0x00}}, {2, [3]byte{0xc2, 0x89, 0x00}}, - {2, [3]byte{0xc2, 0x8a, 0x00}}, {2, [3]byte{0xc2, 0x8b, 0x00}}, - {2, [3]byte{0xc2, 0x8c, 0x00}}, {1, [3]byte{0x05, 0x00, 0x00}}, - {1, [3]byte{0x06, 0x00, 0x00}}, {1, [3]byte{0x07, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x90, 0x00}}, {2, [3]byte{0xc2, 0x91, 0x00}}, - {1, [3]byte{0x16, 0x00, 0x00}}, {2, [3]byte{0xc2, 0x93, 0x00}}, - {2, [3]byte{0xc2, 0x94, 0x00}}, {2, [3]byte{0xc2, 0x95, 0x00}}, - {2, [3]byte{0xc2, 0x96, 0x00}}, {1, [3]byte{0x04, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x98, 0x00}}, {2, [3]byte{0xc2, 0x99, 0x00}}, - {2, [3]byte{0xc2, 0x9a, 0x00}}, {2, [3]byte{0xc2, 0x9b, 0x00}}, - {1, [3]byte{0x14, 0x00, 0x00}}, {1, [3]byte{0x15, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x9e, 0x00}}, {1, [3]byte{0x1a, 0x00, 0x00}}, - {1, [3]byte{0x20, 0x00, 0x00}}, {2, [3]byte{0xc2, 0xa0, 0x00}}, - {2, [3]byte{0xc3, 0xa2, 0x00}}, {2, [3]byte{0xc3, 0xa4, 0x00}}, - {2, [3]byte{0xc3, 0xa0, 0x00}}, {2, [3]byte{0xc3, 0xa1, 0x00}}, - {2, [3]byte{0xc3, 0xa3, 0x00}}, {2, [3]byte{0xc3, 0xa5, 0x00}}, - {2, [3]byte{0xc3, 0xa7, 0x00}}, {2, [3]byte{0xc3, 0xb1, 0x00}}, - {2, [3]byte{0xc2, 0xa2, 0x00}}, {1, [3]byte{0x2e, 0x00, 0x00}}, - {1, [3]byte{0x3c, 0x00, 0x00}}, {1, [3]byte{0x28, 0x00, 0x00}}, - {1, [3]byte{0x2b, 0x00, 0x00}}, {1, [3]byte{0x7c, 0x00, 0x00}}, - {1, [3]byte{0x26, 0x00, 0x00}}, {2, [3]byte{0xc3, 0xa9, 0x00}}, - {2, [3]byte{0xc3, 0xaa, 0x00}}, {2, [3]byte{0xc3, 0xab, 0x00}}, - {2, [3]byte{0xc3, 0xa8, 0x00}}, {2, [3]byte{0xc3, 0xad, 0x00}}, - {2, [3]byte{0xc3, 0xae, 0x00}}, {2, [3]byte{0xc3, 0xaf, 0x00}}, - {2, [3]byte{0xc3, 0xac, 0x00}}, {2, [3]byte{0xc3, 0x9f, 0x00}}, - {1, [3]byte{0x21, 0x00, 0x00}}, {1, [3]byte{0x24, 0x00, 0x00}}, - {1, [3]byte{0x2a, 0x00, 0x00}}, {1, [3]byte{0x29, 0x00, 0x00}}, - {1, [3]byte{0x3b, 0x00, 0x00}}, {2, [3]byte{0xc2, 0xac, 0x00}}, - {1, [3]byte{0x2d, 0x00, 0x00}}, {1, [3]byte{0x2f, 0x00, 0x00}}, - {2, [3]byte{0xc3, 0x82, 0x00}}, {2, [3]byte{0xc3, 0x84, 0x00}}, - {2, [3]byte{0xc3, 0x80, 0x00}}, {2, [3]byte{0xc3, 0x81, 0x00}}, - {2, [3]byte{0xc3, 0x83, 0x00}}, {2, [3]byte{0xc3, 0x85, 0x00}}, - {2, [3]byte{0xc3, 0x87, 0x00}}, {2, [3]byte{0xc3, 0x91, 0x00}}, - {2, [3]byte{0xc2, 0xa6, 0x00}}, {1, [3]byte{0x2c, 0x00, 0x00}}, - {1, [3]byte{0x25, 0x00, 0x00}}, {1, [3]byte{0x5f, 0x00, 0x00}}, - {1, [3]byte{0x3e, 0x00, 0x00}}, {1, [3]byte{0x3f, 0x00, 0x00}}, - {2, [3]byte{0xc3, 0xb8, 0x00}}, {2, [3]byte{0xc3, 0x89, 0x00}}, - {2, [3]byte{0xc3, 0x8a, 0x00}}, {2, [3]byte{0xc3, 0x8b, 0x00}}, - {2, [3]byte{0xc3, 0x88, 0x00}}, {2, [3]byte{0xc3, 0x8d, 0x00}}, - {2, [3]byte{0xc3, 0x8e, 0x00}}, {2, [3]byte{0xc3, 0x8f, 0x00}}, - {2, [3]byte{0xc3, 0x8c, 0x00}}, {1, [3]byte{0x60, 0x00, 0x00}}, - {1, [3]byte{0x3a, 0x00, 0x00}}, {1, [3]byte{0x23, 0x00, 0x00}}, - {1, [3]byte{0x40, 0x00, 0x00}}, {1, [3]byte{0x27, 0x00, 0x00}}, - {1, [3]byte{0x3d, 0x00, 0x00}}, {1, [3]byte{0x22, 0x00, 0x00}}, - {2, [3]byte{0xc3, 0x98, 0x00}}, {1, [3]byte{0x61, 0x00, 0x00}}, - {1, [3]byte{0x62, 0x00, 0x00}}, {1, [3]byte{0x63, 0x00, 0x00}}, - {1, [3]byte{0x64, 0x00, 0x00}}, {1, [3]byte{0x65, 0x00, 0x00}}, - {1, [3]byte{0x66, 0x00, 0x00}}, {1, [3]byte{0x67, 0x00, 0x00}}, - {1, [3]byte{0x68, 0x00, 0x00}}, {1, [3]byte{0x69, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xab, 0x00}}, {2, [3]byte{0xc2, 0xbb, 0x00}}, - {2, [3]byte{0xc3, 0xb0, 0x00}}, {2, [3]byte{0xc3, 0xbd, 0x00}}, - {2, [3]byte{0xc3, 0xbe, 0x00}}, {2, [3]byte{0xc2, 0xb1, 0x00}}, - {2, [3]byte{0xc2, 0xb0, 0x00}}, {1, [3]byte{0x6a, 0x00, 0x00}}, - {1, [3]byte{0x6b, 0x00, 0x00}}, {1, [3]byte{0x6c, 0x00, 0x00}}, - {1, [3]byte{0x6d, 0x00, 0x00}}, {1, [3]byte{0x6e, 0x00, 0x00}}, - {1, [3]byte{0x6f, 0x00, 0x00}}, {1, [3]byte{0x70, 0x00, 0x00}}, - {1, [3]byte{0x71, 0x00, 0x00}}, {1, [3]byte{0x72, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xaa, 0x00}}, {2, [3]byte{0xc2, 0xba, 0x00}}, - {2, [3]byte{0xc3, 0xa6, 0x00}}, {2, [3]byte{0xc2, 0xb8, 0x00}}, - {2, [3]byte{0xc3, 0x86, 0x00}}, {2, [3]byte{0xc2, 0xa4, 0x00}}, - {2, [3]byte{0xc2, 0xb5, 0x00}}, {1, [3]byte{0x7e, 0x00, 0x00}}, - {1, [3]byte{0x73, 0x00, 0x00}}, {1, [3]byte{0x74, 0x00, 0x00}}, - {1, [3]byte{0x75, 0x00, 0x00}}, {1, [3]byte{0x76, 0x00, 0x00}}, - {1, [3]byte{0x77, 0x00, 0x00}}, {1, [3]byte{0x78, 0x00, 0x00}}, - {1, [3]byte{0x79, 0x00, 0x00}}, {1, [3]byte{0x7a, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xa1, 0x00}}, {2, [3]byte{0xc2, 0xbf, 0x00}}, - {2, [3]byte{0xc3, 0x90, 0x00}}, {2, [3]byte{0xc3, 0x9d, 0x00}}, - {2, [3]byte{0xc3, 0x9e, 0x00}}, {2, [3]byte{0xc2, 0xae, 0x00}}, - {1, [3]byte{0x5e, 0x00, 0x00}}, {2, [3]byte{0xc2, 0xa3, 0x00}}, - {2, [3]byte{0xc2, 0xa5, 0x00}}, {2, [3]byte{0xc2, 0xb7, 0x00}}, - {2, [3]byte{0xc2, 0xa9, 0x00}}, {2, [3]byte{0xc2, 0xa7, 0x00}}, - {2, [3]byte{0xc2, 0xb6, 0x00}}, {2, [3]byte{0xc2, 0xbc, 0x00}}, - {2, [3]byte{0xc2, 0xbd, 0x00}}, {2, [3]byte{0xc2, 0xbe, 0x00}}, - {1, [3]byte{0x5b, 0x00, 0x00}}, {1, [3]byte{0x5d, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xaf, 0x00}}, {2, [3]byte{0xc2, 0xa8, 0x00}}, - {2, [3]byte{0xc2, 0xb4, 0x00}}, {2, [3]byte{0xc3, 0x97, 0x00}}, - {1, [3]byte{0x7b, 0x00, 0x00}}, {1, [3]byte{0x41, 0x00, 0x00}}, - {1, [3]byte{0x42, 0x00, 0x00}}, {1, [3]byte{0x43, 0x00, 0x00}}, - {1, [3]byte{0x44, 0x00, 0x00}}, {1, [3]byte{0x45, 0x00, 0x00}}, - {1, [3]byte{0x46, 0x00, 0x00}}, {1, [3]byte{0x47, 0x00, 0x00}}, - {1, [3]byte{0x48, 0x00, 0x00}}, {1, [3]byte{0x49, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xad, 0x00}}, {2, [3]byte{0xc3, 0xb4, 0x00}}, - {2, [3]byte{0xc3, 0xb6, 0x00}}, {2, [3]byte{0xc3, 0xb2, 0x00}}, - {2, [3]byte{0xc3, 0xb3, 0x00}}, {2, [3]byte{0xc3, 0xb5, 0x00}}, - {1, [3]byte{0x7d, 0x00, 0x00}}, {1, [3]byte{0x4a, 0x00, 0x00}}, - {1, [3]byte{0x4b, 0x00, 0x00}}, {1, [3]byte{0x4c, 0x00, 0x00}}, - {1, [3]byte{0x4d, 0x00, 0x00}}, {1, [3]byte{0x4e, 0x00, 0x00}}, - {1, [3]byte{0x4f, 0x00, 0x00}}, {1, [3]byte{0x50, 0x00, 0x00}}, - {1, [3]byte{0x51, 0x00, 0x00}}, {1, [3]byte{0x52, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xb9, 0x00}}, {2, [3]byte{0xc3, 0xbb, 0x00}}, - {2, [3]byte{0xc3, 0xbc, 0x00}}, {2, [3]byte{0xc3, 0xb9, 0x00}}, - {2, [3]byte{0xc3, 0xba, 0x00}}, {2, [3]byte{0xc3, 0xbf, 0x00}}, - {1, [3]byte{0x5c, 0x00, 0x00}}, {2, [3]byte{0xc3, 0xb7, 0x00}}, - {1, [3]byte{0x53, 0x00, 0x00}}, {1, [3]byte{0x54, 0x00, 0x00}}, - {1, [3]byte{0x55, 0x00, 0x00}}, {1, [3]byte{0x56, 0x00, 0x00}}, - {1, [3]byte{0x57, 0x00, 0x00}}, {1, [3]byte{0x58, 0x00, 0x00}}, - {1, [3]byte{0x59, 0x00, 0x00}}, {1, [3]byte{0x5a, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xb2, 0x00}}, {2, [3]byte{0xc3, 0x94, 0x00}}, - {2, [3]byte{0xc3, 0x96, 0x00}}, {2, [3]byte{0xc3, 0x92, 0x00}}, - {2, [3]byte{0xc3, 0x93, 0x00}}, {2, [3]byte{0xc3, 0x95, 0x00}}, - {1, [3]byte{0x30, 0x00, 0x00}}, {1, [3]byte{0x31, 0x00, 0x00}}, - {1, [3]byte{0x32, 0x00, 0x00}}, {1, [3]byte{0x33, 0x00, 0x00}}, - {1, [3]byte{0x34, 0x00, 0x00}}, {1, [3]byte{0x35, 0x00, 0x00}}, - {1, [3]byte{0x36, 0x00, 0x00}}, {1, [3]byte{0x37, 0x00, 0x00}}, - {1, [3]byte{0x38, 0x00, 0x00}}, {1, [3]byte{0x39, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xb3, 0x00}}, {2, [3]byte{0xc3, 0x9b, 0x00}}, - {2, [3]byte{0xc3, 0x9c, 0x00}}, {2, [3]byte{0xc3, 0x99, 0x00}}, - {2, [3]byte{0xc3, 0x9a, 0x00}}, {2, [3]byte{0xc2, 0x9f, 0x00}}, - }, - encode: [256]uint32{ - 0x00000000, 0x01000001, 0x02000002, 0x03000003, 0x37000004, 0x2d000005, 0x2e000006, 0x2f000007, - 0x16000008, 0x05000009, 0x2500000a, 0x0b00000b, 0x0c00000c, 0x0d00000d, 0x0e00000e, 0x0f00000f, - 0x10000010, 0x11000011, 0x12000012, 0x13000013, 0x3c000014, 0x3d000015, 0x32000016, 0x26000017, - 0x18000018, 0x19000019, 0x3f00001a, 0x2700001b, 0x1c00001c, 0x1d00001d, 0x1e00001e, 0x1f00001f, - 0x40000020, 0x5a000021, 0x7f000022, 0x7b000023, 0x5b000024, 0x6c000025, 0x50000026, 0x7d000027, - 0x4d000028, 0x5d000029, 0x5c00002a, 0x4e00002b, 0x6b00002c, 0x6000002d, 0x4b00002e, 0x6100002f, - 0xf0000030, 0xf1000031, 0xf2000032, 0xf3000033, 0xf4000034, 0xf5000035, 0xf6000036, 0xf7000037, - 0xf8000038, 0xf9000039, 0x7a00003a, 0x5e00003b, 0x4c00003c, 0x7e00003d, 0x6e00003e, 0x6f00003f, - 0x7c000040, 0xc1000041, 0xc2000042, 0xc3000043, 0xc4000044, 0xc5000045, 0xc6000046, 0xc7000047, - 0xc8000048, 0xc9000049, 0xd100004a, 0xd200004b, 0xd300004c, 0xd400004d, 0xd500004e, 0xd600004f, - 0xd7000050, 0xd8000051, 0xd9000052, 0xe2000053, 0xe3000054, 0xe4000055, 0xe5000056, 0xe6000057, - 0xe7000058, 0xe8000059, 0xe900005a, 0xba00005b, 0xe000005c, 0xbb00005d, 0xb000005e, 0x6d00005f, - 0x79000060, 0x81000061, 0x82000062, 0x83000063, 0x84000064, 0x85000065, 0x86000066, 0x87000067, - 0x88000068, 0x89000069, 0x9100006a, 0x9200006b, 0x9300006c, 0x9400006d, 0x9500006e, 0x9600006f, - 0x97000070, 0x98000071, 0x99000072, 0xa2000073, 0xa3000074, 0xa4000075, 0xa5000076, 0xa6000077, - 0xa7000078, 0xa8000079, 0xa900007a, 0xc000007b, 0x4f00007c, 0xd000007d, 0xa100007e, 0x0700007f, - 0x20000080, 0x21000081, 0x22000082, 0x23000083, 0x24000084, 0x15000085, 0x06000086, 0x17000087, - 0x28000088, 0x29000089, 0x2a00008a, 0x2b00008b, 0x2c00008c, 0x0900008d, 0x0a00008e, 0x1b00008f, - 0x30000090, 0x31000091, 0x1a000092, 0x33000093, 0x34000094, 0x35000095, 0x36000096, 0x08000097, - 0x38000098, 0x39000099, 0x3a00009a, 0x3b00009b, 0x0400009c, 0x1400009d, 0x3e00009e, 0xff00009f, - 0x410000a0, 0xaa0000a1, 0x4a0000a2, 0xb10000a3, 0x9f0000a4, 0xb20000a5, 0x6a0000a6, 0xb50000a7, - 0xbd0000a8, 0xb40000a9, 0x9a0000aa, 0x8a0000ab, 0x5f0000ac, 0xca0000ad, 0xaf0000ae, 0xbc0000af, - 0x900000b0, 0x8f0000b1, 0xea0000b2, 0xfa0000b3, 0xbe0000b4, 0xa00000b5, 0xb60000b6, 0xb30000b7, - 0x9d0000b8, 0xda0000b9, 0x9b0000ba, 0x8b0000bb, 0xb70000bc, 0xb80000bd, 0xb90000be, 0xab0000bf, - 0x640000c0, 0x650000c1, 0x620000c2, 0x660000c3, 0x630000c4, 0x670000c5, 0x9e0000c6, 0x680000c7, - 0x740000c8, 0x710000c9, 0x720000ca, 0x730000cb, 0x780000cc, 0x750000cd, 0x760000ce, 0x770000cf, - 0xac0000d0, 0x690000d1, 0xed0000d2, 0xee0000d3, 0xeb0000d4, 0xef0000d5, 0xec0000d6, 0xbf0000d7, - 0x800000d8, 0xfd0000d9, 0xfe0000da, 0xfb0000db, 0xfc0000dc, 0xad0000dd, 0xae0000de, 0x590000df, - 0x440000e0, 0x450000e1, 0x420000e2, 0x460000e3, 0x430000e4, 0x470000e5, 0x9c0000e6, 0x480000e7, - 0x540000e8, 0x510000e9, 0x520000ea, 0x530000eb, 0x580000ec, 0x550000ed, 0x560000ee, 0x570000ef, - 0x8c0000f0, 0x490000f1, 0xcd0000f2, 0xce0000f3, 0xcb0000f4, 0xcf0000f5, 0xcc0000f6, 0xe10000f7, - 0x700000f8, 0xdd0000f9, 0xde0000fa, 0xdb0000fb, 0xdc0000fc, 0x8d0000fd, 0x8e0000fe, 0xdf0000ff, - }, -} - // CodePage437 is the IBM Code Page 437 encoding. -var CodePage437 *Charmap = &codePage437 +var CodePage437 encoding.Encoding = &codePage437 -var codePage437 = Charmap{ +var codePage437 = charmap{ name: "IBM Code Page 437", mib: identifier.PC8CodePage437, asciiSuperset: true, @@ -358,9 +183,9 @@ var codePage437 = Charmap{ } // CodePage850 is the IBM Code Page 850 encoding. -var CodePage850 *Charmap = &codePage850 +var CodePage850 encoding.Encoding = &codePage850 -var codePage850 = Charmap{ +var codePage850 = charmap{ name: "IBM Code Page 850", mib: identifier.PC850Multilingual, asciiSuperset: true, @@ -533,9 +358,9 @@ var codePage850 = Charmap{ } // CodePage852 is the IBM Code Page 852 encoding. -var CodePage852 *Charmap = &codePage852 +var CodePage852 encoding.Encoding = &codePage852 -var codePage852 = Charmap{ +var codePage852 = charmap{ name: "IBM Code Page 852", mib: identifier.PCp852, asciiSuperset: true, @@ -708,9 +533,9 @@ var codePage852 = Charmap{ } // CodePage855 is the IBM Code Page 855 encoding. -var CodePage855 *Charmap = &codePage855 +var CodePage855 encoding.Encoding = &codePage855 -var codePage855 = Charmap{ +var codePage855 = charmap{ name: "IBM Code Page 855", mib: identifier.IBM855, asciiSuperset: true, @@ -883,9 +708,9 @@ var codePage855 = Charmap{ } // CodePage858 is the Windows Code Page 858 encoding. -var CodePage858 *Charmap = &codePage858 +var CodePage858 encoding.Encoding = &codePage858 -var codePage858 = Charmap{ +var codePage858 = charmap{ name: "Windows Code Page 858", mib: identifier.IBM00858, asciiSuperset: true, @@ -1058,9 +883,9 @@ var codePage858 = Charmap{ } // CodePage860 is the IBM Code Page 860 encoding. -var CodePage860 *Charmap = &codePage860 +var CodePage860 encoding.Encoding = &codePage860 -var codePage860 = Charmap{ +var codePage860 = charmap{ name: "IBM Code Page 860", mib: identifier.IBM860, asciiSuperset: true, @@ -1233,9 +1058,9 @@ var codePage860 = Charmap{ } // CodePage862 is the IBM Code Page 862 encoding. -var CodePage862 *Charmap = &codePage862 +var CodePage862 encoding.Encoding = &codePage862 -var codePage862 = Charmap{ +var codePage862 = charmap{ name: "IBM Code Page 862", mib: identifier.PC862LatinHebrew, asciiSuperset: true, @@ -1408,9 +1233,9 @@ var codePage862 = Charmap{ } // CodePage863 is the IBM Code Page 863 encoding. -var CodePage863 *Charmap = &codePage863 +var CodePage863 encoding.Encoding = &codePage863 -var codePage863 = Charmap{ +var codePage863 = charmap{ name: "IBM Code Page 863", mib: identifier.IBM863, asciiSuperset: true, @@ -1583,9 +1408,9 @@ var codePage863 = Charmap{ } // CodePage865 is the IBM Code Page 865 encoding. -var CodePage865 *Charmap = &codePage865 +var CodePage865 encoding.Encoding = &codePage865 -var codePage865 = Charmap{ +var codePage865 = charmap{ name: "IBM Code Page 865", mib: identifier.IBM865, asciiSuperset: true, @@ -1758,9 +1583,9 @@ var codePage865 = Charmap{ } // CodePage866 is the IBM Code Page 866 encoding. -var CodePage866 *Charmap = &codePage866 +var CodePage866 encoding.Encoding = &codePage866 -var codePage866 = Charmap{ +var codePage866 = charmap{ name: "IBM Code Page 866", mib: identifier.IBM866, asciiSuperset: true, @@ -1932,360 +1757,10 @@ var codePage866 = Charmap{ }, } -// CodePage1047 is the IBM Code Page 1047 encoding. -var CodePage1047 *Charmap = &codePage1047 - -var codePage1047 = Charmap{ - name: "IBM Code Page 1047", - mib: identifier.IBM1047, - asciiSuperset: false, - low: 0x00, - replacement: 0x3f, - decode: [256]utf8Enc{ - {1, [3]byte{0x00, 0x00, 0x00}}, {1, [3]byte{0x01, 0x00, 0x00}}, - {1, [3]byte{0x02, 0x00, 0x00}}, {1, [3]byte{0x03, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x9c, 0x00}}, {1, [3]byte{0x09, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x86, 0x00}}, {1, [3]byte{0x7f, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x97, 0x00}}, {2, [3]byte{0xc2, 0x8d, 0x00}}, - {2, [3]byte{0xc2, 0x8e, 0x00}}, {1, [3]byte{0x0b, 0x00, 0x00}}, - {1, [3]byte{0x0c, 0x00, 0x00}}, {1, [3]byte{0x0d, 0x00, 0x00}}, - {1, [3]byte{0x0e, 0x00, 0x00}}, {1, [3]byte{0x0f, 0x00, 0x00}}, - {1, [3]byte{0x10, 0x00, 0x00}}, {1, [3]byte{0x11, 0x00, 0x00}}, - {1, [3]byte{0x12, 0x00, 0x00}}, {1, [3]byte{0x13, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x9d, 0x00}}, {2, [3]byte{0xc2, 0x85, 0x00}}, - {1, [3]byte{0x08, 0x00, 0x00}}, {2, [3]byte{0xc2, 0x87, 0x00}}, - {1, [3]byte{0x18, 0x00, 0x00}}, {1, [3]byte{0x19, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x92, 0x00}}, {2, [3]byte{0xc2, 0x8f, 0x00}}, - {1, [3]byte{0x1c, 0x00, 0x00}}, {1, [3]byte{0x1d, 0x00, 0x00}}, - {1, [3]byte{0x1e, 0x00, 0x00}}, {1, [3]byte{0x1f, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x80, 0x00}}, {2, [3]byte{0xc2, 0x81, 0x00}}, - {2, [3]byte{0xc2, 0x82, 0x00}}, {2, [3]byte{0xc2, 0x83, 0x00}}, - {2, [3]byte{0xc2, 0x84, 0x00}}, {1, [3]byte{0x0a, 0x00, 0x00}}, - {1, [3]byte{0x17, 0x00, 0x00}}, {1, [3]byte{0x1b, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x88, 0x00}}, {2, [3]byte{0xc2, 0x89, 0x00}}, - {2, [3]byte{0xc2, 0x8a, 0x00}}, {2, [3]byte{0xc2, 0x8b, 0x00}}, - {2, [3]byte{0xc2, 0x8c, 0x00}}, {1, [3]byte{0x05, 0x00, 0x00}}, - {1, [3]byte{0x06, 0x00, 0x00}}, {1, [3]byte{0x07, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x90, 0x00}}, {2, [3]byte{0xc2, 0x91, 0x00}}, - {1, [3]byte{0x16, 0x00, 0x00}}, {2, [3]byte{0xc2, 0x93, 0x00}}, - {2, [3]byte{0xc2, 0x94, 0x00}}, {2, [3]byte{0xc2, 0x95, 0x00}}, - {2, [3]byte{0xc2, 0x96, 0x00}}, {1, [3]byte{0x04, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x98, 0x00}}, {2, [3]byte{0xc2, 0x99, 0x00}}, - {2, [3]byte{0xc2, 0x9a, 0x00}}, {2, [3]byte{0xc2, 0x9b, 0x00}}, - {1, [3]byte{0x14, 0x00, 0x00}}, {1, [3]byte{0x15, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x9e, 0x00}}, {1, [3]byte{0x1a, 0x00, 0x00}}, - {1, [3]byte{0x20, 0x00, 0x00}}, {2, [3]byte{0xc2, 0xa0, 0x00}}, - {2, [3]byte{0xc3, 0xa2, 0x00}}, {2, [3]byte{0xc3, 0xa4, 0x00}}, - {2, [3]byte{0xc3, 0xa0, 0x00}}, {2, [3]byte{0xc3, 0xa1, 0x00}}, - {2, [3]byte{0xc3, 0xa3, 0x00}}, {2, [3]byte{0xc3, 0xa5, 0x00}}, - {2, [3]byte{0xc3, 0xa7, 0x00}}, {2, [3]byte{0xc3, 0xb1, 0x00}}, - {2, [3]byte{0xc2, 0xa2, 0x00}}, {1, [3]byte{0x2e, 0x00, 0x00}}, - {1, [3]byte{0x3c, 0x00, 0x00}}, {1, [3]byte{0x28, 0x00, 0x00}}, - {1, [3]byte{0x2b, 0x00, 0x00}}, {1, [3]byte{0x7c, 0x00, 0x00}}, - {1, [3]byte{0x26, 0x00, 0x00}}, {2, [3]byte{0xc3, 0xa9, 0x00}}, - {2, [3]byte{0xc3, 0xaa, 0x00}}, {2, [3]byte{0xc3, 0xab, 0x00}}, - {2, [3]byte{0xc3, 0xa8, 0x00}}, {2, [3]byte{0xc3, 0xad, 0x00}}, - {2, [3]byte{0xc3, 0xae, 0x00}}, {2, [3]byte{0xc3, 0xaf, 0x00}}, - {2, [3]byte{0xc3, 0xac, 0x00}}, {2, [3]byte{0xc3, 0x9f, 0x00}}, - {1, [3]byte{0x21, 0x00, 0x00}}, {1, [3]byte{0x24, 0x00, 0x00}}, - {1, [3]byte{0x2a, 0x00, 0x00}}, {1, [3]byte{0x29, 0x00, 0x00}}, - {1, [3]byte{0x3b, 0x00, 0x00}}, {1, [3]byte{0x5e, 0x00, 0x00}}, - {1, [3]byte{0x2d, 0x00, 0x00}}, {1, [3]byte{0x2f, 0x00, 0x00}}, - {2, [3]byte{0xc3, 0x82, 0x00}}, {2, [3]byte{0xc3, 0x84, 0x00}}, - {2, [3]byte{0xc3, 0x80, 0x00}}, {2, [3]byte{0xc3, 0x81, 0x00}}, - {2, [3]byte{0xc3, 0x83, 0x00}}, {2, [3]byte{0xc3, 0x85, 0x00}}, - {2, [3]byte{0xc3, 0x87, 0x00}}, {2, [3]byte{0xc3, 0x91, 0x00}}, - {2, [3]byte{0xc2, 0xa6, 0x00}}, {1, [3]byte{0x2c, 0x00, 0x00}}, - {1, [3]byte{0x25, 0x00, 0x00}}, {1, [3]byte{0x5f, 0x00, 0x00}}, - {1, [3]byte{0x3e, 0x00, 0x00}}, {1, [3]byte{0x3f, 0x00, 0x00}}, - {2, [3]byte{0xc3, 0xb8, 0x00}}, {2, [3]byte{0xc3, 0x89, 0x00}}, - {2, [3]byte{0xc3, 0x8a, 0x00}}, {2, [3]byte{0xc3, 0x8b, 0x00}}, - {2, [3]byte{0xc3, 0x88, 0x00}}, {2, [3]byte{0xc3, 0x8d, 0x00}}, - {2, [3]byte{0xc3, 0x8e, 0x00}}, {2, [3]byte{0xc3, 0x8f, 0x00}}, - {2, [3]byte{0xc3, 0x8c, 0x00}}, {1, [3]byte{0x60, 0x00, 0x00}}, - {1, [3]byte{0x3a, 0x00, 0x00}}, {1, [3]byte{0x23, 0x00, 0x00}}, - {1, [3]byte{0x40, 0x00, 0x00}}, {1, [3]byte{0x27, 0x00, 0x00}}, - {1, [3]byte{0x3d, 0x00, 0x00}}, {1, [3]byte{0x22, 0x00, 0x00}}, - {2, [3]byte{0xc3, 0x98, 0x00}}, {1, [3]byte{0x61, 0x00, 0x00}}, - {1, [3]byte{0x62, 0x00, 0x00}}, {1, [3]byte{0x63, 0x00, 0x00}}, - {1, [3]byte{0x64, 0x00, 0x00}}, {1, [3]byte{0x65, 0x00, 0x00}}, - {1, [3]byte{0x66, 0x00, 0x00}}, {1, [3]byte{0x67, 0x00, 0x00}}, - {1, [3]byte{0x68, 0x00, 0x00}}, {1, [3]byte{0x69, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xab, 0x00}}, {2, [3]byte{0xc2, 0xbb, 0x00}}, - {2, [3]byte{0xc3, 0xb0, 0x00}}, {2, [3]byte{0xc3, 0xbd, 0x00}}, - {2, [3]byte{0xc3, 0xbe, 0x00}}, {2, [3]byte{0xc2, 0xb1, 0x00}}, - {2, [3]byte{0xc2, 0xb0, 0x00}}, {1, [3]byte{0x6a, 0x00, 0x00}}, - {1, [3]byte{0x6b, 0x00, 0x00}}, {1, [3]byte{0x6c, 0x00, 0x00}}, - {1, [3]byte{0x6d, 0x00, 0x00}}, {1, [3]byte{0x6e, 0x00, 0x00}}, - {1, [3]byte{0x6f, 0x00, 0x00}}, {1, [3]byte{0x70, 0x00, 0x00}}, - {1, [3]byte{0x71, 0x00, 0x00}}, {1, [3]byte{0x72, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xaa, 0x00}}, {2, [3]byte{0xc2, 0xba, 0x00}}, - {2, [3]byte{0xc3, 0xa6, 0x00}}, {2, [3]byte{0xc2, 0xb8, 0x00}}, - {2, [3]byte{0xc3, 0x86, 0x00}}, {2, [3]byte{0xc2, 0xa4, 0x00}}, - {2, [3]byte{0xc2, 0xb5, 0x00}}, {1, [3]byte{0x7e, 0x00, 0x00}}, - {1, [3]byte{0x73, 0x00, 0x00}}, {1, [3]byte{0x74, 0x00, 0x00}}, - {1, [3]byte{0x75, 0x00, 0x00}}, {1, [3]byte{0x76, 0x00, 0x00}}, - {1, [3]byte{0x77, 0x00, 0x00}}, {1, [3]byte{0x78, 0x00, 0x00}}, - {1, [3]byte{0x79, 0x00, 0x00}}, {1, [3]byte{0x7a, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xa1, 0x00}}, {2, [3]byte{0xc2, 0xbf, 0x00}}, - {2, [3]byte{0xc3, 0x90, 0x00}}, {1, [3]byte{0x5b, 0x00, 0x00}}, - {2, [3]byte{0xc3, 0x9e, 0x00}}, {2, [3]byte{0xc2, 0xae, 0x00}}, - {2, [3]byte{0xc2, 0xac, 0x00}}, {2, [3]byte{0xc2, 0xa3, 0x00}}, - {2, [3]byte{0xc2, 0xa5, 0x00}}, {2, [3]byte{0xc2, 0xb7, 0x00}}, - {2, [3]byte{0xc2, 0xa9, 0x00}}, {2, [3]byte{0xc2, 0xa7, 0x00}}, - {2, [3]byte{0xc2, 0xb6, 0x00}}, {2, [3]byte{0xc2, 0xbc, 0x00}}, - {2, [3]byte{0xc2, 0xbd, 0x00}}, {2, [3]byte{0xc2, 0xbe, 0x00}}, - {2, [3]byte{0xc3, 0x9d, 0x00}}, {2, [3]byte{0xc2, 0xa8, 0x00}}, - {2, [3]byte{0xc2, 0xaf, 0x00}}, {1, [3]byte{0x5d, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xb4, 0x00}}, {2, [3]byte{0xc3, 0x97, 0x00}}, - {1, [3]byte{0x7b, 0x00, 0x00}}, {1, [3]byte{0x41, 0x00, 0x00}}, - {1, [3]byte{0x42, 0x00, 0x00}}, {1, [3]byte{0x43, 0x00, 0x00}}, - {1, [3]byte{0x44, 0x00, 0x00}}, {1, [3]byte{0x45, 0x00, 0x00}}, - {1, [3]byte{0x46, 0x00, 0x00}}, {1, [3]byte{0x47, 0x00, 0x00}}, - {1, [3]byte{0x48, 0x00, 0x00}}, {1, [3]byte{0x49, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xad, 0x00}}, {2, [3]byte{0xc3, 0xb4, 0x00}}, - {2, [3]byte{0xc3, 0xb6, 0x00}}, {2, [3]byte{0xc3, 0xb2, 0x00}}, - {2, [3]byte{0xc3, 0xb3, 0x00}}, {2, [3]byte{0xc3, 0xb5, 0x00}}, - {1, [3]byte{0x7d, 0x00, 0x00}}, {1, [3]byte{0x4a, 0x00, 0x00}}, - {1, [3]byte{0x4b, 0x00, 0x00}}, {1, [3]byte{0x4c, 0x00, 0x00}}, - {1, [3]byte{0x4d, 0x00, 0x00}}, {1, [3]byte{0x4e, 0x00, 0x00}}, - {1, [3]byte{0x4f, 0x00, 0x00}}, {1, [3]byte{0x50, 0x00, 0x00}}, - {1, [3]byte{0x51, 0x00, 0x00}}, {1, [3]byte{0x52, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xb9, 0x00}}, {2, [3]byte{0xc3, 0xbb, 0x00}}, - {2, [3]byte{0xc3, 0xbc, 0x00}}, {2, [3]byte{0xc3, 0xb9, 0x00}}, - {2, [3]byte{0xc3, 0xba, 0x00}}, {2, [3]byte{0xc3, 0xbf, 0x00}}, - {1, [3]byte{0x5c, 0x00, 0x00}}, {2, [3]byte{0xc3, 0xb7, 0x00}}, - {1, [3]byte{0x53, 0x00, 0x00}}, {1, [3]byte{0x54, 0x00, 0x00}}, - {1, [3]byte{0x55, 0x00, 0x00}}, {1, [3]byte{0x56, 0x00, 0x00}}, - {1, [3]byte{0x57, 0x00, 0x00}}, {1, [3]byte{0x58, 0x00, 0x00}}, - {1, [3]byte{0x59, 0x00, 0x00}}, {1, [3]byte{0x5a, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xb2, 0x00}}, {2, [3]byte{0xc3, 0x94, 0x00}}, - {2, [3]byte{0xc3, 0x96, 0x00}}, {2, [3]byte{0xc3, 0x92, 0x00}}, - {2, [3]byte{0xc3, 0x93, 0x00}}, {2, [3]byte{0xc3, 0x95, 0x00}}, - {1, [3]byte{0x30, 0x00, 0x00}}, {1, [3]byte{0x31, 0x00, 0x00}}, - {1, [3]byte{0x32, 0x00, 0x00}}, {1, [3]byte{0x33, 0x00, 0x00}}, - {1, [3]byte{0x34, 0x00, 0x00}}, {1, [3]byte{0x35, 0x00, 0x00}}, - {1, [3]byte{0x36, 0x00, 0x00}}, {1, [3]byte{0x37, 0x00, 0x00}}, - {1, [3]byte{0x38, 0x00, 0x00}}, {1, [3]byte{0x39, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xb3, 0x00}}, {2, [3]byte{0xc3, 0x9b, 0x00}}, - {2, [3]byte{0xc3, 0x9c, 0x00}}, {2, [3]byte{0xc3, 0x99, 0x00}}, - {2, [3]byte{0xc3, 0x9a, 0x00}}, {2, [3]byte{0xc2, 0x9f, 0x00}}, - }, - encode: [256]uint32{ - 0x00000000, 0x01000001, 0x02000002, 0x03000003, 0x37000004, 0x2d000005, 0x2e000006, 0x2f000007, - 0x16000008, 0x05000009, 0x2500000a, 0x0b00000b, 0x0c00000c, 0x0d00000d, 0x0e00000e, 0x0f00000f, - 0x10000010, 0x11000011, 0x12000012, 0x13000013, 0x3c000014, 0x3d000015, 0x32000016, 0x26000017, - 0x18000018, 0x19000019, 0x3f00001a, 0x2700001b, 0x1c00001c, 0x1d00001d, 0x1e00001e, 0x1f00001f, - 0x40000020, 0x5a000021, 0x7f000022, 0x7b000023, 0x5b000024, 0x6c000025, 0x50000026, 0x7d000027, - 0x4d000028, 0x5d000029, 0x5c00002a, 0x4e00002b, 0x6b00002c, 0x6000002d, 0x4b00002e, 0x6100002f, - 0xf0000030, 0xf1000031, 0xf2000032, 0xf3000033, 0xf4000034, 0xf5000035, 0xf6000036, 0xf7000037, - 0xf8000038, 0xf9000039, 0x7a00003a, 0x5e00003b, 0x4c00003c, 0x7e00003d, 0x6e00003e, 0x6f00003f, - 0x7c000040, 0xc1000041, 0xc2000042, 0xc3000043, 0xc4000044, 0xc5000045, 0xc6000046, 0xc7000047, - 0xc8000048, 0xc9000049, 0xd100004a, 0xd200004b, 0xd300004c, 0xd400004d, 0xd500004e, 0xd600004f, - 0xd7000050, 0xd8000051, 0xd9000052, 0xe2000053, 0xe3000054, 0xe4000055, 0xe5000056, 0xe6000057, - 0xe7000058, 0xe8000059, 0xe900005a, 0xad00005b, 0xe000005c, 0xbd00005d, 0x5f00005e, 0x6d00005f, - 0x79000060, 0x81000061, 0x82000062, 0x83000063, 0x84000064, 0x85000065, 0x86000066, 0x87000067, - 0x88000068, 0x89000069, 0x9100006a, 0x9200006b, 0x9300006c, 0x9400006d, 0x9500006e, 0x9600006f, - 0x97000070, 0x98000071, 0x99000072, 0xa2000073, 0xa3000074, 0xa4000075, 0xa5000076, 0xa6000077, - 0xa7000078, 0xa8000079, 0xa900007a, 0xc000007b, 0x4f00007c, 0xd000007d, 0xa100007e, 0x0700007f, - 0x20000080, 0x21000081, 0x22000082, 0x23000083, 0x24000084, 0x15000085, 0x06000086, 0x17000087, - 0x28000088, 0x29000089, 0x2a00008a, 0x2b00008b, 0x2c00008c, 0x0900008d, 0x0a00008e, 0x1b00008f, - 0x30000090, 0x31000091, 0x1a000092, 0x33000093, 0x34000094, 0x35000095, 0x36000096, 0x08000097, - 0x38000098, 0x39000099, 0x3a00009a, 0x3b00009b, 0x0400009c, 0x1400009d, 0x3e00009e, 0xff00009f, - 0x410000a0, 0xaa0000a1, 0x4a0000a2, 0xb10000a3, 0x9f0000a4, 0xb20000a5, 0x6a0000a6, 0xb50000a7, - 0xbb0000a8, 0xb40000a9, 0x9a0000aa, 0x8a0000ab, 0xb00000ac, 0xca0000ad, 0xaf0000ae, 0xbc0000af, - 0x900000b0, 0x8f0000b1, 0xea0000b2, 0xfa0000b3, 0xbe0000b4, 0xa00000b5, 0xb60000b6, 0xb30000b7, - 0x9d0000b8, 0xda0000b9, 0x9b0000ba, 0x8b0000bb, 0xb70000bc, 0xb80000bd, 0xb90000be, 0xab0000bf, - 0x640000c0, 0x650000c1, 0x620000c2, 0x660000c3, 0x630000c4, 0x670000c5, 0x9e0000c6, 0x680000c7, - 0x740000c8, 0x710000c9, 0x720000ca, 0x730000cb, 0x780000cc, 0x750000cd, 0x760000ce, 0x770000cf, - 0xac0000d0, 0x690000d1, 0xed0000d2, 0xee0000d3, 0xeb0000d4, 0xef0000d5, 0xec0000d6, 0xbf0000d7, - 0x800000d8, 0xfd0000d9, 0xfe0000da, 0xfb0000db, 0xfc0000dc, 0xba0000dd, 0xae0000de, 0x590000df, - 0x440000e0, 0x450000e1, 0x420000e2, 0x460000e3, 0x430000e4, 0x470000e5, 0x9c0000e6, 0x480000e7, - 0x540000e8, 0x510000e9, 0x520000ea, 0x530000eb, 0x580000ec, 0x550000ed, 0x560000ee, 0x570000ef, - 0x8c0000f0, 0x490000f1, 0xcd0000f2, 0xce0000f3, 0xcb0000f4, 0xcf0000f5, 0xcc0000f6, 0xe10000f7, - 0x700000f8, 0xdd0000f9, 0xde0000fa, 0xdb0000fb, 0xdc0000fc, 0x8d0000fd, 0x8e0000fe, 0xdf0000ff, - }, -} - -// CodePage1140 is the IBM Code Page 1140 encoding. -var CodePage1140 *Charmap = &codePage1140 - -var codePage1140 = Charmap{ - name: "IBM Code Page 1140", - mib: identifier.IBM01140, - asciiSuperset: false, - low: 0x00, - replacement: 0x3f, - decode: [256]utf8Enc{ - {1, [3]byte{0x00, 0x00, 0x00}}, {1, [3]byte{0x01, 0x00, 0x00}}, - {1, [3]byte{0x02, 0x00, 0x00}}, {1, [3]byte{0x03, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x9c, 0x00}}, {1, [3]byte{0x09, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x86, 0x00}}, {1, [3]byte{0x7f, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x97, 0x00}}, {2, [3]byte{0xc2, 0x8d, 0x00}}, - {2, [3]byte{0xc2, 0x8e, 0x00}}, {1, [3]byte{0x0b, 0x00, 0x00}}, - {1, [3]byte{0x0c, 0x00, 0x00}}, {1, [3]byte{0x0d, 0x00, 0x00}}, - {1, [3]byte{0x0e, 0x00, 0x00}}, {1, [3]byte{0x0f, 0x00, 0x00}}, - {1, [3]byte{0x10, 0x00, 0x00}}, {1, [3]byte{0x11, 0x00, 0x00}}, - {1, [3]byte{0x12, 0x00, 0x00}}, {1, [3]byte{0x13, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x9d, 0x00}}, {2, [3]byte{0xc2, 0x85, 0x00}}, - {1, [3]byte{0x08, 0x00, 0x00}}, {2, [3]byte{0xc2, 0x87, 0x00}}, - {1, [3]byte{0x18, 0x00, 0x00}}, {1, [3]byte{0x19, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x92, 0x00}}, {2, [3]byte{0xc2, 0x8f, 0x00}}, - {1, [3]byte{0x1c, 0x00, 0x00}}, {1, [3]byte{0x1d, 0x00, 0x00}}, - {1, [3]byte{0x1e, 0x00, 0x00}}, {1, [3]byte{0x1f, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x80, 0x00}}, {2, [3]byte{0xc2, 0x81, 0x00}}, - {2, [3]byte{0xc2, 0x82, 0x00}}, {2, [3]byte{0xc2, 0x83, 0x00}}, - {2, [3]byte{0xc2, 0x84, 0x00}}, {1, [3]byte{0x0a, 0x00, 0x00}}, - {1, [3]byte{0x17, 0x00, 0x00}}, {1, [3]byte{0x1b, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x88, 0x00}}, {2, [3]byte{0xc2, 0x89, 0x00}}, - {2, [3]byte{0xc2, 0x8a, 0x00}}, {2, [3]byte{0xc2, 0x8b, 0x00}}, - {2, [3]byte{0xc2, 0x8c, 0x00}}, {1, [3]byte{0x05, 0x00, 0x00}}, - {1, [3]byte{0x06, 0x00, 0x00}}, {1, [3]byte{0x07, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x90, 0x00}}, {2, [3]byte{0xc2, 0x91, 0x00}}, - {1, [3]byte{0x16, 0x00, 0x00}}, {2, [3]byte{0xc2, 0x93, 0x00}}, - {2, [3]byte{0xc2, 0x94, 0x00}}, {2, [3]byte{0xc2, 0x95, 0x00}}, - {2, [3]byte{0xc2, 0x96, 0x00}}, {1, [3]byte{0x04, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x98, 0x00}}, {2, [3]byte{0xc2, 0x99, 0x00}}, - {2, [3]byte{0xc2, 0x9a, 0x00}}, {2, [3]byte{0xc2, 0x9b, 0x00}}, - {1, [3]byte{0x14, 0x00, 0x00}}, {1, [3]byte{0x15, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x9e, 0x00}}, {1, [3]byte{0x1a, 0x00, 0x00}}, - {1, [3]byte{0x20, 0x00, 0x00}}, {2, [3]byte{0xc2, 0xa0, 0x00}}, - {2, [3]byte{0xc3, 0xa2, 0x00}}, {2, [3]byte{0xc3, 0xa4, 0x00}}, - {2, [3]byte{0xc3, 0xa0, 0x00}}, {2, [3]byte{0xc3, 0xa1, 0x00}}, - {2, [3]byte{0xc3, 0xa3, 0x00}}, {2, [3]byte{0xc3, 0xa5, 0x00}}, - {2, [3]byte{0xc3, 0xa7, 0x00}}, {2, [3]byte{0xc3, 0xb1, 0x00}}, - {2, [3]byte{0xc2, 0xa2, 0x00}}, {1, [3]byte{0x2e, 0x00, 0x00}}, - {1, [3]byte{0x3c, 0x00, 0x00}}, {1, [3]byte{0x28, 0x00, 0x00}}, - {1, [3]byte{0x2b, 0x00, 0x00}}, {1, [3]byte{0x7c, 0x00, 0x00}}, - {1, [3]byte{0x26, 0x00, 0x00}}, {2, [3]byte{0xc3, 0xa9, 0x00}}, - {2, [3]byte{0xc3, 0xaa, 0x00}}, {2, [3]byte{0xc3, 0xab, 0x00}}, - {2, [3]byte{0xc3, 0xa8, 0x00}}, {2, [3]byte{0xc3, 0xad, 0x00}}, - {2, [3]byte{0xc3, 0xae, 0x00}}, {2, [3]byte{0xc3, 0xaf, 0x00}}, - {2, [3]byte{0xc3, 0xac, 0x00}}, {2, [3]byte{0xc3, 0x9f, 0x00}}, - {1, [3]byte{0x21, 0x00, 0x00}}, {1, [3]byte{0x24, 0x00, 0x00}}, - {1, [3]byte{0x2a, 0x00, 0x00}}, {1, [3]byte{0x29, 0x00, 0x00}}, - {1, [3]byte{0x3b, 0x00, 0x00}}, {2, [3]byte{0xc2, 0xac, 0x00}}, - {1, [3]byte{0x2d, 0x00, 0x00}}, {1, [3]byte{0x2f, 0x00, 0x00}}, - {2, [3]byte{0xc3, 0x82, 0x00}}, {2, [3]byte{0xc3, 0x84, 0x00}}, - {2, [3]byte{0xc3, 0x80, 0x00}}, {2, [3]byte{0xc3, 0x81, 0x00}}, - {2, [3]byte{0xc3, 0x83, 0x00}}, {2, [3]byte{0xc3, 0x85, 0x00}}, - {2, [3]byte{0xc3, 0x87, 0x00}}, {2, [3]byte{0xc3, 0x91, 0x00}}, - {2, [3]byte{0xc2, 0xa6, 0x00}}, {1, [3]byte{0x2c, 0x00, 0x00}}, - {1, [3]byte{0x25, 0x00, 0x00}}, {1, [3]byte{0x5f, 0x00, 0x00}}, - {1, [3]byte{0x3e, 0x00, 0x00}}, {1, [3]byte{0x3f, 0x00, 0x00}}, - {2, [3]byte{0xc3, 0xb8, 0x00}}, {2, [3]byte{0xc3, 0x89, 0x00}}, - {2, [3]byte{0xc3, 0x8a, 0x00}}, {2, [3]byte{0xc3, 0x8b, 0x00}}, - {2, [3]byte{0xc3, 0x88, 0x00}}, {2, [3]byte{0xc3, 0x8d, 0x00}}, - {2, [3]byte{0xc3, 0x8e, 0x00}}, {2, [3]byte{0xc3, 0x8f, 0x00}}, - {2, [3]byte{0xc3, 0x8c, 0x00}}, {1, [3]byte{0x60, 0x00, 0x00}}, - {1, [3]byte{0x3a, 0x00, 0x00}}, {1, [3]byte{0x23, 0x00, 0x00}}, - {1, [3]byte{0x40, 0x00, 0x00}}, {1, [3]byte{0x27, 0x00, 0x00}}, - {1, [3]byte{0x3d, 0x00, 0x00}}, {1, [3]byte{0x22, 0x00, 0x00}}, - {2, [3]byte{0xc3, 0x98, 0x00}}, {1, [3]byte{0x61, 0x00, 0x00}}, - {1, [3]byte{0x62, 0x00, 0x00}}, {1, [3]byte{0x63, 0x00, 0x00}}, - {1, [3]byte{0x64, 0x00, 0x00}}, {1, [3]byte{0x65, 0x00, 0x00}}, - {1, [3]byte{0x66, 0x00, 0x00}}, {1, [3]byte{0x67, 0x00, 0x00}}, - {1, [3]byte{0x68, 0x00, 0x00}}, {1, [3]byte{0x69, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xab, 0x00}}, {2, [3]byte{0xc2, 0xbb, 0x00}}, - {2, [3]byte{0xc3, 0xb0, 0x00}}, {2, [3]byte{0xc3, 0xbd, 0x00}}, - {2, [3]byte{0xc3, 0xbe, 0x00}}, {2, [3]byte{0xc2, 0xb1, 0x00}}, - {2, [3]byte{0xc2, 0xb0, 0x00}}, {1, [3]byte{0x6a, 0x00, 0x00}}, - {1, [3]byte{0x6b, 0x00, 0x00}}, {1, [3]byte{0x6c, 0x00, 0x00}}, - {1, [3]byte{0x6d, 0x00, 0x00}}, {1, [3]byte{0x6e, 0x00, 0x00}}, - {1, [3]byte{0x6f, 0x00, 0x00}}, {1, [3]byte{0x70, 0x00, 0x00}}, - {1, [3]byte{0x71, 0x00, 0x00}}, {1, [3]byte{0x72, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xaa, 0x00}}, {2, [3]byte{0xc2, 0xba, 0x00}}, - {2, [3]byte{0xc3, 0xa6, 0x00}}, {2, [3]byte{0xc2, 0xb8, 0x00}}, - {2, [3]byte{0xc3, 0x86, 0x00}}, {3, [3]byte{0xe2, 0x82, 0xac}}, - {2, [3]byte{0xc2, 0xb5, 0x00}}, {1, [3]byte{0x7e, 0x00, 0x00}}, - {1, [3]byte{0x73, 0x00, 0x00}}, {1, [3]byte{0x74, 0x00, 0x00}}, - {1, [3]byte{0x75, 0x00, 0x00}}, {1, [3]byte{0x76, 0x00, 0x00}}, - {1, [3]byte{0x77, 0x00, 0x00}}, {1, [3]byte{0x78, 0x00, 0x00}}, - {1, [3]byte{0x79, 0x00, 0x00}}, {1, [3]byte{0x7a, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xa1, 0x00}}, {2, [3]byte{0xc2, 0xbf, 0x00}}, - {2, [3]byte{0xc3, 0x90, 0x00}}, {2, [3]byte{0xc3, 0x9d, 0x00}}, - {2, [3]byte{0xc3, 0x9e, 0x00}}, {2, [3]byte{0xc2, 0xae, 0x00}}, - {1, [3]byte{0x5e, 0x00, 0x00}}, {2, [3]byte{0xc2, 0xa3, 0x00}}, - {2, [3]byte{0xc2, 0xa5, 0x00}}, {2, [3]byte{0xc2, 0xb7, 0x00}}, - {2, [3]byte{0xc2, 0xa9, 0x00}}, {2, [3]byte{0xc2, 0xa7, 0x00}}, - {2, [3]byte{0xc2, 0xb6, 0x00}}, {2, [3]byte{0xc2, 0xbc, 0x00}}, - {2, [3]byte{0xc2, 0xbd, 0x00}}, {2, [3]byte{0xc2, 0xbe, 0x00}}, - {1, [3]byte{0x5b, 0x00, 0x00}}, {1, [3]byte{0x5d, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xaf, 0x00}}, {2, [3]byte{0xc2, 0xa8, 0x00}}, - {2, [3]byte{0xc2, 0xb4, 0x00}}, {2, [3]byte{0xc3, 0x97, 0x00}}, - {1, [3]byte{0x7b, 0x00, 0x00}}, {1, [3]byte{0x41, 0x00, 0x00}}, - {1, [3]byte{0x42, 0x00, 0x00}}, {1, [3]byte{0x43, 0x00, 0x00}}, - {1, [3]byte{0x44, 0x00, 0x00}}, {1, [3]byte{0x45, 0x00, 0x00}}, - {1, [3]byte{0x46, 0x00, 0x00}}, {1, [3]byte{0x47, 0x00, 0x00}}, - {1, [3]byte{0x48, 0x00, 0x00}}, {1, [3]byte{0x49, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xad, 0x00}}, {2, [3]byte{0xc3, 0xb4, 0x00}}, - {2, [3]byte{0xc3, 0xb6, 0x00}}, {2, [3]byte{0xc3, 0xb2, 0x00}}, - {2, [3]byte{0xc3, 0xb3, 0x00}}, {2, [3]byte{0xc3, 0xb5, 0x00}}, - {1, [3]byte{0x7d, 0x00, 0x00}}, {1, [3]byte{0x4a, 0x00, 0x00}}, - {1, [3]byte{0x4b, 0x00, 0x00}}, {1, [3]byte{0x4c, 0x00, 0x00}}, - {1, [3]byte{0x4d, 0x00, 0x00}}, {1, [3]byte{0x4e, 0x00, 0x00}}, - {1, [3]byte{0x4f, 0x00, 0x00}}, {1, [3]byte{0x50, 0x00, 0x00}}, - {1, [3]byte{0x51, 0x00, 0x00}}, {1, [3]byte{0x52, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xb9, 0x00}}, {2, [3]byte{0xc3, 0xbb, 0x00}}, - {2, [3]byte{0xc3, 0xbc, 0x00}}, {2, [3]byte{0xc3, 0xb9, 0x00}}, - {2, [3]byte{0xc3, 0xba, 0x00}}, {2, [3]byte{0xc3, 0xbf, 0x00}}, - {1, [3]byte{0x5c, 0x00, 0x00}}, {2, [3]byte{0xc3, 0xb7, 0x00}}, - {1, [3]byte{0x53, 0x00, 0x00}}, {1, [3]byte{0x54, 0x00, 0x00}}, - {1, [3]byte{0x55, 0x00, 0x00}}, {1, [3]byte{0x56, 0x00, 0x00}}, - {1, [3]byte{0x57, 0x00, 0x00}}, {1, [3]byte{0x58, 0x00, 0x00}}, - {1, [3]byte{0x59, 0x00, 0x00}}, {1, [3]byte{0x5a, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xb2, 0x00}}, {2, [3]byte{0xc3, 0x94, 0x00}}, - {2, [3]byte{0xc3, 0x96, 0x00}}, {2, [3]byte{0xc3, 0x92, 0x00}}, - {2, [3]byte{0xc3, 0x93, 0x00}}, {2, [3]byte{0xc3, 0x95, 0x00}}, - {1, [3]byte{0x30, 0x00, 0x00}}, {1, [3]byte{0x31, 0x00, 0x00}}, - {1, [3]byte{0x32, 0x00, 0x00}}, {1, [3]byte{0x33, 0x00, 0x00}}, - {1, [3]byte{0x34, 0x00, 0x00}}, {1, [3]byte{0x35, 0x00, 0x00}}, - {1, [3]byte{0x36, 0x00, 0x00}}, {1, [3]byte{0x37, 0x00, 0x00}}, - {1, [3]byte{0x38, 0x00, 0x00}}, {1, [3]byte{0x39, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0xb3, 0x00}}, {2, [3]byte{0xc3, 0x9b, 0x00}}, - {2, [3]byte{0xc3, 0x9c, 0x00}}, {2, [3]byte{0xc3, 0x99, 0x00}}, - {2, [3]byte{0xc3, 0x9a, 0x00}}, {2, [3]byte{0xc2, 0x9f, 0x00}}, - }, - encode: [256]uint32{ - 0x00000000, 0x01000001, 0x02000002, 0x03000003, 0x37000004, 0x2d000005, 0x2e000006, 0x2f000007, - 0x16000008, 0x05000009, 0x2500000a, 0x0b00000b, 0x0c00000c, 0x0d00000d, 0x0e00000e, 0x0f00000f, - 0x10000010, 0x11000011, 0x12000012, 0x13000013, 0x3c000014, 0x3d000015, 0x32000016, 0x26000017, - 0x18000018, 0x19000019, 0x3f00001a, 0x2700001b, 0x1c00001c, 0x1d00001d, 0x1e00001e, 0x1f00001f, - 0x40000020, 0x5a000021, 0x7f000022, 0x7b000023, 0x5b000024, 0x6c000025, 0x50000026, 0x7d000027, - 0x4d000028, 0x5d000029, 0x5c00002a, 0x4e00002b, 0x6b00002c, 0x6000002d, 0x4b00002e, 0x6100002f, - 0xf0000030, 0xf1000031, 0xf2000032, 0xf3000033, 0xf4000034, 0xf5000035, 0xf6000036, 0xf7000037, - 0xf8000038, 0xf9000039, 0x7a00003a, 0x5e00003b, 0x4c00003c, 0x7e00003d, 0x6e00003e, 0x6f00003f, - 0x7c000040, 0xc1000041, 0xc2000042, 0xc3000043, 0xc4000044, 0xc5000045, 0xc6000046, 0xc7000047, - 0xc8000048, 0xc9000049, 0xd100004a, 0xd200004b, 0xd300004c, 0xd400004d, 0xd500004e, 0xd600004f, - 0xd7000050, 0xd8000051, 0xd9000052, 0xe2000053, 0xe3000054, 0xe4000055, 0xe5000056, 0xe6000057, - 0xe7000058, 0xe8000059, 0xe900005a, 0xba00005b, 0xe000005c, 0xbb00005d, 0xb000005e, 0x6d00005f, - 0x79000060, 0x81000061, 0x82000062, 0x83000063, 0x84000064, 0x85000065, 0x86000066, 0x87000067, - 0x88000068, 0x89000069, 0x9100006a, 0x9200006b, 0x9300006c, 0x9400006d, 0x9500006e, 0x9600006f, - 0x97000070, 0x98000071, 0x99000072, 0xa2000073, 0xa3000074, 0xa4000075, 0xa5000076, 0xa6000077, - 0xa7000078, 0xa8000079, 0xa900007a, 0xc000007b, 0x4f00007c, 0xd000007d, 0xa100007e, 0x0700007f, - 0x20000080, 0x21000081, 0x22000082, 0x23000083, 0x24000084, 0x15000085, 0x06000086, 0x17000087, - 0x28000088, 0x29000089, 0x2a00008a, 0x2b00008b, 0x2c00008c, 0x0900008d, 0x0a00008e, 0x1b00008f, - 0x30000090, 0x31000091, 0x1a000092, 0x33000093, 0x34000094, 0x35000095, 0x36000096, 0x08000097, - 0x38000098, 0x39000099, 0x3a00009a, 0x3b00009b, 0x0400009c, 0x1400009d, 0x3e00009e, 0xff00009f, - 0x410000a0, 0xaa0000a1, 0x4a0000a2, 0xb10000a3, 0xb20000a5, 0x6a0000a6, 0xb50000a7, 0xbd0000a8, - 0xb40000a9, 0x9a0000aa, 0x8a0000ab, 0x5f0000ac, 0xca0000ad, 0xaf0000ae, 0xbc0000af, 0x900000b0, - 0x8f0000b1, 0xea0000b2, 0xfa0000b3, 0xbe0000b4, 0xa00000b5, 0xb60000b6, 0xb30000b7, 0x9d0000b8, - 0xda0000b9, 0x9b0000ba, 0x8b0000bb, 0xb70000bc, 0xb80000bd, 0xb90000be, 0xab0000bf, 0x640000c0, - 0x650000c1, 0x620000c2, 0x660000c3, 0x630000c4, 0x670000c5, 0x9e0000c6, 0x680000c7, 0x740000c8, - 0x710000c9, 0x720000ca, 0x730000cb, 0x780000cc, 0x750000cd, 0x760000ce, 0x770000cf, 0xac0000d0, - 0x690000d1, 0xed0000d2, 0xee0000d3, 0xeb0000d4, 0xef0000d5, 0xec0000d6, 0xbf0000d7, 0x800000d8, - 0xfd0000d9, 0xfe0000da, 0xfb0000db, 0xfc0000dc, 0xad0000dd, 0xae0000de, 0x590000df, 0x440000e0, - 0x450000e1, 0x420000e2, 0x460000e3, 0x430000e4, 0x470000e5, 0x9c0000e6, 0x480000e7, 0x540000e8, - 0x510000e9, 0x520000ea, 0x530000eb, 0x580000ec, 0x550000ed, 0x560000ee, 0x570000ef, 0x8c0000f0, - 0x490000f1, 0xcd0000f2, 0xce0000f3, 0xcb0000f4, 0xcf0000f5, 0xcc0000f6, 0xe10000f7, 0x700000f8, - 0xdd0000f9, 0xde0000fa, 0xdb0000fb, 0xdc0000fc, 0x8d0000fd, 0x8e0000fe, 0xdf0000ff, 0x9f0020ac, - }, -} - // ISO8859_1 is the ISO 8859-1 encoding. -var ISO8859_1 *Charmap = &iso8859_1 +var ISO8859_1 encoding.Encoding = &iso8859_1 -var iso8859_1 = Charmap{ +var iso8859_1 = charmap{ name: "ISO 8859-1", mib: identifier.ISOLatin1, asciiSuperset: true, @@ -2458,9 +1933,9 @@ var iso8859_1 = Charmap{ } // ISO8859_2 is the ISO 8859-2 encoding. -var ISO8859_2 *Charmap = &iso8859_2 +var ISO8859_2 encoding.Encoding = &iso8859_2 -var iso8859_2 = Charmap{ +var iso8859_2 = charmap{ name: "ISO 8859-2", mib: identifier.ISOLatin2, asciiSuperset: true, @@ -2633,9 +2108,9 @@ var iso8859_2 = Charmap{ } // ISO8859_3 is the ISO 8859-3 encoding. -var ISO8859_3 *Charmap = &iso8859_3 +var ISO8859_3 encoding.Encoding = &iso8859_3 -var iso8859_3 = Charmap{ +var iso8859_3 = charmap{ name: "ISO 8859-3", mib: identifier.ISOLatin3, asciiSuperset: true, @@ -2808,9 +2283,9 @@ var iso8859_3 = Charmap{ } // ISO8859_4 is the ISO 8859-4 encoding. -var ISO8859_4 *Charmap = &iso8859_4 +var ISO8859_4 encoding.Encoding = &iso8859_4 -var iso8859_4 = Charmap{ +var iso8859_4 = charmap{ name: "ISO 8859-4", mib: identifier.ISOLatin4, asciiSuperset: true, @@ -2983,9 +2458,9 @@ var iso8859_4 = Charmap{ } // ISO8859_5 is the ISO 8859-5 encoding. -var ISO8859_5 *Charmap = &iso8859_5 +var ISO8859_5 encoding.Encoding = &iso8859_5 -var iso8859_5 = Charmap{ +var iso8859_5 = charmap{ name: "ISO 8859-5", mib: identifier.ISOLatinCyrillic, asciiSuperset: true, @@ -3158,9 +2633,9 @@ var iso8859_5 = Charmap{ } // ISO8859_6 is the ISO 8859-6 encoding. -var ISO8859_6 *Charmap = &iso8859_6 +var ISO8859_6 encoding.Encoding = &iso8859_6 -var iso8859_6 = Charmap{ +var iso8859_6 = charmap{ name: "ISO 8859-6", mib: identifier.ISOLatinArabic, asciiSuperset: true, @@ -3333,9 +2808,9 @@ var iso8859_6 = Charmap{ } // ISO8859_7 is the ISO 8859-7 encoding. -var ISO8859_7 *Charmap = &iso8859_7 +var ISO8859_7 encoding.Encoding = &iso8859_7 -var iso8859_7 = Charmap{ +var iso8859_7 = charmap{ name: "ISO 8859-7", mib: identifier.ISOLatinGreek, asciiSuperset: true, @@ -3508,9 +2983,9 @@ var iso8859_7 = Charmap{ } // ISO8859_8 is the ISO 8859-8 encoding. -var ISO8859_8 *Charmap = &iso8859_8 +var ISO8859_8 encoding.Encoding = &iso8859_8 -var iso8859_8 = Charmap{ +var iso8859_8 = charmap{ name: "ISO 8859-8", mib: identifier.ISOLatinHebrew, asciiSuperset: true, @@ -3682,185 +3157,10 @@ var iso8859_8 = Charmap{ }, } -// ISO8859_9 is the ISO 8859-9 encoding. -var ISO8859_9 *Charmap = &iso8859_9 - -var iso8859_9 = Charmap{ - name: "ISO 8859-9", - mib: identifier.ISOLatin5, - asciiSuperset: true, - low: 0x80, - replacement: 0x1a, - decode: [256]utf8Enc{ - {1, [3]byte{0x00, 0x00, 0x00}}, {1, [3]byte{0x01, 0x00, 0x00}}, - {1, [3]byte{0x02, 0x00, 0x00}}, {1, [3]byte{0x03, 0x00, 0x00}}, - {1, [3]byte{0x04, 0x00, 0x00}}, {1, [3]byte{0x05, 0x00, 0x00}}, - {1, [3]byte{0x06, 0x00, 0x00}}, {1, [3]byte{0x07, 0x00, 0x00}}, - {1, [3]byte{0x08, 0x00, 0x00}}, {1, [3]byte{0x09, 0x00, 0x00}}, - {1, [3]byte{0x0a, 0x00, 0x00}}, {1, [3]byte{0x0b, 0x00, 0x00}}, - {1, [3]byte{0x0c, 0x00, 0x00}}, {1, [3]byte{0x0d, 0x00, 0x00}}, - {1, [3]byte{0x0e, 0x00, 0x00}}, {1, [3]byte{0x0f, 0x00, 0x00}}, - {1, [3]byte{0x10, 0x00, 0x00}}, {1, [3]byte{0x11, 0x00, 0x00}}, - {1, [3]byte{0x12, 0x00, 0x00}}, {1, [3]byte{0x13, 0x00, 0x00}}, - {1, [3]byte{0x14, 0x00, 0x00}}, {1, [3]byte{0x15, 0x00, 0x00}}, - {1, [3]byte{0x16, 0x00, 0x00}}, {1, [3]byte{0x17, 0x00, 0x00}}, - {1, [3]byte{0x18, 0x00, 0x00}}, {1, [3]byte{0x19, 0x00, 0x00}}, - {1, [3]byte{0x1a, 0x00, 0x00}}, {1, [3]byte{0x1b, 0x00, 0x00}}, - {1, [3]byte{0x1c, 0x00, 0x00}}, {1, [3]byte{0x1d, 0x00, 0x00}}, - {1, [3]byte{0x1e, 0x00, 0x00}}, {1, [3]byte{0x1f, 0x00, 0x00}}, - {1, [3]byte{0x20, 0x00, 0x00}}, {1, [3]byte{0x21, 0x00, 0x00}}, - {1, [3]byte{0x22, 0x00, 0x00}}, {1, [3]byte{0x23, 0x00, 0x00}}, - {1, [3]byte{0x24, 0x00, 0x00}}, {1, [3]byte{0x25, 0x00, 0x00}}, - {1, [3]byte{0x26, 0x00, 0x00}}, {1, [3]byte{0x27, 0x00, 0x00}}, - {1, [3]byte{0x28, 0x00, 0x00}}, {1, [3]byte{0x29, 0x00, 0x00}}, - {1, [3]byte{0x2a, 0x00, 0x00}}, {1, [3]byte{0x2b, 0x00, 0x00}}, - {1, [3]byte{0x2c, 0x00, 0x00}}, {1, [3]byte{0x2d, 0x00, 0x00}}, - {1, [3]byte{0x2e, 0x00, 0x00}}, {1, [3]byte{0x2f, 0x00, 0x00}}, - {1, [3]byte{0x30, 0x00, 0x00}}, {1, [3]byte{0x31, 0x00, 0x00}}, - {1, [3]byte{0x32, 0x00, 0x00}}, {1, [3]byte{0x33, 0x00, 0x00}}, - {1, [3]byte{0x34, 0x00, 0x00}}, {1, [3]byte{0x35, 0x00, 0x00}}, - {1, [3]byte{0x36, 0x00, 0x00}}, {1, [3]byte{0x37, 0x00, 0x00}}, - {1, [3]byte{0x38, 0x00, 0x00}}, {1, [3]byte{0x39, 0x00, 0x00}}, - {1, [3]byte{0x3a, 0x00, 0x00}}, {1, [3]byte{0x3b, 0x00, 0x00}}, - {1, [3]byte{0x3c, 0x00, 0x00}}, {1, [3]byte{0x3d, 0x00, 0x00}}, - {1, [3]byte{0x3e, 0x00, 0x00}}, {1, [3]byte{0x3f, 0x00, 0x00}}, - {1, [3]byte{0x40, 0x00, 0x00}}, {1, [3]byte{0x41, 0x00, 0x00}}, - {1, [3]byte{0x42, 0x00, 0x00}}, {1, [3]byte{0x43, 0x00, 0x00}}, - {1, [3]byte{0x44, 0x00, 0x00}}, {1, [3]byte{0x45, 0x00, 0x00}}, - {1, [3]byte{0x46, 0x00, 0x00}}, {1, [3]byte{0x47, 0x00, 0x00}}, - {1, [3]byte{0x48, 0x00, 0x00}}, {1, [3]byte{0x49, 0x00, 0x00}}, - {1, [3]byte{0x4a, 0x00, 0x00}}, {1, [3]byte{0x4b, 0x00, 0x00}}, - {1, [3]byte{0x4c, 0x00, 0x00}}, {1, [3]byte{0x4d, 0x00, 0x00}}, - {1, [3]byte{0x4e, 0x00, 0x00}}, {1, [3]byte{0x4f, 0x00, 0x00}}, - {1, [3]byte{0x50, 0x00, 0x00}}, {1, [3]byte{0x51, 0x00, 0x00}}, - {1, [3]byte{0x52, 0x00, 0x00}}, {1, [3]byte{0x53, 0x00, 0x00}}, - {1, [3]byte{0x54, 0x00, 0x00}}, {1, [3]byte{0x55, 0x00, 0x00}}, - {1, [3]byte{0x56, 0x00, 0x00}}, {1, [3]byte{0x57, 0x00, 0x00}}, - {1, [3]byte{0x58, 0x00, 0x00}}, {1, [3]byte{0x59, 0x00, 0x00}}, - {1, [3]byte{0x5a, 0x00, 0x00}}, {1, [3]byte{0x5b, 0x00, 0x00}}, - {1, [3]byte{0x5c, 0x00, 0x00}}, {1, [3]byte{0x5d, 0x00, 0x00}}, - {1, [3]byte{0x5e, 0x00, 0x00}}, {1, [3]byte{0x5f, 0x00, 0x00}}, - {1, [3]byte{0x60, 0x00, 0x00}}, {1, [3]byte{0x61, 0x00, 0x00}}, - {1, [3]byte{0x62, 0x00, 0x00}}, {1, [3]byte{0x63, 0x00, 0x00}}, - {1, [3]byte{0x64, 0x00, 0x00}}, {1, [3]byte{0x65, 0x00, 0x00}}, - {1, [3]byte{0x66, 0x00, 0x00}}, {1, [3]byte{0x67, 0x00, 0x00}}, - {1, [3]byte{0x68, 0x00, 0x00}}, {1, [3]byte{0x69, 0x00, 0x00}}, - {1, [3]byte{0x6a, 0x00, 0x00}}, {1, [3]byte{0x6b, 0x00, 0x00}}, - {1, [3]byte{0x6c, 0x00, 0x00}}, {1, [3]byte{0x6d, 0x00, 0x00}}, - {1, [3]byte{0x6e, 0x00, 0x00}}, {1, [3]byte{0x6f, 0x00, 0x00}}, - {1, [3]byte{0x70, 0x00, 0x00}}, {1, [3]byte{0x71, 0x00, 0x00}}, - {1, [3]byte{0x72, 0x00, 0x00}}, {1, [3]byte{0x73, 0x00, 0x00}}, - {1, [3]byte{0x74, 0x00, 0x00}}, {1, [3]byte{0x75, 0x00, 0x00}}, - {1, [3]byte{0x76, 0x00, 0x00}}, {1, [3]byte{0x77, 0x00, 0x00}}, - {1, [3]byte{0x78, 0x00, 0x00}}, {1, [3]byte{0x79, 0x00, 0x00}}, - {1, [3]byte{0x7a, 0x00, 0x00}}, {1, [3]byte{0x7b, 0x00, 0x00}}, - {1, [3]byte{0x7c, 0x00, 0x00}}, {1, [3]byte{0x7d, 0x00, 0x00}}, - {1, [3]byte{0x7e, 0x00, 0x00}}, {1, [3]byte{0x7f, 0x00, 0x00}}, - {2, [3]byte{0xc2, 0x80, 0x00}}, {2, [3]byte{0xc2, 0x81, 0x00}}, - {2, [3]byte{0xc2, 0x82, 0x00}}, {2, [3]byte{0xc2, 0x83, 0x00}}, - {2, [3]byte{0xc2, 0x84, 0x00}}, {2, [3]byte{0xc2, 0x85, 0x00}}, - {2, [3]byte{0xc2, 0x86, 0x00}}, {2, [3]byte{0xc2, 0x87, 0x00}}, - {2, [3]byte{0xc2, 0x88, 0x00}}, {2, [3]byte{0xc2, 0x89, 0x00}}, - {2, [3]byte{0xc2, 0x8a, 0x00}}, {2, [3]byte{0xc2, 0x8b, 0x00}}, - {2, [3]byte{0xc2, 0x8c, 0x00}}, {2, [3]byte{0xc2, 0x8d, 0x00}}, - {2, [3]byte{0xc2, 0x8e, 0x00}}, {2, [3]byte{0xc2, 0x8f, 0x00}}, - {2, [3]byte{0xc2, 0x90, 0x00}}, {2, [3]byte{0xc2, 0x91, 0x00}}, - {2, [3]byte{0xc2, 0x92, 0x00}}, {2, [3]byte{0xc2, 0x93, 0x00}}, - {2, [3]byte{0xc2, 0x94, 0x00}}, {2, [3]byte{0xc2, 0x95, 0x00}}, - {2, [3]byte{0xc2, 0x96, 0x00}}, {2, [3]byte{0xc2, 0x97, 0x00}}, - {2, [3]byte{0xc2, 0x98, 0x00}}, {2, [3]byte{0xc2, 0x99, 0x00}}, - {2, [3]byte{0xc2, 0x9a, 0x00}}, {2, [3]byte{0xc2, 0x9b, 0x00}}, - {2, [3]byte{0xc2, 0x9c, 0x00}}, {2, [3]byte{0xc2, 0x9d, 0x00}}, - {2, [3]byte{0xc2, 0x9e, 0x00}}, {2, [3]byte{0xc2, 0x9f, 0x00}}, - {2, [3]byte{0xc2, 0xa0, 0x00}}, {2, [3]byte{0xc2, 0xa1, 0x00}}, - {2, [3]byte{0xc2, 0xa2, 0x00}}, {2, [3]byte{0xc2, 0xa3, 0x00}}, - {2, [3]byte{0xc2, 0xa4, 0x00}}, {2, [3]byte{0xc2, 0xa5, 0x00}}, - {2, [3]byte{0xc2, 0xa6, 0x00}}, {2, [3]byte{0xc2, 0xa7, 0x00}}, - {2, [3]byte{0xc2, 0xa8, 0x00}}, {2, [3]byte{0xc2, 0xa9, 0x00}}, - {2, [3]byte{0xc2, 0xaa, 0x00}}, {2, [3]byte{0xc2, 0xab, 0x00}}, - {2, [3]byte{0xc2, 0xac, 0x00}}, {2, [3]byte{0xc2, 0xad, 0x00}}, - {2, [3]byte{0xc2, 0xae, 0x00}}, {2, [3]byte{0xc2, 0xaf, 0x00}}, - {2, [3]byte{0xc2, 0xb0, 0x00}}, {2, [3]byte{0xc2, 0xb1, 0x00}}, - {2, [3]byte{0xc2, 0xb2, 0x00}}, {2, [3]byte{0xc2, 0xb3, 0x00}}, - {2, [3]byte{0xc2, 0xb4, 0x00}}, {2, [3]byte{0xc2, 0xb5, 0x00}}, - {2, [3]byte{0xc2, 0xb6, 0x00}}, {2, [3]byte{0xc2, 0xb7, 0x00}}, - {2, [3]byte{0xc2, 0xb8, 0x00}}, {2, [3]byte{0xc2, 0xb9, 0x00}}, - {2, [3]byte{0xc2, 0xba, 0x00}}, {2, [3]byte{0xc2, 0xbb, 0x00}}, - {2, [3]byte{0xc2, 0xbc, 0x00}}, {2, [3]byte{0xc2, 0xbd, 0x00}}, - {2, [3]byte{0xc2, 0xbe, 0x00}}, {2, [3]byte{0xc2, 0xbf, 0x00}}, - {2, [3]byte{0xc3, 0x80, 0x00}}, {2, [3]byte{0xc3, 0x81, 0x00}}, - {2, [3]byte{0xc3, 0x82, 0x00}}, {2, [3]byte{0xc3, 0x83, 0x00}}, - {2, [3]byte{0xc3, 0x84, 0x00}}, {2, [3]byte{0xc3, 0x85, 0x00}}, - {2, [3]byte{0xc3, 0x86, 0x00}}, {2, [3]byte{0xc3, 0x87, 0x00}}, - {2, [3]byte{0xc3, 0x88, 0x00}}, {2, [3]byte{0xc3, 0x89, 0x00}}, - {2, [3]byte{0xc3, 0x8a, 0x00}}, {2, [3]byte{0xc3, 0x8b, 0x00}}, - {2, [3]byte{0xc3, 0x8c, 0x00}}, {2, [3]byte{0xc3, 0x8d, 0x00}}, - {2, [3]byte{0xc3, 0x8e, 0x00}}, {2, [3]byte{0xc3, 0x8f, 0x00}}, - {2, [3]byte{0xc4, 0x9e, 0x00}}, {2, [3]byte{0xc3, 0x91, 0x00}}, - {2, [3]byte{0xc3, 0x92, 0x00}}, {2, [3]byte{0xc3, 0x93, 0x00}}, - {2, [3]byte{0xc3, 0x94, 0x00}}, {2, [3]byte{0xc3, 0x95, 0x00}}, - {2, [3]byte{0xc3, 0x96, 0x00}}, {2, [3]byte{0xc3, 0x97, 0x00}}, - {2, [3]byte{0xc3, 0x98, 0x00}}, {2, [3]byte{0xc3, 0x99, 0x00}}, - {2, [3]byte{0xc3, 0x9a, 0x00}}, {2, [3]byte{0xc3, 0x9b, 0x00}}, - {2, [3]byte{0xc3, 0x9c, 0x00}}, {2, [3]byte{0xc4, 0xb0, 0x00}}, - {2, [3]byte{0xc5, 0x9e, 0x00}}, {2, [3]byte{0xc3, 0x9f, 0x00}}, - {2, [3]byte{0xc3, 0xa0, 0x00}}, {2, [3]byte{0xc3, 0xa1, 0x00}}, - {2, [3]byte{0xc3, 0xa2, 0x00}}, {2, [3]byte{0xc3, 0xa3, 0x00}}, - {2, [3]byte{0xc3, 0xa4, 0x00}}, {2, [3]byte{0xc3, 0xa5, 0x00}}, - {2, [3]byte{0xc3, 0xa6, 0x00}}, {2, [3]byte{0xc3, 0xa7, 0x00}}, - {2, [3]byte{0xc3, 0xa8, 0x00}}, {2, [3]byte{0xc3, 0xa9, 0x00}}, - {2, [3]byte{0xc3, 0xaa, 0x00}}, {2, [3]byte{0xc3, 0xab, 0x00}}, - {2, [3]byte{0xc3, 0xac, 0x00}}, {2, [3]byte{0xc3, 0xad, 0x00}}, - {2, [3]byte{0xc3, 0xae, 0x00}}, {2, [3]byte{0xc3, 0xaf, 0x00}}, - {2, [3]byte{0xc4, 0x9f, 0x00}}, {2, [3]byte{0xc3, 0xb1, 0x00}}, - {2, [3]byte{0xc3, 0xb2, 0x00}}, {2, [3]byte{0xc3, 0xb3, 0x00}}, - {2, [3]byte{0xc3, 0xb4, 0x00}}, {2, [3]byte{0xc3, 0xb5, 0x00}}, - {2, [3]byte{0xc3, 0xb6, 0x00}}, {2, [3]byte{0xc3, 0xb7, 0x00}}, - {2, [3]byte{0xc3, 0xb8, 0x00}}, {2, [3]byte{0xc3, 0xb9, 0x00}}, - {2, [3]byte{0xc3, 0xba, 0x00}}, {2, [3]byte{0xc3, 0xbb, 0x00}}, - {2, [3]byte{0xc3, 0xbc, 0x00}}, {2, [3]byte{0xc4, 0xb1, 0x00}}, - {2, [3]byte{0xc5, 0x9f, 0x00}}, {2, [3]byte{0xc3, 0xbf, 0x00}}, - }, - encode: [256]uint32{ - 0x00000000, 0x01000001, 0x02000002, 0x03000003, 0x04000004, 0x05000005, 0x06000006, 0x07000007, - 0x08000008, 0x09000009, 0x0a00000a, 0x0b00000b, 0x0c00000c, 0x0d00000d, 0x0e00000e, 0x0f00000f, - 0x10000010, 0x11000011, 0x12000012, 0x13000013, 0x14000014, 0x15000015, 0x16000016, 0x17000017, - 0x18000018, 0x19000019, 0x1a00001a, 0x1b00001b, 0x1c00001c, 0x1d00001d, 0x1e00001e, 0x1f00001f, - 0x20000020, 0x21000021, 0x22000022, 0x23000023, 0x24000024, 0x25000025, 0x26000026, 0x27000027, - 0x28000028, 0x29000029, 0x2a00002a, 0x2b00002b, 0x2c00002c, 0x2d00002d, 0x2e00002e, 0x2f00002f, - 0x30000030, 0x31000031, 0x32000032, 0x33000033, 0x34000034, 0x35000035, 0x36000036, 0x37000037, - 0x38000038, 0x39000039, 0x3a00003a, 0x3b00003b, 0x3c00003c, 0x3d00003d, 0x3e00003e, 0x3f00003f, - 0x40000040, 0x41000041, 0x42000042, 0x43000043, 0x44000044, 0x45000045, 0x46000046, 0x47000047, - 0x48000048, 0x49000049, 0x4a00004a, 0x4b00004b, 0x4c00004c, 0x4d00004d, 0x4e00004e, 0x4f00004f, - 0x50000050, 0x51000051, 0x52000052, 0x53000053, 0x54000054, 0x55000055, 0x56000056, 0x57000057, - 0x58000058, 0x59000059, 0x5a00005a, 0x5b00005b, 0x5c00005c, 0x5d00005d, 0x5e00005e, 0x5f00005f, - 0x60000060, 0x61000061, 0x62000062, 0x63000063, 0x64000064, 0x65000065, 0x66000066, 0x67000067, - 0x68000068, 0x69000069, 0x6a00006a, 0x6b00006b, 0x6c00006c, 0x6d00006d, 0x6e00006e, 0x6f00006f, - 0x70000070, 0x71000071, 0x72000072, 0x73000073, 0x74000074, 0x75000075, 0x76000076, 0x77000077, - 0x78000078, 0x79000079, 0x7a00007a, 0x7b00007b, 0x7c00007c, 0x7d00007d, 0x7e00007e, 0x7f00007f, - 0x80000080, 0x81000081, 0x82000082, 0x83000083, 0x84000084, 0x85000085, 0x86000086, 0x87000087, - 0x88000088, 0x89000089, 0x8a00008a, 0x8b00008b, 0x8c00008c, 0x8d00008d, 0x8e00008e, 0x8f00008f, - 0x90000090, 0x91000091, 0x92000092, 0x93000093, 0x94000094, 0x95000095, 0x96000096, 0x97000097, - 0x98000098, 0x99000099, 0x9a00009a, 0x9b00009b, 0x9c00009c, 0x9d00009d, 0x9e00009e, 0x9f00009f, - 0xa00000a0, 0xa10000a1, 0xa20000a2, 0xa30000a3, 0xa40000a4, 0xa50000a5, 0xa60000a6, 0xa70000a7, - 0xa80000a8, 0xa90000a9, 0xaa0000aa, 0xab0000ab, 0xac0000ac, 0xad0000ad, 0xae0000ae, 0xaf0000af, - 0xb00000b0, 0xb10000b1, 0xb20000b2, 0xb30000b3, 0xb40000b4, 0xb50000b5, 0xb60000b6, 0xb70000b7, - 0xb80000b8, 0xb90000b9, 0xba0000ba, 0xbb0000bb, 0xbc0000bc, 0xbd0000bd, 0xbe0000be, 0xbf0000bf, - 0xc00000c0, 0xc10000c1, 0xc20000c2, 0xc30000c3, 0xc40000c4, 0xc50000c5, 0xc60000c6, 0xc70000c7, - 0xc80000c8, 0xc90000c9, 0xca0000ca, 0xcb0000cb, 0xcc0000cc, 0xcd0000cd, 0xce0000ce, 0xcf0000cf, - 0xd10000d1, 0xd20000d2, 0xd30000d3, 0xd40000d4, 0xd50000d5, 0xd60000d6, 0xd70000d7, 0xd80000d8, - 0xd90000d9, 0xda0000da, 0xdb0000db, 0xdc0000dc, 0xdf0000df, 0xe00000e0, 0xe10000e1, 0xe20000e2, - 0xe30000e3, 0xe40000e4, 0xe50000e5, 0xe60000e6, 0xe70000e7, 0xe80000e8, 0xe90000e9, 0xea0000ea, - 0xeb0000eb, 0xec0000ec, 0xed0000ed, 0xee0000ee, 0xef0000ef, 0xf10000f1, 0xf20000f2, 0xf30000f3, - 0xf40000f4, 0xf50000f5, 0xf60000f6, 0xf70000f7, 0xf80000f8, 0xf90000f9, 0xfa0000fa, 0xfb0000fb, - 0xfc0000fc, 0xff0000ff, 0xd000011e, 0xf000011f, 0xdd000130, 0xfd000131, 0xde00015e, 0xfe00015f, - }, -} - // ISO8859_10 is the ISO 8859-10 encoding. -var ISO8859_10 *Charmap = &iso8859_10 +var ISO8859_10 encoding.Encoding = &iso8859_10 -var iso8859_10 = Charmap{ +var iso8859_10 = charmap{ name: "ISO 8859-10", mib: identifier.ISOLatin6, asciiSuperset: true, @@ -4033,9 +3333,9 @@ var iso8859_10 = Charmap{ } // ISO8859_13 is the ISO 8859-13 encoding. -var ISO8859_13 *Charmap = &iso8859_13 +var ISO8859_13 encoding.Encoding = &iso8859_13 -var iso8859_13 = Charmap{ +var iso8859_13 = charmap{ name: "ISO 8859-13", mib: identifier.ISO885913, asciiSuperset: true, @@ -4208,9 +3508,9 @@ var iso8859_13 = Charmap{ } // ISO8859_14 is the ISO 8859-14 encoding. -var ISO8859_14 *Charmap = &iso8859_14 +var ISO8859_14 encoding.Encoding = &iso8859_14 -var iso8859_14 = Charmap{ +var iso8859_14 = charmap{ name: "ISO 8859-14", mib: identifier.ISO885914, asciiSuperset: true, @@ -4383,9 +3683,9 @@ var iso8859_14 = Charmap{ } // ISO8859_15 is the ISO 8859-15 encoding. -var ISO8859_15 *Charmap = &iso8859_15 +var ISO8859_15 encoding.Encoding = &iso8859_15 -var iso8859_15 = Charmap{ +var iso8859_15 = charmap{ name: "ISO 8859-15", mib: identifier.ISO885915, asciiSuperset: true, @@ -4558,9 +3858,9 @@ var iso8859_15 = Charmap{ } // ISO8859_16 is the ISO 8859-16 encoding. -var ISO8859_16 *Charmap = &iso8859_16 +var ISO8859_16 encoding.Encoding = &iso8859_16 -var iso8859_16 = Charmap{ +var iso8859_16 = charmap{ name: "ISO 8859-16", mib: identifier.ISO885916, asciiSuperset: true, @@ -4733,9 +4033,9 @@ var iso8859_16 = Charmap{ } // KOI8R is the KOI8-R encoding. -var KOI8R *Charmap = &koi8R +var KOI8R encoding.Encoding = &koi8R -var koi8R = Charmap{ +var koi8R = charmap{ name: "KOI8-R", mib: identifier.KOI8R, asciiSuperset: true, @@ -4908,9 +4208,9 @@ var koi8R = Charmap{ } // KOI8U is the KOI8-U encoding. -var KOI8U *Charmap = &koi8U +var KOI8U encoding.Encoding = &koi8U -var koi8U = Charmap{ +var koi8U = charmap{ name: "KOI8-U", mib: identifier.KOI8U, asciiSuperset: true, @@ -5083,9 +4383,9 @@ var koi8U = Charmap{ } // Macintosh is the Macintosh encoding. -var Macintosh *Charmap = &macintosh +var Macintosh encoding.Encoding = &macintosh -var macintosh = Charmap{ +var macintosh = charmap{ name: "Macintosh", mib: identifier.Macintosh, asciiSuperset: true, @@ -5258,9 +4558,9 @@ var macintosh = Charmap{ } // MacintoshCyrillic is the Macintosh Cyrillic encoding. -var MacintoshCyrillic *Charmap = &macintoshCyrillic +var MacintoshCyrillic encoding.Encoding = &macintoshCyrillic -var macintoshCyrillic = Charmap{ +var macintoshCyrillic = charmap{ name: "Macintosh Cyrillic", mib: identifier.MacintoshCyrillic, asciiSuperset: true, @@ -5433,9 +4733,9 @@ var macintoshCyrillic = Charmap{ } // Windows874 is the Windows 874 encoding. -var Windows874 *Charmap = &windows874 +var Windows874 encoding.Encoding = &windows874 -var windows874 = Charmap{ +var windows874 = charmap{ name: "Windows 874", mib: identifier.Windows874, asciiSuperset: true, @@ -5608,9 +4908,9 @@ var windows874 = Charmap{ } // Windows1250 is the Windows 1250 encoding. -var Windows1250 *Charmap = &windows1250 +var Windows1250 encoding.Encoding = &windows1250 -var windows1250 = Charmap{ +var windows1250 = charmap{ name: "Windows 1250", mib: identifier.Windows1250, asciiSuperset: true, @@ -5783,9 +5083,9 @@ var windows1250 = Charmap{ } // Windows1251 is the Windows 1251 encoding. -var Windows1251 *Charmap = &windows1251 +var Windows1251 encoding.Encoding = &windows1251 -var windows1251 = Charmap{ +var windows1251 = charmap{ name: "Windows 1251", mib: identifier.Windows1251, asciiSuperset: true, @@ -5958,9 +5258,9 @@ var windows1251 = Charmap{ } // Windows1252 is the Windows 1252 encoding. -var Windows1252 *Charmap = &windows1252 +var Windows1252 encoding.Encoding = &windows1252 -var windows1252 = Charmap{ +var windows1252 = charmap{ name: "Windows 1252", mib: identifier.Windows1252, asciiSuperset: true, @@ -6133,9 +5433,9 @@ var windows1252 = Charmap{ } // Windows1253 is the Windows 1253 encoding. -var Windows1253 *Charmap = &windows1253 +var Windows1253 encoding.Encoding = &windows1253 -var windows1253 = Charmap{ +var windows1253 = charmap{ name: "Windows 1253", mib: identifier.Windows1253, asciiSuperset: true, @@ -6308,9 +5608,9 @@ var windows1253 = Charmap{ } // Windows1254 is the Windows 1254 encoding. -var Windows1254 *Charmap = &windows1254 +var Windows1254 encoding.Encoding = &windows1254 -var windows1254 = Charmap{ +var windows1254 = charmap{ name: "Windows 1254", mib: identifier.Windows1254, asciiSuperset: true, @@ -6483,9 +5783,9 @@ var windows1254 = Charmap{ } // Windows1255 is the Windows 1255 encoding. -var Windows1255 *Charmap = &windows1255 +var Windows1255 encoding.Encoding = &windows1255 -var windows1255 = Charmap{ +var windows1255 = charmap{ name: "Windows 1255", mib: identifier.Windows1255, asciiSuperset: true, @@ -6593,7 +5893,7 @@ var windows1255 = Charmap{ {2, [3]byte{0xd6, 0xb4, 0x00}}, {2, [3]byte{0xd6, 0xb5, 0x00}}, {2, [3]byte{0xd6, 0xb6, 0x00}}, {2, [3]byte{0xd6, 0xb7, 0x00}}, {2, [3]byte{0xd6, 0xb8, 0x00}}, {2, [3]byte{0xd6, 0xb9, 0x00}}, - {2, [3]byte{0xd6, 0xba, 0x00}}, {2, [3]byte{0xd6, 0xbb, 0x00}}, + {3, [3]byte{0xef, 0xbf, 0xbd}}, {2, [3]byte{0xd6, 0xbb, 0x00}}, {2, [3]byte{0xd6, 0xbc, 0x00}}, {2, [3]byte{0xd6, 0xbd, 0x00}}, {2, [3]byte{0xd6, 0xbe, 0x00}}, {2, [3]byte{0xd6, 0xbf, 0x00}}, {2, [3]byte{0xd7, 0x80, 0x00}}, {2, [3]byte{0xd7, 0x81, 0x00}}, @@ -6643,24 +5943,24 @@ var windows1255 = Charmap{ 0xb20000b2, 0xb30000b3, 0xb40000b4, 0xb50000b5, 0xb60000b6, 0xb70000b7, 0xb80000b8, 0xb90000b9, 0xbb0000bb, 0xbc0000bc, 0xbd0000bd, 0xbe0000be, 0xbf0000bf, 0xaa0000d7, 0xba0000f7, 0x83000192, 0x880002c6, 0x980002dc, 0xc00005b0, 0xc10005b1, 0xc20005b2, 0xc30005b3, 0xc40005b4, 0xc50005b5, - 0xc60005b6, 0xc70005b7, 0xc80005b8, 0xc90005b9, 0xca0005ba, 0xcb0005bb, 0xcc0005bc, 0xcd0005bd, - 0xce0005be, 0xcf0005bf, 0xd00005c0, 0xd10005c1, 0xd20005c2, 0xd30005c3, 0xe00005d0, 0xe10005d1, - 0xe20005d2, 0xe30005d3, 0xe40005d4, 0xe50005d5, 0xe60005d6, 0xe70005d7, 0xe80005d8, 0xe90005d9, - 0xea0005da, 0xeb0005db, 0xec0005dc, 0xed0005dd, 0xee0005de, 0xef0005df, 0xf00005e0, 0xf10005e1, - 0xf20005e2, 0xf30005e3, 0xf40005e4, 0xf50005e5, 0xf60005e6, 0xf70005e7, 0xf80005e8, 0xf90005e9, - 0xfa0005ea, 0xd40005f0, 0xd50005f1, 0xd60005f2, 0xd70005f3, 0xd80005f4, 0xfd00200e, 0xfe00200f, - 0x96002013, 0x97002014, 0x91002018, 0x92002019, 0x8200201a, 0x9300201c, 0x9400201d, 0x8400201e, - 0x86002020, 0x87002021, 0x95002022, 0x85002026, 0x89002030, 0x8b002039, 0x9b00203a, 0xa40020aa, - 0x800020ac, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, + 0xc60005b6, 0xc70005b7, 0xc80005b8, 0xc90005b9, 0xcb0005bb, 0xcc0005bc, 0xcd0005bd, 0xce0005be, + 0xcf0005bf, 0xd00005c0, 0xd10005c1, 0xd20005c2, 0xd30005c3, 0xe00005d0, 0xe10005d1, 0xe20005d2, + 0xe30005d3, 0xe40005d4, 0xe50005d5, 0xe60005d6, 0xe70005d7, 0xe80005d8, 0xe90005d9, 0xea0005da, + 0xeb0005db, 0xec0005dc, 0xed0005dd, 0xee0005de, 0xef0005df, 0xf00005e0, 0xf10005e1, 0xf20005e2, + 0xf30005e3, 0xf40005e4, 0xf50005e5, 0xf60005e6, 0xf70005e7, 0xf80005e8, 0xf90005e9, 0xfa0005ea, + 0xd40005f0, 0xd50005f1, 0xd60005f2, 0xd70005f3, 0xd80005f4, 0xfd00200e, 0xfe00200f, 0x96002013, + 0x97002014, 0x91002018, 0x92002019, 0x8200201a, 0x9300201c, 0x9400201d, 0x8400201e, 0x86002020, + 0x87002021, 0x95002022, 0x85002026, 0x89002030, 0x8b002039, 0x9b00203a, 0xa40020aa, 0x800020ac, + 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, }, } // Windows1256 is the Windows 1256 encoding. -var Windows1256 *Charmap = &windows1256 +var Windows1256 encoding.Encoding = &windows1256 -var windows1256 = Charmap{ +var windows1256 = charmap{ name: "Windows 1256", mib: identifier.Windows1256, asciiSuperset: true, @@ -6833,9 +6133,9 @@ var windows1256 = Charmap{ } // Windows1257 is the Windows 1257 encoding. -var Windows1257 *Charmap = &windows1257 +var Windows1257 encoding.Encoding = &windows1257 -var windows1257 = Charmap{ +var windows1257 = charmap{ name: "Windows 1257", mib: identifier.Windows1257, asciiSuperset: true, @@ -7008,9 +6308,9 @@ var windows1257 = Charmap{ } // Windows1258 is the Windows 1258 encoding. -var Windows1258 *Charmap = &windows1258 +var Windows1258 encoding.Encoding = &windows1258 -var windows1258 = Charmap{ +var windows1258 = charmap{ name: "Windows 1258", mib: identifier.Windows1258, asciiSuperset: true, @@ -7185,9 +6485,9 @@ var windows1258 = Charmap{ // XUserDefined is the X-User-Defined encoding. // // It is defined at http://encoding.spec.whatwg.org/#x-user-defined -var XUserDefined *Charmap = &xUserDefined +var XUserDefined encoding.Encoding = &xUserDefined -var xUserDefined = Charmap{ +var xUserDefined = charmap{ name: "X-User-Defined", mib: identifier.XUserDefined, asciiSuperset: true, @@ -7359,7 +6659,6 @@ var xUserDefined = Charmap{ }, } var listAll = []encoding.Encoding{ - CodePage037, CodePage437, CodePage850, CodePage852, @@ -7370,8 +6669,6 @@ var listAll = []encoding.Encoding{ CodePage863, CodePage865, CodePage866, - CodePage1047, - CodePage1140, ISO8859_1, ISO8859_2, ISO8859_3, @@ -7384,7 +6681,6 @@ var listAll = []encoding.Encoding{ ISO8859_8, ISO8859_8E, ISO8859_8I, - ISO8859_9, ISO8859_10, ISO8859_13, ISO8859_14, @@ -7407,4 +6703,4 @@ var listAll = []encoding.Encoding{ XUserDefined, } -// Total table size 87024 bytes (84KiB); checksum: 811C9DC5 +// Total table size 78736 bytes (76KiB); checksum: 811C9DC5 diff --git a/vendor/golang.org/x/text/encoding/encoding_test.go b/vendor/golang.org/x/text/encoding/encoding_test.go index 1738147..0cf203f 100644 --- a/vendor/golang.org/x/text/encoding/encoding_test.go +++ b/vendor/golang.org/x/text/encoding/encoding_test.go @@ -5,15 +5,453 @@ package encoding_test import ( + "bytes" + "fmt" + "io" "io/ioutil" "strings" "testing" "golang.org/x/text/encoding" "golang.org/x/text/encoding/charmap" + "golang.org/x/text/encoding/japanese" + "golang.org/x/text/encoding/korean" + "golang.org/x/text/encoding/simplifiedchinese" + "golang.org/x/text/encoding/traditionalchinese" + "golang.org/x/text/encoding/unicode" + "golang.org/x/text/encoding/unicode/utf32" "golang.org/x/text/transform" ) +func trim(s string) string { + if len(s) < 120 { + return s + } + return s[:50] + "..." + s[len(s)-50:] +} + +var basicTestCases = []struct { + e encoding.Encoding + encPrefix string + encSuffix string + encoded string + utf8 string +}{ + // The encoded forms can be verified by the iconv program: + // $ echo 月日は百代 | iconv -f UTF-8 -t SHIFT-JIS | xxd + + // Charmap tests. + { + e: charmap.CodePage437, + encoded: "H\x82ll\x93 \x9d\xa7\xf4\x9c\xbe", + utf8: "Héllô ¥º⌠£╛", + }, + { + e: charmap.CodePage866, + encoded: "H\xf3\xd3o \x98\xfd\x9f\xdd\xa1", + utf8: "Hє╙o Ш¤Я▌б", + }, + { + e: charmap.ISO8859_2, + encoded: "Hel\xe5\xf5", + utf8: "Helĺő", + }, + { + e: charmap.ISO8859_3, + encoded: "He\xbd\xd4", + utf8: "He½Ô", + }, + { + e: charmap.ISO8859_4, + encoded: "Hel\xb6\xf8", + utf8: "Helļø", + }, + { + e: charmap.ISO8859_5, + encoded: "H\xd7\xc6o", + utf8: "HзЦo", + }, + { + e: charmap.ISO8859_6, + encoded: "Hel\xc2\xc9", + utf8: "Helآة", + }, + { + e: charmap.ISO8859_7, + encoded: "H\xeel\xebo", + utf8: "Hξlλo", + }, + { + e: charmap.ISO8859_8, + encoded: "Hel\xf5\xed", + utf8: "Helץם", + }, + { + e: charmap.ISO8859_10, + encoded: "H\xea\xbfo", + utf8: "Hęŋo", + }, + { + e: charmap.ISO8859_13, + encoded: "H\xe6l\xf9o", + utf8: "Hęlło", + }, + { + e: charmap.ISO8859_14, + encoded: "He\xfe\xd0o", + utf8: "HeŷŴo", + }, + { + e: charmap.ISO8859_15, + encoded: "H\xa4ll\xd8", + utf8: "H€llØ", + }, + { + e: charmap.ISO8859_16, + encoded: "H\xe6ll\xbd", + utf8: "Hællœ", + }, + { + e: charmap.KOI8R, + encoded: "He\x93\xad\x9c", + utf8: "He⌠╜°", + }, + { + e: charmap.KOI8U, + encoded: "He\x93\xad\x9c", + utf8: "He⌠ґ°", + }, + { + e: charmap.Macintosh, + encoded: "He\xdf\xd7", + utf8: "Hefl◊", + }, + { + e: charmap.MacintoshCyrillic, + encoded: "He\xbe\x94", + utf8: "HeЊФ", + }, + { + e: charmap.Windows874, + encoded: "He\xb7\xf0", + utf8: "Heท๐", + }, + { + e: charmap.Windows1250, + encoded: "He\xe5\xe5o", + utf8: "Heĺĺo", + }, + { + e: charmap.Windows1251, + encoded: "H\xball\xfe", + utf8: "Hєllю", + }, + { + e: charmap.Windows1252, + encoded: "H\xe9ll\xf4 \xa5\xbA\xae\xa3\xd0", + utf8: "Héllô ¥º®£Ð", + }, + { + e: charmap.Windows1253, + encoded: "H\xe5ll\xd6", + utf8: "HεllΦ", + }, + { + e: charmap.Windows1254, + encoded: "\xd0ello", + utf8: "Ğello", + }, + { + e: charmap.Windows1255, + encoded: "He\xd4o", + utf8: "Heװo", + }, + { + e: charmap.Windows1256, + encoded: "H\xdbllo", + utf8: "Hغllo", + }, + { + e: charmap.Windows1257, + encoded: "He\xeflo", + utf8: "Heļlo", + }, + { + e: charmap.Windows1258, + encoded: "Hell\xf5", + utf8: "Hellơ", + }, + { + e: charmap.XUserDefined, + encoded: "\x00\x40\x7f\x80\xab\xff", + utf8: "\u0000\u0040\u007f\uf780\uf7ab\uf7ff", + }, + + // UTF-16 tests. + { + e: utf16BEIB, + encoded: "\x00\x57\x00\xe4\xd8\x35\xdd\x65", + utf8: "\x57\u00e4\U0001d565", + }, + { + e: utf16BEEB, + encPrefix: "\xfe\xff", + encoded: "\x00\x57\x00\xe4\xd8\x35\xdd\x65", + utf8: "\x57\u00e4\U0001d565", + }, + { + e: utf16LEIB, + encoded: "\x57\x00\xe4\x00\x35\xd8\x65\xdd", + utf8: "\x57\u00e4\U0001d565", + }, + { + e: utf16LEEB, + encPrefix: "\xff\xfe", + encoded: "\x57\x00\xe4\x00\x35\xd8\x65\xdd", + utf8: "\x57\u00e4\U0001d565", + }, + + // UTF-32 tests. + { + e: utf32BEIB, + encoded: "\x00\x00\x00\x57\x00\x00\x00\xe4\x00\x01\xd5\x65", + utf8: "\x57\u00e4\U0001d565", + }, + { + e: utf32.UTF32(utf32.BigEndian, utf32.ExpectBOM), + encPrefix: "\x00\x00\xfe\xff", + encoded: "\x00\x00\x00\x57\x00\x00\x00\xe4\x00\x01\xd5\x65", + utf8: "\x57\u00e4\U0001d565", + }, + { + e: utf32.UTF32(utf32.LittleEndian, utf32.IgnoreBOM), + encoded: "\x57\x00\x00\x00\xe4\x00\x00\x00\x65\xd5\x01\x00", + utf8: "\x57\u00e4\U0001d565", + }, + { + e: utf32.UTF32(utf32.LittleEndian, utf32.ExpectBOM), + encPrefix: "\xff\xfe\x00\x00", + encoded: "\x57\x00\x00\x00\xe4\x00\x00\x00\x65\xd5\x01\x00", + utf8: "\x57\u00e4\U0001d565", + }, + + // Chinese tests. + // + // "\u0081\u00de\u00df\u00e0\u00e1\u00e2\u00e3\uffff\U00010000" is a + // nonsense string that contains GB18030 encodable codepoints of which + // only U+00E0 and U+00E1 are GBK encodable. + // + // "A\u3000\u554a\u4e02\u4e90\u72dc\u7349\u02ca\u2588Z€" is a nonsense + // string that contains ASCII and GBK encodable codepoints from Levels + // 1-5 as well as the Euro sign. + // + // "A\u43f0\u4c32\U00027267\u3000\U0002910d\u79d4Z€" is a nonsense string + // that contains ASCII and Big5 encodable codepoints from the Basic + // Multilingual Plane and the Supplementary Ideographic Plane as well as + // the Euro sign. + // + // "花间一壶酒,独酌无相亲。" (simplified) and + // "花間一壺酒,獨酌無相親。" (traditional) + // are from the 8th century poem "Yuè Xià Dú Zhuó". + { + e: simplifiedchinese.GB18030, + encoded: "\x81\x30\x81\x31\x81\x30\x89\x37\x81\x30\x89\x38\xa8\xa4\xa8\xa2" + + "\x81\x30\x89\x39\x81\x30\x8a\x30\x84\x31\xa4\x39\x90\x30\x81\x30", + utf8: "\u0081\u00de\u00df\u00e0\u00e1\u00e2\u00e3\uffff\U00010000", + }, + { + e: simplifiedchinese.GB18030, + encoded: "\xbb\xa8\xbc\xe4\xd2\xbb\xba\xf8\xbe\xc6\xa3\xac\xb6\xc0\xd7\xc3" + + "\xce\xde\xcf\xe0\xc7\xd7\xa1\xa3", + utf8: "花间一壶酒,独酌无相亲。", + }, + { + e: simplifiedchinese.GBK, + encoded: "A\xa1\xa1\xb0\xa1\x81\x40\x81\x80\xaa\x40\xaa\x80\xa8\x40\xa8\x80Z\x80", + utf8: "A\u3000\u554a\u4e02\u4e90\u72dc\u7349\u02ca\u2588Z€", + }, + { + e: simplifiedchinese.GBK, + encoded: "\xbb\xa8\xbc\xe4\xd2\xbb\xba\xf8\xbe\xc6\xa3\xac\xb6\xc0\xd7\xc3" + + "\xce\xde\xcf\xe0\xc7\xd7\xa1\xa3", + utf8: "花间一壶酒,独酌无相亲。", + }, + { + e: simplifiedchinese.HZGB2312, + encoded: "A~{\x21\x21~~\x30\x21~}Z~~", + utf8: "A\u3000~\u554aZ~", + }, + { + e: simplifiedchinese.HZGB2312, + encPrefix: "~{", + encoded: ";(F#,6@WCN^O`GW!#", + utf8: "花间一壶酒,独酌无相亲。", + }, + { + e: traditionalchinese.Big5, + encoded: "A\x87\x40\x87\x41\x87\x45\xa1\x40\xfe\xfd\xfe\xfeZ\xa3\xe1", + utf8: "A\u43f0\u4c32\U00027267\u3000\U0002910d\u79d4Z€", + }, + { + e: traditionalchinese.Big5, + encoded: "\xaa\xe1\xb6\xa1\xa4\x40\xb3\xfd\xb0\x73\xa1\x41\xbf\x57\xb0\x75" + + "\xb5\x4c\xac\xdb\xbf\xcb\xa1\x43", + utf8: "花間一壺酒,獨酌無相親。", + }, + + // Japanese tests. + // + // "A。カ゚ 0208: etc 0212: etc" is a nonsense string that contains ASCII, half-width + // kana, JIS X 0208 (including two near the kink in the Shift JIS second byte + // encoding) and JIS X 0212 encodable codepoints. + // + // "月日は百代の過客にして、行かふ年も又旅人也。" is from the 17th century poem + // "Oku no Hosomichi" and contains both hiragana and kanji. + { + e: japanese.EUCJP, + encoded: "A\x8e\xa1\x8e\xb6\x8e\xdf " + + "0208: \xa1\xa1\xa1\xa2\xa1\xdf\xa1\xe0\xa1\xfd\xa1\xfe\xa2\xa1\xa2\xa2\xf4\xa6 " + + "0212: \x8f\xa2\xaf\x8f\xed\xe3", + utf8: "A。カ゚ " + + "0208: \u3000\u3001\u00d7\u00f7\u25ce\u25c7\u25c6\u25a1\u7199 " + + "0212: \u02d8\u9fa5", + }, + { + e: japanese.EUCJP, + encoded: "\xb7\xee\xc6\xfc\xa4\xcf\xc9\xb4\xc2\xe5\xa4\xce\xb2\xe1\xb5\xd2" + + "\xa4\xcb\xa4\xb7\xa4\xc6\xa1\xa2\xb9\xd4\xa4\xab\xa4\xd5\xc7\xaf" + + "\xa4\xe2\xcb\xf4\xce\xb9\xbf\xcd\xcc\xe9\xa1\xa3", + utf8: "月日は百代の過客にして、行かふ年も又旅人也。", + }, + { + e: japanese.ISO2022JP, + encSuffix: "\x1b\x28\x42", + encoded: "\x1b\x28\x49\x21\x36\x5f\x1b\x28\x42 " + + "0208: \x1b\x24\x42\x21\x21\x21\x22\x21\x5f\x21\x60\x21\x7d\x21\x7e\x22\x21\x22\x22\x74\x26", + utf8: "。カ゚ " + + "0208: \u3000\u3001\u00d7\u00f7\u25ce\u25c7\u25c6\u25a1\u7199", + }, + { + e: japanese.ISO2022JP, + encPrefix: "\x1b\x24\x42", + encSuffix: "\x1b\x28\x42", + encoded: "\x37\x6e\x46\x7c\x24\x4f\x49\x34\x42\x65\x24\x4e\x32\x61\x35\x52" + + "\x24\x4b\x24\x37\x24\x46\x21\x22\x39\x54\x24\x2b\x24\x55\x47\x2f" + + "\x24\x62\x4b\x74\x4e\x39\x3f\x4d\x4c\x69\x21\x23", + utf8: "月日は百代の過客にして、行かふ年も又旅人也。", + }, + { + e: japanese.ShiftJIS, + encoded: "A\xa1\xb6\xdf " + + "0208: \x81\x40\x81\x41\x81\x7e\x81\x80\x81\x9d\x81\x9e\x81\x9f\x81\xa0\xea\xa4", + utf8: "A。カ゚ " + + "0208: \u3000\u3001\u00d7\u00f7\u25ce\u25c7\u25c6\u25a1\u7199", + }, + { + e: japanese.ShiftJIS, + encoded: "\x8c\x8e\x93\xfa\x82\xcd\x95\x53\x91\xe3\x82\xcc\x89\xdf\x8b\x71" + + "\x82\xc9\x82\xb5\x82\xc4\x81\x41\x8d\x73\x82\xa9\x82\xd3\x94\x4e" + + "\x82\xe0\x96\x94\x97\xb7\x90\x6c\x96\xe7\x81\x42", + utf8: "月日は百代の過客にして、行かふ年も又旅人也。", + }, + + // Korean tests. + // + // "A\uac02\uac35\uac56\ud401B\ud408\ud620\ud624C\u4f3d\u8a70D" is a + // nonsense string that contains ASCII, Hangul and CJK ideographs. + // + // "세계야, 안녕" translates as "Hello, world". + { + e: korean.EUCKR, + encoded: "A\x81\x41\x81\x61\x81\x81\xc6\xfeB\xc7\xa1\xc7\xfe\xc8\xa1C\xca\xa1\xfd\xfeD", + utf8: "A\uac02\uac35\uac56\ud401B\ud408\ud620\ud624C\u4f3d\u8a70D", + }, + { + e: korean.EUCKR, + encoded: "\xbc\xbc\xb0\xe8\xbe\xdf\x2c\x20\xbe\xc8\xb3\xe7", + utf8: "세계야, 안녕", + }, +} + +func TestBasics(t *testing.T) { + for _, tc := range basicTestCases { + for _, direction := range []string{"Decode", "Encode"} { + var coder Transcoder + var want, src, wPrefix, sPrefix, wSuffix, sSuffix string + if direction == "Decode" { + coder, want, src = tc.e.NewDecoder(), tc.utf8, tc.encoded + wPrefix, sPrefix, wSuffix, sSuffix = "", tc.encPrefix, "", tc.encSuffix + } else { + coder, want, src = tc.e.NewEncoder(), tc.encoded, tc.utf8 + wPrefix, sPrefix, wSuffix, sSuffix = tc.encPrefix, "", tc.encSuffix, "" + } + + dst := make([]byte, len(wPrefix)+len(want)+len(wSuffix)) + nDst, nSrc, err := coder.Transform(dst, []byte(sPrefix+src+sSuffix), true) + if err != nil { + t.Errorf("%v: %s: %v", tc.e, direction, err) + continue + } + if nDst != len(wPrefix)+len(want)+len(wSuffix) { + t.Errorf("%v: %s: nDst got %d, want %d", + tc.e, direction, nDst, len(wPrefix)+len(want)+len(wSuffix)) + continue + } + if nSrc != len(sPrefix)+len(src)+len(sSuffix) { + t.Errorf("%v: %s: nSrc got %d, want %d", + tc.e, direction, nSrc, len(sPrefix)+len(src)+len(sSuffix)) + continue + } + if got := string(dst); got != wPrefix+want+wSuffix { + t.Errorf("%v: %s:\ngot %q\nwant %q", + tc.e, direction, got, wPrefix+want+wSuffix) + continue + } + + for _, n := range []int{0, 1, 2, 10, 123, 4567} { + input := sPrefix + strings.Repeat(src, n) + sSuffix + g, err := coder.String(input) + if err != nil { + t.Errorf("%v: %s: Bytes: n=%d: %v", tc.e, direction, n, err) + continue + } + if len(g) == 0 && len(input) == 0 { + // If the input is empty then the output can be empty, + // regardless of whatever wPrefix is. + continue + } + got1, want1 := string(g), wPrefix+strings.Repeat(want, n)+wSuffix + if got1 != want1 { + t.Errorf("%v: %s: ReadAll: n=%d\ngot %q\nwant %q", + tc.e, direction, n, trim(got1), trim(want1)) + continue + } + } + } + } +} + +// TestBig5CircumflexAndMacron tests the special cases listed in +// http://encoding.spec.whatwg.org/#big5 +// Note that these special cases aren't preserved by round-tripping through +// decoding and encoding (since +// http://encoding.spec.whatwg.org/index-big5.txt does not have an entry for +// U+0304 or U+030C), so we can't test this in TestBasics. +func TestBig5CircumflexAndMacron(t *testing.T) { + src := "\x88\x5f\x88\x60\x88\x61\x88\x62\x88\x63\x88\x64\x88\x65\x88\x66 " + + "\x88\xa2\x88\xa3\x88\xa4\x88\xa5\x88\xa6" + want := "ÓǑÒ\u00ca\u0304Ế\u00ca\u030cỀÊ " + + "ü\u00ea\u0304ế\u00ea\u030cề" + dst, err := ioutil.ReadAll(transform.NewReader( + strings.NewReader(src), traditionalchinese.Big5.NewDecoder())) + if err != nil { + t.Fatal(err) + } + if got := string(dst); got != want { + t.Fatalf("\ngot %q\nwant %q", got, want) + } +} + func TestEncodeInvalidUTF8(t *testing.T) { inputs := []string{ "hello.", @@ -204,6 +642,238 @@ func TestUTF8Validator(t *testing.T) { } } +var ( + utf16LEIB = unicode.UTF16(unicode.LittleEndian, unicode.IgnoreBOM) // UTF-16LE (atypical interpretation) + utf16LEUB = unicode.UTF16(unicode.LittleEndian, unicode.UseBOM) // UTF-16, LE + utf16LEEB = unicode.UTF16(unicode.LittleEndian, unicode.ExpectBOM) // UTF-16, LE, Expect + utf16BEIB = unicode.UTF16(unicode.BigEndian, unicode.IgnoreBOM) // UTF-16BE (atypical interpretation) + utf16BEUB = unicode.UTF16(unicode.BigEndian, unicode.UseBOM) // UTF-16 default + utf16BEEB = unicode.UTF16(unicode.BigEndian, unicode.ExpectBOM) // UTF-16 Expect +) + +func TestUTF16(t *testing.T) { + testCases := []struct { + desc string + src string + notEOF bool // the inverse of atEOF + sizeDst int + want string + nSrc int + err error + t transform.Transformer + }{{ + desc: "utf-16 IgnoreBOM dec: empty string", + t: utf16BEIB.NewDecoder(), + }, { + desc: "utf-16 UseBOM dec: empty string", + t: utf16BEUB.NewDecoder(), + }, { + desc: "utf-16 ExpectBOM dec: empty string", + err: unicode.ErrMissingBOM, + t: utf16BEEB.NewDecoder(), + }, { + desc: "utf-16 dec: BOM determines encoding BE (RFC 2781:3.3)", + src: "\xFE\xFF\xD8\x08\xDF\x45\x00\x3D\x00\x52\x00\x61", + sizeDst: 100, + want: "\U00012345=Ra", + nSrc: 12, + t: utf16BEUB.NewDecoder(), + }, { + desc: "utf-16 dec: BOM determines encoding LE (RFC 2781:3.3)", + src: "\xFF\xFE\x08\xD8\x45\xDF\x3D\x00\x52\x00\x61\x00", + sizeDst: 100, + want: "\U00012345=Ra", + nSrc: 12, + t: utf16LEUB.NewDecoder(), + }, { + desc: "utf-16 dec: BOM determines encoding LE, change default (RFC 2781:3.3)", + src: "\xFF\xFE\x08\xD8\x45\xDF\x3D\x00\x52\x00\x61\x00", + sizeDst: 100, + want: "\U00012345=Ra", + nSrc: 12, + t: utf16BEUB.NewDecoder(), + }, { + desc: "utf-16 dec: Fail on missing BOM when required", + src: "\x08\xD8\x45\xDF\x3D\x00\xFF\xFE\xFE\xFF\x00\x52\x00\x61", + sizeDst: 100, + want: "", + nSrc: 0, + err: unicode.ErrMissingBOM, + t: utf16BEEB.NewDecoder(), + }, { + desc: "utf-16 dec: SHOULD interpret text as big-endian when BOM not present (RFC 2781:4.3)", + src: "\xD8\x08\xDF\x45\x00\x3D\x00\x52\x00\x61", + sizeDst: 100, + want: "\U00012345=Ra", + nSrc: 10, + t: utf16BEUB.NewDecoder(), + }, { + // This is an error according to RFC 2781. But errors in RFC 2781 are + // open to interpretations, so I guess this is fine. + desc: "utf-16le dec: incorrect BOM is an error (RFC 2781:4.1)", + src: "\xFE\xFF\x08\xD8\x45\xDF\x3D\x00\x52\x00\x61\x00", + sizeDst: 100, + want: "\uFFFE\U00012345=Ra", + nSrc: 12, + t: utf16LEIB.NewDecoder(), + }, { + desc: "utf-16 enc: SHOULD write BOM (RFC 2781:3.3)", + src: "\U00012345=Ra", + sizeDst: 100, + want: "\xFF\xFE\x08\xD8\x45\xDF\x3D\x00\x52\x00\x61\x00", + nSrc: 7, + t: utf16LEUB.NewEncoder(), + }, { + desc: "utf-16 enc: SHOULD write BOM (RFC 2781:3.3)", + src: "\U00012345=Ra", + sizeDst: 100, + want: "\xFE\xFF\xD8\x08\xDF\x45\x00\x3D\x00\x52\x00\x61", + nSrc: 7, + t: utf16BEUB.NewEncoder(), + }, { + desc: "utf-16le enc: MUST NOT write BOM (RFC 2781:3.3)", + src: "\U00012345=Ra", + sizeDst: 100, + want: "\x08\xD8\x45\xDF\x3D\x00\x52\x00\x61\x00", + nSrc: 7, + t: utf16LEIB.NewEncoder(), + }, { + desc: "utf-16be dec: incorrect UTF-16: odd bytes", + src: "\x00", + sizeDst: 100, + want: "\uFFFD", + nSrc: 1, + t: utf16BEIB.NewDecoder(), + }, { + desc: "utf-16be dec: unpaired surrogate, odd bytes", + src: "\xD8\x45\x00", + sizeDst: 100, + want: "\uFFFD\uFFFD", + nSrc: 3, + t: utf16BEIB.NewDecoder(), + }, { + desc: "utf-16be dec: unpaired low surrogate + valid text", + src: "\xD8\x45\x00a", + sizeDst: 100, + want: "\uFFFDa", + nSrc: 4, + t: utf16BEIB.NewDecoder(), + }, { + desc: "utf-16be dec: unpaired low surrogate + valid text + single byte", + src: "\xD8\x45\x00ab", + sizeDst: 100, + want: "\uFFFDa\uFFFD", + nSrc: 5, + t: utf16BEIB.NewDecoder(), + }, { + desc: "utf-16le dec: unpaired high surrogate", + src: "\x00\x00\x00\xDC\x12\xD8", + sizeDst: 100, + want: "\x00\uFFFD\uFFFD", + nSrc: 6, + t: utf16LEIB.NewDecoder(), + }, { + desc: "utf-16be dec: two unpaired low surrogates", + src: "\xD8\x45\xD8\x12", + sizeDst: 100, + want: "\uFFFD\uFFFD", + nSrc: 4, + t: utf16BEIB.NewDecoder(), + }, { + desc: "utf-16be dec: short dst", + src: "\x00a", + sizeDst: 0, + want: "", + nSrc: 0, + t: utf16BEIB.NewDecoder(), + err: transform.ErrShortDst, + }, { + desc: "utf-16be dec: short dst surrogate", + src: "\xD8\xF5\xDC\x12", + sizeDst: 3, + want: "", + nSrc: 0, + t: utf16BEIB.NewDecoder(), + err: transform.ErrShortDst, + }, { + desc: "utf-16be dec: short dst trailing byte", + src: "\x00", + sizeDst: 2, + want: "", + nSrc: 0, + t: utf16BEIB.NewDecoder(), + err: transform.ErrShortDst, + }, { + desc: "utf-16be dec: short src", + src: "\x00", + notEOF: true, + sizeDst: 3, + want: "", + nSrc: 0, + t: utf16BEIB.NewDecoder(), + err: transform.ErrShortSrc, + }, { + desc: "utf-16 enc", + src: "\U00012345=Ra", + sizeDst: 100, + want: "\xFE\xFF\xD8\x08\xDF\x45\x00\x3D\x00\x52\x00\x61", + nSrc: 7, + t: utf16BEUB.NewEncoder(), + }, { + desc: "utf-16 enc: short dst normal", + src: "\U00012345=Ra", + sizeDst: 9, + want: "\xD8\x08\xDF\x45\x00\x3D\x00\x52", + nSrc: 6, + t: utf16BEIB.NewEncoder(), + err: transform.ErrShortDst, + }, { + desc: "utf-16 enc: short dst surrogate", + src: "\U00012345=Ra", + sizeDst: 3, + want: "", + nSrc: 0, + t: utf16BEIB.NewEncoder(), + err: transform.ErrShortDst, + }, { + desc: "utf-16 enc: short src", + src: "\U00012345=Ra\xC2", + notEOF: true, + sizeDst: 100, + want: "\xD8\x08\xDF\x45\x00\x3D\x00\x52\x00\x61", + nSrc: 7, + t: utf16BEIB.NewEncoder(), + err: transform.ErrShortSrc, + }, { + desc: "utf-16be dec: don't change byte order mid-stream", + src: "\xFE\xFF\xD8\x08\xDF\x45\x00\x3D\xFF\xFE\x00\x52\x00\x61", + sizeDst: 100, + want: "\U00012345=\ufffeRa", + nSrc: 14, + t: utf16BEUB.NewDecoder(), + }, { + desc: "utf-16le dec: don't change byte order mid-stream", + src: "\xFF\xFE\x08\xD8\x45\xDF\x3D\x00\xFF\xFE\xFE\xFF\x52\x00\x61\x00", + sizeDst: 100, + want: "\U00012345=\ufeff\ufffeRa", + nSrc: 16, + t: utf16LEUB.NewDecoder(), + }} + for i, tc := range testCases { + b := make([]byte, tc.sizeDst) + nDst, nSrc, err := tc.t.Transform(b, []byte(tc.src), !tc.notEOF) + if err != tc.err { + t.Errorf("%d:%s: error was %v; want %v", i, tc.desc, err, tc.err) + } + if got := string(b[:nDst]); got != tc.want { + t.Errorf("%d:%s: result was %q: want %q", i, tc.desc, got, tc.want) + } + if nSrc != tc.nSrc { + t.Errorf("%d:%s: nSrc was %d; want %d", i, tc.desc, nSrc, tc.nSrc) + } + } +} + func TestErrorHandler(t *testing.T) { testCases := []struct { desc string @@ -288,3 +958,171 @@ func TestErrorHandler(t *testing.T) { } } +func TestBOMOverride(t *testing.T) { + dec := unicode.BOMOverride(charmap.CodePage437.NewDecoder()) + dst := make([]byte, 100) + for i, tc := range []struct { + src string + atEOF bool + dst string + nSrc int + err error + }{ + 0: {"H\x82ll\x93", true, "Héllô", 5, nil}, + 1: {"\uFEFFHéllö", true, "Héllö", 10, nil}, + 2: {"\xFE\xFF\x00H\x00e\x00l\x00l\x00o", true, "Hello", 12, nil}, + 3: {"\xFF\xFEH\x00e\x00l\x00l\x00o\x00", true, "Hello", 12, nil}, + 4: {"\uFEFF", true, "", 3, nil}, + 5: {"\xFE\xFF", true, "", 2, nil}, + 6: {"\xFF\xFE", true, "", 2, nil}, + 7: {"\xEF\xBB", true, "\u2229\u2557", 2, nil}, + 8: {"\xEF", true, "\u2229", 1, nil}, + 9: {"", true, "", 0, nil}, + 10: {"\xFE", true, "\u25a0", 1, nil}, + 11: {"\xFF", true, "\u00a0", 1, nil}, + 12: {"\xEF\xBB", false, "", 0, transform.ErrShortSrc}, + 13: {"\xEF", false, "", 0, transform.ErrShortSrc}, + 14: {"", false, "", 0, transform.ErrShortSrc}, + 15: {"\xFE", false, "", 0, transform.ErrShortSrc}, + 16: {"\xFF", false, "", 0, transform.ErrShortSrc}, + 17: {"\xFF\xFE", false, "", 0, transform.ErrShortSrc}, + } { + dec.Reset() + nDst, nSrc, err := dec.Transform(dst, []byte(tc.src), tc.atEOF) + got := string(dst[:nDst]) + if nSrc != tc.nSrc { + t.Errorf("%d: nSrc: got %d; want %d", i, nSrc, tc.nSrc) + } + if got != tc.dst { + t.Errorf("%d: got %+q; want %+q", i, got, tc.dst) + } + if err != tc.err { + t.Errorf("%d: error: got %v; want %v", i, err, tc.err) + } + } +} + +// testdataFiles are files in testdata/*.txt. +var testdataFiles = []struct { + enc encoding.Encoding + basename, ext string +}{ + {charmap.Windows1252, "candide", "windows-1252"}, + {japanese.EUCJP, "rashomon", "euc-jp"}, + {japanese.ISO2022JP, "rashomon", "iso-2022-jp"}, + {japanese.ShiftJIS, "rashomon", "shift-jis"}, + {korean.EUCKR, "unsu-joh-eun-nal", "euc-kr"}, + {simplifiedchinese.GBK, "sunzi-bingfa-simplified", "gbk"}, + {simplifiedchinese.HZGB2312, "sunzi-bingfa-gb-levels-1-and-2", "hz-gb2312"}, + {traditionalchinese.Big5, "sunzi-bingfa-traditional", "big5"}, + {utf16LEIB, "candide", "utf-16le"}, + {unicode.UTF8, "candide", "utf-8"}, + {utf32BEIB, "candide", "utf-32be"}, + + // GB18030 is a superset of GBK and is nominally a Simplified Chinese + // encoding, but it can also represent the entire Basic Multilingual + // Plane, including codepoints like 'â' that aren't encodable by GBK. + // GB18030 on Simplified Chinese should perform similarly to GBK on + // Simplified Chinese. GB18030 on "candide" is more interesting. + {simplifiedchinese.GB18030, "candide", "gb18030"}, +} + +// Encoder or Decoder +type Transcoder interface { + transform.Transformer + Bytes([]byte) ([]byte, error) + String(string) (string, error) +} + +func load(direction string, enc encoding.Encoding) ([]byte, []byte, Transcoder, error) { + basename, ext, count := "", "", 0 + for _, tf := range testdataFiles { + if tf.enc == enc { + basename, ext = tf.basename, tf.ext + count++ + } + } + if count != 1 { + if count == 0 { + return nil, nil, nil, fmt.Errorf("no testdataFiles for %s", enc) + } + return nil, nil, nil, fmt.Errorf("too many testdataFiles for %s", enc) + } + dstFile := fmt.Sprintf("testdata/%s-%s.txt", basename, ext) + srcFile := fmt.Sprintf("testdata/%s-utf-8.txt", basename) + var coder Transcoder = encoding.ReplaceUnsupported(enc.NewEncoder()) + if direction == "Decode" { + dstFile, srcFile = srcFile, dstFile + coder = enc.NewDecoder() + } + dst, err := ioutil.ReadFile(dstFile) + if err != nil { + return nil, nil, nil, err + } + src, err := ioutil.ReadFile(srcFile) + if err != nil { + return nil, nil, nil, err + } + return dst, src, coder, nil +} + +func TestFiles(t *testing.T) { + for _, dir := range []string{"Decode", "Encode"} { + for _, tf := range testdataFiles { + dst, src, transformer, err := load(dir, tf.enc) + if err != nil { + t.Errorf("%s, %s: load: %v", dir, tf.enc, err) + continue + } + buf, err := transformer.Bytes(src) + if err != nil { + t.Errorf("%s, %s: transform: %v", dir, tf.enc, err) + continue + } + if !bytes.Equal(buf, dst) { + t.Errorf("%s, %s: transformed bytes did not match golden file", dir, tf.enc) + continue + } + } + } +} + +func benchmark(b *testing.B, direction string, enc encoding.Encoding) { + _, src, transformer, err := load(direction, enc) + if err != nil { + b.Fatal(err) + } + b.SetBytes(int64(len(src))) + b.ResetTimer() + for i := 0; i < b.N; i++ { + r := transform.NewReader(bytes.NewReader(src), transformer) + io.Copy(ioutil.Discard, r) + } +} + +func BenchmarkBig5Decoder(b *testing.B) { benchmark(b, "Decode", traditionalchinese.Big5) } +func BenchmarkBig5Encoder(b *testing.B) { benchmark(b, "Encode", traditionalchinese.Big5) } +func BenchmarkCharmapDecoder(b *testing.B) { benchmark(b, "Decode", charmap.Windows1252) } +func BenchmarkCharmapEncoder(b *testing.B) { benchmark(b, "Encode", charmap.Windows1252) } +func BenchmarkEUCJPDecoder(b *testing.B) { benchmark(b, "Decode", japanese.EUCJP) } +func BenchmarkEUCJPEncoder(b *testing.B) { benchmark(b, "Encode", japanese.EUCJP) } +func BenchmarkEUCKRDecoder(b *testing.B) { benchmark(b, "Decode", korean.EUCKR) } +func BenchmarkEUCKREncoder(b *testing.B) { benchmark(b, "Encode", korean.EUCKR) } +func BenchmarkGB18030Decoder(b *testing.B) { benchmark(b, "Decode", simplifiedchinese.GB18030) } +func BenchmarkGB18030Encoder(b *testing.B) { benchmark(b, "Encode", simplifiedchinese.GB18030) } +func BenchmarkGBKDecoder(b *testing.B) { benchmark(b, "Decode", simplifiedchinese.GBK) } +func BenchmarkGBKEncoder(b *testing.B) { benchmark(b, "Encode", simplifiedchinese.GBK) } +func BenchmarkHZGB2312Decoder(b *testing.B) { benchmark(b, "Decode", simplifiedchinese.HZGB2312) } +func BenchmarkHZGB2312Encoder(b *testing.B) { benchmark(b, "Encode", simplifiedchinese.HZGB2312) } +func BenchmarkISO2022JPDecoder(b *testing.B) { benchmark(b, "Decode", japanese.ISO2022JP) } +func BenchmarkISO2022JPEncoder(b *testing.B) { benchmark(b, "Encode", japanese.ISO2022JP) } +func BenchmarkShiftJISDecoder(b *testing.B) { benchmark(b, "Decode", japanese.ShiftJIS) } +func BenchmarkShiftJISEncoder(b *testing.B) { benchmark(b, "Encode", japanese.ShiftJIS) } +func BenchmarkUTF8Decoder(b *testing.B) { benchmark(b, "Decode", unicode.UTF8) } +func BenchmarkUTF8Encoder(b *testing.B) { benchmark(b, "Encode", unicode.UTF8) } +func BenchmarkUTF16Decoder(b *testing.B) { benchmark(b, "Decode", utf16LEIB) } +func BenchmarkUTF16Encoder(b *testing.B) { benchmark(b, "Encode", utf16LEIB) } +func BenchmarkUTF32Decoder(b *testing.B) { benchmark(b, "Decode", utf32BEIB) } +func BenchmarkUTF32Encoder(b *testing.B) { benchmark(b, "Encode", utf32BEIB) } + +var utf32BEIB = utf32.UTF32(utf32.BigEndian, utf32.IgnoreBOM) diff --git a/vendor/golang.org/x/text/encoding/htmlindex/gen.go b/vendor/golang.org/x/text/encoding/htmlindex/gen.go index 80a52f0..d10e5e0 100644 --- a/vendor/golang.org/x/text/encoding/htmlindex/gen.go +++ b/vendor/golang.org/x/text/encoding/htmlindex/gen.go @@ -26,7 +26,7 @@ type group struct { func main() { gen.Init() - r := gen.Open("https://encoding.spec.whatwg.org", "whatwg", "encodings.json") + r := gen.Open("http://www.w3.org/TR", "w3", "encoding/indexes/encodings.json") var groups []group if err := json.NewDecoder(r).Decode(&groups); err != nil { log.Fatalf("Error reading encodings.json: %v", err) @@ -37,10 +37,9 @@ func main() { fmt.Fprintln(w, "const (") for i, g := range groups { for _, e := range g.Encodings { - key := strings.ToLower(e.Name) - name := consts[key] + name := consts[e.Name] if name == "" { - log.Fatalf("No const defined for %s.", key) + log.Fatalf("No const defined for %s.", e.Name) } if i == 0 { fmt.Fprintf(w, "%s htmlEncoding = iota\n", name) @@ -55,7 +54,7 @@ func main() { fmt.Fprintln(w, "var canonical = [numEncodings]string{") for _, g := range groups { for _, e := range g.Encodings { - fmt.Fprintf(w, "%q,\n", strings.ToLower(e.Name)) + fmt.Fprintf(w, "%q,\n", e.Name) } } fmt.Fprint(w, "}\n\n") @@ -64,9 +63,7 @@ func main() { for _, g := range groups { for _, e := range g.Encodings { for _, l := range e.Labels { - key := strings.ToLower(e.Name) - name := consts[key] - fmt.Fprintf(w, "%q: %s,\n", l, name) + fmt.Fprintf(w, "%q: %s,\n", l, consts[e.Name]) } } } diff --git a/vendor/golang.org/x/text/encoding/htmlindex/tables.go b/vendor/golang.org/x/text/encoding/htmlindex/tables.go index cbf4ba9..78950d3 100644 --- a/vendor/golang.org/x/text/encoding/htmlindex/tables.go +++ b/vendor/golang.org/x/text/encoding/htmlindex/tables.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package htmlindex diff --git a/vendor/golang.org/x/text/encoding/ianaindex/example_test.go b/vendor/golang.org/x/text/encoding/ianaindex/example_test.go index e2a3a7e..b305732 100644 --- a/vendor/golang.org/x/text/encoding/ianaindex/example_test.go +++ b/vendor/golang.org/x/text/encoding/ianaindex/example_test.go @@ -13,15 +13,14 @@ import ( func ExampleIndex() { fmt.Println(ianaindex.MIME.Name(charmap.ISO8859_7)) - fmt.Println(ianaindex.IANA.Name(charmap.ISO8859_7)) - fmt.Println(ianaindex.MIB.Name(charmap.ISO8859_7)) - e, _ := ianaindex.IANA.Encoding("cp437") + fmt.Println(ianaindex.IANA.Name(charmap.ISO8859_7)) + + e, _ := ianaindex.IANA.Get("cp437") fmt.Println(ianaindex.IANA.Name(e)) - // Output: - // ISO-8859-7 - // ISO_8859-7:1987 - // ISOLatinGreek - // IBM437 + // TODO: Output: + // ISO-8859-7 + // ISO8859_7:1987 + // IBM437 } diff --git a/vendor/golang.org/x/text/encoding/ianaindex/gen.go b/vendor/golang.org/x/text/encoding/ianaindex/gen.go deleted file mode 100644 index 1b61b82..0000000 --- a/vendor/golang.org/x/text/encoding/ianaindex/gen.go +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build ignore - -package main - -import ( - "encoding/xml" - "fmt" - "io" - "log" - "sort" - "strconv" - "strings" - - "golang.org/x/text/encoding/internal/identifier" - "golang.org/x/text/internal/gen" -) - -type registry struct { - XMLName xml.Name `xml:"registry"` - Updated string `xml:"updated"` - Registry []struct { - ID string `xml:"id,attr"` - Record []struct { - Name string `xml:"name"` - Xref []struct { - Type string `xml:"type,attr"` - Data string `xml:"data,attr"` - } `xml:"xref"` - Desc struct { - Data string `xml:",innerxml"` - } `xml:"description,"` - MIB string `xml:"value"` - Alias []string `xml:"alias"` - MIME string `xml:"preferred_alias"` - } `xml:"record"` - } `xml:"registry"` -} - -func main() { - r := gen.OpenIANAFile("assignments/character-sets/character-sets.xml") - reg := ®istry{} - if err := xml.NewDecoder(r).Decode(®); err != nil && err != io.EOF { - log.Fatalf("Error decoding charset registry: %v", err) - } - if len(reg.Registry) == 0 || reg.Registry[0].ID != "character-sets-1" { - log.Fatalf("Unexpected ID %s", reg.Registry[0].ID) - } - - x := &indexInfo{} - - for _, rec := range reg.Registry[0].Record { - mib := identifier.MIB(parseInt(rec.MIB)) - x.addEntry(mib, rec.Name) - for _, a := range rec.Alias { - a = strings.Split(a, " ")[0] // strip comments. - x.addAlias(a, mib) - // MIB name aliases are prefixed with a "cs" (character set) in the - // registry to identify them as display names and to ensure that - // the name starts with a lowercase letter in case it is used as - // an identifier. We remove it to be left with a nice clean name. - if strings.HasPrefix(a, "cs") { - x.setName(2, a[2:]) - } - } - if rec.MIME != "" { - x.addAlias(rec.MIME, mib) - x.setName(1, rec.MIME) - } - } - - w := gen.NewCodeWriter() - - fmt.Fprintln(w, `import "golang.org/x/text/encoding/internal/identifier"`) - - writeIndex(w, x) - - w.WriteGoFile("tables.go", "ianaindex") -} - -type alias struct { - name string - mib identifier.MIB -} - -type indexInfo struct { - // compacted index from code to MIB - codeToMIB []identifier.MIB - alias []alias - names [][3]string -} - -func (ii *indexInfo) Len() int { - return len(ii.codeToMIB) -} - -func (ii *indexInfo) Less(a, b int) bool { - return ii.codeToMIB[a] < ii.codeToMIB[b] -} - -func (ii *indexInfo) Swap(a, b int) { - ii.codeToMIB[a], ii.codeToMIB[b] = ii.codeToMIB[b], ii.codeToMIB[a] - // Co-sort the names. - ii.names[a], ii.names[b] = ii.names[b], ii.names[a] -} - -func (ii *indexInfo) setName(i int, name string) { - ii.names[len(ii.names)-1][i] = name -} - -func (ii *indexInfo) addEntry(mib identifier.MIB, name string) { - ii.names = append(ii.names, [3]string{name, name, name}) - ii.addAlias(name, mib) - ii.codeToMIB = append(ii.codeToMIB, mib) -} - -func (ii *indexInfo) addAlias(name string, mib identifier.MIB) { - // Don't add duplicates for the same mib. Adding duplicate aliases for - // different MIBs will cause the compiler to barf on an invalid map: great!. - for i := len(ii.alias) - 1; i >= 0 && ii.alias[i].mib == mib; i-- { - if ii.alias[i].name == name { - return - } - } - ii.alias = append(ii.alias, alias{name, mib}) - lower := strings.ToLower(name) - if lower != name { - ii.addAlias(lower, mib) - } -} - -const maxMIMENameLen = '0' - 1 // officially 40, but we leave some buffer. - -func writeIndex(w *gen.CodeWriter, x *indexInfo) { - sort.Stable(x) - - // Write constants. - fmt.Fprintln(w, "const (") - for i, m := range x.codeToMIB { - if i == 0 { - fmt.Fprintf(w, "enc%d = iota\n", m) - } else { - fmt.Fprintf(w, "enc%d\n", m) - } - } - fmt.Fprintln(w, "numIANA") - fmt.Fprintln(w, ")") - - w.WriteVar("ianaToMIB", x.codeToMIB) - - var ianaNames, mibNames []string - for _, names := range x.names { - n := names[0] - if names[0] != names[1] { - // MIME names are mostly identical to IANA names. We share the - // tables by setting the first byte of the string to an index into - // the string itself (< maxMIMENameLen) to the IANA name. The MIME - // name immediately follows the index. - x := len(names[1]) + 1 - if x > maxMIMENameLen { - log.Fatalf("MIME name length (%d) > %d", x, maxMIMENameLen) - } - n = string(x) + names[1] + names[0] - } - ianaNames = append(ianaNames, n) - mibNames = append(mibNames, names[2]) - } - - w.WriteVar("ianaNames", ianaNames) - w.WriteVar("mibNames", mibNames) - - w.WriteComment(` - TODO: Instead of using a map, we could use binary search strings doing - on-the fly lower-casing per character. This allows to always avoid - allocation and will be considerably more compact.`) - fmt.Fprintln(w, "var ianaAliases = map[string]int{") - for _, a := range x.alias { - fmt.Fprintf(w, "%q: enc%d,\n", a.name, a.mib) - } - fmt.Fprintln(w, "}") -} - -func parseInt(s string) int { - x, err := strconv.ParseInt(s, 10, 64) - if err != nil { - log.Fatalf("Could not parse integer: %v", err) - } - return int(x) -} diff --git a/vendor/golang.org/x/text/encoding/ianaindex/ianaindex.go b/vendor/golang.org/x/text/encoding/ianaindex/ianaindex.go index 49b3070..344a8e6 100644 --- a/vendor/golang.org/x/text/encoding/ianaindex/ianaindex.go +++ b/vendor/golang.org/x/text/encoding/ianaindex/ianaindex.go @@ -2,28 +2,17 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:generate go run gen.go - // Package ianaindex maps names to Encodings as specified by the IANA registry. // This includes both the MIME and IANA names. // +// Status: this package is an incomplete API sketch, and isn't usable yet. +// // See http://www.iana.org/assignments/character-sets/character-sets.xhtml for // more details. package ianaindex import ( - "errors" - "sort" - "strings" - "golang.org/x/text/encoding" - "golang.org/x/text/encoding/charmap" - "golang.org/x/text/encoding/internal/identifier" - "golang.org/x/text/encoding/japanese" - "golang.org/x/text/encoding/korean" - "golang.org/x/text/encoding/simplifiedchinese" - "golang.org/x/text/encoding/traditionalchinese" - "golang.org/x/text/encoding/unicode" ) // TODO: remove the "Status... incomplete" in the package doc comment. @@ -36,68 +25,28 @@ import ( // support MIME otherwise. var ( - // MIME is an index to map MIME names. - MIME *Index = mime + // MIME is an index to map MIME names. It does not support aliases. + MIME *Index // IANA is an index that supports all names and aliases using IANA names as // the canonical identifier. - IANA *Index = iana - - // MIB is an index that associates the MIB display name with an Encoding. - MIB *Index = mib - - mime = &Index{mimeName, ianaToMIB, ianaAliases, encodings[:]} - iana = &Index{ianaName, ianaToMIB, ianaAliases, encodings[:]} - mib = &Index{mibName, ianaToMIB, ianaAliases, encodings[:]} + IANA *Index ) // Index maps names registered by IANA to Encodings. -// Currently different Indexes only differ in the names they return for -// encodings. In the future they may also differ in supported aliases. type Index struct { - names func(i int) string - toMIB []identifier.MIB // Sorted slice of supported MIBs - alias map[string]int - enc []encoding.Encoding } -var ( - errInvalidName = errors.New("ianaindex: invalid encoding name") - errUnknown = errors.New("ianaindex: unknown Encoding") - errUnsupported = errors.New("ianaindex: unsupported Encoding") -) - -// Encoding returns an Encoding for IANA-registered names. Matching is +// Get returns an Encoding for IANA-registered names. Matching is // case-insensitive. -func (x *Index) Encoding(name string) (encoding.Encoding, error) { - name = strings.TrimSpace(name) - // First try without lowercasing (possibly creating an allocation). - i, ok := x.alias[name] - if !ok { - i, ok = x.alias[strings.ToLower(name)] - if !ok { - return nil, errInvalidName - } - } - return x.enc[i], nil +func (x *Index) Get(name string) (encoding.Encoding, error) { + panic("TODO: implement") } // Name reports the canonical name of the given Encoding. It will return an // error if the e is not associated with a known encoding scheme. func (x *Index) Name(e encoding.Encoding) (string, error) { - id, ok := e.(identifier.Interface) - if !ok { - return "", errUnknown - } - mib, _ := id.ID() - if mib == 0 { - return "", errUnknown - } - v := findMIB(x.toMIB, mib) - if v == -1 { - return "", errUnsupported - } - return x.names(v), nil + panic("TODO: implement") } // TODO: the coverage of this index is rather spotty. Allowing users to set @@ -116,94 +65,3 @@ func (x *Index) Name(e encoding.Encoding) (string, error) { // func (x *Index) Set(name string, e encoding.Encoding) error { // panic("TODO: implement") // } - -func findMIB(x []identifier.MIB, mib identifier.MIB) int { - i := sort.Search(len(x), func(i int) bool { return x[i] >= mib }) - if i < len(x) && x[i] == mib { - return i - } - return -1 -} - -const maxMIMENameLen = '0' - 1 // officially 40, but we leave some buffer. - -func mimeName(x int) string { - n := ianaNames[x] - // See gen.go for a description of the encoding. - if n[0] <= maxMIMENameLen { - return n[1:n[0]] - } - return n -} - -func ianaName(x int) string { - n := ianaNames[x] - // See gen.go for a description of the encoding. - if n[0] <= maxMIMENameLen { - return n[n[0]:] - } - return n -} - -func mibName(x int) string { - return mibNames[x] -} - -var encodings = [numIANA]encoding.Encoding{ - enc106: unicode.UTF8, - enc1015: unicode.UTF16(unicode.BigEndian, unicode.UseBOM), - enc1013: unicode.UTF16(unicode.BigEndian, unicode.IgnoreBOM), - enc1014: unicode.UTF16(unicode.LittleEndian, unicode.IgnoreBOM), - enc2028: charmap.CodePage037, - enc2011: charmap.CodePage437, - enc2009: charmap.CodePage850, - enc2010: charmap.CodePage852, - enc2046: charmap.CodePage855, - enc2089: charmap.CodePage858, - enc2048: charmap.CodePage860, - enc2013: charmap.CodePage862, - enc2050: charmap.CodePage863, - enc2052: charmap.CodePage865, - enc2086: charmap.CodePage866, - enc2102: charmap.CodePage1047, - enc2091: charmap.CodePage1140, - enc4: charmap.ISO8859_1, - enc5: charmap.ISO8859_2, - enc6: charmap.ISO8859_3, - enc7: charmap.ISO8859_4, - enc8: charmap.ISO8859_5, - enc9: charmap.ISO8859_6, - enc81: charmap.ISO8859_6E, - enc82: charmap.ISO8859_6I, - enc10: charmap.ISO8859_7, - enc11: charmap.ISO8859_8, - enc84: charmap.ISO8859_8E, - enc85: charmap.ISO8859_8I, - enc12: charmap.ISO8859_9, - enc13: charmap.ISO8859_10, - enc109: charmap.ISO8859_13, - enc110: charmap.ISO8859_14, - enc111: charmap.ISO8859_15, - enc112: charmap.ISO8859_16, - enc2084: charmap.KOI8R, - enc2088: charmap.KOI8U, - enc2027: charmap.Macintosh, - enc2109: charmap.Windows874, - enc2250: charmap.Windows1250, - enc2251: charmap.Windows1251, - enc2252: charmap.Windows1252, - enc2253: charmap.Windows1253, - enc2254: charmap.Windows1254, - enc2255: charmap.Windows1255, - enc2256: charmap.Windows1256, - enc2257: charmap.Windows1257, - enc2258: charmap.Windows1258, - enc18: japanese.EUCJP, - enc39: japanese.ISO2022JP, - enc17: japanese.ShiftJIS, - enc38: korean.EUCKR, - enc114: simplifiedchinese.GB18030, - enc113: simplifiedchinese.GBK, - enc2085: simplifiedchinese.HZGB2312, - enc2026: traditionalchinese.Big5, -} diff --git a/vendor/golang.org/x/text/encoding/ianaindex/ianaindex_test.go b/vendor/golang.org/x/text/encoding/ianaindex/ianaindex_test.go deleted file mode 100644 index 20a2131..0000000 --- a/vendor/golang.org/x/text/encoding/ianaindex/ianaindex_test.go +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ianaindex - -import ( - "testing" - - "golang.org/x/text/encoding" - "golang.org/x/text/encoding/charmap" - "golang.org/x/text/encoding/internal/identifier" - "golang.org/x/text/encoding/japanese" - "golang.org/x/text/encoding/korean" - "golang.org/x/text/encoding/simplifiedchinese" - "golang.org/x/text/encoding/traditionalchinese" - "golang.org/x/text/encoding/unicode" -) - -var All = [][]encoding.Encoding{ - unicode.All, - charmap.All, - japanese.All, - korean.All, - simplifiedchinese.All, - traditionalchinese.All, -} - -// TestAllIANA tests whether an Encoding supported in x/text is defined by IANA but -// not supported by this package. -func TestAllIANA(t *testing.T) { - for _, ea := range All { - for _, e := range ea { - mib, _ := e.(identifier.Interface).ID() - if x := findMIB(ianaToMIB, mib); x != -1 && encodings[x] == nil { - t.Errorf("supported MIB %v (%v) not in index", mib, e) - } - } - } -} - -// TestNotSupported reports the encodings in IANA, but not by x/text. -func TestNotSupported(t *testing.T) { - mibs := map[identifier.MIB]bool{} - for _, ea := range All { - for _, e := range ea { - mib, _ := e.(identifier.Interface).ID() - mibs[mib] = true - } - } - - // Many encodings in the IANA index will likely not be suppored by the - // Go encodings. That is fine. - // TODO: consider wheter we should add this test. - // for code, mib := range ianaToMIB { - // t.Run(fmt.Sprint("IANA:", mib), func(t *testing.T) { - // if !mibs[mib] { - // t.Skipf("IANA encoding %s (MIB %v) not supported", - // ianaNames[code], mib) - // } - // }) - // } -} - -func TestEncoding(t *testing.T) { - testCases := []struct { - index *Index - name string - canonical string - err error - }{ - {MIME, "utf-8", "UTF-8", nil}, - {MIME, " utf-8 ", "UTF-8", nil}, - {MIME, " l5 ", "ISO-8859-9", nil}, - {MIME, "latin5 ", "ISO-8859-9", nil}, - {MIME, "LATIN5 ", "ISO-8859-9", nil}, - {MIME, "latin 5", "", errInvalidName}, - {MIME, "latin-5", "", errInvalidName}, - - {IANA, "utf-8", "UTF-8", nil}, - {IANA, " utf-8 ", "UTF-8", nil}, - {IANA, " l5 ", "ISO_8859-9:1989", nil}, - {IANA, "latin5 ", "ISO_8859-9:1989", nil}, - {IANA, "LATIN5 ", "ISO_8859-9:1989", nil}, - {IANA, "latin 5", "", errInvalidName}, - {IANA, "latin-5", "", errInvalidName}, - - {MIB, "utf-8", "UTF8", nil}, - {MIB, " utf-8 ", "UTF8", nil}, - {MIB, " l5 ", "ISOLatin5", nil}, - {MIB, "latin5 ", "ISOLatin5", nil}, - {MIB, "LATIN5 ", "ISOLatin5", nil}, - {MIB, "latin 5", "", errInvalidName}, - {MIB, "latin-5", "", errInvalidName}, - } - for i, tc := range testCases { - enc, err := tc.index.Encoding(tc.name) - if err != tc.err { - t.Errorf("%d: error was %v; want %v", i, err, tc.err) - } - if err != nil { - continue - } - if got, err := tc.index.Name(enc); got != tc.canonical { - t.Errorf("%d: Name(Encoding(%q)) = %q; want %q (%v)", i, tc.name, got, tc.canonical, err) - } - } -} - -func TestTables(t *testing.T) { - for i, x := range []*Index{MIME, IANA} { - for name, index := range x.alias { - got, err := x.Encoding(name) - if err != nil { - t.Errorf("%d%s:err: unexpected error %v", i, name, err) - } - if want := x.enc[index]; got != want { - t.Errorf("%d%s:encoding: got %v; want %v", i, name, got, want) - } - if got != nil { - mib, _ := got.(identifier.Interface).ID() - if i := findMIB(x.toMIB, mib); i != index { - t.Errorf("%d%s:mib: got %d; want %d", i, name, i, index) - } - } - } - } -} - -type unsupported struct { - encoding.Encoding -} - -func (unsupported) ID() (identifier.MIB, string) { return 9999, "" } - -func TestName(t *testing.T) { - testCases := []struct { - desc string - enc encoding.Encoding - f func(e encoding.Encoding) (string, error) - name string - err error - }{{ - "defined encoding", - charmap.ISO8859_2, - MIME.Name, - "ISO-8859-2", - nil, - }, { - "defined Unicode encoding", - unicode.UTF16(unicode.BigEndian, unicode.IgnoreBOM), - IANA.Name, - "UTF-16BE", - nil, - }, { - "another defined Unicode encoding", - unicode.UTF16(unicode.BigEndian, unicode.UseBOM), - MIME.Name, - "UTF-16", - nil, - }, { - "unknown Unicode encoding", - unicode.UTF16(unicode.BigEndian, unicode.ExpectBOM), - MIME.Name, - "", - errUnknown, - }, { - "undefined encoding", - unsupported{}, - MIME.Name, - "", - errUnsupported, - }, { - "undefined other encoding in HTML standard", - charmap.CodePage437, - IANA.Name, - "IBM437", - nil, - }, { - "unknown encoding", - encoding.Nop, - IANA.Name, - "", - errUnknown, - }} - for i, tc := range testCases { - name, err := tc.f(tc.enc) - if name != tc.name || err != tc.err { - t.Errorf("%d:%s: got %q, %v; want %q, %v", i, tc.desc, name, err, tc.name, tc.err) - } - } -} diff --git a/vendor/golang.org/x/text/encoding/ianaindex/tables.go b/vendor/golang.org/x/text/encoding/ianaindex/tables.go deleted file mode 100644 index 98a1d77..0000000 --- a/vendor/golang.org/x/text/encoding/ianaindex/tables.go +++ /dev/null @@ -1,2348 +0,0 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. - -package ianaindex - -import "golang.org/x/text/encoding/internal/identifier" - -const ( - enc3 = iota - enc4 - enc5 - enc6 - enc7 - enc8 - enc9 - enc10 - enc11 - enc12 - enc13 - enc14 - enc15 - enc16 - enc17 - enc18 - enc19 - enc20 - enc21 - enc22 - enc23 - enc24 - enc25 - enc26 - enc27 - enc28 - enc29 - enc30 - enc31 - enc32 - enc33 - enc34 - enc35 - enc36 - enc37 - enc38 - enc39 - enc40 - enc41 - enc42 - enc43 - enc44 - enc45 - enc46 - enc47 - enc48 - enc49 - enc50 - enc51 - enc52 - enc53 - enc54 - enc55 - enc56 - enc57 - enc58 - enc59 - enc60 - enc61 - enc62 - enc63 - enc64 - enc65 - enc66 - enc67 - enc68 - enc69 - enc70 - enc71 - enc72 - enc73 - enc74 - enc75 - enc76 - enc77 - enc78 - enc79 - enc80 - enc81 - enc82 - enc83 - enc84 - enc85 - enc86 - enc87 - enc88 - enc89 - enc90 - enc91 - enc92 - enc93 - enc94 - enc95 - enc96 - enc97 - enc98 - enc99 - enc100 - enc101 - enc102 - enc103 - enc104 - enc105 - enc106 - enc109 - enc110 - enc111 - enc112 - enc113 - enc114 - enc115 - enc116 - enc117 - enc118 - enc119 - enc1000 - enc1001 - enc1002 - enc1003 - enc1004 - enc1005 - enc1006 - enc1007 - enc1008 - enc1009 - enc1010 - enc1011 - enc1012 - enc1013 - enc1014 - enc1015 - enc1016 - enc1017 - enc1018 - enc1019 - enc1020 - enc2000 - enc2001 - enc2002 - enc2003 - enc2004 - enc2005 - enc2006 - enc2007 - enc2008 - enc2009 - enc2010 - enc2011 - enc2012 - enc2013 - enc2014 - enc2015 - enc2016 - enc2017 - enc2018 - enc2019 - enc2020 - enc2021 - enc2022 - enc2023 - enc2024 - enc2025 - enc2026 - enc2027 - enc2028 - enc2029 - enc2030 - enc2031 - enc2032 - enc2033 - enc2034 - enc2035 - enc2036 - enc2037 - enc2038 - enc2039 - enc2040 - enc2041 - enc2042 - enc2043 - enc2044 - enc2045 - enc2046 - enc2047 - enc2048 - enc2049 - enc2050 - enc2051 - enc2052 - enc2053 - enc2054 - enc2055 - enc2056 - enc2057 - enc2058 - enc2059 - enc2060 - enc2061 - enc2062 - enc2063 - enc2064 - enc2065 - enc2066 - enc2067 - enc2068 - enc2069 - enc2070 - enc2071 - enc2072 - enc2073 - enc2074 - enc2075 - enc2076 - enc2077 - enc2078 - enc2079 - enc2080 - enc2081 - enc2082 - enc2083 - enc2084 - enc2085 - enc2086 - enc2087 - enc2088 - enc2089 - enc2090 - enc2091 - enc2092 - enc2093 - enc2094 - enc2095 - enc2096 - enc2097 - enc2098 - enc2099 - enc2100 - enc2101 - enc2102 - enc2103 - enc2104 - enc2105 - enc2106 - enc2107 - enc2108 - enc2109 - enc2250 - enc2251 - enc2252 - enc2253 - enc2254 - enc2255 - enc2256 - enc2257 - enc2258 - enc2259 - enc2260 - numIANA -) - -var ianaToMIB = []identifier.MIB{ // 257 elements - // Entry 0 - 3F - 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, - 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 0x0010, 0x0011, 0x0012, - 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, - 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, 0x0020, 0x0021, 0x0022, - 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, - 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, - 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, - 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x0040, 0x0041, 0x0042, - // Entry 40 - 7F - 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, - 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, - 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, - 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, 0x0060, 0x0061, 0x0062, - 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, - 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, - 0x0075, 0x0076, 0x0077, 0x03e8, 0x03e9, 0x03ea, 0x03eb, 0x03ec, - 0x03ed, 0x03ee, 0x03ef, 0x03f0, 0x03f1, 0x03f2, 0x03f3, 0x03f4, - // Entry 80 - BF - 0x03f5, 0x03f6, 0x03f7, 0x03f8, 0x03f9, 0x03fa, 0x03fb, 0x03fc, - 0x07d0, 0x07d1, 0x07d2, 0x07d3, 0x07d4, 0x07d5, 0x07d6, 0x07d7, - 0x07d8, 0x07d9, 0x07da, 0x07db, 0x07dc, 0x07dd, 0x07de, 0x07df, - 0x07e0, 0x07e1, 0x07e2, 0x07e3, 0x07e4, 0x07e5, 0x07e6, 0x07e7, - 0x07e8, 0x07e9, 0x07ea, 0x07eb, 0x07ec, 0x07ed, 0x07ee, 0x07ef, - 0x07f0, 0x07f1, 0x07f2, 0x07f3, 0x07f4, 0x07f5, 0x07f6, 0x07f7, - 0x07f8, 0x07f9, 0x07fa, 0x07fb, 0x07fc, 0x07fd, 0x07fe, 0x07ff, - 0x0800, 0x0801, 0x0802, 0x0803, 0x0804, 0x0805, 0x0806, 0x0807, - // Entry C0 - FF - 0x0808, 0x0809, 0x080a, 0x080b, 0x080c, 0x080d, 0x080e, 0x080f, - 0x0810, 0x0811, 0x0812, 0x0813, 0x0814, 0x0815, 0x0816, 0x0817, - 0x0818, 0x0819, 0x081a, 0x081b, 0x081c, 0x081d, 0x081e, 0x081f, - 0x0820, 0x0821, 0x0822, 0x0823, 0x0824, 0x0825, 0x0826, 0x0827, - 0x0828, 0x0829, 0x082a, 0x082b, 0x082c, 0x082d, 0x082e, 0x082f, - 0x0830, 0x0831, 0x0832, 0x0833, 0x0834, 0x0835, 0x0836, 0x0837, - 0x0838, 0x0839, 0x083a, 0x083b, 0x083c, 0x083d, 0x08ca, 0x08cb, - 0x08cc, 0x08cd, 0x08ce, 0x08cf, 0x08d0, 0x08d1, 0x08d2, 0x08d3, - // Entry 100 - 13F - 0x08d4, -} // Size: 538 bytes - -var ianaNames = []string{ // 257 elements - "US-ASCII", - "\vISO-8859-1ISO_8859-1:1987", - "\vISO-8859-2ISO_8859-2:1987", - "\vISO-8859-3ISO_8859-3:1988", - "\vISO-8859-4ISO_8859-4:1988", - "\vISO-8859-5ISO_8859-5:1988", - "\vISO-8859-6ISO_8859-6:1987", - "\vISO-8859-7ISO_8859-7:1987", - "\vISO-8859-8ISO_8859-8:1988", - "\vISO-8859-9ISO_8859-9:1989", - "ISO-8859-10", - "ISO_6937-2-add", - "JIS_X0201", - "JIS_Encoding", - "Shift_JIS", - "\x07EUC-JPExtended_UNIX_Code_Packed_Format_for_Japanese", - "Extended_UNIX_Code_Fixed_Width_for_Japanese", - "BS_4730", - "SEN_850200_C", - "IT", - "ES", - "DIN_66003", - "NS_4551-1", - "NF_Z_62-010", - "ISO-10646-UTF-1", - "ISO_646.basic:1983", - "INVARIANT", - "ISO_646.irv:1983", - "NATS-SEFI", - "NATS-SEFI-ADD", - "NATS-DANO", - "NATS-DANO-ADD", - "SEN_850200_B", - "KS_C_5601-1987", - "ISO-2022-KR", - "EUC-KR", - "ISO-2022-JP", - "ISO-2022-JP-2", - "JIS_C6220-1969-jp", - "JIS_C6220-1969-ro", - "PT", - "greek7-old", - "latin-greek", - "NF_Z_62-010_(1973)", - "Latin-greek-1", - "ISO_5427", - "JIS_C6226-1978", - "BS_viewdata", - "INIS", - "INIS-8", - "INIS-cyrillic", - "ISO_5427:1981", - "ISO_5428:1980", - "GB_1988-80", - "GB_2312-80", - "NS_4551-2", - "videotex-suppl", - "PT2", - "ES2", - "MSZ_7795.3", - "JIS_C6226-1983", - "greek7", - "ASMO_449", - "iso-ir-90", - "JIS_C6229-1984-a", - "JIS_C6229-1984-b", - "JIS_C6229-1984-b-add", - "JIS_C6229-1984-hand", - "JIS_C6229-1984-hand-add", - "JIS_C6229-1984-kana", - "ISO_2033-1983", - "ANSI_X3.110-1983", - "T.61-7bit", - "T.61-8bit", - "ECMA-cyrillic", - "CSA_Z243.4-1985-1", - "CSA_Z243.4-1985-2", - "CSA_Z243.4-1985-gr", - "\rISO-8859-6-EISO_8859-6-E", - "\rISO-8859-6-IISO_8859-6-I", - "T.101-G2", - "\rISO-8859-8-EISO_8859-8-E", - "\rISO-8859-8-IISO_8859-8-I", - "CSN_369103", - "JUS_I.B1.002", - "IEC_P27-1", - "JUS_I.B1.003-serb", - "JUS_I.B1.003-mac", - "greek-ccitt", - "NC_NC00-10:81", - "ISO_6937-2-25", - "GOST_19768-74", - "ISO_8859-supp", - "ISO_10367-box", - "latin-lap", - "JIS_X0212-1990", - "DS_2089", - "us-dk", - "dk-us", - "KSC5636", - "UNICODE-1-1-UTF-7", - "ISO-2022-CN", - "ISO-2022-CN-EXT", - "UTF-8", - "ISO-8859-13", - "ISO-8859-14", - "ISO-8859-15", - "ISO-8859-16", - "GBK", - "GB18030", - "OSD_EBCDIC_DF04_15", - "OSD_EBCDIC_DF03_IRV", - "OSD_EBCDIC_DF04_1", - "ISO-11548-1", - "KZ-1048", - "ISO-10646-UCS-2", - "ISO-10646-UCS-4", - "ISO-10646-UCS-Basic", - "ISO-10646-Unicode-Latin1", - "ISO-10646-J-1", - "ISO-Unicode-IBM-1261", - "ISO-Unicode-IBM-1268", - "ISO-Unicode-IBM-1276", - "ISO-Unicode-IBM-1264", - "ISO-Unicode-IBM-1265", - "UNICODE-1-1", - "SCSU", - "UTF-7", - "UTF-16BE", - "UTF-16LE", - "UTF-16", - "CESU-8", - "UTF-32", - "UTF-32BE", - "UTF-32LE", - "BOCU-1", - "ISO-8859-1-Windows-3.0-Latin-1", - "ISO-8859-1-Windows-3.1-Latin-1", - "ISO-8859-2-Windows-Latin-2", - "ISO-8859-9-Windows-Latin-5", - "hp-roman8", - "Adobe-Standard-Encoding", - "Ventura-US", - "Ventura-International", - "DEC-MCS", - "IBM850", - "IBM852", - "IBM437", - "PC8-Danish-Norwegian", - "IBM862", - "PC8-Turkish", - "IBM-Symbols", - "IBM-Thai", - "HP-Legal", - "HP-Pi-font", - "HP-Math8", - "Adobe-Symbol-Encoding", - "HP-DeskTop", - "Ventura-Math", - "Microsoft-Publishing", - "Windows-31J", - "GB2312", - "Big5", - "macintosh", - "IBM037", - "IBM038", - "IBM273", - "IBM274", - "IBM275", - "IBM277", - "IBM278", - "IBM280", - "IBM281", - "IBM284", - "IBM285", - "IBM290", - "IBM297", - "IBM420", - "IBM423", - "IBM424", - "IBM500", - "IBM851", - "IBM855", - "IBM857", - "IBM860", - "IBM861", - "IBM863", - "IBM864", - "IBM865", - "IBM868", - "IBM869", - "IBM870", - "IBM871", - "IBM880", - "IBM891", - "IBM903", - "IBM904", - "IBM905", - "IBM918", - "IBM1026", - "EBCDIC-AT-DE", - "EBCDIC-AT-DE-A", - "EBCDIC-CA-FR", - "EBCDIC-DK-NO", - "EBCDIC-DK-NO-A", - "EBCDIC-FI-SE", - "EBCDIC-FI-SE-A", - "EBCDIC-FR", - "EBCDIC-IT", - "EBCDIC-PT", - "EBCDIC-ES", - "EBCDIC-ES-A", - "EBCDIC-ES-S", - "EBCDIC-UK", - "EBCDIC-US", - "UNKNOWN-8BIT", - "MNEMONIC", - "MNEM", - "VISCII", - "VIQR", - "KOI8-R", - "HZ-GB-2312", - "IBM866", - "IBM775", - "KOI8-U", - "IBM00858", - "IBM00924", - "IBM01140", - "IBM01141", - "IBM01142", - "IBM01143", - "IBM01144", - "IBM01145", - "IBM01146", - "IBM01147", - "IBM01148", - "IBM01149", - "Big5-HKSCS", - "IBM1047", - "PTCP154", - "Amiga-1251", - "KOI7-switched", - "BRF", - "TSCII", - "CP51932", - "windows-874", - "windows-1250", - "windows-1251", - "windows-1252", - "windows-1253", - "windows-1254", - "windows-1255", - "windows-1256", - "windows-1257", - "windows-1258", - "TIS-620", - "CP50220", -} // Size: 7088 bytes - -var mibNames = []string{ // 257 elements - "ASCII", - "ISOLatin1", - "ISOLatin2", - "ISOLatin3", - "ISOLatin4", - "ISOLatinCyrillic", - "ISOLatinArabic", - "ISOLatinGreek", - "ISOLatinHebrew", - "ISOLatin5", - "ISOLatin6", - "ISOTextComm", - "HalfWidthKatakana", - "JISEncoding", - "ShiftJIS", - "EUCPkdFmtJapanese", - "EUCFixWidJapanese", - "ISO4UnitedKingdom", - "ISO11SwedishForNames", - "ISO15Italian", - "ISO17Spanish", - "ISO21German", - "ISO60Norwegian1", - "ISO69French", - "ISO10646UTF1", - "ISO646basic1983", - "INVARIANT", - "ISO2IntlRefVersion", - "NATSSEFI", - "NATSSEFIADD", - "NATSDANO", - "NATSDANOADD", - "ISO10Swedish", - "KSC56011987", - "ISO2022KR", - "EUCKR", - "ISO2022JP", - "ISO2022JP2", - "ISO13JISC6220jp", - "ISO14JISC6220ro", - "ISO16Portuguese", - "ISO18Greek7Old", - "ISO19LatinGreek", - "ISO25French", - "ISO27LatinGreek1", - "ISO5427Cyrillic", - "ISO42JISC62261978", - "ISO47BSViewdata", - "ISO49INIS", - "ISO50INIS8", - "ISO51INISCyrillic", - "ISO54271981", - "ISO5428Greek", - "ISO57GB1988", - "ISO58GB231280", - "ISO61Norwegian2", - "ISO70VideotexSupp1", - "ISO84Portuguese2", - "ISO85Spanish2", - "ISO86Hungarian", - "ISO87JISX0208", - "ISO88Greek7", - "ISO89ASMO449", - "ISO90", - "ISO91JISC62291984a", - "ISO92JISC62991984b", - "ISO93JIS62291984badd", - "ISO94JIS62291984hand", - "ISO95JIS62291984handadd", - "ISO96JISC62291984kana", - "ISO2033", - "ISO99NAPLPS", - "ISO102T617bit", - "ISO103T618bit", - "ISO111ECMACyrillic", - "ISO121Canadian1", - "ISO122Canadian2", - "ISO123CSAZ24341985gr", - "ISO88596E", - "ISO88596I", - "ISO128T101G2", - "ISO88598E", - "ISO88598I", - "ISO139CSN369103", - "ISO141JUSIB1002", - "ISO143IECP271", - "ISO146Serbian", - "ISO147Macedonian", - "ISO150GreekCCITT", - "ISO151Cuba", - "ISO6937Add", - "ISO153GOST1976874", - "ISO8859Supp", - "ISO10367Box", - "ISO158Lap", - "ISO159JISX02121990", - "ISO646Danish", - "USDK", - "DKUS", - "KSC5636", - "Unicode11UTF7", - "ISO2022CN", - "ISO2022CNEXT", - "UTF8", - "ISO885913", - "ISO885914", - "ISO885915", - "ISO885916", - "GBK", - "GB18030", - "OSDEBCDICDF0415", - "OSDEBCDICDF03IRV", - "OSDEBCDICDF041", - "ISO115481", - "KZ1048", - "Unicode", - "UCS4", - "UnicodeASCII", - "UnicodeLatin1", - "UnicodeJapanese", - "UnicodeIBM1261", - "UnicodeIBM1268", - "UnicodeIBM1276", - "UnicodeIBM1264", - "UnicodeIBM1265", - "Unicode11", - "SCSU", - "UTF7", - "UTF16BE", - "UTF16LE", - "UTF16", - "CESU-8", - "UTF32", - "UTF32BE", - "UTF32LE", - "BOCU-1", - "Windows30Latin1", - "Windows31Latin1", - "Windows31Latin2", - "Windows31Latin5", - "HPRoman8", - "AdobeStandardEncoding", - "VenturaUS", - "VenturaInternational", - "DECMCS", - "PC850Multilingual", - "PCp852", - "PC8CodePage437", - "PC8DanishNorwegian", - "PC862LatinHebrew", - "PC8Turkish", - "IBMSymbols", - "IBMThai", - "HPLegal", - "HPPiFont", - "HPMath8", - "HPPSMath", - "HPDesktop", - "VenturaMath", - "MicrosoftPublishing", - "Windows31J", - "GB2312", - "Big5", - "Macintosh", - "IBM037", - "IBM038", - "IBM273", - "IBM274", - "IBM275", - "IBM277", - "IBM278", - "IBM280", - "IBM281", - "IBM284", - "IBM285", - "IBM290", - "IBM297", - "IBM420", - "IBM423", - "IBM424", - "IBM500", - "IBM851", - "IBM855", - "IBM857", - "IBM860", - "IBM861", - "IBM863", - "IBM864", - "IBM865", - "IBM868", - "IBM869", - "IBM870", - "IBM871", - "IBM880", - "IBM891", - "IBM903", - "IBBM904", - "IBM905", - "IBM918", - "IBM1026", - "IBMEBCDICATDE", - "EBCDICATDEA", - "EBCDICCAFR", - "EBCDICDKNO", - "EBCDICDKNOA", - "EBCDICFISE", - "EBCDICFISEA", - "EBCDICFR", - "EBCDICIT", - "EBCDICPT", - "EBCDICES", - "EBCDICESA", - "EBCDICESS", - "EBCDICUK", - "EBCDICUS", - "Unknown8BiT", - "Mnemonic", - "Mnem", - "VISCII", - "VIQR", - "KOI8R", - "HZ-GB-2312", - "IBM866", - "PC775Baltic", - "KOI8U", - "IBM00858", - "IBM00924", - "IBM01140", - "IBM01141", - "IBM01142", - "IBM01143", - "IBM01144", - "IBM01145", - "IBM01146", - "IBM01147", - "IBM01148", - "IBM01149", - "Big5HKSCS", - "IBM1047", - "PTCP154", - "Amiga1251\n(Aliases", - "KOI7switched", - "BRF", - "TSCII", - "CP51932", - "windows874", - "windows1250", - "windows1251", - "windows1252", - "windows1253", - "windows1254", - "windows1255", - "windows1256", - "windows1257", - "windows1258", - "TIS620", - "CP50220", -} // Size: 6776 bytes - -// TODO: Instead of using a map, we could use binary search strings doing -// on-the fly lower-casing per character. This allows to always avoid -// allocation and will be considerably more compact. -var ianaAliases = map[string]int{ - "US-ASCII": enc3, - "us-ascii": enc3, - "iso-ir-6": enc3, - "ANSI_X3.4-1968": enc3, - "ansi_x3.4-1968": enc3, - "ANSI_X3.4-1986": enc3, - "ansi_x3.4-1986": enc3, - "ISO_646.irv:1991": enc3, - "iso_646.irv:1991": enc3, - "ISO646-US": enc3, - "iso646-us": enc3, - "us": enc3, - "IBM367": enc3, - "ibm367": enc3, - "cp367": enc3, - "csASCII": enc3, - "csascii": enc3, - "ISO_8859-1:1987": enc4, - "iso_8859-1:1987": enc4, - "iso-ir-100": enc4, - "ISO_8859-1": enc4, - "iso_8859-1": enc4, - "ISO-8859-1": enc4, - "iso-8859-1": enc4, - "latin1": enc4, - "l1": enc4, - "IBM819": enc4, - "ibm819": enc4, - "CP819": enc4, - "cp819": enc4, - "csISOLatin1": enc4, - "csisolatin1": enc4, - "ISO_8859-2:1987": enc5, - "iso_8859-2:1987": enc5, - "iso-ir-101": enc5, - "ISO_8859-2": enc5, - "iso_8859-2": enc5, - "ISO-8859-2": enc5, - "iso-8859-2": enc5, - "latin2": enc5, - "l2": enc5, - "csISOLatin2": enc5, - "csisolatin2": enc5, - "ISO_8859-3:1988": enc6, - "iso_8859-3:1988": enc6, - "iso-ir-109": enc6, - "ISO_8859-3": enc6, - "iso_8859-3": enc6, - "ISO-8859-3": enc6, - "iso-8859-3": enc6, - "latin3": enc6, - "l3": enc6, - "csISOLatin3": enc6, - "csisolatin3": enc6, - "ISO_8859-4:1988": enc7, - "iso_8859-4:1988": enc7, - "iso-ir-110": enc7, - "ISO_8859-4": enc7, - "iso_8859-4": enc7, - "ISO-8859-4": enc7, - "iso-8859-4": enc7, - "latin4": enc7, - "l4": enc7, - "csISOLatin4": enc7, - "csisolatin4": enc7, - "ISO_8859-5:1988": enc8, - "iso_8859-5:1988": enc8, - "iso-ir-144": enc8, - "ISO_8859-5": enc8, - "iso_8859-5": enc8, - "ISO-8859-5": enc8, - "iso-8859-5": enc8, - "cyrillic": enc8, - "csISOLatinCyrillic": enc8, - "csisolatincyrillic": enc8, - "ISO_8859-6:1987": enc9, - "iso_8859-6:1987": enc9, - "iso-ir-127": enc9, - "ISO_8859-6": enc9, - "iso_8859-6": enc9, - "ISO-8859-6": enc9, - "iso-8859-6": enc9, - "ECMA-114": enc9, - "ecma-114": enc9, - "ASMO-708": enc9, - "asmo-708": enc9, - "arabic": enc9, - "csISOLatinArabic": enc9, - "csisolatinarabic": enc9, - "ISO_8859-7:1987": enc10, - "iso_8859-7:1987": enc10, - "iso-ir-126": enc10, - "ISO_8859-7": enc10, - "iso_8859-7": enc10, - "ISO-8859-7": enc10, - "iso-8859-7": enc10, - "ELOT_928": enc10, - "elot_928": enc10, - "ECMA-118": enc10, - "ecma-118": enc10, - "greek": enc10, - "greek8": enc10, - "csISOLatinGreek": enc10, - "csisolatingreek": enc10, - "ISO_8859-8:1988": enc11, - "iso_8859-8:1988": enc11, - "iso-ir-138": enc11, - "ISO_8859-8": enc11, - "iso_8859-8": enc11, - "ISO-8859-8": enc11, - "iso-8859-8": enc11, - "hebrew": enc11, - "csISOLatinHebrew": enc11, - "csisolatinhebrew": enc11, - "ISO_8859-9:1989": enc12, - "iso_8859-9:1989": enc12, - "iso-ir-148": enc12, - "ISO_8859-9": enc12, - "iso_8859-9": enc12, - "ISO-8859-9": enc12, - "iso-8859-9": enc12, - "latin5": enc12, - "l5": enc12, - "csISOLatin5": enc12, - "csisolatin5": enc12, - "ISO-8859-10": enc13, - "iso-8859-10": enc13, - "iso-ir-157": enc13, - "l6": enc13, - "ISO_8859-10:1992": enc13, - "iso_8859-10:1992": enc13, - "csISOLatin6": enc13, - "csisolatin6": enc13, - "latin6": enc13, - "ISO_6937-2-add": enc14, - "iso_6937-2-add": enc14, - "iso-ir-142": enc14, - "csISOTextComm": enc14, - "csisotextcomm": enc14, - "JIS_X0201": enc15, - "jis_x0201": enc15, - "X0201": enc15, - "x0201": enc15, - "csHalfWidthKatakana": enc15, - "cshalfwidthkatakana": enc15, - "JIS_Encoding": enc16, - "jis_encoding": enc16, - "csJISEncoding": enc16, - "csjisencoding": enc16, - "Shift_JIS": enc17, - "shift_jis": enc17, - "MS_Kanji": enc17, - "ms_kanji": enc17, - "csShiftJIS": enc17, - "csshiftjis": enc17, - "Extended_UNIX_Code_Packed_Format_for_Japanese": enc18, - "extended_unix_code_packed_format_for_japanese": enc18, - "csEUCPkdFmtJapanese": enc18, - "cseucpkdfmtjapanese": enc18, - "EUC-JP": enc18, - "euc-jp": enc18, - "Extended_UNIX_Code_Fixed_Width_for_Japanese": enc19, - "extended_unix_code_fixed_width_for_japanese": enc19, - "csEUCFixWidJapanese": enc19, - "cseucfixwidjapanese": enc19, - "BS_4730": enc20, - "bs_4730": enc20, - "iso-ir-4": enc20, - "ISO646-GB": enc20, - "iso646-gb": enc20, - "gb": enc20, - "uk": enc20, - "csISO4UnitedKingdom": enc20, - "csiso4unitedkingdom": enc20, - "SEN_850200_C": enc21, - "sen_850200_c": enc21, - "iso-ir-11": enc21, - "ISO646-SE2": enc21, - "iso646-se2": enc21, - "se2": enc21, - "csISO11SwedishForNames": enc21, - "csiso11swedishfornames": enc21, - "IT": enc22, - "it": enc22, - "iso-ir-15": enc22, - "ISO646-IT": enc22, - "iso646-it": enc22, - "csISO15Italian": enc22, - "csiso15italian": enc22, - "ES": enc23, - "es": enc23, - "iso-ir-17": enc23, - "ISO646-ES": enc23, - "iso646-es": enc23, - "csISO17Spanish": enc23, - "csiso17spanish": enc23, - "DIN_66003": enc24, - "din_66003": enc24, - "iso-ir-21": enc24, - "de": enc24, - "ISO646-DE": enc24, - "iso646-de": enc24, - "csISO21German": enc24, - "csiso21german": enc24, - "NS_4551-1": enc25, - "ns_4551-1": enc25, - "iso-ir-60": enc25, - "ISO646-NO": enc25, - "iso646-no": enc25, - "no": enc25, - "csISO60DanishNorwegian": enc25, - "csiso60danishnorwegian": enc25, - "csISO60Norwegian1": enc25, - "csiso60norwegian1": enc25, - "NF_Z_62-010": enc26, - "nf_z_62-010": enc26, - "iso-ir-69": enc26, - "ISO646-FR": enc26, - "iso646-fr": enc26, - "fr": enc26, - "csISO69French": enc26, - "csiso69french": enc26, - "ISO-10646-UTF-1": enc27, - "iso-10646-utf-1": enc27, - "csISO10646UTF1": enc27, - "csiso10646utf1": enc27, - "ISO_646.basic:1983": enc28, - "iso_646.basic:1983": enc28, - "ref": enc28, - "csISO646basic1983": enc28, - "csiso646basic1983": enc28, - "INVARIANT": enc29, - "invariant": enc29, - "csINVARIANT": enc29, - "csinvariant": enc29, - "ISO_646.irv:1983": enc30, - "iso_646.irv:1983": enc30, - "iso-ir-2": enc30, - "irv": enc30, - "csISO2IntlRefVersion": enc30, - "csiso2intlrefversion": enc30, - "NATS-SEFI": enc31, - "nats-sefi": enc31, - "iso-ir-8-1": enc31, - "csNATSSEFI": enc31, - "csnatssefi": enc31, - "NATS-SEFI-ADD": enc32, - "nats-sefi-add": enc32, - "iso-ir-8-2": enc32, - "csNATSSEFIADD": enc32, - "csnatssefiadd": enc32, - "NATS-DANO": enc33, - "nats-dano": enc33, - "iso-ir-9-1": enc33, - "csNATSDANO": enc33, - "csnatsdano": enc33, - "NATS-DANO-ADD": enc34, - "nats-dano-add": enc34, - "iso-ir-9-2": enc34, - "csNATSDANOADD": enc34, - "csnatsdanoadd": enc34, - "SEN_850200_B": enc35, - "sen_850200_b": enc35, - "iso-ir-10": enc35, - "FI": enc35, - "fi": enc35, - "ISO646-FI": enc35, - "iso646-fi": enc35, - "ISO646-SE": enc35, - "iso646-se": enc35, - "se": enc35, - "csISO10Swedish": enc35, - "csiso10swedish": enc35, - "KS_C_5601-1987": enc36, - "ks_c_5601-1987": enc36, - "iso-ir-149": enc36, - "KS_C_5601-1989": enc36, - "ks_c_5601-1989": enc36, - "KSC_5601": enc36, - "ksc_5601": enc36, - "korean": enc36, - "csKSC56011987": enc36, - "csksc56011987": enc36, - "ISO-2022-KR": enc37, - "iso-2022-kr": enc37, - "csISO2022KR": enc37, - "csiso2022kr": enc37, - "EUC-KR": enc38, - "euc-kr": enc38, - "csEUCKR": enc38, - "cseuckr": enc38, - "ISO-2022-JP": enc39, - "iso-2022-jp": enc39, - "csISO2022JP": enc39, - "csiso2022jp": enc39, - "ISO-2022-JP-2": enc40, - "iso-2022-jp-2": enc40, - "csISO2022JP2": enc40, - "csiso2022jp2": enc40, - "JIS_C6220-1969-jp": enc41, - "jis_c6220-1969-jp": enc41, - "JIS_C6220-1969": enc41, - "jis_c6220-1969": enc41, - "iso-ir-13": enc41, - "katakana": enc41, - "x0201-7": enc41, - "csISO13JISC6220jp": enc41, - "csiso13jisc6220jp": enc41, - "JIS_C6220-1969-ro": enc42, - "jis_c6220-1969-ro": enc42, - "iso-ir-14": enc42, - "jp": enc42, - "ISO646-JP": enc42, - "iso646-jp": enc42, - "csISO14JISC6220ro": enc42, - "csiso14jisc6220ro": enc42, - "PT": enc43, - "pt": enc43, - "iso-ir-16": enc43, - "ISO646-PT": enc43, - "iso646-pt": enc43, - "csISO16Portuguese": enc43, - "csiso16portuguese": enc43, - "greek7-old": enc44, - "iso-ir-18": enc44, - "csISO18Greek7Old": enc44, - "csiso18greek7old": enc44, - "latin-greek": enc45, - "iso-ir-19": enc45, - "csISO19LatinGreek": enc45, - "csiso19latingreek": enc45, - "NF_Z_62-010_(1973)": enc46, - "nf_z_62-010_(1973)": enc46, - "iso-ir-25": enc46, - "ISO646-FR1": enc46, - "iso646-fr1": enc46, - "csISO25French": enc46, - "csiso25french": enc46, - "Latin-greek-1": enc47, - "latin-greek-1": enc47, - "iso-ir-27": enc47, - "csISO27LatinGreek1": enc47, - "csiso27latingreek1": enc47, - "ISO_5427": enc48, - "iso_5427": enc48, - "iso-ir-37": enc48, - "csISO5427Cyrillic": enc48, - "csiso5427cyrillic": enc48, - "JIS_C6226-1978": enc49, - "jis_c6226-1978": enc49, - "iso-ir-42": enc49, - "csISO42JISC62261978": enc49, - "csiso42jisc62261978": enc49, - "BS_viewdata": enc50, - "bs_viewdata": enc50, - "iso-ir-47": enc50, - "csISO47BSViewdata": enc50, - "csiso47bsviewdata": enc50, - "INIS": enc51, - "inis": enc51, - "iso-ir-49": enc51, - "csISO49INIS": enc51, - "csiso49inis": enc51, - "INIS-8": enc52, - "inis-8": enc52, - "iso-ir-50": enc52, - "csISO50INIS8": enc52, - "csiso50inis8": enc52, - "INIS-cyrillic": enc53, - "inis-cyrillic": enc53, - "iso-ir-51": enc53, - "csISO51INISCyrillic": enc53, - "csiso51iniscyrillic": enc53, - "ISO_5427:1981": enc54, - "iso_5427:1981": enc54, - "iso-ir-54": enc54, - "ISO5427Cyrillic1981": enc54, - "iso5427cyrillic1981": enc54, - "csISO54271981": enc54, - "csiso54271981": enc54, - "ISO_5428:1980": enc55, - "iso_5428:1980": enc55, - "iso-ir-55": enc55, - "csISO5428Greek": enc55, - "csiso5428greek": enc55, - "GB_1988-80": enc56, - "gb_1988-80": enc56, - "iso-ir-57": enc56, - "cn": enc56, - "ISO646-CN": enc56, - "iso646-cn": enc56, - "csISO57GB1988": enc56, - "csiso57gb1988": enc56, - "GB_2312-80": enc57, - "gb_2312-80": enc57, - "iso-ir-58": enc57, - "chinese": enc57, - "csISO58GB231280": enc57, - "csiso58gb231280": enc57, - "NS_4551-2": enc58, - "ns_4551-2": enc58, - "ISO646-NO2": enc58, - "iso646-no2": enc58, - "iso-ir-61": enc58, - "no2": enc58, - "csISO61Norwegian2": enc58, - "csiso61norwegian2": enc58, - "videotex-suppl": enc59, - "iso-ir-70": enc59, - "csISO70VideotexSupp1": enc59, - "csiso70videotexsupp1": enc59, - "PT2": enc60, - "pt2": enc60, - "iso-ir-84": enc60, - "ISO646-PT2": enc60, - "iso646-pt2": enc60, - "csISO84Portuguese2": enc60, - "csiso84portuguese2": enc60, - "ES2": enc61, - "es2": enc61, - "iso-ir-85": enc61, - "ISO646-ES2": enc61, - "iso646-es2": enc61, - "csISO85Spanish2": enc61, - "csiso85spanish2": enc61, - "MSZ_7795.3": enc62, - "msz_7795.3": enc62, - "iso-ir-86": enc62, - "ISO646-HU": enc62, - "iso646-hu": enc62, - "hu": enc62, - "csISO86Hungarian": enc62, - "csiso86hungarian": enc62, - "JIS_C6226-1983": enc63, - "jis_c6226-1983": enc63, - "iso-ir-87": enc63, - "x0208": enc63, - "JIS_X0208-1983": enc63, - "jis_x0208-1983": enc63, - "csISO87JISX0208": enc63, - "csiso87jisx0208": enc63, - "greek7": enc64, - "iso-ir-88": enc64, - "csISO88Greek7": enc64, - "csiso88greek7": enc64, - "ASMO_449": enc65, - "asmo_449": enc65, - "ISO_9036": enc65, - "iso_9036": enc65, - "arabic7": enc65, - "iso-ir-89": enc65, - "csISO89ASMO449": enc65, - "csiso89asmo449": enc65, - "iso-ir-90": enc66, - "csISO90": enc66, - "csiso90": enc66, - "JIS_C6229-1984-a": enc67, - "jis_c6229-1984-a": enc67, - "iso-ir-91": enc67, - "jp-ocr-a": enc67, - "csISO91JISC62291984a": enc67, - "csiso91jisc62291984a": enc67, - "JIS_C6229-1984-b": enc68, - "jis_c6229-1984-b": enc68, - "iso-ir-92": enc68, - "ISO646-JP-OCR-B": enc68, - "iso646-jp-ocr-b": enc68, - "jp-ocr-b": enc68, - "csISO92JISC62991984b": enc68, - "csiso92jisc62991984b": enc68, - "JIS_C6229-1984-b-add": enc69, - "jis_c6229-1984-b-add": enc69, - "iso-ir-93": enc69, - "jp-ocr-b-add": enc69, - "csISO93JIS62291984badd": enc69, - "csiso93jis62291984badd": enc69, - "JIS_C6229-1984-hand": enc70, - "jis_c6229-1984-hand": enc70, - "iso-ir-94": enc70, - "jp-ocr-hand": enc70, - "csISO94JIS62291984hand": enc70, - "csiso94jis62291984hand": enc70, - "JIS_C6229-1984-hand-add": enc71, - "jis_c6229-1984-hand-add": enc71, - "iso-ir-95": enc71, - "jp-ocr-hand-add": enc71, - "csISO95JIS62291984handadd": enc71, - "csiso95jis62291984handadd": enc71, - "JIS_C6229-1984-kana": enc72, - "jis_c6229-1984-kana": enc72, - "iso-ir-96": enc72, - "csISO96JISC62291984kana": enc72, - "csiso96jisc62291984kana": enc72, - "ISO_2033-1983": enc73, - "iso_2033-1983": enc73, - "iso-ir-98": enc73, - "e13b": enc73, - "csISO2033": enc73, - "csiso2033": enc73, - "ANSI_X3.110-1983": enc74, - "ansi_x3.110-1983": enc74, - "iso-ir-99": enc74, - "CSA_T500-1983": enc74, - "csa_t500-1983": enc74, - "NAPLPS": enc74, - "naplps": enc74, - "csISO99NAPLPS": enc74, - "csiso99naplps": enc74, - "T.61-7bit": enc75, - "t.61-7bit": enc75, - "iso-ir-102": enc75, - "csISO102T617bit": enc75, - "csiso102t617bit": enc75, - "T.61-8bit": enc76, - "t.61-8bit": enc76, - "T.61": enc76, - "t.61": enc76, - "iso-ir-103": enc76, - "csISO103T618bit": enc76, - "csiso103t618bit": enc76, - "ECMA-cyrillic": enc77, - "ecma-cyrillic": enc77, - "iso-ir-111": enc77, - "KOI8-E": enc77, - "koi8-e": enc77, - "csISO111ECMACyrillic": enc77, - "csiso111ecmacyrillic": enc77, - "CSA_Z243.4-1985-1": enc78, - "csa_z243.4-1985-1": enc78, - "iso-ir-121": enc78, - "ISO646-CA": enc78, - "iso646-ca": enc78, - "csa7-1": enc78, - "csa71": enc78, - "ca": enc78, - "csISO121Canadian1": enc78, - "csiso121canadian1": enc78, - "CSA_Z243.4-1985-2": enc79, - "csa_z243.4-1985-2": enc79, - "iso-ir-122": enc79, - "ISO646-CA2": enc79, - "iso646-ca2": enc79, - "csa7-2": enc79, - "csa72": enc79, - "csISO122Canadian2": enc79, - "csiso122canadian2": enc79, - "CSA_Z243.4-1985-gr": enc80, - "csa_z243.4-1985-gr": enc80, - "iso-ir-123": enc80, - "csISO123CSAZ24341985gr": enc80, - "csiso123csaz24341985gr": enc80, - "ISO_8859-6-E": enc81, - "iso_8859-6-e": enc81, - "csISO88596E": enc81, - "csiso88596e": enc81, - "ISO-8859-6-E": enc81, - "iso-8859-6-e": enc81, - "ISO_8859-6-I": enc82, - "iso_8859-6-i": enc82, - "csISO88596I": enc82, - "csiso88596i": enc82, - "ISO-8859-6-I": enc82, - "iso-8859-6-i": enc82, - "T.101-G2": enc83, - "t.101-g2": enc83, - "iso-ir-128": enc83, - "csISO128T101G2": enc83, - "csiso128t101g2": enc83, - "ISO_8859-8-E": enc84, - "iso_8859-8-e": enc84, - "csISO88598E": enc84, - "csiso88598e": enc84, - "ISO-8859-8-E": enc84, - "iso-8859-8-e": enc84, - "ISO_8859-8-I": enc85, - "iso_8859-8-i": enc85, - "csISO88598I": enc85, - "csiso88598i": enc85, - "ISO-8859-8-I": enc85, - "iso-8859-8-i": enc85, - "CSN_369103": enc86, - "csn_369103": enc86, - "iso-ir-139": enc86, - "csISO139CSN369103": enc86, - "csiso139csn369103": enc86, - "JUS_I.B1.002": enc87, - "jus_i.b1.002": enc87, - "iso-ir-141": enc87, - "ISO646-YU": enc87, - "iso646-yu": enc87, - "js": enc87, - "yu": enc87, - "csISO141JUSIB1002": enc87, - "csiso141jusib1002": enc87, - "IEC_P27-1": enc88, - "iec_p27-1": enc88, - "iso-ir-143": enc88, - "csISO143IECP271": enc88, - "csiso143iecp271": enc88, - "JUS_I.B1.003-serb": enc89, - "jus_i.b1.003-serb": enc89, - "iso-ir-146": enc89, - "serbian": enc89, - "csISO146Serbian": enc89, - "csiso146serbian": enc89, - "JUS_I.B1.003-mac": enc90, - "jus_i.b1.003-mac": enc90, - "macedonian": enc90, - "iso-ir-147": enc90, - "csISO147Macedonian": enc90, - "csiso147macedonian": enc90, - "greek-ccitt": enc91, - "iso-ir-150": enc91, - "csISO150": enc91, - "csiso150": enc91, - "csISO150GreekCCITT": enc91, - "csiso150greekccitt": enc91, - "NC_NC00-10:81": enc92, - "nc_nc00-10:81": enc92, - "cuba": enc92, - "iso-ir-151": enc92, - "ISO646-CU": enc92, - "iso646-cu": enc92, - "csISO151Cuba": enc92, - "csiso151cuba": enc92, - "ISO_6937-2-25": enc93, - "iso_6937-2-25": enc93, - "iso-ir-152": enc93, - "csISO6937Add": enc93, - "csiso6937add": enc93, - "GOST_19768-74": enc94, - "gost_19768-74": enc94, - "ST_SEV_358-88": enc94, - "st_sev_358-88": enc94, - "iso-ir-153": enc94, - "csISO153GOST1976874": enc94, - "csiso153gost1976874": enc94, - "ISO_8859-supp": enc95, - "iso_8859-supp": enc95, - "iso-ir-154": enc95, - "latin1-2-5": enc95, - "csISO8859Supp": enc95, - "csiso8859supp": enc95, - "ISO_10367-box": enc96, - "iso_10367-box": enc96, - "iso-ir-155": enc96, - "csISO10367Box": enc96, - "csiso10367box": enc96, - "latin-lap": enc97, - "lap": enc97, - "iso-ir-158": enc97, - "csISO158Lap": enc97, - "csiso158lap": enc97, - "JIS_X0212-1990": enc98, - "jis_x0212-1990": enc98, - "x0212": enc98, - "iso-ir-159": enc98, - "csISO159JISX02121990": enc98, - "csiso159jisx02121990": enc98, - "DS_2089": enc99, - "ds_2089": enc99, - "DS2089": enc99, - "ds2089": enc99, - "ISO646-DK": enc99, - "iso646-dk": enc99, - "dk": enc99, - "csISO646Danish": enc99, - "csiso646danish": enc99, - "us-dk": enc100, - "csUSDK": enc100, - "csusdk": enc100, - "dk-us": enc101, - "csDKUS": enc101, - "csdkus": enc101, - "KSC5636": enc102, - "ksc5636": enc102, - "ISO646-KR": enc102, - "iso646-kr": enc102, - "csKSC5636": enc102, - "csksc5636": enc102, - "UNICODE-1-1-UTF-7": enc103, - "unicode-1-1-utf-7": enc103, - "csUnicode11UTF7": enc103, - "csunicode11utf7": enc103, - "ISO-2022-CN": enc104, - "iso-2022-cn": enc104, - "csISO2022CN": enc104, - "csiso2022cn": enc104, - "ISO-2022-CN-EXT": enc105, - "iso-2022-cn-ext": enc105, - "csISO2022CNEXT": enc105, - "csiso2022cnext": enc105, - "UTF-8": enc106, - "utf-8": enc106, - "csUTF8": enc106, - "csutf8": enc106, - "ISO-8859-13": enc109, - "iso-8859-13": enc109, - "csISO885913": enc109, - "csiso885913": enc109, - "ISO-8859-14": enc110, - "iso-8859-14": enc110, - "iso-ir-199": enc110, - "ISO_8859-14:1998": enc110, - "iso_8859-14:1998": enc110, - "ISO_8859-14": enc110, - "iso_8859-14": enc110, - "latin8": enc110, - "iso-celtic": enc110, - "l8": enc110, - "csISO885914": enc110, - "csiso885914": enc110, - "ISO-8859-15": enc111, - "iso-8859-15": enc111, - "ISO_8859-15": enc111, - "iso_8859-15": enc111, - "Latin-9": enc111, - "latin-9": enc111, - "csISO885915": enc111, - "csiso885915": enc111, - "ISO-8859-16": enc112, - "iso-8859-16": enc112, - "iso-ir-226": enc112, - "ISO_8859-16:2001": enc112, - "iso_8859-16:2001": enc112, - "ISO_8859-16": enc112, - "iso_8859-16": enc112, - "latin10": enc112, - "l10": enc112, - "csISO885916": enc112, - "csiso885916": enc112, - "GBK": enc113, - "gbk": enc113, - "CP936": enc113, - "cp936": enc113, - "MS936": enc113, - "ms936": enc113, - "windows-936": enc113, - "csGBK": enc113, - "csgbk": enc113, - "GB18030": enc114, - "gb18030": enc114, - "csGB18030": enc114, - "csgb18030": enc114, - "OSD_EBCDIC_DF04_15": enc115, - "osd_ebcdic_df04_15": enc115, - "csOSDEBCDICDF0415": enc115, - "csosdebcdicdf0415": enc115, - "OSD_EBCDIC_DF03_IRV": enc116, - "osd_ebcdic_df03_irv": enc116, - "csOSDEBCDICDF03IRV": enc116, - "csosdebcdicdf03irv": enc116, - "OSD_EBCDIC_DF04_1": enc117, - "osd_ebcdic_df04_1": enc117, - "csOSDEBCDICDF041": enc117, - "csosdebcdicdf041": enc117, - "ISO-11548-1": enc118, - "iso-11548-1": enc118, - "ISO_11548-1": enc118, - "iso_11548-1": enc118, - "ISO_TR_11548-1": enc118, - "iso_tr_11548-1": enc118, - "csISO115481": enc118, - "csiso115481": enc118, - "KZ-1048": enc119, - "kz-1048": enc119, - "STRK1048-2002": enc119, - "strk1048-2002": enc119, - "RK1048": enc119, - "rk1048": enc119, - "csKZ1048": enc119, - "cskz1048": enc119, - "ISO-10646-UCS-2": enc1000, - "iso-10646-ucs-2": enc1000, - "csUnicode": enc1000, - "csunicode": enc1000, - "ISO-10646-UCS-4": enc1001, - "iso-10646-ucs-4": enc1001, - "csUCS4": enc1001, - "csucs4": enc1001, - "ISO-10646-UCS-Basic": enc1002, - "iso-10646-ucs-basic": enc1002, - "csUnicodeASCII": enc1002, - "csunicodeascii": enc1002, - "ISO-10646-Unicode-Latin1": enc1003, - "iso-10646-unicode-latin1": enc1003, - "csUnicodeLatin1": enc1003, - "csunicodelatin1": enc1003, - "ISO-10646": enc1003, - "iso-10646": enc1003, - "ISO-10646-J-1": enc1004, - "iso-10646-j-1": enc1004, - "csUnicodeJapanese": enc1004, - "csunicodejapanese": enc1004, - "ISO-Unicode-IBM-1261": enc1005, - "iso-unicode-ibm-1261": enc1005, - "csUnicodeIBM1261": enc1005, - "csunicodeibm1261": enc1005, - "ISO-Unicode-IBM-1268": enc1006, - "iso-unicode-ibm-1268": enc1006, - "csUnicodeIBM1268": enc1006, - "csunicodeibm1268": enc1006, - "ISO-Unicode-IBM-1276": enc1007, - "iso-unicode-ibm-1276": enc1007, - "csUnicodeIBM1276": enc1007, - "csunicodeibm1276": enc1007, - "ISO-Unicode-IBM-1264": enc1008, - "iso-unicode-ibm-1264": enc1008, - "csUnicodeIBM1264": enc1008, - "csunicodeibm1264": enc1008, - "ISO-Unicode-IBM-1265": enc1009, - "iso-unicode-ibm-1265": enc1009, - "csUnicodeIBM1265": enc1009, - "csunicodeibm1265": enc1009, - "UNICODE-1-1": enc1010, - "unicode-1-1": enc1010, - "csUnicode11": enc1010, - "csunicode11": enc1010, - "SCSU": enc1011, - "scsu": enc1011, - "csSCSU": enc1011, - "csscsu": enc1011, - "UTF-7": enc1012, - "utf-7": enc1012, - "csUTF7": enc1012, - "csutf7": enc1012, - "UTF-16BE": enc1013, - "utf-16be": enc1013, - "csUTF16BE": enc1013, - "csutf16be": enc1013, - "UTF-16LE": enc1014, - "utf-16le": enc1014, - "csUTF16LE": enc1014, - "csutf16le": enc1014, - "UTF-16": enc1015, - "utf-16": enc1015, - "csUTF16": enc1015, - "csutf16": enc1015, - "CESU-8": enc1016, - "cesu-8": enc1016, - "csCESU8": enc1016, - "cscesu8": enc1016, - "csCESU-8": enc1016, - "cscesu-8": enc1016, - "UTF-32": enc1017, - "utf-32": enc1017, - "csUTF32": enc1017, - "csutf32": enc1017, - "UTF-32BE": enc1018, - "utf-32be": enc1018, - "csUTF32BE": enc1018, - "csutf32be": enc1018, - "UTF-32LE": enc1019, - "utf-32le": enc1019, - "csUTF32LE": enc1019, - "csutf32le": enc1019, - "BOCU-1": enc1020, - "bocu-1": enc1020, - "csBOCU1": enc1020, - "csbocu1": enc1020, - "csBOCU-1": enc1020, - "csbocu-1": enc1020, - "ISO-8859-1-Windows-3.0-Latin-1": enc2000, - "iso-8859-1-windows-3.0-latin-1": enc2000, - "csWindows30Latin1": enc2000, - "cswindows30latin1": enc2000, - "ISO-8859-1-Windows-3.1-Latin-1": enc2001, - "iso-8859-1-windows-3.1-latin-1": enc2001, - "csWindows31Latin1": enc2001, - "cswindows31latin1": enc2001, - "ISO-8859-2-Windows-Latin-2": enc2002, - "iso-8859-2-windows-latin-2": enc2002, - "csWindows31Latin2": enc2002, - "cswindows31latin2": enc2002, - "ISO-8859-9-Windows-Latin-5": enc2003, - "iso-8859-9-windows-latin-5": enc2003, - "csWindows31Latin5": enc2003, - "cswindows31latin5": enc2003, - "hp-roman8": enc2004, - "roman8": enc2004, - "r8": enc2004, - "csHPRoman8": enc2004, - "cshproman8": enc2004, - "Adobe-Standard-Encoding": enc2005, - "adobe-standard-encoding": enc2005, - "csAdobeStandardEncoding": enc2005, - "csadobestandardencoding": enc2005, - "Ventura-US": enc2006, - "ventura-us": enc2006, - "csVenturaUS": enc2006, - "csventuraus": enc2006, - "Ventura-International": enc2007, - "ventura-international": enc2007, - "csVenturaInternational": enc2007, - "csventurainternational": enc2007, - "DEC-MCS": enc2008, - "dec-mcs": enc2008, - "dec": enc2008, - "csDECMCS": enc2008, - "csdecmcs": enc2008, - "IBM850": enc2009, - "ibm850": enc2009, - "cp850": enc2009, - "850": enc2009, - "csPC850Multilingual": enc2009, - "cspc850multilingual": enc2009, - "PC8-Danish-Norwegian": enc2012, - "pc8-danish-norwegian": enc2012, - "csPC8DanishNorwegian": enc2012, - "cspc8danishnorwegian": enc2012, - "IBM862": enc2013, - "ibm862": enc2013, - "cp862": enc2013, - "862": enc2013, - "csPC862LatinHebrew": enc2013, - "cspc862latinhebrew": enc2013, - "PC8-Turkish": enc2014, - "pc8-turkish": enc2014, - "csPC8Turkish": enc2014, - "cspc8turkish": enc2014, - "IBM-Symbols": enc2015, - "ibm-symbols": enc2015, - "csIBMSymbols": enc2015, - "csibmsymbols": enc2015, - "IBM-Thai": enc2016, - "ibm-thai": enc2016, - "csIBMThai": enc2016, - "csibmthai": enc2016, - "HP-Legal": enc2017, - "hp-legal": enc2017, - "csHPLegal": enc2017, - "cshplegal": enc2017, - "HP-Pi-font": enc2018, - "hp-pi-font": enc2018, - "csHPPiFont": enc2018, - "cshppifont": enc2018, - "HP-Math8": enc2019, - "hp-math8": enc2019, - "csHPMath8": enc2019, - "cshpmath8": enc2019, - "Adobe-Symbol-Encoding": enc2020, - "adobe-symbol-encoding": enc2020, - "csHPPSMath": enc2020, - "cshppsmath": enc2020, - "HP-DeskTop": enc2021, - "hp-desktop": enc2021, - "csHPDesktop": enc2021, - "cshpdesktop": enc2021, - "Ventura-Math": enc2022, - "ventura-math": enc2022, - "csVenturaMath": enc2022, - "csventuramath": enc2022, - "Microsoft-Publishing": enc2023, - "microsoft-publishing": enc2023, - "csMicrosoftPublishing": enc2023, - "csmicrosoftpublishing": enc2023, - "Windows-31J": enc2024, - "windows-31j": enc2024, - "csWindows31J": enc2024, - "cswindows31j": enc2024, - "GB2312": enc2025, - "gb2312": enc2025, - "csGB2312": enc2025, - "csgb2312": enc2025, - "Big5": enc2026, - "big5": enc2026, - "csBig5": enc2026, - "csbig5": enc2026, - "macintosh": enc2027, - "mac": enc2027, - "csMacintosh": enc2027, - "csmacintosh": enc2027, - "IBM037": enc2028, - "ibm037": enc2028, - "cp037": enc2028, - "ebcdic-cp-us": enc2028, - "ebcdic-cp-ca": enc2028, - "ebcdic-cp-wt": enc2028, - "ebcdic-cp-nl": enc2028, - "csIBM037": enc2028, - "csibm037": enc2028, - "IBM038": enc2029, - "ibm038": enc2029, - "EBCDIC-INT": enc2029, - "ebcdic-int": enc2029, - "cp038": enc2029, - "csIBM038": enc2029, - "csibm038": enc2029, - "IBM273": enc2030, - "ibm273": enc2030, - "CP273": enc2030, - "cp273": enc2030, - "csIBM273": enc2030, - "csibm273": enc2030, - "IBM274": enc2031, - "ibm274": enc2031, - "EBCDIC-BE": enc2031, - "ebcdic-be": enc2031, - "CP274": enc2031, - "cp274": enc2031, - "csIBM274": enc2031, - "csibm274": enc2031, - "IBM275": enc2032, - "ibm275": enc2032, - "EBCDIC-BR": enc2032, - "ebcdic-br": enc2032, - "cp275": enc2032, - "csIBM275": enc2032, - "csibm275": enc2032, - "IBM277": enc2033, - "ibm277": enc2033, - "EBCDIC-CP-DK": enc2033, - "ebcdic-cp-dk": enc2033, - "EBCDIC-CP-NO": enc2033, - "ebcdic-cp-no": enc2033, - "csIBM277": enc2033, - "csibm277": enc2033, - "IBM278": enc2034, - "ibm278": enc2034, - "CP278": enc2034, - "cp278": enc2034, - "ebcdic-cp-fi": enc2034, - "ebcdic-cp-se": enc2034, - "csIBM278": enc2034, - "csibm278": enc2034, - "IBM280": enc2035, - "ibm280": enc2035, - "CP280": enc2035, - "cp280": enc2035, - "ebcdic-cp-it": enc2035, - "csIBM280": enc2035, - "csibm280": enc2035, - "IBM281": enc2036, - "ibm281": enc2036, - "EBCDIC-JP-E": enc2036, - "ebcdic-jp-e": enc2036, - "cp281": enc2036, - "csIBM281": enc2036, - "csibm281": enc2036, - "IBM284": enc2037, - "ibm284": enc2037, - "CP284": enc2037, - "cp284": enc2037, - "ebcdic-cp-es": enc2037, - "csIBM284": enc2037, - "csibm284": enc2037, - "IBM285": enc2038, - "ibm285": enc2038, - "CP285": enc2038, - "cp285": enc2038, - "ebcdic-cp-gb": enc2038, - "csIBM285": enc2038, - "csibm285": enc2038, - "IBM290": enc2039, - "ibm290": enc2039, - "cp290": enc2039, - "EBCDIC-JP-kana": enc2039, - "ebcdic-jp-kana": enc2039, - "csIBM290": enc2039, - "csibm290": enc2039, - "IBM297": enc2040, - "ibm297": enc2040, - "cp297": enc2040, - "ebcdic-cp-fr": enc2040, - "csIBM297": enc2040, - "csibm297": enc2040, - "IBM420": enc2041, - "ibm420": enc2041, - "cp420": enc2041, - "ebcdic-cp-ar1": enc2041, - "csIBM420": enc2041, - "csibm420": enc2041, - "IBM423": enc2042, - "ibm423": enc2042, - "cp423": enc2042, - "ebcdic-cp-gr": enc2042, - "csIBM423": enc2042, - "csibm423": enc2042, - "IBM424": enc2043, - "ibm424": enc2043, - "cp424": enc2043, - "ebcdic-cp-he": enc2043, - "csIBM424": enc2043, - "csibm424": enc2043, - "IBM437": enc2011, - "ibm437": enc2011, - "cp437": enc2011, - "437": enc2011, - "csPC8CodePage437": enc2011, - "cspc8codepage437": enc2011, - "IBM500": enc2044, - "ibm500": enc2044, - "CP500": enc2044, - "cp500": enc2044, - "ebcdic-cp-be": enc2044, - "ebcdic-cp-ch": enc2044, - "csIBM500": enc2044, - "csibm500": enc2044, - "IBM851": enc2045, - "ibm851": enc2045, - "cp851": enc2045, - "851": enc2045, - "csIBM851": enc2045, - "csibm851": enc2045, - "IBM852": enc2010, - "ibm852": enc2010, - "cp852": enc2010, - "852": enc2010, - "csPCp852": enc2010, - "cspcp852": enc2010, - "IBM855": enc2046, - "ibm855": enc2046, - "cp855": enc2046, - "855": enc2046, - "csIBM855": enc2046, - "csibm855": enc2046, - "IBM857": enc2047, - "ibm857": enc2047, - "cp857": enc2047, - "857": enc2047, - "csIBM857": enc2047, - "csibm857": enc2047, - "IBM860": enc2048, - "ibm860": enc2048, - "cp860": enc2048, - "860": enc2048, - "csIBM860": enc2048, - "csibm860": enc2048, - "IBM861": enc2049, - "ibm861": enc2049, - "cp861": enc2049, - "861": enc2049, - "cp-is": enc2049, - "csIBM861": enc2049, - "csibm861": enc2049, - "IBM863": enc2050, - "ibm863": enc2050, - "cp863": enc2050, - "863": enc2050, - "csIBM863": enc2050, - "csibm863": enc2050, - "IBM864": enc2051, - "ibm864": enc2051, - "cp864": enc2051, - "csIBM864": enc2051, - "csibm864": enc2051, - "IBM865": enc2052, - "ibm865": enc2052, - "cp865": enc2052, - "865": enc2052, - "csIBM865": enc2052, - "csibm865": enc2052, - "IBM868": enc2053, - "ibm868": enc2053, - "CP868": enc2053, - "cp868": enc2053, - "cp-ar": enc2053, - "csIBM868": enc2053, - "csibm868": enc2053, - "IBM869": enc2054, - "ibm869": enc2054, - "cp869": enc2054, - "869": enc2054, - "cp-gr": enc2054, - "csIBM869": enc2054, - "csibm869": enc2054, - "IBM870": enc2055, - "ibm870": enc2055, - "CP870": enc2055, - "cp870": enc2055, - "ebcdic-cp-roece": enc2055, - "ebcdic-cp-yu": enc2055, - "csIBM870": enc2055, - "csibm870": enc2055, - "IBM871": enc2056, - "ibm871": enc2056, - "CP871": enc2056, - "cp871": enc2056, - "ebcdic-cp-is": enc2056, - "csIBM871": enc2056, - "csibm871": enc2056, - "IBM880": enc2057, - "ibm880": enc2057, - "cp880": enc2057, - "EBCDIC-Cyrillic": enc2057, - "ebcdic-cyrillic": enc2057, - "csIBM880": enc2057, - "csibm880": enc2057, - "IBM891": enc2058, - "ibm891": enc2058, - "cp891": enc2058, - "csIBM891": enc2058, - "csibm891": enc2058, - "IBM903": enc2059, - "ibm903": enc2059, - "cp903": enc2059, - "csIBM903": enc2059, - "csibm903": enc2059, - "IBM904": enc2060, - "ibm904": enc2060, - "cp904": enc2060, - "904": enc2060, - "csIBBM904": enc2060, - "csibbm904": enc2060, - "IBM905": enc2061, - "ibm905": enc2061, - "CP905": enc2061, - "cp905": enc2061, - "ebcdic-cp-tr": enc2061, - "csIBM905": enc2061, - "csibm905": enc2061, - "IBM918": enc2062, - "ibm918": enc2062, - "CP918": enc2062, - "cp918": enc2062, - "ebcdic-cp-ar2": enc2062, - "csIBM918": enc2062, - "csibm918": enc2062, - "IBM1026": enc2063, - "ibm1026": enc2063, - "CP1026": enc2063, - "cp1026": enc2063, - "csIBM1026": enc2063, - "csibm1026": enc2063, - "EBCDIC-AT-DE": enc2064, - "ebcdic-at-de": enc2064, - "csIBMEBCDICATDE": enc2064, - "csibmebcdicatde": enc2064, - "EBCDIC-AT-DE-A": enc2065, - "ebcdic-at-de-a": enc2065, - "csEBCDICATDEA": enc2065, - "csebcdicatdea": enc2065, - "EBCDIC-CA-FR": enc2066, - "ebcdic-ca-fr": enc2066, - "csEBCDICCAFR": enc2066, - "csebcdiccafr": enc2066, - "EBCDIC-DK-NO": enc2067, - "ebcdic-dk-no": enc2067, - "csEBCDICDKNO": enc2067, - "csebcdicdkno": enc2067, - "EBCDIC-DK-NO-A": enc2068, - "ebcdic-dk-no-a": enc2068, - "csEBCDICDKNOA": enc2068, - "csebcdicdknoa": enc2068, - "EBCDIC-FI-SE": enc2069, - "ebcdic-fi-se": enc2069, - "csEBCDICFISE": enc2069, - "csebcdicfise": enc2069, - "EBCDIC-FI-SE-A": enc2070, - "ebcdic-fi-se-a": enc2070, - "csEBCDICFISEA": enc2070, - "csebcdicfisea": enc2070, - "EBCDIC-FR": enc2071, - "ebcdic-fr": enc2071, - "csEBCDICFR": enc2071, - "csebcdicfr": enc2071, - "EBCDIC-IT": enc2072, - "ebcdic-it": enc2072, - "csEBCDICIT": enc2072, - "csebcdicit": enc2072, - "EBCDIC-PT": enc2073, - "ebcdic-pt": enc2073, - "csEBCDICPT": enc2073, - "csebcdicpt": enc2073, - "EBCDIC-ES": enc2074, - "ebcdic-es": enc2074, - "csEBCDICES": enc2074, - "csebcdices": enc2074, - "EBCDIC-ES-A": enc2075, - "ebcdic-es-a": enc2075, - "csEBCDICESA": enc2075, - "csebcdicesa": enc2075, - "EBCDIC-ES-S": enc2076, - "ebcdic-es-s": enc2076, - "csEBCDICESS": enc2076, - "csebcdicess": enc2076, - "EBCDIC-UK": enc2077, - "ebcdic-uk": enc2077, - "csEBCDICUK": enc2077, - "csebcdicuk": enc2077, - "EBCDIC-US": enc2078, - "ebcdic-us": enc2078, - "csEBCDICUS": enc2078, - "csebcdicus": enc2078, - "UNKNOWN-8BIT": enc2079, - "unknown-8bit": enc2079, - "csUnknown8BiT": enc2079, - "csunknown8bit": enc2079, - "MNEMONIC": enc2080, - "mnemonic": enc2080, - "csMnemonic": enc2080, - "csmnemonic": enc2080, - "MNEM": enc2081, - "mnem": enc2081, - "csMnem": enc2081, - "csmnem": enc2081, - "VISCII": enc2082, - "viscii": enc2082, - "csVISCII": enc2082, - "csviscii": enc2082, - "VIQR": enc2083, - "viqr": enc2083, - "csVIQR": enc2083, - "csviqr": enc2083, - "KOI8-R": enc2084, - "koi8-r": enc2084, - "csKOI8R": enc2084, - "cskoi8r": enc2084, - "HZ-GB-2312": enc2085, - "hz-gb-2312": enc2085, - "IBM866": enc2086, - "ibm866": enc2086, - "cp866": enc2086, - "866": enc2086, - "csIBM866": enc2086, - "csibm866": enc2086, - "IBM775": enc2087, - "ibm775": enc2087, - "cp775": enc2087, - "csPC775Baltic": enc2087, - "cspc775baltic": enc2087, - "KOI8-U": enc2088, - "koi8-u": enc2088, - "csKOI8U": enc2088, - "cskoi8u": enc2088, - "IBM00858": enc2089, - "ibm00858": enc2089, - "CCSID00858": enc2089, - "ccsid00858": enc2089, - "CP00858": enc2089, - "cp00858": enc2089, - "PC-Multilingual-850+euro": enc2089, - "pc-multilingual-850+euro": enc2089, - "csIBM00858": enc2089, - "csibm00858": enc2089, - "IBM00924": enc2090, - "ibm00924": enc2090, - "CCSID00924": enc2090, - "ccsid00924": enc2090, - "CP00924": enc2090, - "cp00924": enc2090, - "ebcdic-Latin9--euro": enc2090, - "ebcdic-latin9--euro": enc2090, - "csIBM00924": enc2090, - "csibm00924": enc2090, - "IBM01140": enc2091, - "ibm01140": enc2091, - "CCSID01140": enc2091, - "ccsid01140": enc2091, - "CP01140": enc2091, - "cp01140": enc2091, - "ebcdic-us-37+euro": enc2091, - "csIBM01140": enc2091, - "csibm01140": enc2091, - "IBM01141": enc2092, - "ibm01141": enc2092, - "CCSID01141": enc2092, - "ccsid01141": enc2092, - "CP01141": enc2092, - "cp01141": enc2092, - "ebcdic-de-273+euro": enc2092, - "csIBM01141": enc2092, - "csibm01141": enc2092, - "IBM01142": enc2093, - "ibm01142": enc2093, - "CCSID01142": enc2093, - "ccsid01142": enc2093, - "CP01142": enc2093, - "cp01142": enc2093, - "ebcdic-dk-277+euro": enc2093, - "ebcdic-no-277+euro": enc2093, - "csIBM01142": enc2093, - "csibm01142": enc2093, - "IBM01143": enc2094, - "ibm01143": enc2094, - "CCSID01143": enc2094, - "ccsid01143": enc2094, - "CP01143": enc2094, - "cp01143": enc2094, - "ebcdic-fi-278+euro": enc2094, - "ebcdic-se-278+euro": enc2094, - "csIBM01143": enc2094, - "csibm01143": enc2094, - "IBM01144": enc2095, - "ibm01144": enc2095, - "CCSID01144": enc2095, - "ccsid01144": enc2095, - "CP01144": enc2095, - "cp01144": enc2095, - "ebcdic-it-280+euro": enc2095, - "csIBM01144": enc2095, - "csibm01144": enc2095, - "IBM01145": enc2096, - "ibm01145": enc2096, - "CCSID01145": enc2096, - "ccsid01145": enc2096, - "CP01145": enc2096, - "cp01145": enc2096, - "ebcdic-es-284+euro": enc2096, - "csIBM01145": enc2096, - "csibm01145": enc2096, - "IBM01146": enc2097, - "ibm01146": enc2097, - "CCSID01146": enc2097, - "ccsid01146": enc2097, - "CP01146": enc2097, - "cp01146": enc2097, - "ebcdic-gb-285+euro": enc2097, - "csIBM01146": enc2097, - "csibm01146": enc2097, - "IBM01147": enc2098, - "ibm01147": enc2098, - "CCSID01147": enc2098, - "ccsid01147": enc2098, - "CP01147": enc2098, - "cp01147": enc2098, - "ebcdic-fr-297+euro": enc2098, - "csIBM01147": enc2098, - "csibm01147": enc2098, - "IBM01148": enc2099, - "ibm01148": enc2099, - "CCSID01148": enc2099, - "ccsid01148": enc2099, - "CP01148": enc2099, - "cp01148": enc2099, - "ebcdic-international-500+euro": enc2099, - "csIBM01148": enc2099, - "csibm01148": enc2099, - "IBM01149": enc2100, - "ibm01149": enc2100, - "CCSID01149": enc2100, - "ccsid01149": enc2100, - "CP01149": enc2100, - "cp01149": enc2100, - "ebcdic-is-871+euro": enc2100, - "csIBM01149": enc2100, - "csibm01149": enc2100, - "Big5-HKSCS": enc2101, - "big5-hkscs": enc2101, - "csBig5HKSCS": enc2101, - "csbig5hkscs": enc2101, - "IBM1047": enc2102, - "ibm1047": enc2102, - "IBM-1047": enc2102, - "ibm-1047": enc2102, - "csIBM1047": enc2102, - "csibm1047": enc2102, - "PTCP154": enc2103, - "ptcp154": enc2103, - "csPTCP154": enc2103, - "csptcp154": enc2103, - "PT154": enc2103, - "pt154": enc2103, - "CP154": enc2103, - "cp154": enc2103, - "Cyrillic-Asian": enc2103, - "cyrillic-asian": enc2103, - "Amiga-1251": enc2104, - "amiga-1251": enc2104, - "Ami1251": enc2104, - "ami1251": enc2104, - "Amiga1251": enc2104, - "amiga1251": enc2104, - "Ami-1251": enc2104, - "ami-1251": enc2104, - "csAmiga1251\n(Aliases": enc2104, - "csamiga1251\n(aliases": enc2104, - "KOI7-switched": enc2105, - "koi7-switched": enc2105, - "csKOI7switched": enc2105, - "cskoi7switched": enc2105, - "BRF": enc2106, - "brf": enc2106, - "csBRF": enc2106, - "csbrf": enc2106, - "TSCII": enc2107, - "tscii": enc2107, - "csTSCII": enc2107, - "cstscii": enc2107, - "CP51932": enc2108, - "cp51932": enc2108, - "csCP51932": enc2108, - "cscp51932": enc2108, - "windows-874": enc2109, - "cswindows874": enc2109, - "windows-1250": enc2250, - "cswindows1250": enc2250, - "windows-1251": enc2251, - "cswindows1251": enc2251, - "windows-1252": enc2252, - "cswindows1252": enc2252, - "windows-1253": enc2253, - "cswindows1253": enc2253, - "windows-1254": enc2254, - "cswindows1254": enc2254, - "windows-1255": enc2255, - "cswindows1255": enc2255, - "windows-1256": enc2256, - "cswindows1256": enc2256, - "windows-1257": enc2257, - "cswindows1257": enc2257, - "windows-1258": enc2258, - "cswindows1258": enc2258, - "TIS-620": enc2259, - "tis-620": enc2259, - "csTIS620": enc2259, - "cstis620": enc2259, - "ISO-8859-11": enc2259, - "iso-8859-11": enc2259, - "CP50220": enc2260, - "cp50220": enc2260, - "csCP50220": enc2260, - "cscp50220": enc2260, -} - -// Total table size 14402 bytes (14KiB); checksum: CEBAA10C diff --git a/vendor/golang.org/x/text/encoding/internal/enctest/enctest.go b/vendor/golang.org/x/text/encoding/internal/enctest/enctest.go deleted file mode 100644 index 0cccae0..0000000 --- a/vendor/golang.org/x/text/encoding/internal/enctest/enctest.go +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package enctest - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "strings" - "testing" - - "golang.org/x/text/encoding" - "golang.org/x/text/encoding/internal/identifier" - "golang.org/x/text/transform" -) - -// Encoder or Decoder -type Transcoder interface { - transform.Transformer - Bytes([]byte) ([]byte, error) - String(string) (string, error) -} - -func TestEncoding(t *testing.T, e encoding.Encoding, encoded, utf8, prefix, suffix string) { - for _, direction := range []string{"Decode", "Encode"} { - t.Run(fmt.Sprintf("%v/%s", e, direction), func(t *testing.T) { - - var coder Transcoder - var want, src, wPrefix, sPrefix, wSuffix, sSuffix string - if direction == "Decode" { - coder, want, src = e.NewDecoder(), utf8, encoded - wPrefix, sPrefix, wSuffix, sSuffix = "", prefix, "", suffix - } else { - coder, want, src = e.NewEncoder(), encoded, utf8 - wPrefix, sPrefix, wSuffix, sSuffix = prefix, "", suffix, "" - } - - dst := make([]byte, len(wPrefix)+len(want)+len(wSuffix)) - nDst, nSrc, err := coder.Transform(dst, []byte(sPrefix+src+sSuffix), true) - if err != nil { - t.Fatal(err) - } - if nDst != len(wPrefix)+len(want)+len(wSuffix) { - t.Fatalf("nDst got %d, want %d", - nDst, len(wPrefix)+len(want)+len(wSuffix)) - } - if nSrc != len(sPrefix)+len(src)+len(sSuffix) { - t.Fatalf("nSrc got %d, want %d", - nSrc, len(sPrefix)+len(src)+len(sSuffix)) - } - if got := string(dst); got != wPrefix+want+wSuffix { - t.Fatalf("\ngot %q\nwant %q", got, wPrefix+want+wSuffix) - } - - for _, n := range []int{0, 1, 2, 10, 123, 4567} { - input := sPrefix + strings.Repeat(src, n) + sSuffix - g, err := coder.String(input) - if err != nil { - t.Fatalf("Bytes: n=%d: %v", n, err) - } - if len(g) == 0 && len(input) == 0 { - // If the input is empty then the output can be empty, - // regardless of whatever wPrefix is. - continue - } - got1, want1 := string(g), wPrefix+strings.Repeat(want, n)+wSuffix - if got1 != want1 { - t.Fatalf("ReadAll: n=%d\ngot %q\nwant %q", - n, trim(got1), trim(want1)) - } - } - }) - } -} - -func TestFile(t *testing.T, e encoding.Encoding) { - for _, dir := range []string{"Decode", "Encode"} { - t.Run(fmt.Sprintf("%s/%s", e, dir), func(t *testing.T) { - dst, src, transformer, err := load(dir, e) - if err != nil { - t.Fatalf("load: %v", err) - } - buf, err := transformer.Bytes(src) - if err != nil { - t.Fatalf("transform: %v", err) - } - if !bytes.Equal(buf, dst) { - t.Error("transformed bytes did not match golden file") - } - }) - } -} - -func Benchmark(b *testing.B, enc encoding.Encoding) { - for _, direction := range []string{"Decode", "Encode"} { - b.Run(fmt.Sprintf("%s/%s", enc, direction), func(b *testing.B) { - _, src, transformer, err := load(direction, enc) - if err != nil { - b.Fatal(err) - } - b.SetBytes(int64(len(src))) - b.ResetTimer() - for i := 0; i < b.N; i++ { - r := transform.NewReader(bytes.NewReader(src), transformer) - io.Copy(ioutil.Discard, r) - } - }) - } -} - -// testdataFiles are files in testdata/*.txt. -var testdataFiles = []struct { - mib identifier.MIB - basename, ext string -}{ - {identifier.Windows1252, "candide", "windows-1252"}, - {identifier.EUCPkdFmtJapanese, "rashomon", "euc-jp"}, - {identifier.ISO2022JP, "rashomon", "iso-2022-jp"}, - {identifier.ShiftJIS, "rashomon", "shift-jis"}, - {identifier.EUCKR, "unsu-joh-eun-nal", "euc-kr"}, - {identifier.GBK, "sunzi-bingfa-simplified", "gbk"}, - {identifier.HZGB2312, "sunzi-bingfa-gb-levels-1-and-2", "hz-gb2312"}, - {identifier.Big5, "sunzi-bingfa-traditional", "big5"}, - {identifier.UTF16LE, "candide", "utf-16le"}, - {identifier.UTF8, "candide", "utf-8"}, - {identifier.UTF32BE, "candide", "utf-32be"}, - - // GB18030 is a superset of GBK and is nominally a Simplified Chinese - // encoding, but it can also represent the entire Basic Multilingual - // Plane, including codepoints like 'â' that aren't encodable by GBK. - // GB18030 on Simplified Chinese should perform similarly to GBK on - // Simplified Chinese. GB18030 on "candide" is more interesting. - {identifier.GB18030, "candide", "gb18030"}, -} - -func load(direction string, enc encoding.Encoding) ([]byte, []byte, Transcoder, error) { - basename, ext, count := "", "", 0 - for _, tf := range testdataFiles { - if mib, _ := enc.(identifier.Interface).ID(); tf.mib == mib { - basename, ext = tf.basename, tf.ext - count++ - } - } - if count != 1 { - if count == 0 { - return nil, nil, nil, fmt.Errorf("no testdataFiles for %s", enc) - } - return nil, nil, nil, fmt.Errorf("too many testdataFiles for %s", enc) - } - dstFile := fmt.Sprintf("../testdata/%s-%s.txt", basename, ext) - srcFile := fmt.Sprintf("../testdata/%s-utf-8.txt", basename) - var coder Transcoder = encoding.ReplaceUnsupported(enc.NewEncoder()) - if direction == "Decode" { - dstFile, srcFile = srcFile, dstFile - coder = enc.NewDecoder() - } - dst, err := ioutil.ReadFile(dstFile) - if err != nil { - if dst, err = ioutil.ReadFile("../" + dstFile); err != nil { - return nil, nil, nil, err - } - } - src, err := ioutil.ReadFile(srcFile) - if err != nil { - if src, err = ioutil.ReadFile("../" + srcFile); err != nil { - return nil, nil, nil, err - } - } - return dst, src, coder, nil -} - -func trim(s string) string { - if len(s) < 120 { - return s - } - return s[:50] + "..." + s[len(s)-50:] -} diff --git a/vendor/golang.org/x/text/encoding/internal/identifier/identifier.go b/vendor/golang.org/x/text/encoding/internal/identifier/identifier.go index 7351b4e..2a2da0e 100644 --- a/vendor/golang.org/x/text/encoding/internal/identifier/identifier.go +++ b/vendor/golang.org/x/text/encoding/internal/identifier/identifier.go @@ -36,8 +36,8 @@ package identifier // - http://www.ietf.org/rfc/rfc2978.txt // - http://www.unicode.org/reports/tr22/ // - http://www.w3.org/TR/encoding/ +// - http://www.w3.org/TR/encoding/indexes/encodings.json // - https://encoding.spec.whatwg.org/ -// - https://encoding.spec.whatwg.org/encodings.json // - https://tools.ietf.org/html/rfc6657#section-5 // Interface can be implemented by Encodings to define the CCS or CES for which diff --git a/vendor/golang.org/x/text/encoding/internal/identifier/mib.go b/vendor/golang.org/x/text/encoding/internal/identifier/mib.go index 768842b..915abfa 100644 --- a/vendor/golang.org/x/text/encoding/internal/identifier/mib.go +++ b/vendor/golang.org/x/text/encoding/internal/identifier/mib.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package identifier diff --git a/vendor/golang.org/x/text/encoding/japanese/all_test.go b/vendor/golang.org/x/text/encoding/japanese/all_test.go index 9cffe10..fe397aa 100644 --- a/vendor/golang.org/x/text/encoding/japanese/all_test.go +++ b/vendor/golang.org/x/text/encoding/japanese/all_test.go @@ -5,13 +5,10 @@ package japanese import ( - "fmt" - "strings" "testing" "golang.org/x/text/encoding" "golang.org/x/text/encoding/internal" - "golang.org/x/text/encoding/internal/enctest" "golang.org/x/text/transform" ) @@ -23,14 +20,15 @@ func enc(e encoding.Encoding) (dir string, t transform.Transformer, err error) { } func TestNonRepertoire(t *testing.T) { - // Pick n to cause the destination buffer in transform.String to overflow. - const n = 100 - long := strings.Repeat(".", n) testCases := []struct { init func(e encoding.Encoding) (string, transform.Transformer, error) e encoding.Encoding src, want string }{ + {dec, EUCJP, "\xfe\xfc", "\ufffd"}, + {dec, ISO2022JP, "\x1b$B\x7e\x7e", "\ufffd"}, + {dec, ShiftJIS, "\xef\xfc", "\ufffd"}, + {enc, EUCJP, "갂", ""}, {enc, EUCJP, "a갂", "a"}, {enc, EUCJP, "丌갂", "\x8f\xb0\xa4"}, @@ -42,108 +40,17 @@ func TestNonRepertoire(t *testing.T) { {enc, ShiftJIS, "갂", ""}, {enc, ShiftJIS, "a갂", "a"}, {enc, ShiftJIS, "\u2190갂", "\x81\xa9"}, - - // Continue correctly after errors - {dec, EUCJP, "\x8e\xa0", "\ufffd\ufffd"}, - {dec, EUCJP, "\x8e\xe0", "\ufffd"}, - {dec, EUCJP, "\x8e\xff", "\ufffd\ufffd"}, - {dec, EUCJP, "\x8ea", "\ufffda"}, - {dec, EUCJP, "\x8f\xa0", "\ufffd\ufffd"}, - {dec, EUCJP, "\x8f\xa1\xa0", "\ufffd\ufffd"}, - {dec, EUCJP, "\x8f\xa1a", "\ufffda"}, - {dec, EUCJP, "\x8f\xa1a", "\ufffda"}, - {dec, EUCJP, "\x8f\xa1a", "\ufffda"}, - {dec, EUCJP, "\x8f\xa2\xa2", "\ufffd"}, - {dec, EUCJP, "\xfe", "\ufffd"}, - {dec, EUCJP, "\xfe\xfc", "\ufffd"}, - {dec, EUCJP, "\xfe\xff", "\ufffd\ufffd"}, - // Correct handling of end of source - {dec, EUCJP, strings.Repeat("\x8e", n), strings.Repeat("\ufffd", n)}, - {dec, EUCJP, strings.Repeat("\x8f", n), strings.Repeat("\ufffd", n)}, - {dec, EUCJP, strings.Repeat("\x8f\xa0", n), strings.Repeat("\ufffd", 2*n)}, - {dec, EUCJP, "a" + strings.Repeat("\x8f\xa1", n), "a" + strings.Repeat("\ufffd", n)}, - {dec, EUCJP, "a" + strings.Repeat("\x8f\xa1\xff", n), "a" + strings.Repeat("\ufffd", 2*n)}, - - // Continue correctly after errors - {dec, ShiftJIS, "\x80", "\u0080"}, // It's what the spec says. - {dec, ShiftJIS, "\x81", "\ufffd"}, - {dec, ShiftJIS, "\x81\x7f", "\ufffd\u007f"}, - {dec, ShiftJIS, "\xe0", "\ufffd"}, - {dec, ShiftJIS, "\xe0\x39", "\ufffd\u0039"}, - {dec, ShiftJIS, "\xe0\x9f", "燹"}, - {dec, ShiftJIS, "\xe0\xfd", "\ufffd"}, - {dec, ShiftJIS, "\xef\xfc", "\ufffd"}, - {dec, ShiftJIS, "\xfc\xfc", "\ufffd"}, - {dec, ShiftJIS, "\xfc\xfd", "\ufffd"}, - {dec, ShiftJIS, "\xfdaa", "\ufffdaa"}, - - {dec, ShiftJIS, strings.Repeat("\x81\x81", n), strings.Repeat("=", n)}, - {dec, ShiftJIS, strings.Repeat("\xe0\xfd", n), strings.Repeat("\ufffd", n)}, - {dec, ShiftJIS, "a" + strings.Repeat("\xe0\xfd", n), "a" + strings.Repeat("\ufffd", n)}, - - {dec, ISO2022JP, "\x1b$", "\ufffd$"}, - {dec, ISO2022JP, "\x1b(", "\ufffd("}, - {dec, ISO2022JP, "\x1b@", "\ufffd@"}, - {dec, ISO2022JP, "\x1bZ", "\ufffdZ"}, - // incomplete escapes - {dec, ISO2022JP, "\x1b$", "\ufffd$"}, - {dec, ISO2022JP, "\x1b$J.", "\ufffd$J."}, // illegal - {dec, ISO2022JP, "\x1b$B.", "\ufffd"}, // JIS208 - {dec, ISO2022JP, "\x1b$(", "\ufffd$("}, // JIS212 - {dec, ISO2022JP, "\x1b$(..", "\ufffd$(.."}, // JIS212 - {dec, ISO2022JP, "\x1b$(" + long, "\ufffd$(" + long}, // JIS212 - {dec, ISO2022JP, "\x1b$(D.", "\ufffd"}, // JIS212 - {dec, ISO2022JP, "\x1b$(D..", "\ufffd"}, // JIS212 - {dec, ISO2022JP, "\x1b$(D...", "\ufffd\ufffd"}, // JIS212 - {dec, ISO2022JP, "\x1b(B.", "."}, // ascii - {dec, ISO2022JP, "\x1b(B..", ".."}, // ascii - {dec, ISO2022JP, "\x1b(J.", "."}, // roman - {dec, ISO2022JP, "\x1b(J..", ".."}, // roman - {dec, ISO2022JP, "\x1b(I\x20", "\ufffd"}, // katakana - {dec, ISO2022JP, "\x1b(I\x20\x20", "\ufffd\ufffd"}, // katakana - // recover to same state - {dec, ISO2022JP, "\x1b(B\x1b.", "\ufffd."}, - {dec, ISO2022JP, "\x1b(I\x1b.", "\ufffdョ"}, - {dec, ISO2022JP, "\x1b(I\x1b$.", "\ufffd、ョ"}, - {dec, ISO2022JP, "\x1b(I\x1b(.", "\ufffdィョ"}, - {dec, ISO2022JP, "\x1b$B\x7e\x7e", "\ufffd"}, - {dec, ISO2022JP, "\x1b$@\x0a.", "\x0a."}, - {dec, ISO2022JP, "\x1b$B\x0a.", "\x0a."}, - {dec, ISO2022JP, "\x1b$(D\x0a.", "\x0a."}, - {dec, ISO2022JP, "\x1b$(D\x7e\x7e", "\ufffd"}, - {dec, ISO2022JP, "\x80", "\ufffd"}, - - // TODO: according to https://encoding.spec.whatwg.org/#iso-2022-jp, - // these should all be correct. - // {dec, ISO2022JP, "\x1b(B\x0E", "\ufffd"}, - // {dec, ISO2022JP, "\x1b(B\x0F", "\ufffd"}, - {dec, ISO2022JP, "\x1b(B\x5C", "\u005C"}, - {dec, ISO2022JP, "\x1b(B\x7E", "\u007E"}, - // {dec, ISO2022JP, "\x1b(J\x0E", "\ufffd"}, - // {dec, ISO2022JP, "\x1b(J\x0F", "\ufffd"}, - // {dec, ISO2022JP, "\x1b(J\x5C", "\u00A5"}, - // {dec, ISO2022JP, "\x1b(J\x7E", "\u203E"}, } for _, tc := range testCases { dir, tr, wantErr := tc.init(tc.e) - t.Run(fmt.Sprintf("%s/%v/%q", dir, tc.e, tc.src), func(t *testing.T) { - dst := make([]byte, 100000) - src := []byte(tc.src) - for i := 0; i <= len(tc.src); i++ { - nDst, nSrc, err := tr.Transform(dst, src[:i], false) - if err != nil && err != transform.ErrShortSrc && err != wantErr { - t.Fatalf("error on first call to Transform: %v", err) - } - n, _, err := tr.Transform(dst[nDst:], src[nSrc:], true) - nDst += n - if err != wantErr { - t.Fatalf("(%q|%q): got %v; want %v", tc.src[:i], tc.src[i:], err, wantErr) - } - if got := string(dst[:nDst]); got != tc.want { - t.Errorf("(%q|%q):\ngot %q\nwant %q", tc.src[:i], tc.src[i:], got, tc.want) - } - } - }) + + dst, _, err := transform.String(tr, tc.src) + if err != wantErr { + t.Errorf("%s %v(%q): got %v; want %v", dir, tc.e, tc.src, err, wantErr) + } + if got := string(dst); got != tc.want { + t.Errorf("%s %v(%q):\ngot %q\nwant %q", dir, tc.e, tc.src, got, tc.want) + } } } @@ -171,78 +78,3 @@ func TestCorrect(t *testing.T) { } } } - -func TestBasics(t *testing.T) { - // The encoded forms can be verified by the iconv program: - // $ echo 月日は百代 | iconv -f UTF-8 -t SHIFT-JIS | xxd - testCases := []struct { - e encoding.Encoding - encPrefix string - encSuffix string - encoded string - utf8 string - }{{ - // "A。カ゚ 0208: etc 0212: etc" is a nonsense string that contains ASCII, half-width - // kana, JIS X 0208 (including two near the kink in the Shift JIS second byte - // encoding) and JIS X 0212 encodable codepoints. - // - // "月日は百代の過客にして、行かふ年も又旅人也。" is from the 17th century poem - // "Oku no Hosomichi" and contains both hiragana and kanji. - e: EUCJP, - encoded: "A\x8e\xa1\x8e\xb6\x8e\xdf " + - "0208: \xa1\xa1\xa1\xa2\xa1\xdf\xa1\xe0\xa1\xfd\xa1\xfe\xa2\xa1\xa2\xa2\xf4\xa6 " + - "0212: \x8f\xa2\xaf\x8f\xed\xe3", - utf8: "A。カ゚ " + - "0208: \u3000\u3001\u00d7\u00f7\u25ce\u25c7\u25c6\u25a1\u7199 " + - "0212: \u02d8\u9fa5", - }, { - e: EUCJP, - encoded: "\xb7\xee\xc6\xfc\xa4\xcf\xc9\xb4\xc2\xe5\xa4\xce\xb2\xe1\xb5\xd2" + - "\xa4\xcb\xa4\xb7\xa4\xc6\xa1\xa2\xb9\xd4\xa4\xab\xa4\xd5\xc7\xaf" + - "\xa4\xe2\xcb\xf4\xce\xb9\xbf\xcd\xcc\xe9\xa1\xa3", - utf8: "月日は百代の過客にして、行かふ年も又旅人也。", - }, { - e: ISO2022JP, - encSuffix: "\x1b\x28\x42", - encoded: "\x1b\x28\x49\x21\x36\x5f\x1b\x28\x42 " + - "0208: \x1b\x24\x42\x21\x21\x21\x22\x21\x5f\x21\x60\x21\x7d\x21\x7e\x22\x21\x22\x22\x74\x26", - utf8: "。カ゚ " + - "0208: \u3000\u3001\u00d7\u00f7\u25ce\u25c7\u25c6\u25a1\u7199", - }, { - e: ISO2022JP, - encPrefix: "\x1b\x24\x42", - encSuffix: "\x1b\x28\x42", - encoded: "\x37\x6e\x46\x7c\x24\x4f\x49\x34\x42\x65\x24\x4e\x32\x61\x35\x52" + - "\x24\x4b\x24\x37\x24\x46\x21\x22\x39\x54\x24\x2b\x24\x55\x47\x2f" + - "\x24\x62\x4b\x74\x4e\x39\x3f\x4d\x4c\x69\x21\x23", - utf8: "月日は百代の過客にして、行かふ年も又旅人也。", - }, { - e: ShiftJIS, - encoded: "A\xa1\xb6\xdf " + - "0208: \x81\x40\x81\x41\x81\x7e\x81\x80\x81\x9d\x81\x9e\x81\x9f\x81\xa0\xea\xa4", - utf8: "A。カ゚ " + - "0208: \u3000\u3001\u00d7\u00f7\u25ce\u25c7\u25c6\u25a1\u7199", - }, { - e: ShiftJIS, - encoded: "\x8c\x8e\x93\xfa\x82\xcd\x95\x53\x91\xe3\x82\xcc\x89\xdf\x8b\x71" + - "\x82\xc9\x82\xb5\x82\xc4\x81\x41\x8d\x73\x82\xa9\x82\xd3\x94\x4e" + - "\x82\xe0\x96\x94\x97\xb7\x90\x6c\x96\xe7\x81\x42", - utf8: "月日は百代の過客にして、行かふ年も又旅人也。", - }} - - for _, tc := range testCases { - enctest.TestEncoding(t, tc.e, tc.encoded, tc.utf8, tc.encPrefix, tc.encSuffix) - } -} - -func TestFiles(t *testing.T) { - enctest.TestFile(t, EUCJP) - enctest.TestFile(t, ISO2022JP) - enctest.TestFile(t, ShiftJIS) -} - -func BenchmarkEncoding(b *testing.B) { - enctest.Benchmark(b, EUCJP) - enctest.Benchmark(b, ISO2022JP) - enctest.Benchmark(b, ShiftJIS) -} diff --git a/vendor/golang.org/x/text/encoding/japanese/eucjp.go b/vendor/golang.org/x/text/encoding/japanese/eucjp.go index 79313fa..40f9b05 100644 --- a/vendor/golang.org/x/text/encoding/japanese/eucjp.go +++ b/vendor/golang.org/x/text/encoding/japanese/eucjp.go @@ -5,6 +5,7 @@ package japanese import ( + "errors" "unicode/utf8" "golang.org/x/text/encoding" @@ -22,9 +23,10 @@ var eucJP = internal.Encoding{ identifier.EUCPkdFmtJapanese, } +var errInvalidEUCJP = errors.New("japanese: invalid EUC-JP encoding") + type eucJPDecoder struct{ transform.NopResetter } -// See https://encoding.spec.whatwg.org/#euc-jp-decoder. func (eucJPDecoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { r, size := rune(0), 0 loop: @@ -35,79 +37,60 @@ loop: case c0 == 0x8e: if nSrc+1 >= len(src) { - if !atEOF { - err = transform.ErrShortSrc - break loop - } - r, size = utf8.RuneError, 1 - break + err = transform.ErrShortSrc + break loop } c1 := src[nSrc+1] - switch { - case c1 < 0xa1: - r, size = utf8.RuneError, 1 - case c1 > 0xdf: - r, size = utf8.RuneError, 2 - if c1 == 0xff { - size = 1 - } - default: - r, size = rune(c1)+(0xff61-0xa1), 2 + if c1 < 0xa1 || 0xdf < c1 { + err = errInvalidEUCJP + break loop } + r, size = rune(c1)+(0xff61-0xa1), 2 + case c0 == 0x8f: if nSrc+2 >= len(src) { - if !atEOF { - err = transform.ErrShortSrc - break loop - } - r, size = utf8.RuneError, 1 - if p := nSrc + 1; p < len(src) && 0xa1 <= src[p] && src[p] < 0xfe { - size = 2 - } - break + err = transform.ErrShortSrc + break loop } c1 := src[nSrc+1] if c1 < 0xa1 || 0xfe < c1 { - r, size = utf8.RuneError, 1 - break + err = errInvalidEUCJP + break loop } c2 := src[nSrc+2] if c2 < 0xa1 || 0xfe < c2 { - r, size = utf8.RuneError, 2 - break + err = errInvalidEUCJP + break loop } - r, size = utf8.RuneError, 3 + r, size = '\ufffd', 3 if i := int(c1-0xa1)*94 + int(c2-0xa1); i < len(jis0212Decode) { r = rune(jis0212Decode[i]) if r == 0 { - r = utf8.RuneError + r = '\ufffd' } } case 0xa1 <= c0 && c0 <= 0xfe: if nSrc+1 >= len(src) { - if !atEOF { - err = transform.ErrShortSrc - break loop - } - r, size = utf8.RuneError, 1 - break + err = transform.ErrShortSrc + break loop } c1 := src[nSrc+1] if c1 < 0xa1 || 0xfe < c1 { - r, size = utf8.RuneError, 1 - break + err = errInvalidEUCJP + break loop } - r, size = utf8.RuneError, 2 + r, size = '\ufffd', 2 if i := int(c0-0xa1)*94 + int(c1-0xa1); i < len(jis0208Decode) { r = rune(jis0208Decode[i]) if r == 0 { - r = utf8.RuneError + r = '\ufffd' } } default: - r, size = utf8.RuneError, 1 + err = errInvalidEUCJP + break loop } if nDst+utf8.RuneLen(r) > len(dst) { @@ -116,6 +99,9 @@ loop: } nDst += utf8.EncodeRune(dst[nDst:], r) } + if atEOF && err == transform.ErrShortSrc { + err = errInvalidEUCJP + } return nDst, nSrc, err } diff --git a/vendor/golang.org/x/text/encoding/japanese/iso2022jp.go b/vendor/golang.org/x/text/encoding/japanese/iso2022jp.go index 613226d..b63e7d5 100644 --- a/vendor/golang.org/x/text/encoding/japanese/iso2022jp.go +++ b/vendor/golang.org/x/text/encoding/japanese/iso2022jp.go @@ -5,6 +5,7 @@ package japanese import ( + "errors" "unicode/utf8" "golang.org/x/text/encoding" @@ -30,6 +31,8 @@ func iso2022JPNewEncoder() transform.Transformer { return new(iso2022JPEncoder) } +var errInvalidISO2022JP = errors.New("japanese: invalid ISO-2022-JP encoding") + const ( asciiState = iota katakanaState @@ -47,51 +50,45 @@ func (d *iso2022JPDecoder) Reset() { func (d *iso2022JPDecoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { r, size := rune(0), 0 +loop: for ; nSrc < len(src); nSrc += size { c0 := src[nSrc] if c0 >= utf8.RuneSelf { - r, size = '\ufffd', 1 - goto write + err = errInvalidISO2022JP + break loop } if c0 == asciiEsc { if nSrc+2 >= len(src) { - if !atEOF { - return nDst, nSrc, transform.ErrShortSrc - } - // TODO: is it correct to only skip 1?? - r, size = '\ufffd', 1 - goto write + err = transform.ErrShortSrc + break loop } size = 3 c1 := src[nSrc+1] c2 := src[nSrc+2] switch { - case c1 == '$' && (c2 == '@' || c2 == 'B'): // 0x24 {0x40, 0x42} + case c1 == '$' && (c2 == '@' || c2 == 'B'): *d = jis0208State continue - case c1 == '$' && c2 == '(': // 0x24 0x28 + case c1 == '$' && c2 == '(': if nSrc+3 >= len(src) { - if !atEOF { - return nDst, nSrc, transform.ErrShortSrc - } - r, size = '\ufffd', 1 - goto write + err = transform.ErrShortSrc + break loop } size = 4 - if src[nSrc+3] == 'D' { + if src[nSrc]+3 == 'D' { *d = jis0212State continue } - case c1 == '(' && (c2 == 'B' || c2 == 'J'): // 0x28 {0x42, 0x4A} + case c1 == '(' && (c2 == 'B' || c2 == 'J'): *d = asciiState continue - case c1 == '(' && c2 == 'I': // 0x28 0x49 + case c1 == '(' && c2 == 'I': *d = katakanaState continue } - r, size = '\ufffd', 1 - goto write + err = errInvalidISO2022JP + break loop } switch *d { @@ -100,8 +97,8 @@ func (d *iso2022JPDecoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc in case katakanaState: if c0 < 0x21 || 0x60 <= c0 { - r, size = '\ufffd', 1 - goto write + err = errInvalidISO2022JP + break loop } r, size = rune(c0)+(0xff61-0x21), 1 @@ -109,14 +106,11 @@ func (d *iso2022JPDecoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc in if c0 == 0x0a { *d = asciiState r, size = rune(c0), 1 - goto write + break } if nSrc+1 >= len(src) { - if !atEOF { - return nDst, nSrc, transform.ErrShortSrc - } - r, size = '\ufffd', 1 - goto write + err = transform.ErrShortSrc + break loop } size = 2 c1 := src[nSrc+1] @@ -127,19 +121,22 @@ func (d *iso2022JPDecoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc in r = rune(jis0212Decode[i]) } else { r = '\ufffd' - goto write + break } if r == 0 { r = '\ufffd' } } - write: if nDst+utf8.RuneLen(r) > len(dst) { - return nDst, nSrc, transform.ErrShortDst + err = transform.ErrShortDst + break loop } nDst += utf8.EncodeRune(dst[nDst:], r) } + if atEOF && err == transform.ErrShortSrc { + err = errInvalidISO2022JP + } return nDst, nSrc, err } diff --git a/vendor/golang.org/x/text/encoding/japanese/shiftjis.go b/vendor/golang.org/x/text/encoding/japanese/shiftjis.go index 16fd8a6..099aecc 100644 --- a/vendor/golang.org/x/text/encoding/japanese/shiftjis.go +++ b/vendor/golang.org/x/text/encoding/japanese/shiftjis.go @@ -5,6 +5,7 @@ package japanese import ( + "errors" "unicode/utf8" "golang.org/x/text/encoding" @@ -23,6 +24,8 @@ var shiftJIS = internal.Encoding{ identifier.ShiftJIS, } +var errInvalidShiftJIS = errors.New("japanese: invalid Shift JIS encoding") + type shiftJISDecoder struct{ transform.NopResetter } func (shiftJISDecoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { @@ -45,32 +48,28 @@ loop: c0 = 2*c0 - 0x21 if nSrc+1 >= len(src) { - if !atEOF { - err = transform.ErrShortSrc - break loop - } - r, size = '\ufffd', 1 - goto write + err = transform.ErrShortSrc + break loop } c1 := src[nSrc+1] switch { case c1 < 0x40: - r, size = '\ufffd', 1 // c1 is ASCII so output on next round - goto write + err = errInvalidShiftJIS + break loop case c1 < 0x7f: c0-- c1 -= 0x40 case c1 == 0x7f: - r, size = '\ufffd', 1 // c1 is ASCII so output on next round - goto write + err = errInvalidShiftJIS + break loop case c1 < 0x9f: c0-- c1 -= 0x41 case c1 < 0xfd: c1 -= 0x9f default: - r, size = '\ufffd', 2 - goto write + err = errInvalidShiftJIS + break loop } r, size = '\ufffd', 2 if i := int(c0)*94 + int(c1); i < len(jis0208Decode) { @@ -80,19 +79,20 @@ loop: } } - case c0 == 0x80: - r, size = 0x80, 1 - default: - r, size = '\ufffd', 1 + err = errInvalidShiftJIS + break loop } - write: + if nDst+utf8.RuneLen(r) > len(dst) { err = transform.ErrShortDst break loop } nDst += utf8.EncodeRune(dst[nDst:], r) } + if atEOF && err == transform.ErrShortSrc { + err = errInvalidShiftJIS + } return nDst, nSrc, err } diff --git a/vendor/golang.org/x/text/encoding/korean/all_test.go b/vendor/golang.org/x/text/encoding/korean/all_test.go index 8225ce6..502c262 100644 --- a/vendor/golang.org/x/text/encoding/korean/all_test.go +++ b/vendor/golang.org/x/text/encoding/korean/all_test.go @@ -5,12 +5,10 @@ package korean import ( - "strings" "testing" "golang.org/x/text/encoding" "golang.org/x/text/encoding/internal" - "golang.org/x/text/encoding/internal/enctest" "golang.org/x/text/transform" ) @@ -22,9 +20,6 @@ func enc(e encoding.Encoding) (dir string, t transform.Transformer, err error) { } func TestNonRepertoire(t *testing.T) { - // Pick n large enough to cause an overflow in the destination buffer of - // transform.String. - const n = 10000 testCases := []struct { init func(e encoding.Encoding) (string, transform.Transformer, error) e encoding.Encoding @@ -37,16 +32,6 @@ func TestNonRepertoire(t *testing.T) { {enc, EUCKR, "aא", "a"}, {enc, EUCKR, "\uac00א", "\xb0\xa1"}, // TODO: should we also handle Jamo? - - {dec, EUCKR, "\x80", "\ufffd"}, - {dec, EUCKR, "\xff", "\ufffd"}, - {dec, EUCKR, "\x81", "\ufffd"}, - {dec, EUCKR, "\xb0\x40", "\ufffd@"}, - {dec, EUCKR, "\xb0\xff", "\ufffd"}, - {dec, EUCKR, "\xd0\x20", "\ufffd "}, - {dec, EUCKR, "\xd0\xff", "\ufffd"}, - - {dec, EUCKR, strings.Repeat("\x81", n), strings.Repeat("걖", n/2)}, } for _, tc := range testCases { dir, tr, wantErr := tc.init(tc.e) @@ -60,35 +45,3 @@ func TestNonRepertoire(t *testing.T) { } } } - -func TestBasics(t *testing.T) { - // The encoded forms can be verified by the iconv program: - // $ echo 月日は百代 | iconv -f UTF-8 -t SHIFT-JIS | xxd - testCases := []struct { - e encoding.Encoding - encoded string - utf8 string - }{{ - // Korean tests. - // - // "A\uac02\uac35\uac56\ud401B\ud408\ud620\ud624C\u4f3d\u8a70D" is a - // nonsense string that contains ASCII, Hangul and CJK ideographs. - // - // "세계야, 안녕" translates as "Hello, world". - e: EUCKR, - encoded: "A\x81\x41\x81\x61\x81\x81\xc6\xfeB\xc7\xa1\xc7\xfe\xc8\xa1C\xca\xa1\xfd\xfeD", - utf8: "A\uac02\uac35\uac56\ud401B\ud408\ud620\ud624C\u4f3d\u8a70D", - }, { - e: EUCKR, - encoded: "\xbc\xbc\xb0\xe8\xbe\xdf\x2c\x20\xbe\xc8\xb3\xe7", - utf8: "세계야, 안녕", - }} - - for _, tc := range testCases { - enctest.TestEncoding(t, tc.e, tc.encoded, tc.utf8, "", "") - } -} - -func TestFiles(t *testing.T) { enctest.TestFile(t, EUCKR) } - -func BenchmarkEncoding(b *testing.B) { enctest.Benchmark(b, EUCKR) } diff --git a/vendor/golang.org/x/text/encoding/korean/euckr.go b/vendor/golang.org/x/text/encoding/korean/euckr.go index 034337f..a4b9ff1 100644 --- a/vendor/golang.org/x/text/encoding/korean/euckr.go +++ b/vendor/golang.org/x/text/encoding/korean/euckr.go @@ -5,6 +5,7 @@ package korean import ( + "errors" "unicode/utf8" "golang.org/x/text/encoding" @@ -25,6 +26,8 @@ var eucKR = internal.Encoding{ identifier.EUCKR, } +var errInvalidEUCKR = errors.New("korean: invalid EUC-KR encoding") + type eucKRDecoder struct{ transform.NopResetter } func (eucKRDecoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { @@ -37,15 +40,10 @@ loop: case 0x81 <= c0 && c0 < 0xff: if nSrc+1 >= len(src) { - if !atEOF { - err = transform.ErrShortSrc - break loop - } - r, size = utf8.RuneError, 1 - break + err = transform.ErrShortSrc + break loop } c1 := src[nSrc+1] - size = 2 if c0 < 0xc7 { r = 178 * rune(c0-0x81) switch { @@ -56,36 +54,39 @@ loop: case 0x81 <= c1 && c1 < 0xff: r += rune(c1) - (0x81 - 2*26) default: - goto decError + err = errInvalidEUCKR + break loop } } else if 0xa1 <= c1 && c1 < 0xff { r = 178*(0xc7-0x81) + rune(c0-0xc7)*94 + rune(c1-0xa1) } else { - goto decError + err = errInvalidEUCKR + break loop } if int(r) < len(decode) { r = rune(decode[r]) - if r != 0 { - break + if r == 0 { + r = '\ufffd' } + } else { + r = '\ufffd' } - decError: - r = utf8.RuneError - if c1 < utf8.RuneSelf { - size = 1 - } + size = 2 default: - r, size = utf8.RuneError, 1 - break + err = errInvalidEUCKR + break loop } if nDst+utf8.RuneLen(r) > len(dst) { err = transform.ErrShortDst - break + break loop } nDst += utf8.EncodeRune(dst[nDst:], r) } + if atEOF && err == transform.ErrShortSrc { + err = errInvalidEUCKR + } return nDst, nSrc, err } diff --git a/vendor/golang.org/x/text/encoding/simplifiedchinese/all_test.go b/vendor/golang.org/x/text/encoding/simplifiedchinese/all_test.go index b369da2..afdb7aa 100644 --- a/vendor/golang.org/x/text/encoding/simplifiedchinese/all_test.go +++ b/vendor/golang.org/x/text/encoding/simplifiedchinese/all_test.go @@ -5,12 +5,10 @@ package simplifiedchinese import ( - "strings" "testing" "golang.org/x/text/encoding" "golang.org/x/text/encoding/internal" - "golang.org/x/text/encoding/internal/enctest" "golang.org/x/text/transform" ) @@ -22,8 +20,6 @@ func enc(e encoding.Encoding) (dir string, t transform.Transformer, err error) { } func TestNonRepertoire(t *testing.T) { - // Pick n large enough to overflow the destination buffer of transform.String. - const n = 10000 testCases := []struct { init func(e encoding.Encoding) (string, transform.Transformer, error) e encoding.Encoding @@ -39,24 +35,6 @@ func TestNonRepertoire(t *testing.T) { {enc, HZGB2312, "갂", ""}, {enc, HZGB2312, "a갂", "a"}, {enc, HZGB2312, "\u6cf5갂", "~{1C~}"}, - - {dec, GB18030, "\x80", "€"}, - {dec, GB18030, "\x81", "\ufffd"}, - {dec, GB18030, "\x81\x20", "\ufffd "}, - {dec, GB18030, "\xfe\xfe", "\ufffd"}, - {dec, GB18030, "\xfe\xff", "\ufffd\ufffd"}, - {dec, GB18030, "\xfe\x30", "\ufffd0"}, - {dec, GB18030, "\xfe\x30\x30 ", "\ufffd00 "}, - {dec, GB18030, "\xfe\x30\xff ", "\ufffd0\ufffd "}, - {dec, GB18030, "\xfe\x30\x81\x21", "\ufffd0\ufffd!"}, - - {dec, GB18030, strings.Repeat("\xfe\x30", n), strings.Repeat("\ufffd0", n)}, - - {dec, HZGB2312, "~/", "\ufffd"}, - {dec, HZGB2312, "~{a\x80", "\ufffd"}, - {dec, HZGB2312, "~{a\x80", "\ufffd"}, - {dec, HZGB2312, "~{" + strings.Repeat("z~", n), strings.Repeat("\ufffd", n)}, - {dec, HZGB2312, "~{" + strings.Repeat("\xfe\x30", n), strings.Repeat("\ufffd", n*2)}, } for _, tc := range testCases { dir, tr, wantErr := tc.init(tc.e) @@ -70,74 +48,3 @@ func TestNonRepertoire(t *testing.T) { } } } - -func TestBasics(t *testing.T) { - // The encoded forms can be verified by the iconv program: - // $ echo 月日は百代 | iconv -f UTF-8 -t SHIFT-JIS | xxd - testCases := []struct { - e encoding.Encoding - encPrefix string - encoded string - utf8 string - }{{ - // "\u0081\u00de\u00df\u00e0\u00e1\u00e2\u00e3\uffff\U00010000" is a - // nonsense string that contains GB18030 encodable codepoints of which - // only U+00E0 and U+00E1 are GBK encodable. - // - // "A\u3000\u554a\u4e02\u4e90\u72dc\u7349\u02ca\u2588Z€" is a nonsense - // string that contains ASCII and GBK encodable codepoints from Levels - // 1-5 as well as the Euro sign. - // - // "A\u43f0\u4c32\U00027267\u3000\U0002910d\u79d4Z€" is a nonsense string - // that contains ASCII and Big5 encodable codepoints from the Basic - // Multilingual Plane and the Supplementary Ideographic Plane as well as - // the Euro sign. - // - // "花间一壶酒,独酌无相亲。" (simplified) and - // "花間一壺酒,獨酌無相親。" (traditional) - // are from the 8th century poem "Yuè Xià Dú Zhuó". - e: GB18030, - encoded: "\x81\x30\x81\x31\x81\x30\x89\x37\x81\x30\x89\x38\xa8\xa4\xa8\xa2" + - "\x81\x30\x89\x39\x81\x30\x8a\x30\x84\x31\xa4\x39\x90\x30\x81\x30", - utf8: "\u0081\u00de\u00df\u00e0\u00e1\u00e2\u00e3\uffff\U00010000", - }, { - e: GB18030, - encoded: "\xbb\xa8\xbc\xe4\xd2\xbb\xba\xf8\xbe\xc6\xa3\xac\xb6\xc0\xd7\xc3" + - "\xce\xde\xcf\xe0\xc7\xd7\xa1\xa3", - utf8: "花间一壶酒,独酌无相亲。", - }, { - e: GBK, - encoded: "A\xa1\xa1\xb0\xa1\x81\x40\x81\x80\xaa\x40\xaa\x80\xa8\x40\xa8\x80Z\x80", - utf8: "A\u3000\u554a\u4e02\u4e90\u72dc\u7349\u02ca\u2588Z€", - }, { - e: GBK, - encoded: "\xbb\xa8\xbc\xe4\xd2\xbb\xba\xf8\xbe\xc6\xa3\xac\xb6\xc0\xd7\xc3" + - "\xce\xde\xcf\xe0\xc7\xd7\xa1\xa3", - utf8: "花间一壶酒,独酌无相亲。", - }, { - e: HZGB2312, - encoded: "A~{\x21\x21~~\x30\x21~}Z~~", - utf8: "A\u3000~\u554aZ~", - }, { - e: HZGB2312, - encPrefix: "~{", - encoded: ";(F#,6@WCN^O`GW!#", - utf8: "花间一壶酒,独酌无相亲。", - }} - - for _, tc := range testCases { - enctest.TestEncoding(t, tc.e, tc.encoded, tc.utf8, tc.encPrefix, "") - } -} - -func TestFiles(t *testing.T) { - enctest.TestFile(t, GB18030) - enctest.TestFile(t, GBK) - enctest.TestFile(t, HZGB2312) -} - -func BenchmarkEncoding(b *testing.B) { - enctest.Benchmark(b, GB18030) - enctest.Benchmark(b, GBK) - enctest.Benchmark(b, HZGB2312) -} diff --git a/vendor/golang.org/x/text/encoding/simplifiedchinese/gbk.go b/vendor/golang.org/x/text/encoding/simplifiedchinese/gbk.go index b89c45b..e0b15bb 100644 --- a/vendor/golang.org/x/text/encoding/simplifiedchinese/gbk.go +++ b/vendor/golang.org/x/text/encoding/simplifiedchinese/gbk.go @@ -5,6 +5,7 @@ package simplifiedchinese import ( + "errors" "unicode/utf8" "golang.org/x/text/encoding" @@ -39,6 +40,11 @@ var gbk18030 = internal.Encoding{ identifier.GB18030, } +var ( + errInvalidGB18030 = errors.New("simplifiedchinese: invalid GB18030 encoding") + errInvalidGBK = errors.New("simplifiedchinese: invalid GBK encoding") +) + type gbkDecoder struct { transform.NopResetter gb18030 bool @@ -60,12 +66,8 @@ loop: case c0 < 0xff: if nSrc+1 >= len(src) { - if !atEOF { - err = transform.ErrShortSrc - break loop - } - r, size = utf8.RuneError, 1 - goto write + err = transform.ErrShortSrc + break loop } c1 := src[nSrc+1] switch { @@ -75,24 +77,18 @@ loop: c1 -= 0x41 case d.gb18030 && 0x30 <= c1 && c1 < 0x40: if nSrc+3 >= len(src) { - if !atEOF { - err = transform.ErrShortSrc - break loop - } - // The second byte here is always ASCII, so we can set size - // to 1 in all cases. - r, size = utf8.RuneError, 1 - goto write + err = transform.ErrShortSrc + break loop } c2 := src[nSrc+2] if c2 < 0x81 || 0xff <= c2 { - r, size = utf8.RuneError, 1 - goto write + err = errInvalidGB18030 + break loop } c3 := src[nSrc+3] if c3 < 0x30 || 0x3a <= c3 { - r, size = utf8.RuneError, 1 - goto write + err = errInvalidGB18030 + break loop } size = 4 r = ((rune(c0-0x81)*10+rune(c1-0x30))*126+rune(c2-0x81))*10 + rune(c3-0x30) @@ -113,13 +109,17 @@ loop: r -= 189000 if 0 <= r && r < 0x100000 { r += 0x10000 - } else { - r, size = utf8.RuneError, 1 + goto write } - goto write + err = errInvalidGB18030 + break loop default: - r, size = utf8.RuneError, 1 - goto write + if d.gb18030 { + err = errInvalidGB18030 + } else { + err = errInvalidGBK + } + break loop } r, size = '\ufffd', 2 if i := int(c0-0x81)*190 + int(c1); i < len(decode) { @@ -130,7 +130,12 @@ loop: } default: - r, size = utf8.RuneError, 1 + if d.gb18030 { + err = errInvalidGB18030 + } else { + err = errInvalidGBK + } + break loop } write: @@ -140,6 +145,13 @@ loop: } nDst += utf8.EncodeRune(dst[nDst:], r) } + if atEOF && err == transform.ErrShortSrc { + if d.gb18030 { + err = errInvalidGB18030 + } else { + err = errInvalidGBK + } + } return nDst, nSrc, err } diff --git a/vendor/golang.org/x/text/encoding/simplifiedchinese/hzgb2312.go b/vendor/golang.org/x/text/encoding/simplifiedchinese/hzgb2312.go index eb3157f..85de6b1 100644 --- a/vendor/golang.org/x/text/encoding/simplifiedchinese/hzgb2312.go +++ b/vendor/golang.org/x/text/encoding/simplifiedchinese/hzgb2312.go @@ -5,6 +5,7 @@ package simplifiedchinese import ( + "errors" "unicode/utf8" "golang.org/x/text/encoding" @@ -30,6 +31,8 @@ func hzGB2312NewEncoder() transform.Transformer { return new(hzGB2312Encoder) } +var errInvalidHZGB2312 = errors.New("simplifiedchinese: invalid HZ-GB2312 encoding") + const ( asciiState = iota gbState @@ -47,18 +50,14 @@ loop: for ; nSrc < len(src); nSrc += size { c0 := src[nSrc] if c0 >= utf8.RuneSelf { - r, size = utf8.RuneError, 1 - goto write + err = errInvalidHZGB2312 + break loop } if c0 == '~' { if nSrc+1 >= len(src) { - if !atEOF { - err = transform.ErrShortSrc - break loop - } - r = utf8.RuneError - goto write + err = transform.ErrShortSrc + break loop } size = 2 switch src[nSrc+1] { @@ -79,8 +78,8 @@ loop: case '\n': continue default: - r = utf8.RuneError - goto write + err = errInvalidHZGB2312 + break loop } } @@ -88,37 +87,33 @@ loop: r, size = rune(c0), 1 } else { if nSrc+1 >= len(src) { - if !atEOF { - err = transform.ErrShortSrc - break loop - } - r, size = utf8.RuneError, 1 - goto write + err = transform.ErrShortSrc + break loop } - size = 2 c1 := src[nSrc+1] if c0 < 0x21 || 0x7e <= c0 || c1 < 0x21 || 0x7f <= c1 { - // error - } else if i := int(c0-0x01)*190 + int(c1+0x3f); i < len(decode) { + err = errInvalidHZGB2312 + break loop + } + + r, size = '\ufffd', 2 + if i := int(c0-0x01)*190 + int(c1+0x3f); i < len(decode) { r = rune(decode[i]) - if r != 0 { - goto write + if r == 0 { + r = '\ufffd' } } - if c1 > utf8.RuneSelf { - // Be consistent and always treat non-ASCII as a single error. - size = 1 - } - r = utf8.RuneError } - write: if nDst+utf8.RuneLen(r) > len(dst) { err = transform.ErrShortDst break loop } nDst += utf8.EncodeRune(dst[nDst:], r) } + if atEOF && err == transform.ErrShortSrc { + err = errInvalidHZGB2312 + } return nDst, nSrc, err } diff --git a/vendor/golang.org/x/text/encoding/traditionalchinese/all_test.go b/vendor/golang.org/x/text/encoding/traditionalchinese/all_test.go index 3825c76..e779b69 100644 --- a/vendor/golang.org/x/text/encoding/traditionalchinese/all_test.go +++ b/vendor/golang.org/x/text/encoding/traditionalchinese/all_test.go @@ -5,14 +5,10 @@ package traditionalchinese import ( - "fmt" - "io/ioutil" - "strings" "testing" "golang.org/x/text/encoding" "golang.org/x/text/encoding/internal" - "golang.org/x/text/encoding/internal/enctest" "golang.org/x/text/transform" ) @@ -29,12 +25,7 @@ func TestNonRepertoire(t *testing.T) { e encoding.Encoding src, want string }{ - {dec, Big5, "\x80", "\ufffd"}, - {dec, Big5, "\x81", "\ufffd"}, - {dec, Big5, "\x81\x30", "\ufffd\x30"}, {dec, Big5, "\x81\x40", "\ufffd"}, - {dec, Big5, "\x81\xa0", "\ufffd"}, - {dec, Big5, "\xff", "\ufffd"}, {enc, Big5, "갂", ""}, {enc, Big5, "a갂", "a"}, @@ -42,73 +33,13 @@ func TestNonRepertoire(t *testing.T) { } for _, tc := range testCases { dir, tr, wantErr := tc.init(tc.e) - t.Run(fmt.Sprintf("%s/%v/%q", dir, tc.e, tc.src), func(t *testing.T) { - dst := make([]byte, 100) - src := []byte(tc.src) - for i := 0; i <= len(tc.src); i++ { - nDst, nSrc, err := tr.Transform(dst, src[:i], false) - if err != nil && err != transform.ErrShortSrc && err != wantErr { - t.Fatalf("error on first call to Transform: %v", err) - } - n, _, err := tr.Transform(dst[nDst:], src[nSrc:], true) - nDst += n - if err != wantErr { - t.Fatalf("(%q|%q): got %v; want %v", tc.src[:i], tc.src[i:], err, wantErr) - } - if got := string(dst[:nDst]); got != tc.want { - t.Errorf("(%q|%q):\ngot %q\nwant %q", tc.src[:i], tc.src[i:], got, tc.want) - } - } - }) - } -} - -func TestBasics(t *testing.T) { - // The encoded forms can be verified by the iconv program: - // $ echo 月日は百代 | iconv -f UTF-8 -t SHIFT-JIS | xxd - testCases := []struct { - e encoding.Encoding - encPrefix string - encSuffix string - encoded string - utf8 string - }{{ - e: Big5, - encoded: "A\x87\x40\x87\x41\x87\x45\xa1\x40\xfe\xfd\xfe\xfeZ\xa3\xe1", - utf8: "A\u43f0\u4c32\U00027267\u3000\U0002910d\u79d4Z€", - }, { - e: Big5, - encoded: "\xaa\xe1\xb6\xa1\xa4\x40\xb3\xfd\xb0\x73\xa1\x41\xbf\x57\xb0\x75" + - "\xb5\x4c\xac\xdb\xbf\xcb\xa1\x43", - utf8: "花間一壺酒,獨酌無相親。", - }} - - for _, tc := range testCases { - enctest.TestEncoding(t, tc.e, tc.encoded, tc.utf8, "", "") - } -} - -func TestFiles(t *testing.T) { enctest.TestFile(t, Big5) } - -func BenchmarkEncoding(b *testing.B) { enctest.Benchmark(b, Big5) } - -// TestBig5CircumflexAndMacron tests the special cases listed in -// http://encoding.spec.whatwg.org/#big5 -// Note that these special cases aren't preserved by round-tripping through -// decoding and encoding (since -// http://encoding.spec.whatwg.org/index-big5.txt does not have an entry for -// U+0304 or U+030C), so we can't test this in TestBasics. -func TestBig5CircumflexAndMacron(t *testing.T) { - src := "\x88\x5f\x88\x60\x88\x61\x88\x62\x88\x63\x88\x64\x88\x65\x88\x66 " + - "\x88\xa2\x88\xa3\x88\xa4\x88\xa5\x88\xa6" - want := "ÓǑÒ\u00ca\u0304Ế\u00ca\u030cỀÊ " + - "ü\u00ea\u0304ế\u00ea\u030cề" - dst, err := ioutil.ReadAll(transform.NewReader( - strings.NewReader(src), Big5.NewDecoder())) - if err != nil { - t.Fatal(err) - } - if got := string(dst); got != want { - t.Fatalf("\ngot %q\nwant %q", got, want) + + dst, _, err := transform.String(tr, tc.src) + if err != wantErr { + t.Errorf("%s %v(%q): got %v; want %v", dir, tc.e, tc.src, err, wantErr) + } + if got := string(dst); got != tc.want { + t.Errorf("%s %v(%q):\ngot %q\nwant %q", dir, tc.e, tc.src, got, tc.want) + } } } diff --git a/vendor/golang.org/x/text/encoding/traditionalchinese/big5.go b/vendor/golang.org/x/text/encoding/traditionalchinese/big5.go index 1fcddde..275821f 100644 --- a/vendor/golang.org/x/text/encoding/traditionalchinese/big5.go +++ b/vendor/golang.org/x/text/encoding/traditionalchinese/big5.go @@ -5,6 +5,7 @@ package traditionalchinese import ( + "errors" "unicode/utf8" "golang.org/x/text/encoding" @@ -25,6 +26,8 @@ var big5 = internal.Encoding{ identifier.Big5, } +var errInvalidBig5 = errors.New("traditionalchinese: invalid Big5 encoding") + type big5Decoder struct{ transform.NopResetter } func (big5Decoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { @@ -37,12 +40,8 @@ loop: case 0x81 <= c0 && c0 < 0xff: if nSrc+1 >= len(src) { - if !atEOF { - err = transform.ErrShortSrc - break loop - } - r, size = utf8.RuneError, 1 - goto write + err = transform.ErrShortSrc + break loop } c1 := src[nSrc+1] switch { @@ -50,12 +49,9 @@ loop: c1 -= 0x40 case 0xa1 <= c1 && c1 < 0xff: c1 -= 0x62 - case c1 < 0x40: - r, size = utf8.RuneError, 1 - goto write default: - r, size = utf8.RuneError, 2 - goto write + err = errInvalidBig5 + break loop } r, size = '\ufffd', 2 if i := int(c0-0x81)*157 + int(c1); i < len(decode) { @@ -84,10 +80,10 @@ loop: } default: - r, size = utf8.RuneError, 1 + err = errInvalidBig5 + break loop } - write: if nDst+utf8.RuneLen(r) > len(dst) { err = transform.ErrShortDst break loop @@ -103,6 +99,9 @@ loop: nDst += copy(dst[nDst:], s) continue loop } + if atEOF && err == transform.ErrShortSrc { + err = errInvalidBig5 + } return nDst, nSrc, err } diff --git a/vendor/golang.org/x/text/encoding/unicode/unicode_test.go b/vendor/golang.org/x/text/encoding/unicode/unicode_test.go index 51b4712..2bc9615 100644 --- a/vendor/golang.org/x/text/encoding/unicode/unicode_test.go +++ b/vendor/golang.org/x/text/encoding/unicode/unicode_test.go @@ -7,286 +7,9 @@ package unicode import ( "testing" - "golang.org/x/text/encoding" - "golang.org/x/text/encoding/charmap" - "golang.org/x/text/encoding/internal/enctest" "golang.org/x/text/transform" ) -func TestBasics(t *testing.T) { - testCases := []struct { - e encoding.Encoding - encPrefix string - encSuffix string - encoded string - utf8 string - }{{ - e: utf16BEIB, - encoded: "\x00\x57\x00\xe4\xd8\x35\xdd\x65", - utf8: "\x57\u00e4\U0001d565", - }, { - e: utf16BEEB, - encPrefix: "\xfe\xff", - encoded: "\x00\x57\x00\xe4\xd8\x35\xdd\x65", - utf8: "\x57\u00e4\U0001d565", - }, { - e: utf16LEIB, - encoded: "\x57\x00\xe4\x00\x35\xd8\x65\xdd", - utf8: "\x57\u00e4\U0001d565", - }, { - e: utf16LEEB, - encPrefix: "\xff\xfe", - encoded: "\x57\x00\xe4\x00\x35\xd8\x65\xdd", - utf8: "\x57\u00e4\U0001d565", - }} - - for _, tc := range testCases { - enctest.TestEncoding(t, tc.e, tc.encoded, tc.utf8, tc.encPrefix, tc.encSuffix) - } -} - -func TestFiles(t *testing.T) { - enctest.TestFile(t, UTF8) - enctest.TestFile(t, utf16LEIB) -} - -func BenchmarkEncoding(b *testing.B) { - enctest.Benchmark(b, UTF8) - enctest.Benchmark(b, utf16LEIB) -} - -var ( - utf16LEIB = UTF16(LittleEndian, IgnoreBOM) // UTF-16LE (atypical interpretation) - utf16LEUB = UTF16(LittleEndian, UseBOM) // UTF-16, LE - utf16LEEB = UTF16(LittleEndian, ExpectBOM) // UTF-16, LE, Expect - utf16BEIB = UTF16(BigEndian, IgnoreBOM) // UTF-16BE (atypical interpretation) - utf16BEUB = UTF16(BigEndian, UseBOM) // UTF-16 default - utf16BEEB = UTF16(BigEndian, ExpectBOM) // UTF-16 Expect -) - -func TestUTF16(t *testing.T) { - testCases := []struct { - desc string - src string - notEOF bool // the inverse of atEOF - sizeDst int - want string - nSrc int - err error - t transform.Transformer - }{{ - desc: "utf-16 IgnoreBOM dec: empty string", - t: utf16BEIB.NewDecoder(), - }, { - desc: "utf-16 UseBOM dec: empty string", - t: utf16BEUB.NewDecoder(), - }, { - desc: "utf-16 ExpectBOM dec: empty string", - err: ErrMissingBOM, - t: utf16BEEB.NewDecoder(), - }, { - desc: "utf-16 dec: BOM determines encoding BE (RFC 2781:3.3)", - src: "\xFE\xFF\xD8\x08\xDF\x45\x00\x3D\x00\x52\x00\x61", - sizeDst: 100, - want: "\U00012345=Ra", - nSrc: 12, - t: utf16BEUB.NewDecoder(), - }, { - desc: "utf-16 dec: BOM determines encoding LE (RFC 2781:3.3)", - src: "\xFF\xFE\x08\xD8\x45\xDF\x3D\x00\x52\x00\x61\x00", - sizeDst: 100, - want: "\U00012345=Ra", - nSrc: 12, - t: utf16LEUB.NewDecoder(), - }, { - desc: "utf-16 dec: BOM determines encoding LE, change default (RFC 2781:3.3)", - src: "\xFF\xFE\x08\xD8\x45\xDF\x3D\x00\x52\x00\x61\x00", - sizeDst: 100, - want: "\U00012345=Ra", - nSrc: 12, - t: utf16BEUB.NewDecoder(), - }, { - desc: "utf-16 dec: Fail on missing BOM when required", - src: "\x08\xD8\x45\xDF\x3D\x00\xFF\xFE\xFE\xFF\x00\x52\x00\x61", - sizeDst: 100, - want: "", - nSrc: 0, - err: ErrMissingBOM, - t: utf16BEEB.NewDecoder(), - }, { - desc: "utf-16 dec: SHOULD interpret text as big-endian when BOM not present (RFC 2781:4.3)", - src: "\xD8\x08\xDF\x45\x00\x3D\x00\x52\x00\x61", - sizeDst: 100, - want: "\U00012345=Ra", - nSrc: 10, - t: utf16BEUB.NewDecoder(), - }, { - // This is an error according to RFC 2781. But errors in RFC 2781 are - // open to interpretations, so I guess this is fine. - desc: "utf-16le dec: incorrect BOM is an error (RFC 2781:4.1)", - src: "\xFE\xFF\x08\xD8\x45\xDF\x3D\x00\x52\x00\x61\x00", - sizeDst: 100, - want: "\uFFFE\U00012345=Ra", - nSrc: 12, - t: utf16LEIB.NewDecoder(), - }, { - desc: "utf-16 enc: SHOULD write BOM (RFC 2781:3.3)", - src: "\U00012345=Ra", - sizeDst: 100, - want: "\xFF\xFE\x08\xD8\x45\xDF\x3D\x00\x52\x00\x61\x00", - nSrc: 7, - t: utf16LEUB.NewEncoder(), - }, { - desc: "utf-16 enc: SHOULD write BOM (RFC 2781:3.3)", - src: "\U00012345=Ra", - sizeDst: 100, - want: "\xFE\xFF\xD8\x08\xDF\x45\x00\x3D\x00\x52\x00\x61", - nSrc: 7, - t: utf16BEUB.NewEncoder(), - }, { - desc: "utf-16le enc: MUST NOT write BOM (RFC 2781:3.3)", - src: "\U00012345=Ra", - sizeDst: 100, - want: "\x08\xD8\x45\xDF\x3D\x00\x52\x00\x61\x00", - nSrc: 7, - t: utf16LEIB.NewEncoder(), - }, { - desc: "utf-16be dec: incorrect UTF-16: odd bytes", - src: "\x00", - sizeDst: 100, - want: "\uFFFD", - nSrc: 1, - t: utf16BEIB.NewDecoder(), - }, { - desc: "utf-16be dec: unpaired surrogate, odd bytes", - src: "\xD8\x45\x00", - sizeDst: 100, - want: "\uFFFD\uFFFD", - nSrc: 3, - t: utf16BEIB.NewDecoder(), - }, { - desc: "utf-16be dec: unpaired low surrogate + valid text", - src: "\xD8\x45\x00a", - sizeDst: 100, - want: "\uFFFDa", - nSrc: 4, - t: utf16BEIB.NewDecoder(), - }, { - desc: "utf-16be dec: unpaired low surrogate + valid text + single byte", - src: "\xD8\x45\x00ab", - sizeDst: 100, - want: "\uFFFDa\uFFFD", - nSrc: 5, - t: utf16BEIB.NewDecoder(), - }, { - desc: "utf-16le dec: unpaired high surrogate", - src: "\x00\x00\x00\xDC\x12\xD8", - sizeDst: 100, - want: "\x00\uFFFD\uFFFD", - nSrc: 6, - t: utf16LEIB.NewDecoder(), - }, { - desc: "utf-16be dec: two unpaired low surrogates", - src: "\xD8\x45\xD8\x12", - sizeDst: 100, - want: "\uFFFD\uFFFD", - nSrc: 4, - t: utf16BEIB.NewDecoder(), - }, { - desc: "utf-16be dec: short dst", - src: "\x00a", - sizeDst: 0, - want: "", - nSrc: 0, - t: utf16BEIB.NewDecoder(), - err: transform.ErrShortDst, - }, { - desc: "utf-16be dec: short dst surrogate", - src: "\xD8\xF5\xDC\x12", - sizeDst: 3, - want: "", - nSrc: 0, - t: utf16BEIB.NewDecoder(), - err: transform.ErrShortDst, - }, { - desc: "utf-16be dec: short dst trailing byte", - src: "\x00", - sizeDst: 2, - want: "", - nSrc: 0, - t: utf16BEIB.NewDecoder(), - err: transform.ErrShortDst, - }, { - desc: "utf-16be dec: short src", - src: "\x00", - notEOF: true, - sizeDst: 3, - want: "", - nSrc: 0, - t: utf16BEIB.NewDecoder(), - err: transform.ErrShortSrc, - }, { - desc: "utf-16 enc", - src: "\U00012345=Ra", - sizeDst: 100, - want: "\xFE\xFF\xD8\x08\xDF\x45\x00\x3D\x00\x52\x00\x61", - nSrc: 7, - t: utf16BEUB.NewEncoder(), - }, { - desc: "utf-16 enc: short dst normal", - src: "\U00012345=Ra", - sizeDst: 9, - want: "\xD8\x08\xDF\x45\x00\x3D\x00\x52", - nSrc: 6, - t: utf16BEIB.NewEncoder(), - err: transform.ErrShortDst, - }, { - desc: "utf-16 enc: short dst surrogate", - src: "\U00012345=Ra", - sizeDst: 3, - want: "", - nSrc: 0, - t: utf16BEIB.NewEncoder(), - err: transform.ErrShortDst, - }, { - desc: "utf-16 enc: short src", - src: "\U00012345=Ra\xC2", - notEOF: true, - sizeDst: 100, - want: "\xD8\x08\xDF\x45\x00\x3D\x00\x52\x00\x61", - nSrc: 7, - t: utf16BEIB.NewEncoder(), - err: transform.ErrShortSrc, - }, { - desc: "utf-16be dec: don't change byte order mid-stream", - src: "\xFE\xFF\xD8\x08\xDF\x45\x00\x3D\xFF\xFE\x00\x52\x00\x61", - sizeDst: 100, - want: "\U00012345=\ufffeRa", - nSrc: 14, - t: utf16BEUB.NewDecoder(), - }, { - desc: "utf-16le dec: don't change byte order mid-stream", - src: "\xFF\xFE\x08\xD8\x45\xDF\x3D\x00\xFF\xFE\xFE\xFF\x52\x00\x61\x00", - sizeDst: 100, - want: "\U00012345=\ufeff\ufffeRa", - nSrc: 16, - t: utf16LEUB.NewDecoder(), - }} - for i, tc := range testCases { - b := make([]byte, tc.sizeDst) - nDst, nSrc, err := tc.t.Transform(b, []byte(tc.src), !tc.notEOF) - if err != tc.err { - t.Errorf("%d:%s: error was %v; want %v", i, tc.desc, err, tc.err) - } - if got := string(b[:nDst]); got != tc.want { - t.Errorf("%d:%s: result was %q: want %q", i, tc.desc, got, tc.want) - } - if nSrc != tc.nSrc { - t.Errorf("%d:%s: nSrc was %d; want %d", i, tc.desc, nSrc, tc.nSrc) - } - } -} - func TestUTF8Decoder(t *testing.T) { testCases := []struct { desc string @@ -453,47 +176,3 @@ func TestUTF8Decoder(t *testing.T) { } } } - -func TestBOMOverride(t *testing.T) { - dec := BOMOverride(charmap.CodePage437.NewDecoder()) - dst := make([]byte, 100) - for i, tc := range []struct { - src string - atEOF bool - dst string - nSrc int - err error - }{ - 0: {"H\x82ll\x93", true, "Héllô", 5, nil}, - 1: {"\uFEFFHéllö", true, "Héllö", 10, nil}, - 2: {"\xFE\xFF\x00H\x00e\x00l\x00l\x00o", true, "Hello", 12, nil}, - 3: {"\xFF\xFEH\x00e\x00l\x00l\x00o\x00", true, "Hello", 12, nil}, - 4: {"\uFEFF", true, "", 3, nil}, - 5: {"\xFE\xFF", true, "", 2, nil}, - 6: {"\xFF\xFE", true, "", 2, nil}, - 7: {"\xEF\xBB", true, "\u2229\u2557", 2, nil}, - 8: {"\xEF", true, "\u2229", 1, nil}, - 9: {"", true, "", 0, nil}, - 10: {"\xFE", true, "\u25a0", 1, nil}, - 11: {"\xFF", true, "\u00a0", 1, nil}, - 12: {"\xEF\xBB", false, "", 0, transform.ErrShortSrc}, - 13: {"\xEF", false, "", 0, transform.ErrShortSrc}, - 14: {"", false, "", 0, transform.ErrShortSrc}, - 15: {"\xFE", false, "", 0, transform.ErrShortSrc}, - 16: {"\xFF", false, "", 0, transform.ErrShortSrc}, - 17: {"\xFF\xFE", false, "", 0, transform.ErrShortSrc}, - } { - dec.Reset() - nDst, nSrc, err := dec.Transform(dst, []byte(tc.src), tc.atEOF) - got := string(dst[:nDst]) - if nSrc != tc.nSrc { - t.Errorf("%d: nSrc: got %d; want %d", i, nSrc, tc.nSrc) - } - if got != tc.dst { - t.Errorf("%d: got %+q; want %+q", i, got, tc.dst) - } - if err != tc.err { - t.Errorf("%d: error: got %v; want %v", i, err, tc.err) - } - } -} diff --git a/vendor/golang.org/x/text/encoding/unicode/utf32/utf32_test.go b/vendor/golang.org/x/text/encoding/unicode/utf32/utf32_test.go index cd6158e..6de88cb 100644 --- a/vendor/golang.org/x/text/encoding/unicode/utf32/utf32_test.go +++ b/vendor/golang.org/x/text/encoding/unicode/utf32/utf32_test.go @@ -7,8 +7,6 @@ package utf32 import ( "testing" - "golang.org/x/text/encoding" - "golang.org/x/text/encoding/internal/enctest" "golang.org/x/text/transform" ) @@ -21,42 +19,6 @@ var ( utf32BEEB = UTF32(BigEndian, ExpectBOM) // UTF-32 Expect ) -func TestBasics(t *testing.T) { - testCases := []struct { - e encoding.Encoding - encPrefix string - encSuffix string - encoded string - utf8 string - }{{ - e: utf32BEIB, - encoded: "\x00\x00\x00\x57\x00\x00\x00\xe4\x00\x01\xd5\x65", - utf8: "\x57\u00e4\U0001d565", - }, { - e: UTF32(BigEndian, ExpectBOM), - encPrefix: "\x00\x00\xfe\xff", - encoded: "\x00\x00\x00\x57\x00\x00\x00\xe4\x00\x01\xd5\x65", - utf8: "\x57\u00e4\U0001d565", - }, { - e: UTF32(LittleEndian, IgnoreBOM), - encoded: "\x57\x00\x00\x00\xe4\x00\x00\x00\x65\xd5\x01\x00", - utf8: "\x57\u00e4\U0001d565", - }, { - e: UTF32(LittleEndian, ExpectBOM), - encPrefix: "\xff\xfe\x00\x00", - encoded: "\x57\x00\x00\x00\xe4\x00\x00\x00\x65\xd5\x01\x00", - utf8: "\x57\u00e4\U0001d565", - }} - - for _, tc := range testCases { - enctest.TestEncoding(t, tc.e, tc.encoded, tc.utf8, tc.encPrefix, tc.encSuffix) - } -} - -func TestFiles(t *testing.T) { enctest.TestFile(t, utf32BEIB) } - -func BenchmarkEncoding(b *testing.B) { enctest.Benchmark(b, utf32BEIB) } - func TestUTF32(t *testing.T) { testCases := []struct { desc string diff --git a/vendor/golang.org/x/text/gen.go b/vendor/golang.org/x/text/gen.go index a694fdd..68976af 100644 --- a/vendor/golang.org/x/text/gen.go +++ b/vendor/golang.org/x/text/gen.go @@ -13,13 +13,10 @@ import ( "flag" "fmt" "go/build" - "go/format" "io/ioutil" "os" "os/exec" - "path" "path/filepath" - "regexp" "runtime" "strings" "sync" @@ -104,25 +101,20 @@ func main() { cases = generate("./cases", unicode, norm, language, rangetable) width = generate("./width", unicode) bidi = generate("./unicode/bidi", unicode, norm, rangetable) - mib = generate("./encoding/internal/identifier", unicode) - _ = generate("./encoding/htmlindex", unicode, language, mib) - _ = generate("./encoding/ianaindex", unicode, language, mib) _ = generate("./secure/precis", unicode, norm, rangetable, cases, width, bidi) + _ = generate("./encoding/htmlindex", unicode, language) _ = generate("./currency", unicode, cldr, language, internal) _ = generate("./internal/number", unicode, cldr, language, internal) - _ = generate("./internal/export/idna", unicode, bidi, norm) _ = generate("./language/display", unicode, cldr, language, internal) _ = generate("./collate", unicode, norm, cldr, language, rangetable) _ = generate("./search", unicode, norm, cldr, language, rangetable) ) - all.Wait() - - // Copy exported packages to the destination golang.org repo. - copyExported("golang.org/x/net/idna") if updateCore { copyVendored() + generate("vendor/golang_org/x/net/idna", unicode, norm, width, cases) } + all.Wait() if hasErrors { fmt.Println("FAIL") @@ -195,84 +187,23 @@ func generate(pkg string, deps ...*dependency) *dependency { return &wg } -// copyExported copies a package in x/text/internal/export to the -// destination repository. -func copyExported(p string) { - copyPackage( - filepath.Join("internal", "export", path.Base(p)), - filepath.Join("..", filepath.FromSlash(p[len("golang.org/x"):])), - "golang.org/x/text/internal/export/"+path.Base(p), - p) -} - -// copyVendored copies packages used by Go core into the vendored directory. func copyVendored() { - root := filepath.Join(build.Default.GOROOT, filepath.FromSlash("src/vendor/golang_org/x")) - - err := filepath.Walk(root, func(dir string, info os.FileInfo, err error) error { - if err != nil || !info.IsDir() || root == dir { - return err - } - src := dir[len(root)+1:] - const slash = string(filepath.Separator) - if c := strings.Split(src, slash); c[0] == "text" { - // Copy a text repo package from its normal location. - src = strings.Join(c[1:], slash) - } else { - // Copy the vendored package if it exists in the export directory. - src = filepath.Join("internal", "export", filepath.Base(src)) - } - copyPackage(src, dir, "golang.org", "golang_org") - return nil - }) - if err != nil { - fmt.Printf("Seeding directory %s has failed %v:", root, err) - os.Exit(1) - } -} - -// goGenRE is used to remove go:generate lines. -var goGenRE = regexp.MustCompile("//go:generate[^\n]*\n") - -// copyPackage copies relevant files from a directory in x/text to the -// destination package directory. The destination package is assumed to have -// the same name. For each copied file go:generate lines are removed and -// and package comments are rewritten to the new path. -func copyPackage(dirSrc, dirDst, search, replace string) { - err := filepath.Walk(dirSrc, func(file string, info os.FileInfo, err error) error { - base := filepath.Base(file) - if err != nil || info.IsDir() || - !strings.HasSuffix(base, ".go") || - strings.HasSuffix(base, "_test.go") && !strings.HasPrefix(base, "example") || - // Don't process subdirectories. - filepath.Dir(file) != dirSrc { + // Copy the vendored files. Some more may need to be copied in by hand. + dir := filepath.Join(build.Default.GOROOT, "src/vendor/golang_org/x/text") + err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error { + if info.IsDir() { return nil } - b, err := ioutil.ReadFile(file) - if err != nil || bytes.Contains(b, []byte("\n// +build ignore")) { + b, err := ioutil.ReadFile(path[len(dir)+1:]) + if err != nil { return err } - // Fix paths. - b = bytes.Replace(b, []byte(search), []byte(replace), -1) - // Remove go:generate lines. - b = goGenRE.ReplaceAllLiteral(b, nil) - comment := "// Code generated by running \"go generate\" in golang.org/x/text. DO NOT EDIT.\n\n" - if *doCore { - comment = "// Code generated by running \"go run gen.go -core\" in golang.org/x/text. DO NOT EDIT.\n\n" - } - if !bytes.HasPrefix(b, []byte(comment)) { - b = append([]byte(comment), b...) - } - if b, err = format.Source(b); err != nil { - fmt.Println("Failed to format file:", err) - os.Exit(1) - } - file = filepath.Join(dirDst, base) - vprintf("=== COPY %s\n", file) - return ioutil.WriteFile(file, b, 0666) + vprintf("=== COPY %s\n", path) + b = bytes.Replace(b, []byte("golang.org"), []byte("golang_org"), -1) + return ioutil.WriteFile(path, b, 0666) }) if err != nil { - fmt.Println("Copying exported files failed:", err) + fmt.Println("Copying vendored files failed:", err) os.Exit(1) } } diff --git a/vendor/golang.org/x/text/internal/export/idna/common_test.go b/vendor/golang.org/x/text/internal/export/idna/common_test.go index 0b07c12..5f101d7 100644 --- a/vendor/golang.org/x/text/internal/export/idna/common_test.go +++ b/vendor/golang.org/x/text/internal/export/idna/common_test.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package idna diff --git a/vendor/golang.org/x/text/internal/export/idna/example_test.go b/vendor/golang.org/x/text/internal/export/idna/example_test.go deleted file mode 100644 index 6e6b872..0000000 --- a/vendor/golang.org/x/text/internal/export/idna/example_test.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package idna_test - -import ( - "fmt" - - "golang.org/x/text/internal/export/idna" -) - -func ExampleProfile() { - // Raw Punycode has no restrictions and does no mappings. - fmt.Println(idna.ToASCII("")) - fmt.Println(idna.ToASCII("*.faß.com")) - fmt.Println(idna.Punycode.ToASCII("*.faß.com")) - - // Rewrite IDN for lookup. This (currently) uses transitional mappings to - // find a balance between IDNA2003 and IDNA2008 compatibility. - fmt.Println(idna.Lookup.ToASCII("")) - fmt.Println(idna.Lookup.ToASCII("www.faß.com")) - - // Convert an IDN to ASCII for registration purposes. This changes the - // encoding, but reports an error if the input was illformed. - fmt.Println(idna.Registration.ToASCII("")) - fmt.Println(idna.Registration.ToASCII("www.faß.com")) - - // Output: - // - // *.xn--fa-hia.com - // *.xn--fa-hia.com - // - // www.fass.com - // idna: invalid label "" - // www.xn--fa-hia.com -} - -func ExampleNew() { - var p *idna.Profile - - // Raw Punycode has no restrictions and does no mappings. - p = idna.New() - fmt.Println(p.ToASCII("*.faß.com")) - - // Do mappings. Note that star is not allowed in a DNS lookup. - p = idna.New( - idna.MapForLookup(), - idna.Transitional(true)) // Map ß -> ss - fmt.Println(p.ToASCII("*.faß.com")) - - // Lookup for registration. Also does not allow '*'. - p = idna.New(idna.ValidateForRegistration()) - fmt.Println(p.ToUnicode("*.faß.com")) - - // Set up a profile maps for lookup, but allows wild cards. - p = idna.New( - idna.MapForLookup(), - idna.Transitional(true), // Map ß -> ss - idna.StrictDomainName(false)) // Set more permissive ASCII rules. - fmt.Println(p.ToASCII("*.faß.com")) - - // Output: - // *.xn--fa-hia.com - // *.fass.com idna: disallowed rune U+002A - // *.faß.com idna: disallowed rune U+002A - // *.fass.com -} diff --git a/vendor/golang.org/x/text/internal/export/idna/idna.go b/vendor/golang.org/x/text/internal/export/idna/idna.go index 3184fbb..c42ea24 100644 --- a/vendor/golang.org/x/text/internal/export/idna/idna.go +++ b/vendor/golang.org/x/text/internal/export/idna/idna.go @@ -4,6 +4,8 @@ //go:generate go run gen.go gen_trieval.go gen_common.go +// http://www.unicode.org/reports/tr46 + // Package idna implements IDNA2008 using the compatibility processing // defined by UTS (Unicode Technical Standard) #46, which defines a standard to // deal with the transition from IDNA2003. @@ -39,24 +41,27 @@ import ( // error in the future. // I think Option 1 is best, but it is quite opinionated. -// ToASCII is a wrapper for Punycode.ToASCII. +// ToASCII converts a domain or domain label to its ASCII form. For example, +// ToASCII("bücher.example.com") is "xn--bcher-kva.example.com", and +// ToASCII("golang") is "golang". If an error is encountered it will return +// an error and a (partially) processed result. func ToASCII(s string) (string, error) { - return Punycode.process(s, true) + return Resolve.process(s, true) } -// ToUnicode is a wrapper for Punycode.ToUnicode. +// ToUnicode converts a domain or domain label to its Unicode form. For example, +// ToUnicode("xn--bcher-kva.example.com") is "bücher.example.com", and +// ToUnicode("golang") is "golang". If an error is encountered it will return +// an error and a (partially) processed result. func ToUnicode(s string) (string, error) { - return Punycode.process(s, false) + return NonTransitional.process(s, false) } // An Option configures a Profile at creation time. type Option func(*options) -// Transitional sets a Profile to use the Transitional mapping as defined in UTS -// #46. This will cause, for example, "ß" to be mapped to "ss". Using the -// transitional mapping provides a compromise between IDNA2003 and IDNA2008 -// compatibility. It is used by most browsers when resolving domain names. This -// option is only meaningful if combined with MapForLookup. +// Transitional sets a Profile to use the Transitional mapping as defined +// in UTS #46. func Transitional(transitional bool) Option { return func(o *options) { o.transitional = true } } @@ -67,93 +72,19 @@ func VerifyDNSLength(verify bool) Option { return func(o *options) { o.verifyDNSLength = verify } } -// ValidateLabels sets whether to check the mandatory label validation criteria -// as defined in Section 5.4 of RFC 5891. This includes testing for correct use -// of hyphens ('-'), normalization, validity of runes, and the context rules. -func ValidateLabels(enable bool) Option { - return func(o *options) { - // Don't override existing mappings, but set one that at least checks - // normalization if it is not set. - if o.mapping == nil && enable { - o.mapping = normalize - } - o.trie = trie - o.validateLabels = enable - o.fromPuny = validateFromPunycode - } -} - -// StrictDomainName limits the set of permissable ASCII characters to those -// allowed in domain names as defined in RFC 1034 (A-Z, a-z, 0-9 and the -// hyphen). This is set by default for MapForLookup and ValidateForRegistration. -// -// This option is useful, for instance, for browsers that allow characters -// outside this range, for example a '_' (U+005F LOW LINE). See -// http://www.rfc-editor.org/std/std3.txt for more details This option -// corresponds to the UseSTD3ASCIIRules option in UTS #46. -func StrictDomainName(use bool) Option { - return func(o *options) { - o.trie = trie - o.useSTD3Rules = use - o.fromPuny = validateFromPunycode - } -} - -// NOTE: the following options pull in tables. The tables should not be linked -// in as long as the options are not used. - -// BidiRule enables the Bidi rule as defined in RFC 5893. Any application -// that relies on proper validation of labels should include this rule. -func BidiRule() Option { - return func(o *options) { o.bidirule = bidirule.ValidString } -} - -// ValidateForRegistration sets validation options to verify that a given IDN is -// properly formatted for registration as defined by Section 4 of RFC 5891. -func ValidateForRegistration() Option { - return func(o *options) { - o.mapping = validateRegistration - StrictDomainName(true)(o) - ValidateLabels(true)(o) - VerifyDNSLength(true)(o) - BidiRule()(o) - } -} - -// MapForLookup sets validation and mapping options such that a given IDN is -// transformed for domain name lookup according to the requirements set out in -// Section 5 of RFC 5891. The mappings follow the recommendations of RFC 5894, -// RFC 5895 and UTS 46. It does not add the Bidi Rule. Use the BidiRule option -// to add this check. -// -// The mappings include normalization and mapping case, width and other -// compatibility mappings. -func MapForLookup() Option { - return func(o *options) { - o.mapping = validateAndMap - StrictDomainName(true)(o) - ValidateLabels(true)(o) - } +// IgnoreSTD3Rules sets whether ASCII characters outside the A-Z, a-z, 0-9 and +// the hyphen should be allowed. By default this is not allowed, but IDNA2003, +// and as a consequence UTS #46, allows this to be overridden to support +// browsers that allow characters outside this range, for example a '_' (U+005F +// LOW LINE). See http://www.rfc- editor.org/std/std3.txt for more details. +func IgnoreSTD3Rules(ignore bool) Option { + return func(o *options) { o.ignoreSTD3Rules = ignore } } type options struct { transitional bool - useSTD3Rules bool - validateLabels bool + ignoreSTD3Rules bool verifyDNSLength bool - - trie *idnaTrie - - // fromPuny calls validation rules when converting A-labels to U-labels. - fromPuny func(p *Profile, s string) error - - // mapping implements a validation and mapping step as defined in RFC 5895 - // or UTS 46, tailored to, for example, domain registration or lookup. - mapping func(p *Profile, s string) (string, error) - - // bidirule, if specified, checks whether s conforms to the Bidi Rule - // defined in RFC 5893. - bidirule func(s string) bool } // A Profile defines the configuration of a IDNA mapper. @@ -168,13 +99,8 @@ func apply(o *options, opts []Option) { } // New creates a new Profile. -// -// With no options, the returned Profile is the most permissive and equals the -// Punycode Profile. Options can be passed to further restrict the Profile. The -// MapForLookup and ValidateForRegistration options set a collection of options, -// for lookup and registration purposes respectively, which can be tailored by -// adding more fine-grained options, where later options override earlier -// options. +// With no options, the returned profile is the non-transitional profile as +// defined in UTS #46. func New(o ...Option) *Profile { p := &Profile{} apply(&p.options, o) @@ -208,67 +134,33 @@ func (p *Profile) String() string { } else { s = "NonTransitional" } - if p.useSTD3Rules { - s += ":UseSTD3Rules" - } - if p.validateLabels { - s += ":ValidateLabels" - } - if p.verifyDNSLength { - s += ":VerifyDNSLength" + if p.ignoreSTD3Rules { + s += ":NoSTD3Rules" } return s } var ( - // Punycode is a Profile that does raw punycode processing with a minimum - // of validation. - Punycode *Profile = punycode - - // Lookup is the recommended profile for looking up domain names, according - // to Section 5 of RFC 5891. The exact configuration of this profile may - // change over time. - Lookup *Profile = lookup + // Resolve is the recommended profile for resolving domain names. + // The configuration of this profile may change over time. + Resolve = resolve // Display is the recommended profile for displaying domain names. // The configuration of this profile may change over time. - Display *Profile = display + Display = display - // Registration is the recommended profile for checking whether a given - // IDN is valid for registration, according to Section 4 of RFC 5891. - Registration *Profile = registration + // NonTransitional defines a profile that implements the Transitional + // mapping as defined in UTS #46 with no additional constraints. + NonTransitional = nonTransitional - punycode = &Profile{} - lookup = &Profile{options{ - transitional: true, - useSTD3Rules: true, - validateLabels: true, - trie: trie, - fromPuny: validateFromPunycode, - mapping: validateAndMap, - bidirule: bidirule.ValidString, - }} - display = &Profile{options{ - useSTD3Rules: true, - validateLabels: true, - trie: trie, - fromPuny: validateFromPunycode, - mapping: validateAndMap, - bidirule: bidirule.ValidString, - }} - registration = &Profile{options{ - useSTD3Rules: true, - validateLabels: true, - verifyDNSLength: true, - trie: trie, - fromPuny: validateFromPunycode, - mapping: validateRegistration, - bidirule: bidirule.ValidString, - }} + resolve = &Profile{options{transitional: true}} + display = &Profile{} + nonTransitional = &Profile{} // TODO: profiles - // Register: recommended for approving domain names: don't do any mappings - // but rather reject on invalid input. Bundle or block deviation characters. + // V2008: strict IDNA2008 + // Register: recommended for approving domain names: nontransitional, but + // bundle or block deviation characters. ) type labelError struct{ label, code_ string } @@ -288,17 +180,53 @@ func (e runeError) Error() string { // process implements the algorithm described in section 4 of UTS #46, // see http://www.unicode.org/reports/tr46. func (p *Profile) process(s string, toASCII bool) (string, error) { - var err error - if p.mapping != nil { - s, err = p.mapping(p, s) + var ( + b []byte + err error + k, i int + ) + for i < len(s) { + v, sz := trie.lookupString(s[i:]) + start := i + i += sz + // Copy bytes not copied so far. + switch p.simplify(info(v).category()) { + case valid: + continue + case disallowed: + if err == nil { + r, _ := utf8.DecodeRuneInString(s[i:]) + err = runeError(r) + } + continue + case mapped, deviation: + b = append(b, s[k:start]...) + b = info(v).appendMapping(b, s[start:i]) + case ignored: + b = append(b, s[k:start]...) + // drop the rune + case unknown: + b = append(b, s[k:start]...) + b = append(b, "\ufffd"...) + } + k = i } - // Remove leading empty labels. + if k == 0 { + // No changes so far. + s = norm.NFC.String(s) + } else { + b = append(b, s[k:]...) + if norm.NFC.QuickSpan(b) != len(b) { + b = norm.NFC.Bytes(b) + } + // TODO: the punycode converters require strings as input. + s = string(b) + } + // Remove leading empty labels for ; len(s) > 0 && s[0] == '.'; s = s[1:] { } - // It seems like we should only create this error on ToASCII, but the - // UTS 46 conformance tests suggests we should always check this. - if err == nil && p.verifyDNSLength && s == "" { - err = &labelError{s, "A4"} + if s == "" { + return "", &labelError{s, "A4"} } labels := labelIter{orig: s} for ; !labels.done(); labels.next() { @@ -306,7 +234,7 @@ func (p *Profile) process(s string, toASCII bool) (string, error) { if label == "" { // Empty labels are not okay. The label iterator skips the last // label if it is empty. - if err == nil && p.verifyDNSLength { + if err == nil { err = &labelError{s, "A4"} } continue @@ -321,17 +249,14 @@ func (p *Profile) process(s string, toASCII bool) (string, error) { continue } labels.set(u) - if err == nil && p.validateLabels { - err = p.fromPuny(p, u) + if err == nil { + err = p.validateFromPunycode(u) } if err == nil { - // This should be called on NonTransitional, according to the - // spec, but that currently does not have any effect. Use the - // original profile to preserve options. - err = p.validateLabel(u) + err = NonTransitional.validate(u) } } else if err == nil { - err = p.validateLabel(label) + err = p.validate(label) } } if toASCII { @@ -365,76 +290,6 @@ func (p *Profile) process(s string, toASCII bool) (string, error) { return s, err } -func normalize(p *Profile, s string) (string, error) { - return norm.NFC.String(s), nil -} - -func validateRegistration(p *Profile, s string) (string, error) { - if !norm.NFC.IsNormalString(s) { - return s, &labelError{s, "V1"} - } - for i := 0; i < len(s); { - v, sz := trie.lookupString(s[i:]) - // Copy bytes not copied so far. - switch p.simplify(info(v).category()) { - // TODO: handle the NV8 defined in the Unicode idna data set to allow - // for strict conformance to IDNA2008. - case valid, deviation: - case disallowed, mapped, unknown, ignored: - r, _ := utf8.DecodeRuneInString(s[i:]) - return s, runeError(r) - } - i += sz - } - return s, nil -} - -func validateAndMap(p *Profile, s string) (string, error) { - var ( - err error - b []byte - k int - ) - for i := 0; i < len(s); { - v, sz := trie.lookupString(s[i:]) - start := i - i += sz - // Copy bytes not copied so far. - switch p.simplify(info(v).category()) { - case valid: - continue - case disallowed: - if err == nil { - r, _ := utf8.DecodeRuneInString(s[start:]) - err = runeError(r) - } - continue - case mapped, deviation: - b = append(b, s[k:start]...) - b = info(v).appendMapping(b, s[start:i]) - case ignored: - b = append(b, s[k:start]...) - // drop the rune - case unknown: - b = append(b, s[k:start]...) - b = append(b, "\ufffd"...) - } - k = i - } - if k == 0 { - // No changes so far. - s = norm.NFC.String(s) - } else { - b = append(b, s[k:]...) - if norm.NFC.QuickSpan(b) != len(b) { - b = norm.NFC.Bytes(b) - } - // TODO: the punycode converters require strings as input. - s = string(b) - } - return s, err -} - // A labelIter allows iterating over domain name labels. type labelIter struct { orig string @@ -501,13 +356,13 @@ const acePrefix = "xn--" func (p *Profile) simplify(cat category) category { switch cat { case disallowedSTD3Mapped: - if p.useSTD3Rules { + if !p.ignoreSTD3Rules { cat = disallowed } else { cat = mapped } case disallowedSTD3Valid: - if p.useSTD3Rules { + if !p.ignoreSTD3Rules { cat = disallowed } else { cat = valid @@ -523,7 +378,7 @@ func (p *Profile) simplify(cat category) category { return cat } -func validateFromPunycode(p *Profile, s string) error { +func (p *Profile) validateFromPunycode(s string) error { if !norm.NFC.IsNormalString(s) { return &labelError{s, "V1"} } @@ -599,22 +454,9 @@ var joinStates = [][numJoinTypes]joinState{ }, } -// validateLabel validates the criteria from Section 4.1. Item 1, 4, and 6 are +// validate validates the criteria from Section 4.1. Item 1, 4, and 6 are // already implicitly satisfied by the overall implementation. -func (p *Profile) validateLabel(s string) error { - if s == "" { - if p.verifyDNSLength { - return &labelError{s, "A4"} - } - return nil - } - if p.bidirule != nil && !p.bidirule(s) { - return &labelError{s, "B"} - } - if !p.validateLabels { - return nil - } - trie := p.trie // p.validateLabels is only set if trie is set. +func (p *Profile) validate(s string) error { if len(s) > 4 && s[2] == '-' && s[3] == '-' { return &labelError{s, "V2"} } @@ -627,6 +469,9 @@ func (p *Profile) validateLabel(s string) error { if x.isModifier() { return &labelError{s, "V5"} } + if !bidirule.ValidString(s) { + return &labelError{s, "B"} + } // Quickly return in the absence of zero-width (non) joiners. if strings.Index(s, zwj) == -1 && strings.Index(s, zwnj) == -1 { return nil diff --git a/vendor/golang.org/x/text/internal/export/idna/idna_test.go b/vendor/golang.org/x/text/internal/export/idna/idna_test.go index 01fd50b..73ecfd5 100644 --- a/vendor/golang.org/x/text/internal/export/idna/idna_test.go +++ b/vendor/golang.org/x/text/internal/export/idna/idna_test.go @@ -33,32 +33,6 @@ func TestAllocToASCII(t *testing.T) { } } -func TestProfiles(t *testing.T) { - testCases := []struct { - name string - want, got *Profile - }{ - {"Punycode", punycode, New()}, - {"Registration", registration, New(ValidateForRegistration())}, - {"Registration", registration, New( - ValidateForRegistration(), - VerifyDNSLength(true), - BidiRule(), - )}, - {"Lookup", lookup, New(MapForLookup(), BidiRule(), Transitional(true))}, - {"Display", display, New(MapForLookup(), BidiRule())}, - } - for _, tc := range testCases { - // Functions are not comparable, but the printed version will include - // their pointers. - got := fmt.Sprintf("%#v", tc.got) - want := fmt.Sprintf("%#v", tc.want) - if got != want { - t.Errorf("%s: \ngot %#v,\nwant %#v", tc.name, got, want) - } - } -} - // doTest performs a single test f(input) and verifies that the output matches // out and that the returned error is expected. The errors string contains // all allowed error codes as categorized in @@ -116,55 +90,14 @@ func TestLabelErrors(t *testing.T) { name string f func(string) (string, error) } - punyA := kind{"PunycodeA", punycode.ToASCII} - resolve := kind{"ToASCII", Lookup.ToASCII} + resolve := kind{"ToASCII", Resolve.ToASCII} display := kind{"ToUnicode", Display.ToUnicode} - p := New(VerifyDNSLength(true), MapForLookup(), BidiRule()) - lengthU := kind{"CheckLengthU", p.ToUnicode} - lengthA := kind{"CheckLengthA", p.ToASCII} - p = New(MapForLookup(), StrictDomainName(false)) - std3 := kind{"STD3", p.ToASCII} - testCases := []struct { kind input string want string wantErr string }{ - {lengthU, "", "", "A4"}, // From UTS 46 conformance test. - {lengthA, "", "", "A4"}, - - {lengthU, "xn--", "", "A4"}, - {lengthU, "foo.xn--", "foo.", "A4"}, // TODO: is dropping xn-- correct? - {lengthU, "xn--.foo", ".foo", "A4"}, - {lengthU, "foo.xn--.bar", "foo..bar", "A4"}, - - {display, "xn--", "", ""}, - {display, "foo.xn--", "foo.", ""}, // TODO: is dropping xn-- correct? - {display, "xn--.foo", ".foo", ""}, - {display, "foo.xn--.bar", "foo..bar", ""}, - - {lengthA, "a..b", "a..b", "A4"}, - // Stripping leading empty labels here but not for "empty" punycode - // above seems inconsistent, but seems to be applied by both the - // conformance test and Chrome. Different interpretations would be - // possible, though. - {lengthA, "..b", "b", ""}, - {lengthA, "b..", "b..", ""}, // TODO: remove trailing dots? - - {resolve, "a..b", "a..b", ""}, - {resolve, "..b", "b", ""}, - {resolve, "b..", "b..", ""}, // TODO: remove trailing dots? - - // Raw punycode - {punyA, "", "", ""}, - {punyA, "*.foo.com", "*.foo.com", ""}, - {punyA, "Foo.com", "Foo.com", ""}, - - // STD3 rules - {display, "*.foo.com", "*.foo.com", "P1"}, - {std3, "*.foo.com", "*.foo.com", ""}, - // Don't map U+2490 (DIGIT NINE FULL STOP). This is the behavior of // Chrome, Safari, and IE. Firefox will first map ⒐ to 9. and return // lab9.be. @@ -172,7 +105,7 @@ func TestLabelErrors(t *testing.T) { {display, "lab⒐be", "lab⒐be", "P1"}, {resolve, "plan⒐faß.de", "xn--planfass-c31e.de", "P1"}, // encode("plan⒐fass") + ".de" - {display, "Plan⒐faß.de", "plan⒐faß.de", "P1"}, + {display, "plan⒐faß.de", "plan⒐faß.de", "P1"}, // Chrome 54.0 recognizes the error and treats this input verbatim as a // search string. @@ -232,8 +165,8 @@ func TestConformance(t *testing.T) { section = strings.ToLower(strings.Split(s, " ")[0]) } })) - transitional := New(Transitional(true), VerifyDNSLength(true), BidiRule(), MapForLookup()) - nonTransitional := New(VerifyDNSLength(true), BidiRule(), MapForLookup()) + transitional := New(Transitional(true), VerifyDNSLength(true)) + nonTransitional := New(VerifyDNSLength(true)) for p.Next() { started = true diff --git a/vendor/golang.org/x/text/internal/export/idna/tables.go b/vendor/golang.org/x/text/internal/export/idna/tables.go index d281934..9749d77 100644 --- a/vendor/golang.org/x/text/internal/export/idna/tables.go +++ b/vendor/golang.org/x/text/internal/export/idna/tables.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package idna diff --git a/vendor/golang.org/x/text/internal/export/idna/trie.go b/vendor/golang.org/x/text/internal/export/idna/trie.go index d909968..9ebb9b5 100644 --- a/vendor/golang.org/x/text/internal/export/idna/trie.go +++ b/vendor/golang.org/x/text/internal/export/idna/trie.go @@ -42,8 +42,7 @@ var idnaSparse = sparseBlocks{ offset: idnaSparseOffset[:], } -// Don't use newIdnaTrie to avoid unconditional linking in of the table. -var trie = &idnaTrie{} +var trie = newIdnaTrie(0) // lookup determines the type of block n and looks up the value for b. // For n < t.cutoff, the block is a simple lookup table. Otherwise, the block diff --git a/vendor/golang.org/x/text/internal/export/idna/trieval.go b/vendor/golang.org/x/text/internal/export/idna/trieval.go index 63cb03b..2ea5396 100644 --- a/vendor/golang.org/x/text/internal/export/idna/trieval.go +++ b/vendor/golang.org/x/text/internal/export/idna/trieval.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package idna diff --git a/vendor/golang.org/x/text/internal/gen/gen.go b/vendor/golang.org/x/text/internal/gen/gen.go index 2acb035..84c699f 100644 --- a/vendor/golang.org/x/text/internal/gen/gen.go +++ b/vendor/golang.org/x/text/internal/gen/gen.go @@ -67,7 +67,7 @@ func Init() { flag.Parse() } -const header = `// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +const header = `// This file was generated by go generate; DO NOT EDIT package %s diff --git a/vendor/golang.org/x/text/internal/number/gen.go b/vendor/golang.org/x/text/internal/number/gen.go index 0d5f592..59a982b 100644 --- a/vendor/golang.org/x/text/internal/number/gen.go +++ b/vendor/golang.org/x/text/internal/number/gen.go @@ -364,7 +364,7 @@ func genFormats(w *gen.CodeWriter, data *cldr.CLDR) { } // Fill the first slot with a dummy so we can identify unspecified tags. - formats := []number.Pattern{{}} + formats := []number.Format{{}} patterns := map[string]int{} // TODO: It would be possible to eliminate two of these slices by having diff --git a/vendor/golang.org/x/text/internal/number/number.go b/vendor/golang.org/x/text/internal/number/number.go index d412194..db8ad67 100644 --- a/vendor/golang.org/x/text/internal/number/number.go +++ b/vendor/golang.org/x/text/internal/number/number.go @@ -136,7 +136,7 @@ func (n Info) Symbol(t SymbolType) string { return symData.Elem(int(symIndex[n.symIndex][t])) } -func formatForLang(t language.Tag, index []byte) *Pattern { +func formatForLang(t language.Tag, index []byte) *Format { for ; ; t = t.Parent() { if x, ok := language.CompactIndex(t); ok { return &formats[index[x]] diff --git a/vendor/golang.org/x/text/internal/number/pattern.go b/vendor/golang.org/x/text/internal/number/pattern.go index 018cf02..2714b73 100644 --- a/vendor/golang.org/x/text/internal/number/pattern.go +++ b/vendor/golang.org/x/text/internal/number/pattern.go @@ -31,14 +31,14 @@ import ( // TODO: replace special characters in affixes (-, +, ¤) with control codes. -// Pattern holds information for formatting numbers. It is designed to hold +// Format holds information for formatting numbers. It is designed to hold // information from CLDR number patterns. // // This pattern is precompiled for all patterns for all languages. Even though // the number of patterns is not very large, we want to keep this small. // // This type is only intended for internal use. -type Pattern struct { +type Format struct { // TODO: this struct can be packed a lot better than it is now. Should be // possible to make it 32 bytes. @@ -53,7 +53,7 @@ type Pattern struct { FormatWidth uint16 GroupingSize [2]uint8 - Flags PatternFlag + Flags FormatFlag // Number of digits. MinIntegerDigits uint8 @@ -65,11 +65,11 @@ type Pattern struct { MinExponentDigits uint8 } -// A PatternFlag is a bit mask for the flag field of a Format. -type PatternFlag uint8 +// A FormatFlag is a bit mask for the flag field of a Format. +type FormatFlag uint8 const ( - AlwaysSign PatternFlag = 1 << iota + AlwaysSign FormatFlag = 1 << iota AlwaysExpSign AlwaysDecimalSeparator ParenthesisForNegative // Common pattern. Saves space. @@ -85,7 +85,7 @@ const ( ) type parser struct { - *Pattern + *Format leadingSharps int @@ -126,8 +126,8 @@ var ( // ParsePattern extracts formatting information from a CLDR number pattern. // // See http://unicode.org/reports/tr35/tr35-numbers.html#Number_Format_Patterns. -func ParsePattern(s string) (f *Pattern, err error) { - p := parser{Pattern: &Pattern{}} +func ParsePattern(s string) (f *Format, err error) { + p := parser{Format: &Format{}} s = p.parseSubPattern(s) @@ -137,7 +137,7 @@ func ParsePattern(s string) (f *Pattern, err error) { p.setError(errors.New("format: error parsing first sub pattern")) return nil, p.err } - neg := parser{Pattern: &Pattern{}} // just for extracting the affixes. + neg := parser{Format: &Format{}} // just for extracting the affixes. s = neg.parseSubPattern(s[len(";"):]) p.NegOffset = uint16(len(p.buf)) p.buf = append(p.buf, neg.buf...) @@ -154,7 +154,7 @@ func ParsePattern(s string) (f *Pattern, err error) { } else { p.Affix = affix } - return p.Pattern, nil + return p.Format, nil } func (p *parser) parseSubPattern(s string) string { @@ -170,7 +170,7 @@ func (p *parser) parseSubPattern(s string) string { return s } -func (p *parser) parsePad(s string, f PatternFlag) (tail string) { +func (p *parser) parsePad(s string, f FormatFlag) (tail string) { if len(s) >= 2 && s[0] == '*' { r, sz := utf8.DecodeRuneInString(s[1:]) if p.PadRune != 0 { diff --git a/vendor/golang.org/x/text/internal/number/pattern_test.go b/vendor/golang.org/x/text/internal/number/pattern_test.go index 810b5a8..f2ad55d 100644 --- a/vendor/golang.org/x/text/internal/number/pattern_test.go +++ b/vendor/golang.org/x/text/internal/number/pattern_test.go @@ -12,48 +12,48 @@ import ( var testCases = []struct { pat string - want *Pattern + want *Format }{{ "#", - &Pattern{ + &Format{ FormatWidth: 1, // TODO: Should MinIntegerDigits be 1? }, }, { "0", - &Pattern{ + &Format{ FormatWidth: 1, MinIntegerDigits: 1, }, }, { "0000", - &Pattern{ + &Format{ FormatWidth: 4, MinIntegerDigits: 4, }, }, { ".#", - &Pattern{ + &Format{ FormatWidth: 2, MaxFractionDigits: 1, }, }, { "#0.###", - &Pattern{ + &Format{ FormatWidth: 6, MinIntegerDigits: 1, MaxFractionDigits: 3, }, }, { "#0.######", - &Pattern{ + &Format{ FormatWidth: 9, MinIntegerDigits: 1, MaxFractionDigits: 6, }, }, { "#,##0.###", - &Pattern{ + &Format{ FormatWidth: 9, GroupingSize: [2]uint8{3, 0}, MinIntegerDigits: 1, @@ -61,7 +61,7 @@ var testCases = []struct { }, }, { "#,##,##0.###", - &Pattern{ + &Format{ FormatWidth: 12, GroupingSize: [2]uint8{3, 2}, MinIntegerDigits: 1, @@ -70,7 +70,7 @@ var testCases = []struct { }, { // Ignore additional separators. "#,####,##,##0.###", - &Pattern{ + &Format{ FormatWidth: 17, GroupingSize: [2]uint8{3, 2}, MinIntegerDigits: 1, @@ -78,21 +78,21 @@ var testCases = []struct { }, }, { "#E0", - &Pattern{ + &Format{ FormatWidth: 3, MaxIntegerDigits: 1, MinExponentDigits: 1, }, }, { "0E0", - &Pattern{ + &Format{ FormatWidth: 3, MinIntegerDigits: 1, MinExponentDigits: 1, }, }, { "##00.0#E0", - &Pattern{ + &Format{ FormatWidth: 9, MinIntegerDigits: 2, MaxIntegerDigits: 4, @@ -102,7 +102,7 @@ var testCases = []struct { }, }, { "#00.0E+0", - &Pattern{ + &Format{ FormatWidth: 8, Flags: AlwaysExpSign, MinIntegerDigits: 2, @@ -120,7 +120,7 @@ var testCases = []struct { }, { // significant digits "@", - &Pattern{ + &Format{ FormatWidth: 1, MinSignificantDigits: 1, MaxSignificantDigits: 1, @@ -128,14 +128,14 @@ var testCases = []struct { }, { // significant digits "@@@@", - &Pattern{ + &Format{ FormatWidth: 4, MinSignificantDigits: 4, MaxSignificantDigits: 4, }, }, { "@###", - &Pattern{ + &Format{ FormatWidth: 4, MinSignificantDigits: 1, MaxSignificantDigits: 4, @@ -143,7 +143,7 @@ var testCases = []struct { }, { // Exponents in significant digits mode gets normalized. "@@E0", - &Pattern{ + &Format{ FormatWidth: 4, MinIntegerDigits: 1, MaxIntegerDigits: 1, @@ -153,7 +153,7 @@ var testCases = []struct { }, }, { "@###E00", - &Pattern{ + &Format{ FormatWidth: 7, MinIntegerDigits: 1, MaxIntegerDigits: 1, @@ -168,7 +168,7 @@ var testCases = []struct { }, { //alternative negative pattern "#0.###;(#0.###)", - &Pattern{ + &Format{ Affix: "\x00\x00\x01(\x01)", NegOffset: 2, FormatWidth: 6, @@ -178,7 +178,7 @@ var testCases = []struct { }, { // Rounding increments "1.05", - &Pattern{ + &Format{ RoundIncrement: 105, FormatWidth: 4, MinIntegerDigits: 1, @@ -187,7 +187,7 @@ var testCases = []struct { }, }, { "0.0%", - &Pattern{ + &Format{ Affix: "\x00\x01%", Multiplier: 100, FormatWidth: 4, @@ -197,7 +197,7 @@ var testCases = []struct { }, }, { "0.0‰", - &Pattern{ + &Format{ Affix: "\x00\x03‰", Multiplier: 1000, FormatWidth: 4, @@ -207,7 +207,7 @@ var testCases = []struct { }, }, { "#,##0.00¤", - &Pattern{ + &Format{ Affix: "\x00\x02¤", FormatWidth: 9, GroupingSize: [2]uint8{3, 0}, @@ -217,7 +217,7 @@ var testCases = []struct { }, }, { "#,##0.00 ¤;(#,##0.00 ¤)", - &Pattern{Affix: "\x00\x04\u00a0¤\x01(\x05\u00a0¤)", + &Format{Affix: "\x00\x04\u00a0¤\x01(\x05\u00a0¤)", NegOffset: 6, Multiplier: 0, FormatWidth: 10, @@ -229,28 +229,28 @@ var testCases = []struct { }, { // padding "*x#", - &Pattern{ + &Format{ PadRune: 'x', FormatWidth: 1, }, }, { // padding "#*x", - &Pattern{ + &Format{ PadRune: 'x', FormatWidth: 1, Flags: PadBeforeSuffix, }, }, { "*xpre#suf", - &Pattern{ + &Format{ Affix: "\x03pre\x03suf", PadRune: 'x', FormatWidth: 7, }, }, { "pre*x#suf", - &Pattern{ + &Format{ Affix: "\x03pre\x03suf", PadRune: 'x', FormatWidth: 7, @@ -258,7 +258,7 @@ var testCases = []struct { }, }, { "pre#*xsuf", - &Pattern{ + &Format{ Affix: "\x03pre\x03suf", PadRune: 'x', FormatWidth: 7, @@ -266,7 +266,7 @@ var testCases = []struct { }, }, { "pre#suf*x", - &Pattern{ + &Format{ Affix: "\x03pre\x03suf", PadRune: 'x', FormatWidth: 7, @@ -293,7 +293,7 @@ func TestParsePattern(t *testing.T) { } func TestPatternSize(t *testing.T) { - if sz := unsafe.Sizeof(Pattern{}); sz > 48 { + if sz := unsafe.Sizeof(Format{}); sz > 48 { t.Errorf("got %d; want 48", sz) } diff --git a/vendor/golang.org/x/text/internal/number/tables.go b/vendor/golang.org/x/text/internal/number/tables.go index 845e0b1..245535a 100644 --- a/vendor/golang.org/x/text/internal/number/tables.go +++ b/vendor/golang.org/x/text/internal/number/tables.go @@ -1376,7 +1376,7 @@ var tagToPercent = []uint8{ // 752 elements 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, } // Size: 776 bytes -var formats = []Pattern{Pattern{Affix: "", +var formats = []Format{Format{Affix: "", Offset: 0x0, NegOffset: 0x0, Multiplier: 0x0, @@ -1393,7 +1393,7 @@ var formats = []Pattern{Pattern{Affix: "", MinSignificantDigits: 0x0, MaxSignificantDigits: 0x0, MinExponentDigits: 0x0}, - Pattern{Affix: "", + Format{Affix: "", Offset: 0x0, NegOffset: 0x0, Multiplier: 0x0, @@ -1410,7 +1410,7 @@ var formats = []Pattern{Pattern{Affix: "", MinSignificantDigits: 0x0, MaxSignificantDigits: 0x0, MinExponentDigits: 0x0}, - Pattern{Affix: "", + Format{Affix: "", Offset: 0x0, NegOffset: 0x0, Multiplier: 0x0, @@ -1427,7 +1427,7 @@ var formats = []Pattern{Pattern{Affix: "", MinSignificantDigits: 0x0, MaxSignificantDigits: 0x0, MinExponentDigits: 0x1}, - Pattern{Affix: "\x00\x03\u00a0%", + Format{Affix: "\x00\x03\u00a0%", Offset: 0x0, NegOffset: 0x0, Multiplier: 0x64, @@ -1444,7 +1444,7 @@ var formats = []Pattern{Pattern{Affix: "", MinSignificantDigits: 0x0, MaxSignificantDigits: 0x0, MinExponentDigits: 0x0}, - Pattern{Affix: "\x00\x01%", + Format{Affix: "\x00\x01%", Offset: 0x0, NegOffset: 0x0, Multiplier: 0x64, @@ -1461,7 +1461,7 @@ var formats = []Pattern{Pattern{Affix: "", MinSignificantDigits: 0x0, MaxSignificantDigits: 0x0, MinExponentDigits: 0x0}, - Pattern{Affix: "", + Format{Affix: "", Offset: 0x0, NegOffset: 0x0, Multiplier: 0x0, @@ -1478,7 +1478,7 @@ var formats = []Pattern{Pattern{Affix: "", MinSignificantDigits: 0x0, MaxSignificantDigits: 0x0, MinExponentDigits: 0x0}, - Pattern{Affix: "\x00\x01%", + Format{Affix: "\x00\x01%", Offset: 0x0, NegOffset: 0x0, Multiplier: 0x64, @@ -1495,7 +1495,7 @@ var formats = []Pattern{Pattern{Affix: "", MinSignificantDigits: 0x0, MaxSignificantDigits: 0x0, MinExponentDigits: 0x0}, - Pattern{Affix: "\x00\x03\u00a0%", + Format{Affix: "\x00\x03\u00a0%", Offset: 0x0, NegOffset: 0x0, Multiplier: 0x64, @@ -1512,7 +1512,7 @@ var formats = []Pattern{Pattern{Affix: "", MinSignificantDigits: 0x0, MaxSignificantDigits: 0x0, MinExponentDigits: 0x0}, - Pattern{Affix: "", + Format{Affix: "", Offset: 0x0, NegOffset: 0x0, Multiplier: 0x0, @@ -1529,7 +1529,7 @@ var formats = []Pattern{Pattern{Affix: "", MinSignificantDigits: 0x0, MaxSignificantDigits: 0x0, MinExponentDigits: 0x0}, - Pattern{Affix: "", + Format{Affix: "", Offset: 0x0, NegOffset: 0x0, Multiplier: 0x0, @@ -1546,7 +1546,7 @@ var formats = []Pattern{Pattern{Affix: "", MinSignificantDigits: 0x0, MaxSignificantDigits: 0x0, MinExponentDigits: 0x3}, - Pattern{Affix: "\x00\x01%", + Format{Affix: "\x00\x01%", Offset: 0x0, NegOffset: 0x0, Multiplier: 0x64, @@ -1563,7 +1563,7 @@ var formats = []Pattern{Pattern{Affix: "", MinSignificantDigits: 0x0, MaxSignificantDigits: 0x0, MinExponentDigits: 0x0}, - Pattern{Affix: "\x03%\u00a0\x00", + Format{Affix: "\x03%\u00a0\x00", Offset: 0x0, NegOffset: 0x0, Multiplier: 0x64, @@ -1580,7 +1580,7 @@ var formats = []Pattern{Pattern{Affix: "", MinSignificantDigits: 0x0, MaxSignificantDigits: 0x0, MinExponentDigits: 0x0}, - Pattern{Affix: "\x03%\u00a0\x00\x04%\u00a0-\x00", + Format{Affix: "\x03%\u00a0\x00\x04%\u00a0-\x00", Offset: 0x0, NegOffset: 0x5, Multiplier: 0x64, @@ -1597,7 +1597,7 @@ var formats = []Pattern{Pattern{Affix: "", MinSignificantDigits: 0x0, MaxSignificantDigits: 0x0, MinExponentDigits: 0x0}, - Pattern{Affix: "\x01[\x01]", + Format{Affix: "\x01[\x01]", Offset: 0x0, NegOffset: 0x0, Multiplier: 0x0, @@ -1614,7 +1614,7 @@ var formats = []Pattern{Pattern{Affix: "", MinSignificantDigits: 0x0, MaxSignificantDigits: 0x0, MinExponentDigits: 0x1}, - Pattern{Affix: "", + Format{Affix: "", Offset: 0x0, NegOffset: 0x0, Multiplier: 0x0, @@ -1631,7 +1631,7 @@ var formats = []Pattern{Pattern{Affix: "", MinSignificantDigits: 0x0, MaxSignificantDigits: 0x0, MinExponentDigits: 0x0}, - Pattern{Affix: "\x01%\x00", + Format{Affix: "\x01%\x00", Offset: 0x0, NegOffset: 0x0, Multiplier: 0x64, diff --git a/vendor/golang.org/x/text/internal/tables.go b/vendor/golang.org/x/text/internal/tables.go index 7fb15f6..5e8f5fa 100644 --- a/vendor/golang.org/x/text/internal/tables.go +++ b/vendor/golang.org/x/text/internal/tables.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package internal diff --git a/vendor/golang.org/x/text/language/common.go b/vendor/golang.org/x/text/language/common.go index 9d86e18..a255bb0 100644 --- a/vendor/golang.org/x/text/language/common.go +++ b/vendor/golang.org/x/text/language/common.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package language diff --git a/vendor/golang.org/x/text/language/display/tables.go b/vendor/golang.org/x/text/language/display/tables.go index 0d7ebd7..895b677 100644 --- a/vendor/golang.org/x/text/language/display/tables.go +++ b/vendor/golang.org/x/text/language/display/tables.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package display diff --git a/vendor/golang.org/x/text/language/index.go b/vendor/golang.org/x/text/language/index.go index b370ffa..50c7521 100644 --- a/vendor/golang.org/x/text/language/index.go +++ b/vendor/golang.org/x/text/language/index.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package language diff --git a/vendor/golang.org/x/text/language/tables.go b/vendor/golang.org/x/text/language/tables.go index a2aec62..ccdc1ff 100644 --- a/vendor/golang.org/x/text/language/tables.go +++ b/vendor/golang.org/x/text/language/tables.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package language diff --git a/vendor/golang.org/x/text/search/tables.go b/vendor/golang.org/x/text/search/tables.go index 72d27b5..e7f95db 100644 --- a/vendor/golang.org/x/text/search/tables.go +++ b/vendor/golang.org/x/text/search/tables.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package search diff --git a/vendor/golang.org/x/text/secure/precis/tables.go b/vendor/golang.org/x/text/secure/precis/tables.go index 2f550c1..a9b500d 100644 --- a/vendor/golang.org/x/text/secure/precis/tables.go +++ b/vendor/golang.org/x/text/secure/precis/tables.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package precis diff --git a/vendor/golang.org/x/text/secure/precis/trieval.go b/vendor/golang.org/x/text/secure/precis/trieval.go index 4833f96..fed7d75 100644 --- a/vendor/golang.org/x/text/secure/precis/trieval.go +++ b/vendor/golang.org/x/text/secure/precis/trieval.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package precis diff --git a/vendor/golang.org/x/text/unicode/bidi/core.go b/vendor/golang.org/x/text/unicode/bidi/core.go index d4c1399..ec52f14 100644 --- a/vendor/golang.org/x/text/unicode/bidi/core.go +++ b/vendor/golang.org/x/text/unicode/bidi/core.go @@ -726,7 +726,7 @@ loop: continue loop } } - log.Panicf("invalid bidi code %v present in assertOnly at position %d", t, s.indexes[i]) + log.Panicf("invalid bidi code %s present in assertOnly at position %d", t, s.indexes[i]) } } diff --git a/vendor/golang.org/x/text/unicode/bidi/ranges_test.go b/vendor/golang.org/x/text/unicode/bidi/ranges_test.go index bfaecd5..a1b313e 100644 --- a/vendor/golang.org/x/text/unicode/bidi/ranges_test.go +++ b/vendor/golang.org/x/text/unicode/bidi/ranges_test.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package bidi diff --git a/vendor/golang.org/x/text/unicode/bidi/tables.go b/vendor/golang.org/x/text/unicode/bidi/tables.go index 7212d5a..2d4dde0 100644 --- a/vendor/golang.org/x/text/unicode/bidi/tables.go +++ b/vendor/golang.org/x/text/unicode/bidi/tables.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package bidi diff --git a/vendor/golang.org/x/text/unicode/bidi/trieval.go b/vendor/golang.org/x/text/unicode/bidi/trieval.go index 4c459c4..bebd855 100644 --- a/vendor/golang.org/x/text/unicode/bidi/trieval.go +++ b/vendor/golang.org/x/text/unicode/bidi/trieval.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package bidi diff --git a/vendor/golang.org/x/text/unicode/cldr/xml.go b/vendor/golang.org/x/text/unicode/cldr/xml.go index 99fa963..a1550ed 100644 --- a/vendor/golang.org/x/text/unicode/cldr/xml.go +++ b/vendor/golang.org/x/text/unicode/cldr/xml.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package cldr diff --git a/vendor/golang.org/x/text/unicode/norm/example_test.go b/vendor/golang.org/x/text/unicode/norm/example_test.go index 8f3b156..f2bec5b 100644 --- a/vendor/golang.org/x/text/unicode/norm/example_test.go +++ b/vendor/golang.org/x/text/unicode/norm/example_test.go @@ -10,7 +10,7 @@ import ( "golang.org/x/text/unicode/norm" ) -func ExampleForm_NextBoundary() { +func ExampleNextBoundary() { s := norm.NFD.String("Mêlée") for i := 0; i < len(s); { diff --git a/vendor/golang.org/x/text/unicode/norm/forminfo.go b/vendor/golang.org/x/text/unicode/norm/forminfo.go index e67e765..15a67c6 100644 --- a/vendor/golang.org/x/text/unicode/norm/forminfo.go +++ b/vendor/golang.org/x/text/unicode/norm/forminfo.go @@ -10,7 +10,7 @@ package norm // and its corresponding decomposing form share the same trie. Each trie maps // a rune to a uint16. The values take two forms. For v >= 0x8000: // bits -// 15: 1 (inverse of NFD_QC bit of qcInfo) +// 15: 1 (inverse of NFD_QD bit of qcInfo) // 13..7: qcInfo (see below). isYesD is always true (no decompostion). // 6..0: ccc (compressed CCC value). // For v < 0x8000, the respective rune has a decomposition and v is an index @@ -56,31 +56,28 @@ type formInfo struct { nextMain iterFunc } -var formTable = []*formInfo{{ - form: NFC, - composing: true, - compatibility: false, - info: lookupInfoNFC, - nextMain: nextComposed, -}, { - form: NFD, - composing: false, - compatibility: false, - info: lookupInfoNFC, - nextMain: nextDecomposed, -}, { - form: NFKC, - composing: true, - compatibility: true, - info: lookupInfoNFKC, - nextMain: nextComposed, -}, { - form: NFKD, - composing: false, - compatibility: true, - info: lookupInfoNFKC, - nextMain: nextDecomposed, -}} +var formTable []*formInfo + +func init() { + formTable = make([]*formInfo, 4) + + for i := range formTable { + f := &formInfo{} + formTable[i] = f + f.form = Form(i) + if Form(i) == NFKD || Form(i) == NFKC { + f.compatibility = true + f.info = lookupInfoNFKC + } else { + f.info = lookupInfoNFC + } + f.nextMain = nextDecomposed + if Form(i) == NFC || Form(i) == NFKC { + f.nextMain = nextComposed + f.composing = true + } + } +} // We do not distinguish between boundaries for NFC, NFD, etc. to avoid // unexpected behavior for the user. For example, in NFD, there is a boundary diff --git a/vendor/golang.org/x/text/unicode/norm/maketables.go b/vendor/golang.org/x/text/unicode/norm/maketables.go index 8d41816..07bdff6 100644 --- a/vendor/golang.org/x/text/unicode/norm/maketables.go +++ b/vendor/golang.org/x/text/unicode/norm/maketables.go @@ -35,9 +35,12 @@ func main() { computeNonStarterCounts() verifyComputed() printChars() - testDerived() - printTestdata() - makeTables() + if *test { + testDerived() + printTestdata() + } else { + makeTables() + } } var ( @@ -599,7 +602,6 @@ func printCharInfoTables(w io.Writer) int { } index := normalDecomp nTrail := chars[r].nTrailingNonStarters - nLead := chars[r].nLeadingNonStarters if tccc > 0 || lccc > 0 || nTrail > 0 { tccc <<= 2 tccc |= nTrail @@ -610,7 +612,7 @@ func printCharInfoTables(w io.Writer) int { index = firstCCC } } - if lccc > 0 || nLead > 0 { + if lccc > 0 { s += string([]byte{lccc}) if index == firstCCC { log.Fatalf("%U: multi-segment decomposition not supported for decompositions with leading CCC != 0", r) diff --git a/vendor/golang.org/x/text/unicode/norm/normalize.go b/vendor/golang.org/x/text/unicode/norm/normalize.go index d3f2069..bba8ce9 100644 --- a/vendor/golang.org/x/text/unicode/norm/normalize.go +++ b/vendor/golang.org/x/text/unicode/norm/normalize.go @@ -2,9 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Note: the file data_test.go that is generated should not be checked in. //go:generate go run maketables.go triegen.go -//go:generate go test -tags test +//go:generate go run maketables.go triegen.go -test // Package norm contains types and functions for normalizing Unicode strings. package norm // import "golang.org/x/text/unicode/norm" diff --git a/vendor/golang.org/x/text/unicode/norm/normalize_test.go b/vendor/golang.org/x/text/unicode/norm/normalize_test.go index ffa1034..04810e7 100644 --- a/vendor/golang.org/x/text/unicode/norm/normalize_test.go +++ b/vendor/golang.org/x/text/unicode/norm/normalize_test.go @@ -878,25 +878,6 @@ func TestString(t *testing.T) { }) } -func TestLinking(t *testing.T) { - const prog = ` - package main - import "fmt" - import "golang.org/x/text/unicode/norm" - func main() { fmt.Println(norm.%s) } - ` - baseline, errB := testtext.CodeSize(fmt.Sprintf(prog, "MaxSegmentSize")) - withTables, errT := testtext.CodeSize(fmt.Sprintf(prog, `NFC.String("")`)) - if errB != nil || errT != nil { - t.Skipf("code size failed: %v and %v", errB, errT) - } - // Tables are at least 50K - if d := withTables - baseline; d < 50*1024 { - t.Errorf("tables appear not to be dropped: %d - %d = %d", - withTables, baseline, d) - } -} - func appendBench(f Form, in []byte) func() { buf := make([]byte, 0, 4*len(in)) return func() { diff --git a/vendor/golang.org/x/text/unicode/norm/tables.go b/vendor/golang.org/x/text/unicode/norm/tables.go index bf9ff80..a56697b 100644 --- a/vendor/golang.org/x/text/unicode/norm/tables.go +++ b/vendor/golang.org/x/text/unicode/norm/tables.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package norm @@ -27,14 +27,14 @@ const ( firstMulti = 0x186D firstCCC = 0x2C9E endMulti = 0x2F60 - firstLeadingCCC = 0x49AE - firstCCCZeroExcept = 0x4A78 - firstStarterWithNLead = 0x4A9F - lastDecomp = 0x4AA1 + firstLeadingCCC = 0x4A44 + firstCCCZeroExcept = 0x4A5A + firstStarterWithNLead = 0x4A81 + lastDecomp = 0x4A83 maxDecomp = 0x8000 ) -// decomps: 19105 bytes +// decomps: 19075 bytes var decomps = [...]byte{ // Bytes 0 - 3f 0x00, 0x41, 0x20, 0x41, 0x21, 0x41, 0x22, 0x41, @@ -2443,287 +2443,283 @@ var decomps = [...]byte{ 0xD9, 0x8F, 0x69, 0x43, 0x20, 0xD9, 0x90, 0x6D, 0x43, 0x20, 0xD9, 0x91, 0x71, 0x43, 0x20, 0xD9, 0x92, 0x75, 0x43, 0x41, 0xCC, 0x8A, 0xC9, 0x43, - 0x73, 0xCC, 0x87, 0xC9, 0x44, 0x20, 0xE3, 0x82, - 0x99, 0x0D, 0x44, 0x20, 0xE3, 0x82, 0x9A, 0x0D, - 0x44, 0xC2, 0xA8, 0xCC, 0x81, 0xCA, 0x44, 0xCE, - 0x91, 0xCC, 0x81, 0xC9, 0x44, 0xCE, 0x95, 0xCC, - 0x81, 0xC9, 0x44, 0xCE, 0x97, 0xCC, 0x81, 0xC9, + 0x73, 0xCC, 0x87, 0xC9, 0x43, 0xE1, 0x85, 0xA1, + 0x01, 0x43, 0xE1, 0x85, 0xA2, 0x01, 0x43, 0xE1, + 0x85, 0xA3, 0x01, 0x43, 0xE1, 0x85, 0xA4, 0x01, + 0x43, 0xE1, 0x85, 0xA5, 0x01, 0x43, 0xE1, 0x85, + 0xA6, 0x01, 0x43, 0xE1, 0x85, 0xA7, 0x01, 0x43, // Bytes 4300 - 433f - 0x44, 0xCE, 0x99, 0xCC, 0x81, 0xC9, 0x44, 0xCE, - 0x9F, 0xCC, 0x81, 0xC9, 0x44, 0xCE, 0xA5, 0xCC, - 0x81, 0xC9, 0x44, 0xCE, 0xA5, 0xCC, 0x88, 0xC9, - 0x44, 0xCE, 0xA9, 0xCC, 0x81, 0xC9, 0x44, 0xCE, - 0xB1, 0xCC, 0x81, 0xC9, 0x44, 0xCE, 0xB5, 0xCC, - 0x81, 0xC9, 0x44, 0xCE, 0xB7, 0xCC, 0x81, 0xC9, - 0x44, 0xCE, 0xB9, 0xCC, 0x81, 0xC9, 0x44, 0xCE, - 0xBF, 0xCC, 0x81, 0xC9, 0x44, 0xCF, 0x85, 0xCC, + 0xE1, 0x85, 0xA8, 0x01, 0x43, 0xE1, 0x85, 0xA9, + 0x01, 0x43, 0xE1, 0x85, 0xAA, 0x01, 0x43, 0xE1, + 0x85, 0xAB, 0x01, 0x43, 0xE1, 0x85, 0xAC, 0x01, + 0x43, 0xE1, 0x85, 0xAD, 0x01, 0x43, 0xE1, 0x85, + 0xAE, 0x01, 0x43, 0xE1, 0x85, 0xAF, 0x01, 0x43, + 0xE1, 0x85, 0xB0, 0x01, 0x43, 0xE1, 0x85, 0xB1, + 0x01, 0x43, 0xE1, 0x85, 0xB2, 0x01, 0x43, 0xE1, + 0x85, 0xB3, 0x01, 0x43, 0xE1, 0x85, 0xB4, 0x01, // Bytes 4340 - 437f - 0x81, 0xC9, 0x44, 0xCF, 0x89, 0xCC, 0x81, 0xC9, - 0x44, 0xD7, 0x90, 0xD6, 0xB7, 0x31, 0x44, 0xD7, - 0x90, 0xD6, 0xB8, 0x35, 0x44, 0xD7, 0x90, 0xD6, - 0xBC, 0x41, 0x44, 0xD7, 0x91, 0xD6, 0xBC, 0x41, - 0x44, 0xD7, 0x91, 0xD6, 0xBF, 0x49, 0x44, 0xD7, - 0x92, 0xD6, 0xBC, 0x41, 0x44, 0xD7, 0x93, 0xD6, - 0xBC, 0x41, 0x44, 0xD7, 0x94, 0xD6, 0xBC, 0x41, - 0x44, 0xD7, 0x95, 0xD6, 0xB9, 0x39, 0x44, 0xD7, + 0x43, 0xE1, 0x85, 0xB5, 0x01, 0x43, 0xE1, 0x86, + 0xAA, 0x01, 0x43, 0xE1, 0x86, 0xAC, 0x01, 0x43, + 0xE1, 0x86, 0xAD, 0x01, 0x43, 0xE1, 0x86, 0xB0, + 0x01, 0x43, 0xE1, 0x86, 0xB1, 0x01, 0x43, 0xE1, + 0x86, 0xB2, 0x01, 0x43, 0xE1, 0x86, 0xB3, 0x01, + 0x43, 0xE1, 0x86, 0xB4, 0x01, 0x43, 0xE1, 0x86, + 0xB5, 0x01, 0x44, 0x20, 0xE3, 0x82, 0x99, 0x0D, + 0x44, 0x20, 0xE3, 0x82, 0x9A, 0x0D, 0x44, 0xC2, // Bytes 4380 - 43bf - 0x95, 0xD6, 0xBC, 0x41, 0x44, 0xD7, 0x96, 0xD6, - 0xBC, 0x41, 0x44, 0xD7, 0x98, 0xD6, 0xBC, 0x41, - 0x44, 0xD7, 0x99, 0xD6, 0xB4, 0x25, 0x44, 0xD7, - 0x99, 0xD6, 0xBC, 0x41, 0x44, 0xD7, 0x9A, 0xD6, - 0xBC, 0x41, 0x44, 0xD7, 0x9B, 0xD6, 0xBC, 0x41, - 0x44, 0xD7, 0x9B, 0xD6, 0xBF, 0x49, 0x44, 0xD7, - 0x9C, 0xD6, 0xBC, 0x41, 0x44, 0xD7, 0x9E, 0xD6, - 0xBC, 0x41, 0x44, 0xD7, 0xA0, 0xD6, 0xBC, 0x41, + 0xA8, 0xCC, 0x81, 0xCA, 0x44, 0xCE, 0x91, 0xCC, + 0x81, 0xC9, 0x44, 0xCE, 0x95, 0xCC, 0x81, 0xC9, + 0x44, 0xCE, 0x97, 0xCC, 0x81, 0xC9, 0x44, 0xCE, + 0x99, 0xCC, 0x81, 0xC9, 0x44, 0xCE, 0x9F, 0xCC, + 0x81, 0xC9, 0x44, 0xCE, 0xA5, 0xCC, 0x81, 0xC9, + 0x44, 0xCE, 0xA5, 0xCC, 0x88, 0xC9, 0x44, 0xCE, + 0xA9, 0xCC, 0x81, 0xC9, 0x44, 0xCE, 0xB1, 0xCC, + 0x81, 0xC9, 0x44, 0xCE, 0xB5, 0xCC, 0x81, 0xC9, // Bytes 43c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 0xD9, - 0x8B, 0x59, 0x44, 0xD9, 0x80, 0xD9, 0x8E, 0x65, - 0x44, 0xD9, 0x80, 0xD9, 0x8F, 0x69, 0x44, 0xD9, + 0xBC, 0x41, 0x44, 0xD7, 0x93, 0xD6, 0xBC, 0x41, + 0x44, 0xD7, 0x94, 0xD6, 0xBC, 0x41, 0x44, 0xD7, + 0x95, 0xD6, 0xB9, 0x39, 0x44, 0xD7, 0x95, 0xD6, + 0xBC, 0x41, 0x44, 0xD7, 0x96, 0xD6, 0xBC, 0x41, + 0x44, 0xD7, 0x98, 0xD6, 0xBC, 0x41, 0x44, 0xD7, + 0x99, 0xD6, 0xB4, 0x25, 0x44, 0xD7, 0x99, 0xD6, + 0xBC, 0x41, 0x44, 0xD7, 0x9A, 0xD6, 0xBC, 0x41, + 0x44, 0xD7, 0x9B, 0xD6, 0xBC, 0x41, 0x44, 0xD7, // Bytes 4440 - 447f - 0x80, 0xD9, 0x90, 0x6D, 0x44, 0xD9, 0x80, 0xD9, - 0x91, 0x71, 0x44, 0xD9, 0x80, 0xD9, 0x92, 0x75, - 0x44, 0xD9, 0x87, 0xD9, 0xB0, 0x79, 0x44, 0xD9, - 0x88, 0xD9, 0x94, 0xC9, 0x44, 0xD9, 0x89, 0xD9, - 0xB0, 0x79, 0x44, 0xD9, 0x8A, 0xD9, 0x94, 0xC9, - 0x44, 0xDB, 0x92, 0xD9, 0x94, 0xC9, 0x44, 0xDB, - 0x95, 0xD9, 0x94, 0xC9, 0x45, 0x20, 0xCC, 0x88, - 0xCC, 0x80, 0xCA, 0x45, 0x20, 0xCC, 0x88, 0xCC, + 0x9B, 0xD6, 0xBF, 0x49, 0x44, 0xD7, 0x9C, 0xD6, + 0xBC, 0x41, 0x44, 0xD7, 0x9E, 0xD6, 0xBC, 0x41, + 0x44, 0xD7, 0xA0, 0xD6, 0xBC, 0x41, 0x44, 0xD7, + 0xA1, 0xD6, 0xBC, 0x41, 0x44, 0xD7, 0xA3, 0xD6, + 0xBC, 0x41, 0x44, 0xD7, 0xA4, 0xD6, 0xBC, 0x41, + 0x44, 0xD7, 0xA4, 0xD6, 0xBF, 0x49, 0x44, 0xD7, + 0xA6, 0xD6, 0xBC, 0x41, 0x44, 0xD7, 0xA7, 0xD6, + 0xBC, 0x41, 0x44, 0xD7, 0xA8, 0xD6, 0xBC, 0x41, // Bytes 4480 - 44bf - 0x81, 0xCA, 0x45, 0x20, 0xCC, 0x88, 0xCD, 0x82, - 0xCA, 0x45, 0x20, 0xCC, 0x93, 0xCC, 0x80, 0xCA, - 0x45, 0x20, 0xCC, 0x93, 0xCC, 0x81, 0xCA, 0x45, - 0x20, 0xCC, 0x93, 0xCD, 0x82, 0xCA, 0x45, 0x20, - 0xCC, 0x94, 0xCC, 0x80, 0xCA, 0x45, 0x20, 0xCC, - 0x94, 0xCC, 0x81, 0xCA, 0x45, 0x20, 0xCC, 0x94, - 0xCD, 0x82, 0xCA, 0x45, 0x20, 0xD9, 0x8C, 0xD9, - 0x91, 0x72, 0x45, 0x20, 0xD9, 0x8D, 0xD9, 0x91, + 0x44, 0xD7, 0xA9, 0xD6, 0xBC, 0x41, 0x44, 0xD7, + 0xA9, 0xD7, 0x81, 0x4D, 0x44, 0xD7, 0xA9, 0xD7, + 0x82, 0x51, 0x44, 0xD7, 0xAA, 0xD6, 0xBC, 0x41, + 0x44, 0xD7, 0xB2, 0xD6, 0xB7, 0x31, 0x44, 0xD8, + 0xA7, 0xD9, 0x8B, 0x59, 0x44, 0xD8, 0xA7, 0xD9, + 0x93, 0xC9, 0x44, 0xD8, 0xA7, 0xD9, 0x94, 0xC9, + 0x44, 0xD8, 0xA7, 0xD9, 0x95, 0xB5, 0x44, 0xD8, + 0xB0, 0xD9, 0xB0, 0x79, 0x44, 0xD8, 0xB1, 0xD9, // Bytes 44c0 - 44ff - 0x72, 0x45, 0x20, 0xD9, 0x8E, 0xD9, 0x91, 0x72, - 0x45, 0x20, 0xD9, 0x8F, 0xD9, 0x91, 0x72, 0x45, - 0x20, 0xD9, 0x90, 0xD9, 0x91, 0x72, 0x45, 0x20, - 0xD9, 0x91, 0xD9, 0xB0, 0x7A, 0x45, 0xE2, 0xAB, - 0x9D, 0xCC, 0xB8, 0x05, 0x46, 0xCE, 0xB9, 0xCC, - 0x88, 0xCC, 0x81, 0xCA, 0x46, 0xCF, 0x85, 0xCC, - 0x88, 0xCC, 0x81, 0xCA, 0x46, 0xD7, 0xA9, 0xD6, - 0xBC, 0xD7, 0x81, 0x4E, 0x46, 0xD7, 0xA9, 0xD6, + 0xB0, 0x79, 0x44, 0xD9, 0x80, 0xD9, 0x8B, 0x59, + 0x44, 0xD9, 0x80, 0xD9, 0x8E, 0x65, 0x44, 0xD9, + 0x80, 0xD9, 0x8F, 0x69, 0x44, 0xD9, 0x80, 0xD9, + 0x90, 0x6D, 0x44, 0xD9, 0x80, 0xD9, 0x91, 0x71, + 0x44, 0xD9, 0x80, 0xD9, 0x92, 0x75, 0x44, 0xD9, + 0x87, 0xD9, 0xB0, 0x79, 0x44, 0xD9, 0x88, 0xD9, + 0x94, 0xC9, 0x44, 0xD9, 0x89, 0xD9, 0xB0, 0x79, + 0x44, 0xD9, 0x8A, 0xD9, 0x94, 0xC9, 0x44, 0xDB, // Bytes 4500 - 453f - 0xBC, 0xD7, 0x82, 0x52, 0x46, 0xD9, 0x80, 0xD9, - 0x8E, 0xD9, 0x91, 0x72, 0x46, 0xD9, 0x80, 0xD9, - 0x8F, 0xD9, 0x91, 0x72, 0x46, 0xD9, 0x80, 0xD9, - 0x90, 0xD9, 0x91, 0x72, 0x46, 0xE0, 0xA4, 0x95, - 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA4, 0x96, - 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA4, 0x97, - 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA4, 0x9C, - 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA4, 0xA1, + 0x92, 0xD9, 0x94, 0xC9, 0x44, 0xDB, 0x95, 0xD9, + 0x94, 0xC9, 0x45, 0x20, 0xCC, 0x88, 0xCC, 0x80, + 0xCA, 0x45, 0x20, 0xCC, 0x88, 0xCC, 0x81, 0xCA, + 0x45, 0x20, 0xCC, 0x88, 0xCD, 0x82, 0xCA, 0x45, + 0x20, 0xCC, 0x93, 0xCC, 0x80, 0xCA, 0x45, 0x20, + 0xCC, 0x93, 0xCC, 0x81, 0xCA, 0x45, 0x20, 0xCC, + 0x93, 0xCD, 0x82, 0xCA, 0x45, 0x20, 0xCC, 0x94, + 0xCC, 0x80, 0xCA, 0x45, 0x20, 0xCC, 0x94, 0xCC, // Bytes 4540 - 457f - 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA4, 0xA2, - 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA4, 0xAB, - 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA4, 0xAF, - 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA6, 0xA1, - 0xE0, 0xA6, 0xBC, 0x09, 0x46, 0xE0, 0xA6, 0xA2, - 0xE0, 0xA6, 0xBC, 0x09, 0x46, 0xE0, 0xA6, 0xAF, - 0xE0, 0xA6, 0xBC, 0x09, 0x46, 0xE0, 0xA8, 0x96, - 0xE0, 0xA8, 0xBC, 0x09, 0x46, 0xE0, 0xA8, 0x97, + 0x81, 0xCA, 0x45, 0x20, 0xCC, 0x94, 0xCD, 0x82, + 0xCA, 0x45, 0x20, 0xD9, 0x8C, 0xD9, 0x91, 0x72, + 0x45, 0x20, 0xD9, 0x8D, 0xD9, 0x91, 0x72, 0x45, + 0x20, 0xD9, 0x8E, 0xD9, 0x91, 0x72, 0x45, 0x20, + 0xD9, 0x8F, 0xD9, 0x91, 0x72, 0x45, 0x20, 0xD9, + 0x90, 0xD9, 0x91, 0x72, 0x45, 0x20, 0xD9, 0x91, + 0xD9, 0xB0, 0x7A, 0x45, 0xE2, 0x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 0xA5, 0xF0, 0x9D, 0x85, 0xAF, 0xAE, 0x83, 0x41, + 0xCC, 0x82, 0xC9, 0x83, 0x41, 0xCC, 0x86, 0xC9, + 0x83, 0x41, 0xCC, 0x87, 0xC9, 0x83, 0x41, 0xCC, + 0x88, 0xC9, 0x83, 0x41, 0xCC, 0x8A, 0xC9, 0x83, + 0x41, 0xCC, 0xA3, 0xB5, 0x83, 0x43, 0xCC, 0xA7, // Bytes 4740 - 477f - 0xC9, 0x83, 0x65, 0xCC, 0x84, 0xC9, 0x83, 0x65, - 0xCC, 0xA3, 0xB5, 0x83, 0x65, 0xCC, 0xA7, 0xA5, - 0x83, 0x69, 0xCC, 0x88, 0xC9, 0x83, 0x6C, 0xCC, - 0xA3, 0xB5, 0x83, 0x6F, 0xCC, 0x82, 0xC9, 0x83, - 0x6F, 0xCC, 0x83, 0xC9, 0x83, 0x6F, 0xCC, 0x84, - 0xC9, 0x83, 0x6F, 0xCC, 0x87, 0xC9, 0x83, 0x6F, - 0xCC, 0x88, 0xC9, 0x83, 0x6F, 0xCC, 0x9B, 0xAD, - 0x83, 0x6F, 0xCC, 0xA3, 0xB5, 0x83, 0x6F, 0xCC, + 0xA5, 0x83, 0x45, 0xCC, 0x82, 0xC9, 0x83, 0x45, + 0xCC, 0x84, 0xC9, 0x83, 0x45, 0xCC, 0xA3, 0xB5, + 0x83, 0x45, 0xCC, 0xA7, 0xA5, 0x83, 0x49, 0xCC, + 0x88, 0xC9, 0x83, 0x4C, 0xCC, 0xA3, 0xB5, 0x83, + 0x4F, 0xCC, 0x82, 0xC9, 0x83, 0x4F, 0xCC, 0x83, + 0xC9, 0x83, 0x4F, 0xCC, 0x84, 0xC9, 0x83, 0x4F, + 0xCC, 0x87, 0xC9, 0x83, 0x4F, 0xCC, 0x88, 0xC9, + 0x83, 0x4F, 0xCC, 0x9B, 0xAD, 0x83, 0x4F, 0xCC, // Bytes 4780 - 47bf - 0xA8, 0xA5, 0x83, 0x72, 0xCC, 0xA3, 0xB5, 0x83, - 0x73, 0xCC, 0x81, 0xC9, 0x83, 0x73, 0xCC, 0x8C, - 0xC9, 0x83, 0x73, 0xCC, 0xA3, 0xB5, 0x83, 0x75, - 0xCC, 0x83, 0xC9, 0x83, 0x75, 0xCC, 0x84, 0xC9, - 0x83, 0x75, 0xCC, 0x88, 0xC9, 0x83, 0x75, 0xCC, - 0x9B, 0xAD, 0x84, 0xCE, 0x91, 0xCC, 0x93, 0xC9, - 0x84, 0xCE, 0x91, 0xCC, 0x94, 0xC9, 0x84, 0xCE, - 0x95, 0xCC, 0x93, 0xC9, 0x84, 0xCE, 0x95, 0xCC, + 0xA3, 0xB5, 0x83, 0x4F, 0xCC, 0xA8, 0xA5, 0x83, + 0x52, 0xCC, 0xA3, 0xB5, 0x83, 0x53, 0xCC, 0x81, + 0xC9, 0x83, 0x53, 0xCC, 0x8C, 0xC9, 0x83, 0x53, + 0xCC, 0xA3, 0xB5, 0x83, 0x55, 0xCC, 0x83, 0xC9, + 0x83, 0x55, 0xCC, 0x84, 0xC9, 0x83, 0x55, 0xCC, + 0x88, 0xC9, 0x83, 0x55, 0xCC, 0x9B, 0xAD, 0x83, + 0x61, 0xCC, 0x82, 0xC9, 0x83, 0x61, 0xCC, 0x86, + 0xC9, 0x83, 0x61, 0xCC, 0x87, 0xC9, 0x83, 0x61, // Bytes 47c0 - 47ff - 0x94, 0xC9, 0x84, 0xCE, 0x97, 0xCC, 0x93, 0xC9, - 0x84, 0xCE, 0x97, 0xCC, 0x94, 0xC9, 0x84, 0xCE, - 0x99, 0xCC, 0x93, 0xC9, 0x84, 0xCE, 0x99, 0xCC, - 0x94, 0xC9, 0x84, 0xCE, 0x9F, 0xCC, 0x93, 0xC9, - 0x84, 0xCE, 0x9F, 0xCC, 0x94, 0xC9, 0x84, 0xCE, - 0xA5, 0xCC, 0x94, 0xC9, 0x84, 0xCE, 0xA9, 0xCC, - 0x93, 0xC9, 0x84, 0xCE, 0xA9, 0xCC, 0x94, 0xC9, - 0x84,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, 0xCC, 0xA3, 0xB5, 0x83, 0x75, 0xCC, 0x83, + 0xC9, 0x83, 0x75, 0xCC, 0x84, 0xC9, 0x83, 0x75, + 0xCC, 0x88, 0xC9, 0x83, 0x75, 0xCC, 0x9B, 0xAD, // Bytes 4840 - 487f - 0x84, 0xCE, 0xB9, 0xCC, 0x88, 0xC9, 0x84, 0xCE, - 0xB9, 0xCC, 0x93, 0xC9, 0x84, 0xCE, 0xB9, 0xCC, - 0x94, 0xC9, 0x84, 0xCE, 0xBF, 0xCC, 0x93, 0xC9, - 0x84, 0xCE, 0xBF, 0xCC, 0x94, 0xC9, 0x84, 0xCF, - 0x85, 0xCC, 0x88, 0xC9, 0x84, 0xCF, 0x85, 0xCC, - 0x93, 0xC9, 0x84, 0xCF, 0x85, 0xCC, 0x94, 0xC9, - 0x84, 0xCF, 0x89, 0xCC, 0x80, 0xC9, 0x84, 0xCF, - 0x89, 0xCC, 0x81, 0xC9, 0x84, 0xCF, 0x89, 0xCC, + 0x84, 0xCE, 0x91, 0xCC, 0x93, 0xC9, 0x84, 0xCE, + 0x91, 0xCC, 0x94, 0xC9, 0x84, 0xCE, 0x95, 0xCC, + 0x93, 0xC9, 0x84, 0xCE, 0x95, 0xCC, 0x94, 0xC9, + 0x84, 0xCE, 0x97, 0xCC, 0x93, 0xC9, 0x84, 0xCE, + 0x97, 0xCC, 0x94, 0xC9, 0x84, 0xCE, 0x99, 0xCC, + 0x93, 0xC9, 0x84, 0xCE, 0x99, 0xCC, 0x94, 0xC9, + 0x84, 0xCE, 0x9F, 0xCC, 0x93, 0xC9, 0x84, 0xCE, + 0x9F, 0xCC, 0x94, 0xC9, 0x84, 0xCE, 0xA5, 0xCC, // Bytes 4880 - 48bf - 0x93, 0xC9, 0x84, 0xCF, 0x89, 0xCC, 0x94, 0xC9, - 0x84, 0xCF, 0x89, 0xCD, 0x82, 0xC9, 0x86, 0xCE, - 0x91, 0xCC, 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCE, - 0x91, 0xCC, 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCE, - 0x91, 0xCC, 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCE, - 0x91, 0xCC, 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCE, - 0x91, 0xCC, 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCE, - 0x91, 0xCC, 0x94, 0xCD, 0x82, 0xCA, 0x86, 0xCE, + 0x94, 0xC9, 0x84, 0xCE, 0xA9, 0xCC, 0x93, 0xC9, + 0x84, 0xCE, 0xA9, 0xCC, 0x94, 0xC9, 0x84, 0xCE, + 0xB1, 0xCC, 0x80, 0xC9, 0x84, 0xCE, 0xB1, 0xCC, + 0x81, 0xC9, 0x84, 0xCE, 0xB1, 0xCC, 0x93, 0xC9, + 0x84, 0xCE, 0xB1, 0xCC, 0x94, 0xC9, 0x84, 0xCE, + 0xB1, 0xCD, 0x82, 0xC9, 0x84, 0xCE, 0xB5, 0xCC, + 0x93, 0xC9, 0x84, 0xCE, 0xB5, 0xCC, 0x94, 0xC9, + 0x84, 0xCE, 0xB7, 0xCC, 0x80, 0xC9, 0x84, 0xCE, // Bytes 48c0 - 48ff - 0x97, 0xCC, 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCE, - 0x97, 0xCC, 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCE, - 0x97, 0xCC, 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCE, - 0x97, 0xCC, 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCE, - 0x97, 0xCC, 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCE, - 0x97, 0xCC, 0x94, 0xCD, 0x82, 0xCA, 0x86, 0xCE, - 0xA9, 0xCC, 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCE, - 0xA9, 0xCC, 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCE, + 0xB7, 0xCC, 0x81, 0xC9, 0x84, 0xCE, 0xB7, 0xCC, + 0x93, 0xC9, 0x84, 0xCE, 0xB7, 0xCC, 0x94, 0xC9, + 0x84, 0xCE, 0xB7, 0xCD, 0x82, 0xC9, 0x84, 0xCE, + 0xB9, 0xCC, 0x88, 0xC9, 0x84, 0xCE, 0xB9, 0xCC, + 0x93, 0xC9, 0x84, 0xCE, 0xB9, 0xCC, 0x94, 0xC9, + 0x84, 0xCE, 0xBF, 0xCC, 0x93, 0xC9, 0x84, 0xCE, + 0xBF, 0xCC, 0x94, 0xC9, 0x84, 0xCF, 0x85, 0xCC, + 0x88, 0xC9, 0x84, 0xCF, 0x85, 0xCC, 0x93, 0xC9, // Bytes 4900 - 493f - 0xA9, 0xCC, 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCE, - 0xA9, 0xCC, 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCE, - 0xA9, 0xCC, 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCE, - 0xA9, 0xCC, 0x94, 0xCD, 0x82, 0xCA, 0x86, 0xCE, - 0xB1, 0xCC, 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCE, - 0xB1, 0xCC, 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCE, - 0xB1, 0xCC, 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCE, - 0xB1, 0xCC, 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCE, + 0x84, 0xCF, 0x85, 0xCC, 0x94, 0xC9, 0x84, 0xCF, + 0x89, 0xCC, 0x80, 0xC9, 0x84, 0xCF, 0x89, 0xCC, + 0x81, 0xC9, 0x84, 0xCF, 0x89, 0xCC, 0x93, 0xC9, + 0x84, 0xCF, 0x89, 0xCC, 0x94, 0xC9, 0x84, 0xCF, + 0x89, 0xCD, 0x82, 0xC9, 0x86, 0xCE, 0x91, 0xCC, + 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCE, 0x91, 0xCC, + 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCE, 0x91, 0xCC, + 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCE, 0x91, 0xCC, // Bytes 4940 - 497f - 0xB1, 0xCC, 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCE, - 0xB1, 0xCC, 0x94, 0xCD, 0x82, 0xCA, 0x86, 0xCE, - 0xB7, 0xCC, 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCE, - 0xB7, 0xCC, 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCE, - 0xB7, 0xCC, 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCE, - 0xB7, 0xCC, 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCE, - 0xB7, 0xCC, 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCE, - 0xB7, 0xCC, 0x94, 0xCD, 0x82, 0xCA, 0x86, 0xCF, + 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCE, 0x91, 0xCC, + 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCE, 0x91, 0xCC, + 0x94, 0xCD, 0x82, 0xCA, 0x86, 0xCE, 0x97, 0xCC, + 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCE, 0x97, 0xCC, + 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCE, 0x97, 0xCC, + 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCE, 0x97, 0xCC, + 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCE, 0x97, 0xCC, + 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCE, 0x97, 0xCC, // Bytes 4980 - 49bf - 0x89, 0xCC, 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCF, - 0x89, 0xCC, 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCF, - 0x89, 0xCC, 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCF, - 0x89, 0xCC, 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCF, - 0x89, 0xCC, 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCF, - 0x89, 0xCC, 0x94, 0xCD, 0x82, 0xCA, 0x42, 0xCC, - 0x80, 0xC9, 0x32, 0x42, 0xCC, 0x81, 0xC9, 0x32, - 0x42, 0xCC, 0x93, 0xC9, 0x32, 0x43, 0xE1, 0x85, + 0x94, 0xCD, 0x82, 0xCA, 0x86, 0xCE, 0xA9, 0xCC, + 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCE, 0xA9, 0xCC, + 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCE, 0xA9, 0xCC, + 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCE, 0xA9, 0xCC, + 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCE, 0xA9, 0xCC, + 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCE, 0xA9, 0xCC, + 0x94, 0xCD, 0x82, 0xCA, 0x86, 0xCE, 0xB1, 0xCC, + 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCE, 0xB1, 0xCC, // Bytes 49c0 - 49ff - 0xA1, 0x01, 0x00, 0x43, 0xE1, 0x85, 0xA2, 0x01, - 0x00, 0x43, 0xE1, 0x85, 0xA3, 0x01, 0x00, 0x43, - 0xE1, 0x85, 0xA4, 0x01, 0x00, 0x43, 0xE1, 0x85, - 0xA5, 0x01, 0x00, 0x43, 0xE1, 0x85, 0xA6, 0x01, - 0x00, 0x43, 0xE1, 0x85, 0xA7, 0x01, 0x00, 0x43, - 0xE1, 0x85, 0xA8, 0x01, 0x00, 0x43, 0xE1, 0x85, - 0xA9, 0x01, 0x00, 0x43, 0xE1, 0x85, 0xAA, 0x01, - 0x00, 0x43, 0xE1, 0x85, 0xAB, 0x01, 0x00, 0x43, + 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCE, 0xB1, 0xCC, + 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCE, 0xB1, 0xCC, + 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCE, 0xB1, 0xCC, + 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCE, 0xB1, 0xCC, + 0x94, 0xCD, 0x82, 0xCA, 0x86, 0xCE, 0xB7, 0xCC, + 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCE, 0xB7, 0xCC, + 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCE, 0xB7, 0xCC, + 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCE, 0xB7, 0xCC, // Bytes 4a00 - 4a3f - 0xE1, 0x85, 0xAC, 0x01, 0x00, 0x43, 0xE1, 0x85, - 0xAD, 0x01, 0x00, 0x43, 0xE1, 0x85, 0xAE, 0x01, - 0x00, 0x43, 0xE1, 0x85, 0xAF, 0x01, 0x00, 0x43, - 0xE1, 0x85, 0xB0, 0x01, 0x00, 0x43, 0xE1, 0x85, - 0xB1, 0x01, 0x00, 0x43, 0xE1, 0x85, 0xB2, 0x01, - 0x00, 0x43, 0xE1, 0x85, 0xB3, 0x01, 0x00, 0x43, - 0xE1, 0x85, 0xB4, 0x01, 0x00, 0x43, 0xE1, 0x85, - 0xB5, 0x01, 0x00, 0x43, 0xE1, 0x86, 0xAA, 0x01, + 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCE, 0xB7, 0xCC, + 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCE, 0xB7, 0xCC, + 0x94, 0xCD, 0x82, 0xCA, 0x86, 0xCF, 0x89, 0xCC, + 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCF, 0x89, 0xCC, + 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCF, 0x89, 0xCC, + 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCF, 0x89, 0xCC, + 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCF, 0x89, 0xCC, + 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCF, 0x89, 0xCC, // Bytes 4a40 - 4a7f - 0x00, 0x43, 0xE1, 0x86, 0xAC, 0x01, 0x00, 0x43, - 0xE1, 0x86, 0xAD, 0x01, 0x00, 0x43, 0xE1, 0x86, - 0xB0, 0x01, 0x00, 0x43, 0xE1, 0x86, 0xB1, 0x01, - 0x00, 0x43, 0xE1, 0x86, 0xB2, 0x01, 0x00, 0x43, - 0xE1, 0x86, 0xB3, 0x01, 0x00, 0x43, 0xE1, 0x86, - 0xB4, 0x01, 0x00, 0x43, 0xE1, 0x86, 0xB5, 0x01, - 0x00, 0x44, 0xCC, 0x88, 0xCC, 0x81, 0xCA, 0x32, - 0x43, 0xE3, 0x82, 0x99, 0x0D, 0x03, 0x43, 0xE3, + 0x94, 0xCD, 0x82, 0xCA, 0x42, 0xCC, 0x80, 0xC9, + 0x32, 0x42, 0xCC, 0x81, 0xC9, 0x32, 0x42, 0xCC, + 0x93, 0xC9, 0x32, 0x44, 0xCC, 0x88, 0xCC, 0x81, + 0xCA, 0x32, 0x43, 0xE3, 0x82, 0x99, 0x0D, 0x03, + 0x43, 0xE3, 0x82, 0x9A, 0x0D, 0x03, 0x46, 0xE0, + 0xBD, 0xB1, 0xE0, 0xBD, 0xB2, 0x9E, 0x26, 0x46, + 0xE0, 0xBD, 0xB1, 0xE0, 0xBD, 0xB4, 0xA2, 0x26, + 0x46, 0xE0, 0xBD, 0xB1, 0xE0, 0xBE, 0x80, 0x9E, // Bytes 4a80 - 4abf - 0x82, 0x9A, 0x0D, 0x03, 0x46, 0xE0, 0xBD, 0xB1, - 0xE0, 0xBD, 0xB2, 0x9E, 0x26, 0x46, 0xE0, 0xBD, - 0xB1, 0xE0, 0xBD, 0xB4, 0xA2, 0x26, 0x46, 0xE0, - 0xBD, 0xB1, 0xE0, 0xBE, 0x80, 0x9E, 0x26, 0x00, - 0x01, + 0x26, 0x00, 0x01, } // lookup returns the trie value for the first UTF-8 encoding in s and @@ -2896,7 +2892,7 @@ func (t *nfcTrie) lookupStringUnsafe(s string) uint16 { return 0 } -// nfcTrie. Total size: 10332 bytes (10.09 KiB). Checksum: 51cc525b297fc970. +// nfcTrie. Total size: 10332 bytes (10.09 KiB). Checksum: ad355b768fddb1b6. type nfcTrie struct{} func newNfcTrie(i int) *nfcTrie { @@ -2932,22 +2928,22 @@ var nfcValues = [2944]uint16{ 0x76: 0xa000, 0x77: 0xa000, 0x78: 0xa000, 0x79: 0xa000, 0x7a: 0xa000, // Block 0x2, offset 0x80 // Block 0x3, offset 0xc0 - 0xc0: 0x2f6f, 0xc1: 0x2f74, 0xc2: 0x4688, 0xc3: 0x2f79, 0xc4: 0x4697, 0xc5: 0x469c, - 0xc6: 0xa000, 0xc7: 0x46a6, 0xc8: 0x2fe2, 0xc9: 0x2fe7, 0xca: 0x46ab, 0xcb: 0x2ffb, - 0xcc: 0x306e, 0xcd: 0x3073, 0xce: 0x3078, 0xcf: 0x46bf, 0xd1: 0x3104, - 0xd2: 0x3127, 0xd3: 0x312c, 0xd4: 0x46c9, 0xd5: 0x46ce, 0xd6: 0x46dd, - 0xd8: 0xa000, 0xd9: 0x31b3, 0xda: 0x31b8, 0xdb: 0x31bd, 0xdc: 0x470f, 0xdd: 0x3235, - 0xe0: 0x327b, 0xe1: 0x3280, 0xe2: 0x4719, 0xe3: 0x3285, - 0xe4: 0x4728, 0xe5: 0x472d, 0xe6: 0xa000, 0xe7: 0x4737, 0xe8: 0x32ee, 0xe9: 0x32f3, - 0xea: 0x473c, 0xeb: 0x3307, 0xec: 0x337f, 0xed: 0x3384, 0xee: 0x3389, 0xef: 0x4750, - 0xf1: 0x3415, 0xf2: 0x3438, 0xf3: 0x343d, 0xf4: 0x475a, 0xf5: 0x475f, - 0xf6: 0x476e, 0xf8: 0xa000, 0xf9: 0x34c9, 0xfa: 0x34ce, 0xfb: 0x34d3, - 0xfc: 0x47a0, 0xfd: 0x3550, 0xff: 0x3569, + 0xc0: 0x2f6f, 0xc1: 0x2f74, 0xc2: 0x471e, 0xc3: 0x2f79, 0xc4: 0x472d, 0xc5: 0x4732, + 0xc6: 0xa000, 0xc7: 0x473c, 0xc8: 0x2fe2, 0xc9: 0x2fe7, 0xca: 0x4741, 0xcb: 0x2ffb, + 0xcc: 0x306e, 0xcd: 0x3073, 0xce: 0x3078, 0xcf: 0x4755, 0xd1: 0x3104, + 0xd2: 0x3127, 0xd3: 0x312c, 0xd4: 0x475f, 0xd5: 0x4764, 0xd6: 0x4773, + 0xd8: 0xa000, 0xd9: 0x31b3, 0xda: 0x31b8, 0xdb: 0x31bd, 0xdc: 0x47a5, 0xdd: 0x3235, + 0xe0: 0x327b, 0xe1: 0x3280, 0xe2: 0x47af, 0xe3: 0x3285, + 0xe4: 0x47be, 0xe5: 0x47c3, 0xe6: 0xa000, 0xe7: 0x47cd, 0xe8: 0x32ee, 0xe9: 0x32f3, + 0xea: 0x47d2, 0xeb: 0x3307, 0xec: 0x337f, 0xed: 0x3384, 0xee: 0x3389, 0xef: 0x47e6, + 0xf1: 0x3415, 0xf2: 0x3438, 0xf3: 0x343d, 0xf4: 0x47f0, 0xf5: 0x47f5, + 0xf6: 0x4804, 0xf8: 0xa000, 0xf9: 0x34c9, 0xfa: 0x34ce, 0xfb: 0x34d3, + 0xfc: 0x4836, 0xfd: 0x3550, 0xff: 0x3569, // Block 0x4, offset 0x100 - 0x100: 0x2f7e, 0x101: 0x328a, 0x102: 0x468d, 0x103: 0x471e, 0x104: 0x2f9c, 0x105: 0x32a8, + 0x100: 0x2f7e, 0x101: 0x328a, 0x102: 0x4723, 0x103: 0x47b4, 0x104: 0x2f9c, 0x105: 0x32a8, 0x106: 0x2fb0, 0x107: 0x32bc, 0x108: 0x2fb5, 0x109: 0x32c1, 0x10a: 0x2fba, 0x10b: 0x32c6, 0x10c: 0x2fbf, 0x10d: 0x32cb, 0x10e: 0x2fc9, 0x10f: 0x32d5, - 0x112: 0x46b0, 0x113: 0x4741, 0x114: 0x2ff1, 0x115: 0x32fd, 0x116: 0x2ff6, 0x117: 0x3302, + 0x112: 0x4746, 0x113: 0x47d7, 0x114: 0x2ff1, 0x115: 0x32fd, 0x116: 0x2ff6, 0x117: 0x3302, 0x118: 0x3014, 0x119: 0x3320, 0x11a: 0x3005, 0x11b: 0x3311, 0x11c: 0x302d, 0x11d: 0x3339, 0x11e: 0x3037, 0x11f: 0x3343, 0x120: 0x303c, 0x121: 0x3348, 0x122: 0x3046, 0x123: 0x3352, 0x124: 0x304b, 0x125: 0x3357, 0x128: 0x307d, 0x129: 0x338e, @@ -2958,12 +2954,12 @@ var nfcValues = [2944]uint16{ // Block 0x5, offset 0x140 0x143: 0x30ff, 0x144: 0x3410, 0x145: 0x3118, 0x146: 0x3429, 0x147: 0x310e, 0x148: 0x341f, - 0x14c: 0x46d3, 0x14d: 0x4764, 0x14e: 0x3131, 0x14f: 0x3442, 0x150: 0x313b, 0x151: 0x344c, + 0x14c: 0x4769, 0x14d: 0x47fa, 0x14e: 0x3131, 0x14f: 0x3442, 0x150: 0x313b, 0x151: 0x344c, 0x154: 0x3159, 0x155: 0x346a, 0x156: 0x3172, 0x157: 0x3483, - 0x158: 0x3163, 0x159: 0x3474, 0x15a: 0x46f6, 0x15b: 0x4787, 0x15c: 0x317c, 0x15d: 0x348d, - 0x15e: 0x318b, 0x15f: 0x349c, 0x160: 0x46fb, 0x161: 0x478c, 0x162: 0x31a4, 0x163: 0x34ba, - 0x164: 0x3195, 0x165: 0x34ab, 0x168: 0x4705, 0x169: 0x4796, - 0x16a: 0x470a, 0x16b: 0x479b, 0x16c: 0x31c2, 0x16d: 0x34d8, 0x16e: 0x31cc, 0x16f: 0x34e2, + 0x158: 0x3163, 0x159: 0x3474, 0x15a: 0x478c, 0x15b: 0x481d, 0x15c: 0x317c, 0x15d: 0x348d, + 0x15e: 0x318b, 0x15f: 0x349c, 0x160: 0x4791, 0x161: 0x4822, 0x162: 0x31a4, 0x163: 0x34ba, + 0x164: 0x3195, 0x165: 0x34ab, 0x168: 0x479b, 0x169: 0x482c, + 0x16a: 0x47a0, 0x16b: 0x4831, 0x16c: 0x31c2, 0x16d: 0x34d8, 0x16e: 0x31cc, 0x16f: 0x34e2, 0x170: 0x31d1, 0x171: 0x34e7, 0x172: 0x31ef, 0x173: 0x3505, 0x174: 0x3212, 0x175: 0x3528, 0x176: 0x323a, 0x177: 0x3555, 0x178: 0x324e, 0x179: 0x325d, 0x17a: 0x357d, 0x17b: 0x3267, 0x17c: 0x3587, 0x17d: 0x326c, 0x17e: 0x358c, 0x17f: 0xa000, @@ -2975,7 +2971,7 @@ var nfcValues = [2944]uint16{ 0x198: 0x3b57, 0x199: 0x39d6, 0x19a: 0x3b65, 0x19b: 0x39c1, 0x19c: 0x3b50, 0x19e: 0x38b0, 0x19f: 0x3a3f, 0x1a0: 0x38a9, 0x1a1: 0x3a38, 0x1a2: 0x35b3, 0x1a3: 0x35c5, 0x1a6: 0x3041, 0x1a7: 0x334d, 0x1a8: 0x30be, 0x1a9: 0x33cf, - 0x1aa: 0x46ec, 0x1ab: 0x477d, 0x1ac: 0x3990, 0x1ad: 0x3b1f, 0x1ae: 0x35d7, 0x1af: 0x35dd, + 0x1aa: 0x4782, 0x1ab: 0x4813, 0x1ac: 0x3990, 0x1ad: 0x3b1f, 0x1ae: 0x35d7, 0x1af: 0x35dd, 0x1b0: 0x33c5, 0x1b4: 0x3028, 0x1b5: 0x3334, 0x1b8: 0x30fa, 0x1b9: 0x340b, 0x1ba: 0x38b7, 0x1bb: 0x3a46, 0x1bc: 0x35ad, 0x1bd: 0x35bf, 0x1be: 0x35b9, 0x1bf: 0x35cb, @@ -2986,8 +2982,8 @@ var nfcValues = [2944]uint16{ 0x1d2: 0x316d, 0x1d3: 0x347e, 0x1d4: 0x31db, 0x1d5: 0x34f1, 0x1d6: 0x31e0, 0x1d7: 0x34f6, 0x1d8: 0x3186, 0x1d9: 0x3497, 0x1da: 0x319f, 0x1db: 0x34b5, 0x1de: 0x305a, 0x1df: 0x3366, - 0x1e6: 0x4692, 0x1e7: 0x4723, 0x1e8: 0x46ba, 0x1e9: 0x474b, - 0x1ea: 0x395f, 0x1eb: 0x3aee, 0x1ec: 0x393c, 0x1ed: 0x3acb, 0x1ee: 0x46d8, 0x1ef: 0x4769, + 0x1e6: 0x4728, 0x1e7: 0x47b9, 0x1e8: 0x4750, 0x1e9: 0x47e1, + 0x1ea: 0x395f, 0x1eb: 0x3aee, 0x1ec: 0x393c, 0x1ed: 0x3acb, 0x1ee: 0x476e, 0x1ef: 0x47ff, 0x1f0: 0x3958, 0x1f1: 0x3ae7, 0x1f2: 0x3244, 0x1f3: 0x355f, // Block 0x8, offset 0x200 0x200: 0x9932, 0x201: 0x9932, 0x202: 0x9932, 0x203: 0x9932, 0x204: 0x9932, 0x205: 0x8132, @@ -3002,7 +2998,7 @@ var nfcValues = [2944]uint16{ 0x236: 0x8101, 0x237: 0x8101, 0x238: 0x9901, 0x239: 0x812d, 0x23a: 0x812d, 0x23b: 0x812d, 0x23c: 0x812d, 0x23d: 0x8132, 0x23e: 0x8132, 0x23f: 0x8132, // Block 0x9, offset 0x240 - 0x240: 0x49ae, 0x241: 0x49b3, 0x242: 0x9932, 0x243: 0x49b8, 0x244: 0x4a71, 0x245: 0x9936, + 0x240: 0x4a44, 0x241: 0x4a49, 0x242: 0x9932, 0x243: 0x4a4e, 0x244: 0x4a53, 0x245: 0x9936, 0x246: 0x8132, 0x247: 0x812d, 0x248: 0x812d, 0x249: 0x812d, 0x24a: 0x8132, 0x24b: 0x8132, 0x24c: 0x8132, 0x24d: 0x812d, 0x24e: 0x812d, 0x250: 0x8132, 0x251: 0x8132, 0x252: 0x8132, 0x253: 0x812d, 0x254: 0x812d, 0x255: 0x812d, 0x256: 0x812d, 0x257: 0x8132, @@ -3021,7 +3017,7 @@ var nfcValues = [2944]uint16{ 0x299: 0xa000, 0x29f: 0xa000, 0x2a1: 0xa000, 0x2a5: 0xa000, 0x2a9: 0xa000, - 0x2aa: 0x3637, 0x2ab: 0x3667, 0x2ac: 0x47fe, 0x2ad: 0x3697, 0x2ae: 0x4828, 0x2af: 0x36a9, + 0x2aa: 0x3637, 0x2ab: 0x3667, 0x2ac: 0x4894, 0x2ad: 0x3697, 0x2ae: 0x48be, 0x2af: 0x36a9, 0x2b0: 0x3e70, 0x2b1: 0xa000, 0x2b5: 0xa000, 0x2b7: 0xa000, 0x2b9: 0xa000, 0x2bf: 0xa000, @@ -3082,15 +3078,15 @@ var nfcValues = [2944]uint16{ 0x424: 0x305f, 0x425: 0x336b, 0x426: 0x3055, 0x427: 0x3361, 0x428: 0x3064, 0x429: 0x3370, 0x42a: 0x3069, 0x42b: 0x3375, 0x42c: 0x30af, 0x42d: 0x33bb, 0x42e: 0x390b, 0x42f: 0x3a9a, 0x430: 0x30b9, 0x431: 0x33ca, 0x432: 0x30c3, 0x433: 0x33d4, 0x434: 0x30cd, 0x435: 0x33de, - 0x436: 0x46c4, 0x437: 0x4755, 0x438: 0x3912, 0x439: 0x3aa1, 0x43a: 0x30e6, 0x43b: 0x33f7, + 0x436: 0x475a, 0x437: 0x47eb, 0x438: 0x3912, 0x439: 0x3aa1, 0x43a: 0x30e6, 0x43b: 0x33f7, 0x43c: 0x30e1, 0x43d: 0x33f2, 0x43e: 0x30eb, 0x43f: 0x33fc, // Block 0x11, offset 0x440 0x440: 0x30f0, 0x441: 0x3401, 0x442: 0x30f5, 0x443: 0x3406, 0x444: 0x3109, 0x445: 0x341a, 0x446: 0x3113, 0x447: 0x3424, 0x448: 0x3122, 0x449: 0x3433, 0x44a: 0x311d, 0x44b: 0x342e, 0x44c: 0x3935, 0x44d: 0x3ac4, 0x44e: 0x3943, 0x44f: 0x3ad2, 0x450: 0x394a, 0x451: 0x3ad9, 0x452: 0x3951, 0x453: 0x3ae0, 0x454: 0x314f, 0x455: 0x3460, 0x456: 0x3154, 0x457: 0x3465, - 0x458: 0x315e, 0x459: 0x346f, 0x45a: 0x46f1, 0x45b: 0x4782, 0x45c: 0x3997, 0x45d: 0x3b26, - 0x45e: 0x3177, 0x45f: 0x3488, 0x460: 0x3181, 0x461: 0x3492, 0x462: 0x4700, 0x463: 0x4791, + 0x458: 0x315e, 0x459: 0x346f, 0x45a: 0x4787, 0x45b: 0x4818, 0x45c: 0x3997, 0x45d: 0x3b26, + 0x45e: 0x3177, 0x45f: 0x3488, 0x460: 0x3181, 0x461: 0x3492, 0x462: 0x4796, 0x463: 0x4827, 0x464: 0x399e, 0x465: 0x3b2d, 0x466: 0x39a5, 0x467: 0x3b34, 0x468: 0x39ac, 0x469: 0x3b3b, 0x46a: 0x3190, 0x46b: 0x34a1, 0x46c: 0x319a, 0x46d: 0x34b0, 0x46e: 0x31ae, 0x46f: 0x34c4, 0x470: 0x31a9, 0x471: 0x34bf, 0x472: 0x31ea, 0x473: 0x3500, 0x474: 0x31f9, 0x475: 0x350f, @@ -3102,16 +3098,16 @@ var nfcValues = [2944]uint16{ 0x48c: 0x322b, 0x48d: 0x3546, 0x48e: 0x3249, 0x48f: 0x3564, 0x490: 0x3262, 0x491: 0x3582, 0x492: 0x3271, 0x493: 0x3591, 0x494: 0x3276, 0x495: 0x3596, 0x496: 0x337a, 0x497: 0x34a6, 0x498: 0x3537, 0x499: 0x3573, 0x49b: 0x35d1, - 0x4a0: 0x46a1, 0x4a1: 0x4732, 0x4a2: 0x2f83, 0x4a3: 0x328f, + 0x4a0: 0x4737, 0x4a1: 0x47c8, 0x4a2: 0x2f83, 0x4a3: 0x328f, 0x4a4: 0x3878, 0x4a5: 0x3a07, 0x4a6: 0x3871, 0x4a7: 0x3a00, 0x4a8: 0x3886, 0x4a9: 0x3a15, 0x4aa: 0x387f, 0x4ab: 0x3a0e, 0x4ac: 0x38be, 0x4ad: 0x3a4d, 0x4ae: 0x3894, 0x4af: 0x3a23, 0x4b0: 0x388d, 0x4b1: 0x3a1c, 0x4b2: 0x38a2, 0x4b3: 0x3a31, 0x4b4: 0x389b, 0x4b5: 0x3a2a, - 0x4b6: 0x38c5, 0x4b7: 0x3a54, 0x4b8: 0x46b5, 0x4b9: 0x4746, 0x4ba: 0x3000, 0x4bb: 0x330c, + 0x4b6: 0x38c5, 0x4b7: 0x3a54, 0x4b8: 0x474b, 0x4b9: 0x47dc, 0x4ba: 0x3000, 0x4bb: 0x330c, 0x4bc: 0x2fec, 0x4bd: 0x32f8, 0x4be: 0x38da, 0x4bf: 0x3a69, // Block 0x13, offset 0x4c0 0x4c0: 0x38d3, 0x4c1: 0x3a62, 0x4c2: 0x38e8, 0x4c3: 0x3a77, 0x4c4: 0x38e1, 0x4c5: 0x3a70, 0x4c6: 0x38fd, 0x4c7: 0x3a8c, 0x4c8: 0x3091, 0x4c9: 0x339d, 0x4ca: 0x30a5, 0x4cb: 0x33b1, - 0x4cc: 0x46e7, 0x4cd: 0x4778, 0x4ce: 0x3136, 0x4cf: 0x3447, 0x4d0: 0x3920, 0x4d1: 0x3aaf, + 0x4cc: 0x477d, 0x4cd: 0x480e, 0x4ce: 0x3136, 0x4cf: 0x3447, 0x4d0: 0x3920, 0x4d1: 0x3aaf, 0x4d2: 0x3919, 0x4d3: 0x3aa8, 0x4d4: 0x392e, 0x4d5: 0x3abd, 0x4d6: 0x3927, 0x4d7: 0x3ab6, 0x4d8: 0x3989, 0x4d9: 0x3b18, 0x4da: 0x396d, 0x4db: 0x3afc, 0x4dc: 0x3966, 0x4dd: 0x3af5, 0x4de: 0x397b, 0x4df: 0x3b0a, 0x4e0: 0x3974, 0x4e1: 0x3b03, 0x4e2: 0x3982, 0x4e3: 0x3b11, @@ -3120,29 +3116,29 @@ var nfcValues = [2944]uint16{ 0x4f0: 0x39f9, 0x4f1: 0x3b88, 0x4f2: 0x3230, 0x4f3: 0x354b, 0x4f4: 0x3258, 0x4f5: 0x3578, 0x4f6: 0x3253, 0x4f7: 0x356e, 0x4f8: 0x323f, 0x4f9: 0x355a, // Block 0x14, offset 0x500 - 0x500: 0x4804, 0x501: 0x480a, 0x502: 0x491e, 0x503: 0x4936, 0x504: 0x4926, 0x505: 0x493e, - 0x506: 0x492e, 0x507: 0x4946, 0x508: 0x47aa, 0x509: 0x47b0, 0x50a: 0x488e, 0x50b: 0x48a6, - 0x50c: 0x4896, 0x50d: 0x48ae, 0x50e: 0x489e, 0x50f: 0x48b6, 0x510: 0x4816, 0x511: 0x481c, + 0x500: 0x489a, 0x501: 0x48a0, 0x502: 0x49b4, 0x503: 0x49cc, 0x504: 0x49bc, 0x505: 0x49d4, + 0x506: 0x49c4, 0x507: 0x49dc, 0x508: 0x4840, 0x509: 0x4846, 0x50a: 0x4924, 0x50b: 0x493c, + 0x50c: 0x492c, 0x50d: 0x4944, 0x50e: 0x4934, 0x50f: 0x494c, 0x510: 0x48ac, 0x511: 0x48b2, 0x512: 0x3db8, 0x513: 0x3dc8, 0x514: 0x3dc0, 0x515: 0x3dd0, - 0x518: 0x47b6, 0x519: 0x47bc, 0x51a: 0x3ce8, 0x51b: 0x3cf8, 0x51c: 0x3cf0, 0x51d: 0x3d00, - 0x520: 0x482e, 0x521: 0x4834, 0x522: 0x494e, 0x523: 0x4966, - 0x524: 0x4956, 0x525: 0x496e, 0x526: 0x495e, 0x527: 0x4976, 0x528: 0x47c2, 0x529: 0x47c8, - 0x52a: 0x48be, 0x52b: 0x48d6, 0x52c: 0x48c6, 0x52d: 0x48de, 0x52e: 0x48ce, 0x52f: 0x48e6, - 0x530: 0x4846, 0x531: 0x484c, 0x532: 0x3e18, 0x533: 0x3e30, 0x534: 0x3e20, 0x535: 0x3e38, - 0x536: 0x3e28, 0x537: 0x3e40, 0x538: 0x47ce, 0x539: 0x47d4, 0x53a: 0x3d18, 0x53b: 0x3d30, + 0x518: 0x484c, 0x519: 0x4852, 0x51a: 0x3ce8, 0x51b: 0x3cf8, 0x51c: 0x3cf0, 0x51d: 0x3d00, + 0x520: 0x48c4, 0x521: 0x48ca, 0x522: 0x49e4, 0x523: 0x49fc, + 0x524: 0x49ec, 0x525: 0x4a04, 0x526: 0x49f4, 0x527: 0x4a0c, 0x528: 0x4858, 0x529: 0x485e, + 0x52a: 0x4954, 0x52b: 0x496c, 0x52c: 0x495c, 0x52d: 0x4974, 0x52e: 0x4964, 0x52f: 0x497c, + 0x530: 0x48dc, 0x531: 0x48e2, 0x532: 0x3e18, 0x533: 0x3e30, 0x534: 0x3e20, 0x535: 0x3e38, + 0x536: 0x3e28, 0x537: 0x3e40, 0x538: 0x4864, 0x539: 0x486a, 0x53a: 0x3d18, 0x53b: 0x3d30, 0x53c: 0x3d20, 0x53d: 0x3d38, 0x53e: 0x3d28, 0x53f: 0x3d40, // Block 0x15, offset 0x540 - 0x540: 0x4852, 0x541: 0x4858, 0x542: 0x3e48, 0x543: 0x3e58, 0x544: 0x3e50, 0x545: 0x3e60, - 0x548: 0x47da, 0x549: 0x47e0, 0x54a: 0x3d48, 0x54b: 0x3d58, - 0x54c: 0x3d50, 0x54d: 0x3d60, 0x550: 0x4864, 0x551: 0x486a, + 0x540: 0x48e8, 0x541: 0x48ee, 0x542: 0x3e48, 0x543: 0x3e58, 0x544: 0x3e50, 0x545: 0x3e60, + 0x548: 0x4870, 0x549: 0x4876, 0x54a: 0x3d48, 0x54b: 0x3d58, + 0x54c: 0x3d50, 0x54d: 0x3d60, 0x550: 0x48fa, 0x551: 0x4900, 0x552: 0x3e80, 0x553: 0x3e98, 0x554: 0x3e88, 0x555: 0x3ea0, 0x556: 0x3e90, 0x557: 0x3ea8, - 0x559: 0x47e6, 0x55b: 0x3d68, 0x55d: 0x3d70, - 0x55f: 0x3d78, 0x560: 0x487c, 0x561: 0x4882, 0x562: 0x497e, 0x563: 0x4996, - 0x564: 0x4986, 0x565: 0x499e, 0x566: 0x498e, 0x567: 0x49a6, 0x568: 0x47ec, 0x569: 0x47f2, - 0x56a: 0x48ee, 0x56b: 0x4906, 0x56c: 0x48f6, 0x56d: 0x490e, 0x56e: 0x48fe, 0x56f: 0x4916, - 0x570: 0x47f8, 0x571: 0x431e, 0x572: 0x3691, 0x573: 0x4324, 0x574: 0x4822, 0x575: 0x432a, - 0x576: 0x36a3, 0x577: 0x4330, 0x578: 0x36c1, 0x579: 0x4336, 0x57a: 0x36d9, 0x57b: 0x433c, - 0x57c: 0x4870, 0x57d: 0x4342, + 0x559: 0x487c, 0x55b: 0x3d68, 0x55d: 0x3d70, + 0x55f: 0x3d78, 0x560: 0x4912, 0x561: 0x4918, 0x562: 0x4a14, 0x563: 0x4a2c, + 0x564: 0x4a1c, 0x565: 0x4a34, 0x566: 0x4a24, 0x567: 0x4a3c, 0x568: 0x4882, 0x569: 0x4888, + 0x56a: 0x4984, 0x56b: 0x499c, 0x56c: 0x498c, 0x56d: 0x49a4, 0x56e: 0x4994, 0x56f: 0x49ac, + 0x570: 0x488e, 0x571: 0x43b4, 0x572: 0x3691, 0x573: 0x43ba, 0x574: 0x48b8, 0x575: 0x43c0, + 0x576: 0x36a3, 0x577: 0x43c6, 0x578: 0x36c1, 0x579: 0x43cc, 0x57a: 0x36d9, 0x57b: 0x43d2, + 0x57c: 0x4906, 0x57d: 0x43d8, // Block 0x16, offset 0x580 0x580: 0x3da0, 0x581: 0x3da8, 0x582: 0x4184, 0x583: 0x41a2, 0x584: 0x418e, 0x585: 0x41ac, 0x586: 0x4198, 0x587: 0x41b6, 0x588: 0x3cd8, 0x589: 0x3ce0, 0x58a: 0x40d0, 0x58b: 0x40ee, @@ -3153,19 +3149,19 @@ var nfcValues = [2944]uint16{ 0x5a4: 0x4206, 0x5a5: 0x4224, 0x5a6: 0x4210, 0x5a7: 0x422e, 0x5a8: 0x3d80, 0x5a9: 0x3d88, 0x5aa: 0x4148, 0x5ab: 0x4166, 0x5ac: 0x4152, 0x5ad: 0x4170, 0x5ae: 0x415c, 0x5af: 0x417a, 0x5b0: 0x3685, 0x5b1: 0x367f, 0x5b2: 0x3d90, 0x5b3: 0x368b, 0x5b4: 0x3d98, - 0x5b6: 0x4810, 0x5b7: 0x3db0, 0x5b8: 0x35f5, 0x5b9: 0x35ef, 0x5ba: 0x35e3, 0x5bb: 0x42ee, + 0x5b6: 0x48a6, 0x5b7: 0x3db0, 0x5b8: 0x35f5, 0x5b9: 0x35ef, 0x5ba: 0x35e3, 0x5bb: 0x4384, 0x5bc: 0x35fb, 0x5bd: 0x8100, 0x5be: 0x01d3, 0x5bf: 0xa100, // Block 0x17, offset 0x5c0 0x5c0: 0x8100, 0x5c1: 0x35a7, 0x5c2: 0x3dd8, 0x5c3: 0x369d, 0x5c4: 0x3de0, - 0x5c6: 0x483a, 0x5c7: 0x3df8, 0x5c8: 0x3601, 0x5c9: 0x42f4, 0x5ca: 0x360d, 0x5cb: 0x42fa, + 0x5c6: 0x48d0, 0x5c7: 0x3df8, 0x5c8: 0x3601, 0x5c9: 0x438a, 0x5ca: 0x360d, 0x5cb: 0x4390, 0x5cc: 0x3619, 0x5cd: 0x3b8f, 0x5ce: 0x3b96, 0x5cf: 0x3b9d, 0x5d0: 0x36b5, 0x5d1: 0x36af, - 0x5d2: 0x3e00, 0x5d3: 0x44e4, 0x5d6: 0x36bb, 0x5d7: 0x3e10, - 0x5d8: 0x3631, 0x5d9: 0x362b, 0x5da: 0x361f, 0x5db: 0x4300, 0x5dd: 0x3ba4, - 0x5de: 0x3bab, 0x5df: 0x3bb2, 0x5e0: 0x36eb, 0x5e1: 0x36e5, 0x5e2: 0x3e68, 0x5e3: 0x44ec, + 0x5d2: 0x3e00, 0x5d3: 0x457a, 0x5d6: 0x36bb, 0x5d7: 0x3e10, + 0x5d8: 0x3631, 0x5d9: 0x362b, 0x5da: 0x361f, 0x5db: 0x4396, 0x5dd: 0x3ba4, + 0x5de: 0x3bab, 0x5df: 0x3bb2, 0x5e0: 0x36eb, 0x5e1: 0x36e5, 0x5e2: 0x3e68, 0x5e3: 0x4582, 0x5e4: 0x36cd, 0x5e5: 0x36d3, 0x5e6: 0x36f1, 0x5e7: 0x3e78, 0x5e8: 0x3661, 0x5e9: 0x365b, - 0x5ea: 0x364f, 0x5eb: 0x430c, 0x5ec: 0x3649, 0x5ed: 0x359b, 0x5ee: 0x42e8, 0x5ef: 0x0081, + 0x5ea: 0x364f, 0x5eb: 0x43a2, 0x5ec: 0x3649, 0x5ed: 0x359b, 0x5ee: 0x437e, 0x5ef: 0x0081, 0x5f2: 0x3eb0, 0x5f3: 0x36f7, 0x5f4: 0x3eb8, - 0x5f6: 0x4888, 0x5f7: 0x3ed0, 0x5f8: 0x363d, 0x5f9: 0x4306, 0x5fa: 0x366d, 0x5fb: 0x4318, + 0x5f6: 0x491e, 0x5f7: 0x3ed0, 0x5f8: 0x363d, 0x5f9: 0x439c, 0x5fa: 0x366d, 0x5fb: 0x43ae, 0x5fc: 0x3679, 0x5fd: 0x4256, 0x5fe: 0xa100, // Block 0x18, offset 0x600 0x601: 0x3c06, 0x603: 0xa000, 0x604: 0x3c0d, 0x605: 0xa000, @@ -3523,8 +3519,8 @@ var nfcSparseValues = [688]valueRange{ {value: 0x8100, lo: 0xb8, hi: 0xb8}, // Block 0x1, offset 0x5 {value: 0x0091, lo: 0x03}, - {value: 0x46e2, lo: 0xa0, hi: 0xa1}, - {value: 0x4714, lo: 0xaf, hi: 0xb0}, + {value: 0x4778, lo: 0xa0, hi: 0xa1}, + {value: 0x47aa, lo: 0xaf, hi: 0xb0}, {value: 0xa000, lo: 0xb7, hi: 0xb7}, // Block 0x2, offset 0x9 {value: 0x0000, lo: 0x01}, @@ -3537,11 +3533,11 @@ var nfcSparseValues = [688]valueRange{ {value: 0xa000, lo: 0x81, hi: 0x81}, {value: 0xa000, lo: 0x85, hi: 0x85}, {value: 0xa000, lo: 0x89, hi: 0x89}, - {value: 0x4840, lo: 0x8a, hi: 0x8a}, - {value: 0x485e, lo: 0x8b, hi: 0x8b}, + {value: 0x48d6, lo: 0x8a, hi: 0x8a}, + {value: 0x48f4, lo: 0x8b, hi: 0x8b}, {value: 0x36c7, lo: 0x8c, hi: 0x8c}, {value: 0x36df, lo: 0x8d, hi: 0x8d}, - {value: 0x4876, lo: 0x8e, hi: 0x8e}, + {value: 0x490c, lo: 0x8e, hi: 0x8e}, {value: 0xa000, lo: 0x92, hi: 0x92}, {value: 0x36fd, lo: 0x93, hi: 0x94}, // Block 0x5, offset 0x18 @@ -3669,7 +3665,7 @@ var nfcSparseValues = [688]valueRange{ {value: 0x812d, lo: 0x92, hi: 0x92}, {value: 0x8132, lo: 0x93, hi: 0x93}, {value: 0x8132, lo: 0x94, hi: 0x94}, - {value: 0x451c, lo: 0x98, hi: 0x9f}, + {value: 0x45b2, lo: 0x98, hi: 0x9f}, // Block 0x12, offset 0x89 {value: 0x0000, lo: 0x02}, {value: 0x8102, lo: 0xbc, hi: 0xbc}, @@ -3680,18 +3676,18 @@ var nfcSparseValues = [688]valueRange{ {value: 0x2c9e, lo: 0x8b, hi: 0x8c}, {value: 0x8104, lo: 0x8d, hi: 0x8d}, {value: 0x9900, lo: 0x97, hi: 0x97}, - {value: 0x455c, lo: 0x9c, hi: 0x9d}, - {value: 0x456c, lo: 0x9f, hi: 0x9f}, + {value: 0x45f2, lo: 0x9c, hi: 0x9d}, + {value: 0x4602, lo: 0x9f, hi: 0x9f}, // Block 0x14, offset 0x93 {value: 0x0000, lo: 0x03}, - {value: 0x4594, lo: 0xb3, hi: 0xb3}, - {value: 0x459c, lo: 0xb6, hi: 0xb6}, + {value: 0x462a, lo: 0xb3, hi: 0xb3}, + {value: 0x4632, lo: 0xb6, hi: 0xb6}, {value: 0x8102, lo: 0xbc, hi: 0xbc}, // Block 0x15, offset 0x97 {value: 0x0008, lo: 0x03}, {value: 0x8104, lo: 0x8d, hi: 0x8d}, - {value: 0x4574, lo: 0x99, hi: 0x9b}, - {value: 0x458c, lo: 0x9e, hi: 0x9e}, + {value: 0x460a, lo: 0x99, hi: 0x9b}, + {value: 0x4622, lo: 0x9e, hi: 0x9e}, // Block 0x16, offset 0x9b {value: 0x0000, lo: 0x01}, {value: 0x8102, lo: 0xbc, hi: 0xbc}, @@ -3706,8 +3702,8 @@ var nfcSparseValues = [688]valueRange{ {value: 0x2cbe, lo: 0x8c, hi: 0x8c}, {value: 0x8104, lo: 0x8d, hi: 0x8d}, {value: 0x9900, lo: 0x96, hi: 0x97}, - {value: 0x45a4, lo: 0x9c, hi: 0x9c}, - {value: 0x45ac, lo: 0x9d, hi: 0x9d}, + {value: 0x463a, lo: 0x9c, hi: 0x9c}, + {value: 0x4642, lo: 0x9d, hi: 0x9d}, // Block 0x19, offset 0xa8 {value: 0x0000, lo: 0x03}, {value: 0xa000, lo: 0x92, hi: 0x92}, @@ -3791,18 +3787,18 @@ var nfcSparseValues = [688]valueRange{ {value: 0x263d, lo: 0xa9, hi: 0xa9}, {value: 0x8126, lo: 0xb1, hi: 0xb1}, {value: 0x8127, lo: 0xb2, hi: 0xb2}, - {value: 0x4a84, lo: 0xb3, hi: 0xb3}, + {value: 0x4a66, lo: 0xb3, hi: 0xb3}, {value: 0x8128, lo: 0xb4, hi: 0xb4}, - {value: 0x4a8d, lo: 0xb5, hi: 0xb5}, - {value: 0x45b4, lo: 0xb6, hi: 0xb6}, + {value: 0x4a6f, lo: 0xb5, hi: 0xb5}, + {value: 0x464a, lo: 0xb6, hi: 0xb6}, {value: 0x8200, lo: 0xb7, hi: 0xb7}, - {value: 0x45bc, lo: 0xb8, hi: 0xb8}, + {value: 0x4652, lo: 0xb8, hi: 0xb8}, {value: 0x8200, lo: 0xb9, hi: 0xb9}, {value: 0x8127, lo: 0xba, hi: 0xbd}, // Block 0x27, offset 0xf5 {value: 0x0000, lo: 0x0b}, {value: 0x8127, lo: 0x80, hi: 0x80}, - {value: 0x4a96, lo: 0x81, hi: 0x81}, + {value: 0x4a78, lo: 0x81, hi: 0x81}, {value: 0x8132, lo: 0x82, hi: 0x83}, {value: 0x8104, lo: 0x84, hi: 0x84}, {value: 0x8132, lo: 0x86, hi: 0x87}, @@ -3979,7 +3975,7 @@ var nfcSparseValues = [688]valueRange{ {value: 0x048b, lo: 0xa9, hi: 0xaa}, // Block 0x45, offset 0x189 {value: 0x0000, lo: 0x01}, - {value: 0x44dd, lo: 0x9c, hi: 0x9c}, + {value: 0x4573, lo: 0x9c, hi: 0x9c}, // Block 0x46, offset 0x18b {value: 0x0000, lo: 0x01}, {value: 0x8132, lo: 0xaf, hi: 0xb1}, @@ -3998,12 +3994,12 @@ var nfcSparseValues = [688]valueRange{ {value: 0x812f, lo: 0xae, hi: 0xaf}, // Block 0x4a, offset 0x197 {value: 0x0000, lo: 0x03}, - {value: 0x4a9f, lo: 0xb3, hi: 0xb3}, - {value: 0x4a9f, lo: 0xb5, hi: 0xb6}, - {value: 0x4a9f, lo: 0xba, hi: 0xbf}, + {value: 0x4a81, lo: 0xb3, hi: 0xb3}, + {value: 0x4a81, lo: 0xb5, hi: 0xb6}, + {value: 0x4a81, lo: 0xba, hi: 0xbf}, // Block 0x4b, offset 0x19b {value: 0x0000, lo: 0x01}, - {value: 0x4a9f, lo: 0x8f, hi: 0xa3}, + {value: 0x4a81, lo: 0x8f, hi: 0xa3}, // Block 0x4c, offset 0x19d {value: 0x0000, lo: 0x01}, {value: 0x8100, lo: 0xae, hi: 0xbe}, @@ -4123,29 +4119,29 @@ var nfcSparseValues = [688]valueRange{ {value: 0xc600, lo: 0x89, hi: 0xa3}, // Block 0x63, offset 0x1fb {value: 0x0006, lo: 0x0d}, - {value: 0x4390, lo: 0x9d, hi: 0x9d}, + {value: 0x4426, lo: 0x9d, hi: 0x9d}, {value: 0x8115, lo: 0x9e, hi: 0x9e}, - {value: 0x4402, lo: 0x9f, hi: 0x9f}, - {value: 0x43f0, lo: 0xaa, hi: 0xab}, - {value: 0x44f4, lo: 0xac, hi: 0xac}, - {value: 0x44fc, lo: 0xad, hi: 0xad}, - {value: 0x4348, lo: 0xae, hi: 0xb1}, - {value: 0x4366, lo: 0xb2, hi: 0xb4}, - {value: 0x437e, lo: 0xb5, hi: 0xb6}, - {value: 0x438a, lo: 0xb8, hi: 0xb8}, - {value: 0x4396, lo: 0xb9, hi: 0xbb}, - {value: 0x43ae, lo: 0xbc, hi: 0xbc}, - {value: 0x43b4, lo: 0xbe, hi: 0xbe}, + {value: 0x4498, lo: 0x9f, hi: 0x9f}, + {value: 0x4486, lo: 0xaa, hi: 0xab}, + {value: 0x458a, lo: 0xac, hi: 0xac}, + {value: 0x4592, lo: 0xad, hi: 0xad}, + {value: 0x43de, lo: 0xae, hi: 0xb1}, + {value: 0x43fc, lo: 0xb2, hi: 0xb4}, + {value: 0x4414, lo: 0xb5, hi: 0xb6}, + {value: 0x4420, lo: 0xb8, hi: 0xb8}, + {value: 0x442c, lo: 0xb9, hi: 0xbb}, + {value: 0x4444, lo: 0xbc, hi: 0xbc}, + {value: 0x444a, lo: 0xbe, hi: 0xbe}, // Block 0x64, offset 0x209 {value: 0x0006, lo: 0x08}, - {value: 0x43ba, lo: 0x80, hi: 0x81}, - {value: 0x43c6, lo: 0x83, hi: 0x84}, - {value: 0x43d8, lo: 0x86, hi: 0x89}, - {value: 0x43fc, lo: 0x8a, hi: 0x8a}, - {value: 0x4378, lo: 0x8b, hi: 0x8b}, - {value: 0x4360, lo: 0x8c, hi: 0x8c}, - {value: 0x43a8, lo: 0x8d, hi: 0x8d}, - {value: 0x43d2, lo: 0x8e, hi: 0x8e}, + {value: 0x4450, lo: 0x80, hi: 0x81}, + {value: 0x445c, lo: 0x83, hi: 0x84}, + {value: 0x446e, lo: 0x86, hi: 0x89}, + {value: 0x4492, lo: 0x8a, hi: 0x8a}, + {value: 0x440e, lo: 0x8b, hi: 0x8b}, + {value: 0x43f6, lo: 0x8c, hi: 0x8c}, + {value: 0x443e, lo: 0x8d, hi: 0x8d}, + {value: 0x4468, lo: 0x8e, hi: 0x8e}, // Block 0x65, offset 0x212 {value: 0x0000, lo: 0x02}, {value: 0x8100, lo: 0xa4, hi: 0xa5}, @@ -4183,16 +4179,16 @@ var nfcSparseValues = [688]valueRange{ {value: 0x8100, lo: 0xb5, hi: 0xba}, // Block 0x6e, offset 0x22c {value: 0x0000, lo: 0x04}, - {value: 0x4a9f, lo: 0x9e, hi: 0x9f}, - {value: 0x4a9f, lo: 0xa3, hi: 0xa3}, - {value: 0x4a9f, lo: 0xa5, hi: 0xa6}, - {value: 0x4a9f, lo: 0xaa, hi: 0xaf}, + {value: 0x4a81, lo: 0x9e, hi: 0x9f}, + {value: 0x4a81, lo: 0xa3, hi: 0xa3}, + {value: 0x4a81, lo: 0xa5, hi: 0xa6}, + {value: 0x4a81, lo: 0xaa, hi: 0xaf}, // Block 0x6f, offset 0x231 {value: 0x0000, lo: 0x05}, - {value: 0x4a9f, lo: 0x82, hi: 0x87}, - {value: 0x4a9f, lo: 0x8a, hi: 0x8f}, - {value: 0x4a9f, lo: 0x92, hi: 0x97}, - {value: 0x4a9f, lo: 0x9a, hi: 0x9c}, + {value: 0x4a81, lo: 0x82, hi: 0x87}, + {value: 0x4a81, lo: 0x8a, hi: 0x8f}, + {value: 0x4a81, lo: 0x92, hi: 0x97}, + {value: 0x4a81, lo: 0x9a, hi: 0x9c}, {value: 0x8100, lo: 0xa3, hi: 0xa3}, // Block 0x70, offset 0x237 {value: 0x0000, lo: 0x01}, @@ -4299,13 +4295,13 @@ var nfcSparseValues = [688]valueRange{ {value: 0x8101, lo: 0x9e, hi: 0x9e}, // Block 0x86, offset 0x288 {value: 0x0000, lo: 0x0c}, - {value: 0x45cc, lo: 0x9e, hi: 0x9e}, - {value: 0x45d6, lo: 0x9f, hi: 0x9f}, - {value: 0x460a, lo: 0xa0, hi: 0xa0}, - {value: 0x4618, lo: 0xa1, hi: 0xa1}, - {value: 0x4626, lo: 0xa2, hi: 0xa2}, - {value: 0x4634, lo: 0xa3, hi: 0xa3}, - {value: 0x4642, lo: 0xa4, hi: 0xa4}, + {value: 0x4662, lo: 0x9e, hi: 0x9e}, + {value: 0x466c, lo: 0x9f, hi: 0x9f}, + {value: 0x46a0, lo: 0xa0, hi: 0xa0}, + {value: 0x46ae, lo: 0xa1, hi: 0xa1}, + {value: 0x46bc, lo: 0xa2, hi: 0xa2}, + {value: 0x46ca, lo: 0xa3, hi: 0xa3}, + {value: 0x46d8, lo: 0xa4, hi: 0xa4}, {value: 0x812b, lo: 0xa5, hi: 0xa6}, {value: 0x8101, lo: 0xa7, hi: 0xa9}, {value: 0x8130, lo: 0xad, hi: 0xad}, @@ -4317,14 +4313,14 @@ var nfcSparseValues = [688]valueRange{ {value: 0x8132, lo: 0x85, hi: 0x89}, {value: 0x812d, lo: 0x8a, hi: 0x8b}, {value: 0x8132, lo: 0xaa, hi: 0xad}, - {value: 0x45e0, lo: 0xbb, hi: 0xbb}, - {value: 0x45ea, lo: 0xbc, hi: 0xbc}, - {value: 0x4650, lo: 0xbd, hi: 0xbd}, - {value: 0x466c, lo: 0xbe, hi: 0xbe}, - {value: 0x465e, lo: 0xbf, hi: 0xbf}, + {value: 0x4676, lo: 0xbb, hi: 0xbb}, + {value: 0x4680, lo: 0xbc, hi: 0xbc}, + {value: 0x46e6, lo: 0xbd, hi: 0xbd}, + {value: 0x4702, lo: 0xbe, hi: 0xbe}, + {value: 0x46f4, lo: 0xbf, hi: 0xbf}, // Block 0x88, offset 0x29f {value: 0x0000, lo: 0x01}, - {value: 0x467a, lo: 0x80, hi: 0x80}, + {value: 0x4710, lo: 0x80, hi: 0x80}, // Block 0x89, offset 0x2a1 {value: 0x0000, lo: 0x01}, {value: 0x8132, lo: 0x82, hi: 0x84}, @@ -4517,7 +4513,7 @@ func (t *nfkcTrie) lookupStringUnsafe(s string) uint16 { return 0 } -// nfkcTrie. Total size: 16994 bytes (16.60 KiB). Checksum: c3ed54ee046f3c46. +// nfkcTrie. Total size: 16994 bytes (16.60 KiB). Checksum: 146925fc21092b17. type nfkcTrie struct{} func newNfkcTrie(i int) *nfkcTrie { @@ -4553,22 +4549,22 @@ var nfkcValues = [5888]uint16{ 0x76: 0xa000, 0x77: 0xa000, 0x78: 0xa000, 0x79: 0xa000, 0x7a: 0xa000, // Block 0x2, offset 0x80 // Block 0x3, offset 0xc0 - 0xc0: 0x2f6f, 0xc1: 0x2f74, 0xc2: 0x4688, 0xc3: 0x2f79, 0xc4: 0x4697, 0xc5: 0x469c, - 0xc6: 0xa000, 0xc7: 0x46a6, 0xc8: 0x2fe2, 0xc9: 0x2fe7, 0xca: 0x46ab, 0xcb: 0x2ffb, - 0xcc: 0x306e, 0xcd: 0x3073, 0xce: 0x3078, 0xcf: 0x46bf, 0xd1: 0x3104, - 0xd2: 0x3127, 0xd3: 0x312c, 0xd4: 0x46c9, 0xd5: 0x46ce, 0xd6: 0x46dd, - 0xd8: 0xa000, 0xd9: 0x31b3, 0xda: 0x31b8, 0xdb: 0x31bd, 0xdc: 0x470f, 0xdd: 0x3235, - 0xe0: 0x327b, 0xe1: 0x3280, 0xe2: 0x4719, 0xe3: 0x3285, - 0xe4: 0x4728, 0xe5: 0x472d, 0xe6: 0xa000, 0xe7: 0x4737, 0xe8: 0x32ee, 0xe9: 0x32f3, - 0xea: 0x473c, 0xeb: 0x3307, 0xec: 0x337f, 0xed: 0x3384, 0xee: 0x3389, 0xef: 0x4750, - 0xf1: 0x3415, 0xf2: 0x3438, 0xf3: 0x343d, 0xf4: 0x475a, 0xf5: 0x475f, - 0xf6: 0x476e, 0xf8: 0xa000, 0xf9: 0x34c9, 0xfa: 0x34ce, 0xfb: 0x34d3, - 0xfc: 0x47a0, 0xfd: 0x3550, 0xff: 0x3569, + 0xc0: 0x2f6f, 0xc1: 0x2f74, 0xc2: 0x471e, 0xc3: 0x2f79, 0xc4: 0x472d, 0xc5: 0x4732, + 0xc6: 0xa000, 0xc7: 0x473c, 0xc8: 0x2fe2, 0xc9: 0x2fe7, 0xca: 0x4741, 0xcb: 0x2ffb, + 0xcc: 0x306e, 0xcd: 0x3073, 0xce: 0x3078, 0xcf: 0x4755, 0xd1: 0x3104, + 0xd2: 0x3127, 0xd3: 0x312c, 0xd4: 0x475f, 0xd5: 0x4764, 0xd6: 0x4773, + 0xd8: 0xa000, 0xd9: 0x31b3, 0xda: 0x31b8, 0xdb: 0x31bd, 0xdc: 0x47a5, 0xdd: 0x3235, + 0xe0: 0x327b, 0xe1: 0x3280, 0xe2: 0x47af, 0xe3: 0x3285, + 0xe4: 0x47be, 0xe5: 0x47c3, 0xe6: 0xa000, 0xe7: 0x47cd, 0xe8: 0x32ee, 0xe9: 0x32f3, + 0xea: 0x47d2, 0xeb: 0x3307, 0xec: 0x337f, 0xed: 0x3384, 0xee: 0x3389, 0xef: 0x47e6, + 0xf1: 0x3415, 0xf2: 0x3438, 0xf3: 0x343d, 0xf4: 0x47f0, 0xf5: 0x47f5, + 0xf6: 0x4804, 0xf8: 0xa000, 0xf9: 0x34c9, 0xfa: 0x34ce, 0xfb: 0x34d3, + 0xfc: 0x4836, 0xfd: 0x3550, 0xff: 0x3569, // Block 0x4, offset 0x100 - 0x100: 0x2f7e, 0x101: 0x328a, 0x102: 0x468d, 0x103: 0x471e, 0x104: 0x2f9c, 0x105: 0x32a8, + 0x100: 0x2f7e, 0x101: 0x328a, 0x102: 0x4723, 0x103: 0x47b4, 0x104: 0x2f9c, 0x105: 0x32a8, 0x106: 0x2fb0, 0x107: 0x32bc, 0x108: 0x2fb5, 0x109: 0x32c1, 0x10a: 0x2fba, 0x10b: 0x32c6, 0x10c: 0x2fbf, 0x10d: 0x32cb, 0x10e: 0x2fc9, 0x10f: 0x32d5, - 0x112: 0x46b0, 0x113: 0x4741, 0x114: 0x2ff1, 0x115: 0x32fd, 0x116: 0x2ff6, 0x117: 0x3302, + 0x112: 0x4746, 0x113: 0x47d7, 0x114: 0x2ff1, 0x115: 0x32fd, 0x116: 0x2ff6, 0x117: 0x3302, 0x118: 0x3014, 0x119: 0x3320, 0x11a: 0x3005, 0x11b: 0x3311, 0x11c: 0x302d, 0x11d: 0x3339, 0x11e: 0x3037, 0x11f: 0x3343, 0x120: 0x303c, 0x121: 0x3348, 0x122: 0x3046, 0x123: 0x3352, 0x124: 0x304b, 0x125: 0x3357, 0x128: 0x307d, 0x129: 0x338e, @@ -4579,12 +4575,12 @@ var nfkcValues = [5888]uint16{ // Block 0x5, offset 0x140 0x140: 0x1c34, 0x143: 0x30ff, 0x144: 0x3410, 0x145: 0x3118, 0x146: 0x3429, 0x147: 0x310e, 0x148: 0x341f, 0x149: 0x1c5c, - 0x14c: 0x46d3, 0x14d: 0x4764, 0x14e: 0x3131, 0x14f: 0x3442, 0x150: 0x313b, 0x151: 0x344c, + 0x14c: 0x4769, 0x14d: 0x47fa, 0x14e: 0x3131, 0x14f: 0x3442, 0x150: 0x313b, 0x151: 0x344c, 0x154: 0x3159, 0x155: 0x346a, 0x156: 0x3172, 0x157: 0x3483, - 0x158: 0x3163, 0x159: 0x3474, 0x15a: 0x46f6, 0x15b: 0x4787, 0x15c: 0x317c, 0x15d: 0x348d, - 0x15e: 0x318b, 0x15f: 0x349c, 0x160: 0x46fb, 0x161: 0x478c, 0x162: 0x31a4, 0x163: 0x34ba, - 0x164: 0x3195, 0x165: 0x34ab, 0x168: 0x4705, 0x169: 0x4796, - 0x16a: 0x470a, 0x16b: 0x479b, 0x16c: 0x31c2, 0x16d: 0x34d8, 0x16e: 0x31cc, 0x16f: 0x34e2, + 0x158: 0x3163, 0x159: 0x3474, 0x15a: 0x478c, 0x15b: 0x481d, 0x15c: 0x317c, 0x15d: 0x348d, + 0x15e: 0x318b, 0x15f: 0x349c, 0x160: 0x4791, 0x161: 0x4822, 0x162: 0x31a4, 0x163: 0x34ba, + 0x164: 0x3195, 0x165: 0x34ab, 0x168: 0x479b, 0x169: 0x482c, + 0x16a: 0x47a0, 0x16b: 0x4831, 0x16c: 0x31c2, 0x16d: 0x34d8, 0x16e: 0x31cc, 0x16f: 0x34e2, 0x170: 0x31d1, 0x171: 0x34e7, 0x172: 0x31ef, 0x173: 0x3505, 0x174: 0x3212, 0x175: 0x3528, 0x176: 0x323a, 0x177: 0x3555, 0x178: 0x324e, 0x179: 0x325d, 0x17a: 0x357d, 0x17b: 0x3267, 0x17c: 0x3587, 0x17d: 0x326c, 0x17e: 0x358c, 0x17f: 0x00a7, @@ -4596,7 +4592,7 @@ var nfkcValues = [5888]uint16{ 0x198: 0x3b57, 0x199: 0x39d6, 0x19a: 0x3b65, 0x19b: 0x39c1, 0x19c: 0x3b50, 0x19e: 0x38b0, 0x19f: 0x3a3f, 0x1a0: 0x38a9, 0x1a1: 0x3a38, 0x1a2: 0x35b3, 0x1a3: 0x35c5, 0x1a6: 0x3041, 0x1a7: 0x334d, 0x1a8: 0x30be, 0x1a9: 0x33cf, - 0x1aa: 0x46ec, 0x1ab: 0x477d, 0x1ac: 0x3990, 0x1ad: 0x3b1f, 0x1ae: 0x35d7, 0x1af: 0x35dd, + 0x1aa: 0x4782, 0x1ab: 0x4813, 0x1ac: 0x3990, 0x1ad: 0x3b1f, 0x1ae: 0x35d7, 0x1af: 0x35dd, 0x1b0: 0x33c5, 0x1b1: 0x1942, 0x1b2: 0x1945, 0x1b3: 0x19cf, 0x1b4: 0x3028, 0x1b5: 0x3334, 0x1b8: 0x30fa, 0x1b9: 0x340b, 0x1ba: 0x38b7, 0x1bb: 0x3a46, 0x1bc: 0x35ad, 0x1bd: 0x35bf, 0x1be: 0x35b9, 0x1bf: 0x35cb, @@ -4607,8 +4603,8 @@ var nfkcValues = [5888]uint16{ 0x1d2: 0x316d, 0x1d3: 0x347e, 0x1d4: 0x31db, 0x1d5: 0x34f1, 0x1d6: 0x31e0, 0x1d7: 0x34f6, 0x1d8: 0x3186, 0x1d9: 0x3497, 0x1da: 0x319f, 0x1db: 0x34b5, 0x1de: 0x305a, 0x1df: 0x3366, - 0x1e6: 0x4692, 0x1e7: 0x4723, 0x1e8: 0x46ba, 0x1e9: 0x474b, - 0x1ea: 0x395f, 0x1eb: 0x3aee, 0x1ec: 0x393c, 0x1ed: 0x3acb, 0x1ee: 0x46d8, 0x1ef: 0x4769, + 0x1e6: 0x4728, 0x1e7: 0x47b9, 0x1e8: 0x4750, 0x1e9: 0x47e1, + 0x1ea: 0x395f, 0x1eb: 0x3aee, 0x1ec: 0x393c, 0x1ed: 0x3acb, 0x1ee: 0x476e, 0x1ef: 0x47ff, 0x1f0: 0x3958, 0x1f1: 0x3ae7, 0x1f2: 0x3244, 0x1f3: 0x355f, // Block 0x8, offset 0x200 0x200: 0x9932, 0x201: 0x9932, 0x202: 0x9932, 0x203: 0x9932, 0x204: 0x9932, 0x205: 0x8132, @@ -4623,7 +4619,7 @@ var nfkcValues = [5888]uint16{ 0x236: 0x8101, 0x237: 0x8101, 0x238: 0x9901, 0x239: 0x812d, 0x23a: 0x812d, 0x23b: 0x812d, 0x23c: 0x812d, 0x23d: 0x8132, 0x23e: 0x8132, 0x23f: 0x8132, // Block 0x9, offset 0x240 - 0x240: 0x49ae, 0x241: 0x49b3, 0x242: 0x9932, 0x243: 0x49b8, 0x244: 0x4a71, 0x245: 0x9936, + 0x240: 0x4a44, 0x241: 0x4a49, 0x242: 0x9932, 0x243: 0x4a4e, 0x244: 0x4a53, 0x245: 0x9936, 0x246: 0x8132, 0x247: 0x812d, 0x248: 0x812d, 0x249: 0x812d, 0x24a: 0x8132, 0x24b: 0x8132, 0x24c: 0x8132, 0x24d: 0x812d, 0x24e: 0x812d, 0x250: 0x8132, 0x251: 0x8132, 0x252: 0x8132, 0x253: 0x812d, 0x254: 0x812d, 0x255: 0x812d, 0x256: 0x812d, 0x257: 0x8132, @@ -4635,22 +4631,22 @@ var nfkcValues = [5888]uint16{ 0x27a: 0x42a5, 0x27e: 0x0037, // Block 0xa, offset 0x280 - 0x284: 0x425a, 0x285: 0x447b, + 0x284: 0x425a, 0x285: 0x4511, 0x286: 0x35e9, 0x287: 0x00ce, 0x288: 0x3607, 0x289: 0x3613, 0x28a: 0x3625, 0x28c: 0x3643, 0x28e: 0x3655, 0x28f: 0x3673, 0x290: 0x3e08, 0x291: 0xa000, 0x295: 0xa000, 0x297: 0xa000, 0x299: 0xa000, 0x29f: 0xa000, 0x2a1: 0xa000, 0x2a5: 0xa000, 0x2a9: 0xa000, - 0x2aa: 0x3637, 0x2ab: 0x3667, 0x2ac: 0x47fe, 0x2ad: 0x3697, 0x2ae: 0x4828, 0x2af: 0x36a9, + 0x2aa: 0x3637, 0x2ab: 0x3667, 0x2ac: 0x4894, 0x2ad: 0x3697, 0x2ae: 0x48be, 0x2af: 0x36a9, 0x2b0: 0x3e70, 0x2b1: 0xa000, 0x2b5: 0xa000, 0x2b7: 0xa000, 0x2b9: 0xa000, 0x2bf: 0xa000, // Block 0xb, offset 0x2c0 0x2c1: 0xa000, 0x2c5: 0xa000, - 0x2c9: 0xa000, 0x2ca: 0x4840, 0x2cb: 0x485e, - 0x2cc: 0x36c7, 0x2cd: 0x36df, 0x2ce: 0x4876, 0x2d0: 0x01be, 0x2d1: 0x01d0, - 0x2d2: 0x01ac, 0x2d3: 0x430c, 0x2d4: 0x4312, 0x2d5: 0x01fa, 0x2d6: 0x01e8, + 0x2c9: 0xa000, 0x2ca: 0x48d6, 0x2cb: 0x48f4, + 0x2cc: 0x36c7, 0x2cd: 0x36df, 0x2ce: 0x490c, 0x2d0: 0x01be, 0x2d1: 0x01d0, + 0x2d2: 0x01ac, 0x2d3: 0x43a2, 0x2d4: 0x43a8, 0x2d5: 0x01fa, 0x2d6: 0x01e8, 0x2f0: 0x01d6, 0x2f1: 0x01eb, 0x2f2: 0x01ee, 0x2f4: 0x0188, 0x2f5: 0x01c7, 0x2f9: 0x01a6, // Block 0xc, offset 0x300 @@ -4730,15 +4726,15 @@ var nfkcValues = [5888]uint16{ 0x4e4: 0x305f, 0x4e5: 0x336b, 0x4e6: 0x3055, 0x4e7: 0x3361, 0x4e8: 0x3064, 0x4e9: 0x3370, 0x4ea: 0x3069, 0x4eb: 0x3375, 0x4ec: 0x30af, 0x4ed: 0x33bb, 0x4ee: 0x390b, 0x4ef: 0x3a9a, 0x4f0: 0x30b9, 0x4f1: 0x33ca, 0x4f2: 0x30c3, 0x4f3: 0x33d4, 0x4f4: 0x30cd, 0x4f5: 0x33de, - 0x4f6: 0x46c4, 0x4f7: 0x4755, 0x4f8: 0x3912, 0x4f9: 0x3aa1, 0x4fa: 0x30e6, 0x4fb: 0x33f7, + 0x4f6: 0x475a, 0x4f7: 0x47eb, 0x4f8: 0x3912, 0x4f9: 0x3aa1, 0x4fa: 0x30e6, 0x4fb: 0x33f7, 0x4fc: 0x30e1, 0x4fd: 0x33f2, 0x4fe: 0x30eb, 0x4ff: 0x33fc, // Block 0x14, offset 0x500 0x500: 0x30f0, 0x501: 0x3401, 0x502: 0x30f5, 0x503: 0x3406, 0x504: 0x3109, 0x505: 0x341a, 0x506: 0x3113, 0x507: 0x3424, 0x508: 0x3122, 0x509: 0x3433, 0x50a: 0x311d, 0x50b: 0x342e, 0x50c: 0x3935, 0x50d: 0x3ac4, 0x50e: 0x3943, 0x50f: 0x3ad2, 0x510: 0x394a, 0x511: 0x3ad9, 0x512: 0x3951, 0x513: 0x3ae0, 0x514: 0x314f, 0x515: 0x3460, 0x516: 0x3154, 0x517: 0x3465, - 0x518: 0x315e, 0x519: 0x346f, 0x51a: 0x46f1, 0x51b: 0x4782, 0x51c: 0x3997, 0x51d: 0x3b26, - 0x51e: 0x3177, 0x51f: 0x3488, 0x520: 0x3181, 0x521: 0x3492, 0x522: 0x4700, 0x523: 0x4791, + 0x518: 0x315e, 0x519: 0x346f, 0x51a: 0x4787, 0x51b: 0x4818, 0x51c: 0x3997, 0x51d: 0x3b26, + 0x51e: 0x3177, 0x51f: 0x3488, 0x520: 0x3181, 0x521: 0x3492, 0x522: 0x4796, 0x523: 0x4827, 0x524: 0x399e, 0x525: 0x3b2d, 0x526: 0x39a5, 0x527: 0x3b34, 0x528: 0x39ac, 0x529: 0x3b3b, 0x52a: 0x3190, 0x52b: 0x34a1, 0x52c: 0x319a, 0x52d: 0x34b0, 0x52e: 0x31ae, 0x52f: 0x34c4, 0x530: 0x31a9, 0x531: 0x34bf, 0x532: 0x31ea, 0x533: 0x3500, 0x534: 0x31f9, 0x535: 0x350f, @@ -4750,16 +4746,16 @@ var nfkcValues = [5888]uint16{ 0x54c: 0x322b, 0x54d: 0x3546, 0x54e: 0x3249, 0x54f: 0x3564, 0x550: 0x3262, 0x551: 0x3582, 0x552: 0x3271, 0x553: 0x3591, 0x554: 0x3276, 0x555: 0x3596, 0x556: 0x337a, 0x557: 0x34a6, 0x558: 0x3537, 0x559: 0x3573, 0x55a: 0x1be0, 0x55b: 0x42d7, - 0x560: 0x46a1, 0x561: 0x4732, 0x562: 0x2f83, 0x563: 0x328f, + 0x560: 0x4737, 0x561: 0x47c8, 0x562: 0x2f83, 0x563: 0x328f, 0x564: 0x3878, 0x565: 0x3a07, 0x566: 0x3871, 0x567: 0x3a00, 0x568: 0x3886, 0x569: 0x3a15, 0x56a: 0x387f, 0x56b: 0x3a0e, 0x56c: 0x38be, 0x56d: 0x3a4d, 0x56e: 0x3894, 0x56f: 0x3a23, 0x570: 0x388d, 0x571: 0x3a1c, 0x572: 0x38a2, 0x573: 0x3a31, 0x574: 0x389b, 0x575: 0x3a2a, - 0x576: 0x38c5, 0x577: 0x3a54, 0x578: 0x46b5, 0x579: 0x4746, 0x57a: 0x3000, 0x57b: 0x330c, + 0x576: 0x38c5, 0x577: 0x3a54, 0x578: 0x474b, 0x579: 0x47dc, 0x57a: 0x3000, 0x57b: 0x330c, 0x57c: 0x2fec, 0x57d: 0x32f8, 0x57e: 0x38da, 0x57f: 0x3a69, // Block 0x16, offset 0x580 0x580: 0x38d3, 0x581: 0x3a62, 0x582: 0x38e8, 0x583: 0x3a77, 0x584: 0x38e1, 0x585: 0x3a70, 0x586: 0x38fd, 0x587: 0x3a8c, 0x588: 0x3091, 0x589: 0x339d, 0x58a: 0x30a5, 0x58b: 0x33b1, - 0x58c: 0x46e7, 0x58d: 0x4778, 0x58e: 0x3136, 0x58f: 0x3447, 0x590: 0x3920, 0x591: 0x3aaf, + 0x58c: 0x477d, 0x58d: 0x480e, 0x58e: 0x3136, 0x58f: 0x3447, 0x590: 0x3920, 0x591: 0x3aaf, 0x592: 0x3919, 0x593: 0x3aa8, 0x594: 0x392e, 0x595: 0x3abd, 0x596: 0x3927, 0x597: 0x3ab6, 0x598: 0x3989, 0x599: 0x3b18, 0x59a: 0x396d, 0x59b: 0x3afc, 0x59c: 0x3966, 0x59d: 0x3af5, 0x59e: 0x397b, 0x59f: 0x3b0a, 0x5a0: 0x3974, 0x5a1: 0x3b03, 0x5a2: 0x3982, 0x5a3: 0x3b11, @@ -4768,29 +4764,29 @@ var nfkcValues = [5888]uint16{ 0x5b0: 0x39f9, 0x5b1: 0x3b88, 0x5b2: 0x3230, 0x5b3: 0x354b, 0x5b4: 0x3258, 0x5b5: 0x3578, 0x5b6: 0x3253, 0x5b7: 0x356e, 0x5b8: 0x323f, 0x5b9: 0x355a, // Block 0x17, offset 0x5c0 - 0x5c0: 0x4804, 0x5c1: 0x480a, 0x5c2: 0x491e, 0x5c3: 0x4936, 0x5c4: 0x4926, 0x5c5: 0x493e, - 0x5c6: 0x492e, 0x5c7: 0x4946, 0x5c8: 0x47aa, 0x5c9: 0x47b0, 0x5ca: 0x488e, 0x5cb: 0x48a6, - 0x5cc: 0x4896, 0x5cd: 0x48ae, 0x5ce: 0x489e, 0x5cf: 0x48b6, 0x5d0: 0x4816, 0x5d1: 0x481c, + 0x5c0: 0x489a, 0x5c1: 0x48a0, 0x5c2: 0x49b4, 0x5c3: 0x49cc, 0x5c4: 0x49bc, 0x5c5: 0x49d4, + 0x5c6: 0x49c4, 0x5c7: 0x49dc, 0x5c8: 0x4840, 0x5c9: 0x4846, 0x5ca: 0x4924, 0x5cb: 0x493c, + 0x5cc: 0x492c, 0x5cd: 0x4944, 0x5ce: 0x4934, 0x5cf: 0x494c, 0x5d0: 0x48ac, 0x5d1: 0x48b2, 0x5d2: 0x3db8, 0x5d3: 0x3dc8, 0x5d4: 0x3dc0, 0x5d5: 0x3dd0, - 0x5d8: 0x47b6, 0x5d9: 0x47bc, 0x5da: 0x3ce8, 0x5db: 0x3cf8, 0x5dc: 0x3cf0, 0x5dd: 0x3d00, - 0x5e0: 0x482e, 0x5e1: 0x4834, 0x5e2: 0x494e, 0x5e3: 0x4966, - 0x5e4: 0x4956, 0x5e5: 0x496e, 0x5e6: 0x495e, 0x5e7: 0x4976, 0x5e8: 0x47c2, 0x5e9: 0x47c8, - 0x5ea: 0x48be, 0x5eb: 0x48d6, 0x5ec: 0x48c6, 0x5ed: 0x48de, 0x5ee: 0x48ce, 0x5ef: 0x48e6, - 0x5f0: 0x4846, 0x5f1: 0x484c, 0x5f2: 0x3e18, 0x5f3: 0x3e30, 0x5f4: 0x3e20, 0x5f5: 0x3e38, - 0x5f6: 0x3e28, 0x5f7: 0x3e40, 0x5f8: 0x47ce, 0x5f9: 0x47d4, 0x5fa: 0x3d18, 0x5fb: 0x3d30, + 0x5d8: 0x484c, 0x5d9: 0x4852, 0x5da: 0x3ce8, 0x5db: 0x3cf8, 0x5dc: 0x3cf0, 0x5dd: 0x3d00, + 0x5e0: 0x48c4, 0x5e1: 0x48ca, 0x5e2: 0x49e4, 0x5e3: 0x49fc, + 0x5e4: 0x49ec, 0x5e5: 0x4a04, 0x5e6: 0x49f4, 0x5e7: 0x4a0c, 0x5e8: 0x4858, 0x5e9: 0x485e, + 0x5ea: 0x4954, 0x5eb: 0x496c, 0x5ec: 0x495c, 0x5ed: 0x4974, 0x5ee: 0x4964, 0x5ef: 0x497c, + 0x5f0: 0x48dc, 0x5f1: 0x48e2, 0x5f2: 0x3e18, 0x5f3: 0x3e30, 0x5f4: 0x3e20, 0x5f5: 0x3e38, + 0x5f6: 0x3e28, 0x5f7: 0x3e40, 0x5f8: 0x4864, 0x5f9: 0x486a, 0x5fa: 0x3d18, 0x5fb: 0x3d30, 0x5fc: 0x3d20, 0x5fd: 0x3d38, 0x5fe: 0x3d28, 0x5ff: 0x3d40, // Block 0x18, offset 0x600 - 0x600: 0x4852, 0x601: 0x4858, 0x602: 0x3e48, 0x603: 0x3e58, 0x604: 0x3e50, 0x605: 0x3e60, - 0x608: 0x47da, 0x609: 0x47e0, 0x60a: 0x3d48, 0x60b: 0x3d58, - 0x60c: 0x3d50, 0x60d: 0x3d60, 0x610: 0x4864, 0x611: 0x486a, + 0x600: 0x48e8, 0x601: 0x48ee, 0x602: 0x3e48, 0x603: 0x3e58, 0x604: 0x3e50, 0x605: 0x3e60, + 0x608: 0x4870, 0x609: 0x4876, 0x60a: 0x3d48, 0x60b: 0x3d58, + 0x60c: 0x3d50, 0x60d: 0x3d60, 0x610: 0x48fa, 0x611: 0x4900, 0x612: 0x3e80, 0x613: 0x3e98, 0x614: 0x3e88, 0x615: 0x3ea0, 0x616: 0x3e90, 0x617: 0x3ea8, - 0x619: 0x47e6, 0x61b: 0x3d68, 0x61d: 0x3d70, - 0x61f: 0x3d78, 0x620: 0x487c, 0x621: 0x4882, 0x622: 0x497e, 0x623: 0x4996, - 0x624: 0x4986, 0x625: 0x499e, 0x626: 0x498e, 0x627: 0x49a6, 0x628: 0x47ec, 0x629: 0x47f2, - 0x62a: 0x48ee, 0x62b: 0x4906, 0x62c: 0x48f6, 0x62d: 0x490e, 0x62e: 0x48fe, 0x62f: 0x4916, - 0x630: 0x47f8, 0x631: 0x431e, 0x632: 0x3691, 0x633: 0x4324, 0x634: 0x4822, 0x635: 0x432a, - 0x636: 0x36a3, 0x637: 0x4330, 0x638: 0x36c1, 0x639: 0x4336, 0x63a: 0x36d9, 0x63b: 0x433c, - 0x63c: 0x4870, 0x63d: 0x4342, + 0x619: 0x487c, 0x61b: 0x3d68, 0x61d: 0x3d70, + 0x61f: 0x3d78, 0x620: 0x4912, 0x621: 0x4918, 0x622: 0x4a14, 0x623: 0x4a2c, + 0x624: 0x4a1c, 0x625: 0x4a34, 0x626: 0x4a24, 0x627: 0x4a3c, 0x628: 0x4882, 0x629: 0x4888, + 0x62a: 0x4984, 0x62b: 0x499c, 0x62c: 0x498c, 0x62d: 0x49a4, 0x62e: 0x4994, 0x62f: 0x49ac, + 0x630: 0x488e, 0x631: 0x43b4, 0x632: 0x3691, 0x633: 0x43ba, 0x634: 0x48b8, 0x635: 0x43c0, + 0x636: 0x36a3, 0x637: 0x43c6, 0x638: 0x36c1, 0x639: 0x43cc, 0x63a: 0x36d9, 0x63b: 0x43d2, + 0x63c: 0x4906, 0x63d: 0x43d8, // Block 0x19, offset 0x640 0x640: 0x3da0, 0x641: 0x3da8, 0x642: 0x4184, 0x643: 0x41a2, 0x644: 0x418e, 0x645: 0x41ac, 0x646: 0x4198, 0x647: 0x41b6, 0x648: 0x3cd8, 0x649: 0x3ce0, 0x64a: 0x40d0, 0x64b: 0x40ee, @@ -4801,19 +4797,19 @@ var nfkcValues = [5888]uint16{ 0x664: 0x4206, 0x665: 0x4224, 0x666: 0x4210, 0x667: 0x422e, 0x668: 0x3d80, 0x669: 0x3d88, 0x66a: 0x4148, 0x66b: 0x4166, 0x66c: 0x4152, 0x66d: 0x4170, 0x66e: 0x415c, 0x66f: 0x417a, 0x670: 0x3685, 0x671: 0x367f, 0x672: 0x3d90, 0x673: 0x368b, 0x674: 0x3d98, - 0x676: 0x4810, 0x677: 0x3db0, 0x678: 0x35f5, 0x679: 0x35ef, 0x67a: 0x35e3, 0x67b: 0x42ee, + 0x676: 0x48a6, 0x677: 0x3db0, 0x678: 0x35f5, 0x679: 0x35ef, 0x67a: 0x35e3, 0x67b: 0x4384, 0x67c: 0x35fb, 0x67d: 0x4287, 0x67e: 0x01d3, 0x67f: 0x4287, // Block 0x1a, offset 0x680 - 0x680: 0x42a0, 0x681: 0x4482, 0x682: 0x3dd8, 0x683: 0x369d, 0x684: 0x3de0, - 0x686: 0x483a, 0x687: 0x3df8, 0x688: 0x3601, 0x689: 0x42f4, 0x68a: 0x360d, 0x68b: 0x42fa, - 0x68c: 0x3619, 0x68d: 0x4489, 0x68e: 0x4490, 0x68f: 0x4497, 0x690: 0x36b5, 0x691: 0x36af, - 0x692: 0x3e00, 0x693: 0x44e4, 0x696: 0x36bb, 0x697: 0x3e10, - 0x698: 0x3631, 0x699: 0x362b, 0x69a: 0x361f, 0x69b: 0x4300, 0x69d: 0x449e, - 0x69e: 0x44a5, 0x69f: 0x44ac, 0x6a0: 0x36eb, 0x6a1: 0x36e5, 0x6a2: 0x3e68, 0x6a3: 0x44ec, + 0x680: 0x42a0, 0x681: 0x4518, 0x682: 0x3dd8, 0x683: 0x369d, 0x684: 0x3de0, + 0x686: 0x48d0, 0x687: 0x3df8, 0x688: 0x3601, 0x689: 0x438a, 0x68a: 0x360d, 0x68b: 0x4390, + 0x68c: 0x3619, 0x68d: 0x451f, 0x68e: 0x4526, 0x68f: 0x452d, 0x690: 0x36b5, 0x691: 0x36af, + 0x692: 0x3e00, 0x693: 0x457a, 0x696: 0x36bb, 0x697: 0x3e10, + 0x698: 0x3631, 0x699: 0x362b, 0x69a: 0x361f, 0x69b: 0x4396, 0x69d: 0x4534, + 0x69e: 0x453b, 0x69f: 0x4542, 0x6a0: 0x36eb, 0x6a1: 0x36e5, 0x6a2: 0x3e68, 0x6a3: 0x4582, 0x6a4: 0x36cd, 0x6a5: 0x36d3, 0x6a6: 0x36f1, 0x6a7: 0x3e78, 0x6a8: 0x3661, 0x6a9: 0x365b, - 0x6aa: 0x364f, 0x6ab: 0x430c, 0x6ac: 0x3649, 0x6ad: 0x4474, 0x6ae: 0x447b, 0x6af: 0x0081, + 0x6aa: 0x364f, 0x6ab: 0x43a2, 0x6ac: 0x3649, 0x6ad: 0x450a, 0x6ae: 0x4511, 0x6af: 0x0081, 0x6b2: 0x3eb0, 0x6b3: 0x36f7, 0x6b4: 0x3eb8, - 0x6b6: 0x4888, 0x6b7: 0x3ed0, 0x6b8: 0x363d, 0x6b9: 0x4306, 0x6ba: 0x366d, 0x6bb: 0x4318, + 0x6b6: 0x491e, 0x6b7: 0x3ed0, 0x6b8: 0x363d, 0x6b9: 0x439c, 0x6ba: 0x366d, 0x6bb: 0x43ae, 0x6bc: 0x3679, 0x6bd: 0x425a, 0x6be: 0x428c, // Block 0x1b, offset 0x6c0 0x6c0: 0x1bd8, 0x6c1: 0x1bdc, 0x6c2: 0x0047, 0x6c3: 0x1c54, 0x6c5: 0x1be8, @@ -4926,7 +4922,7 @@ var nfkcValues = [5888]uint16{ 0x93c: 0x3fc0, 0x93d: 0x3fc8, // Block 0x25, offset 0x940 0x954: 0x3f00, - 0x959: 0x9903, 0x95a: 0x9903, 0x95b: 0x42dc, 0x95c: 0x42e2, 0x95d: 0xa000, + 0x959: 0x9903, 0x95a: 0x9903, 0x95b: 0x4372, 0x95c: 0x4378, 0x95d: 0xa000, 0x95e: 0x3fd0, 0x95f: 0x26b4, 0x966: 0xa000, 0x96b: 0xa000, 0x96c: 0x3fe0, 0x96d: 0xa000, 0x96e: 0x3fe8, 0x96f: 0xa000, @@ -4946,10 +4942,10 @@ var nfkcValues = [5888]uint16{ // Block 0x27, offset 0x9c0 0x9c0: 0x0367, 0x9c1: 0x032b, 0x9c2: 0x032f, 0x9c3: 0x0333, 0x9c4: 0x037b, 0x9c5: 0x0337, 0x9c6: 0x033b, 0x9c7: 0x033f, 0x9c8: 0x0343, 0x9c9: 0x0347, 0x9ca: 0x034b, 0x9cb: 0x034f, - 0x9cc: 0x0353, 0x9cd: 0x0357, 0x9ce: 0x035b, 0x9cf: 0x49bd, 0x9d0: 0x49c3, 0x9d1: 0x49c9, - 0x9d2: 0x49cf, 0x9d3: 0x49d5, 0x9d4: 0x49db, 0x9d5: 0x49e1, 0x9d6: 0x49e7, 0x9d7: 0x49ed, - 0x9d8: 0x49f3, 0x9d9: 0x49f9, 0x9da: 0x49ff, 0x9db: 0x4a05, 0x9dc: 0x4a0b, 0x9dd: 0x4a11, - 0x9de: 0x4a17, 0x9df: 0x4a1d, 0x9e0: 0x4a23, 0x9e1: 0x4a29, 0x9e2: 0x4a2f, 0x9e3: 0x4a35, + 0x9cc: 0x0353, 0x9cd: 0x0357, 0x9ce: 0x035b, 0x9cf: 0x42dc, 0x9d0: 0x42e1, 0x9d1: 0x42e6, + 0x9d2: 0x42eb, 0x9d3: 0x42f0, 0x9d4: 0x42f5, 0x9d5: 0x42fa, 0x9d6: 0x42ff, 0x9d7: 0x4304, + 0x9d8: 0x4309, 0x9d9: 0x430e, 0x9da: 0x4313, 0x9db: 0x4318, 0x9dc: 0x431d, 0x9dd: 0x4322, + 0x9de: 0x4327, 0x9df: 0x432c, 0x9e0: 0x4331, 0x9e1: 0x4336, 0x9e2: 0x433b, 0x9e3: 0x4340, 0x9e4: 0x03c3, 0x9e5: 0x035f, 0x9e6: 0x0363, 0x9e7: 0x03e7, 0x9e8: 0x03eb, 0x9e9: 0x03ef, 0x9ea: 0x03f3, 0x9eb: 0x03f7, 0x9ec: 0x03fb, 0x9ed: 0x03ff, 0x9ee: 0x036b, 0x9ef: 0x0403, 0x9f0: 0x0407, 0x9f1: 0x036f, 0x9f2: 0x0373, 0x9f3: 0x0377, 0x9f4: 0x037f, 0x9f5: 0x0383, @@ -5152,17 +5148,17 @@ var nfkcValues = [5888]uint16{ 0xe40: 0x19d5, 0xe41: 0x19d8, 0xe42: 0x19db, 0xe43: 0x1c08, 0xe44: 0x1c0c, 0xe45: 0x1a5f, 0xe46: 0x1a5f, 0xe53: 0x1d75, 0xe54: 0x1d66, 0xe55: 0x1d6b, 0xe56: 0x1d7a, 0xe57: 0x1d70, - 0xe5d: 0x4390, - 0xe5e: 0x8115, 0xe5f: 0x4402, 0xe60: 0x022d, 0xe61: 0x0215, 0xe62: 0x021e, 0xe63: 0x0221, + 0xe5d: 0x4426, + 0xe5e: 0x8115, 0xe5f: 0x4498, 0xe60: 0x022d, 0xe61: 0x0215, 0xe62: 0x021e, 0xe63: 0x0221, 0xe64: 0x0224, 0xe65: 0x0227, 0xe66: 0x022a, 0xe67: 0x0230, 0xe68: 0x0233, 0xe69: 0x0017, - 0xe6a: 0x43f0, 0xe6b: 0x43f6, 0xe6c: 0x44f4, 0xe6d: 0x44fc, 0xe6e: 0x4348, 0xe6f: 0x434e, - 0xe70: 0x4354, 0xe71: 0x435a, 0xe72: 0x4366, 0xe73: 0x436c, 0xe74: 0x4372, 0xe75: 0x437e, - 0xe76: 0x4384, 0xe78: 0x438a, 0xe79: 0x4396, 0xe7a: 0x439c, 0xe7b: 0x43a2, - 0xe7c: 0x43ae, 0xe7e: 0x43b4, + 0xe6a: 0x4486, 0xe6b: 0x448c, 0xe6c: 0x458a, 0xe6d: 0x4592, 0xe6e: 0x43de, 0xe6f: 0x43e4, + 0xe70: 0x43ea, 0xe71: 0x43f0, 0xe72: 0x43fc, 0xe73: 0x4402, 0xe74: 0x4408, 0xe75: 0x4414, + 0xe76: 0x441a, 0xe78: 0x4420, 0xe79: 0x442c, 0xe7a: 0x4432, 0xe7b: 0x4438, + 0xe7c: 0x4444, 0xe7e: 0x444a, // Block 0x3a, offset 0xe80 - 0xe80: 0x43ba, 0xe81: 0x43c0, 0xe83: 0x43c6, 0xe84: 0x43cc, - 0xe86: 0x43d8, 0xe87: 0x43de, 0xe88: 0x43e4, 0xe89: 0x43ea, 0xe8a: 0x43fc, 0xe8b: 0x4378, - 0xe8c: 0x4360, 0xe8d: 0x43a8, 0xe8e: 0x43d2, 0xe8f: 0x1d7f, 0xe90: 0x0299, 0xe91: 0x0299, + 0xe80: 0x4450, 0xe81: 0x4456, 0xe83: 0x445c, 0xe84: 0x4462, + 0xe86: 0x446e, 0xe87: 0x4474, 0xe88: 0x447a, 0xe89: 0x4480, 0xe8a: 0x4492, 0xe8b: 0x440e, + 0xe8c: 0x43f6, 0xe8d: 0x443e, 0xe8e: 0x4468, 0xe8f: 0x1d7f, 0xe90: 0x0299, 0xe91: 0x0299, 0xe92: 0x02a2, 0xe93: 0x02a2, 0xe94: 0x02a2, 0xe95: 0x02a2, 0xe96: 0x02a5, 0xe97: 0x02a5, 0xe98: 0x02a5, 0xe99: 0x02a5, 0xe9a: 0x02ab, 0xe9b: 0x02ab, 0xe9c: 0x02ab, 0xe9d: 0x02ab, 0xe9e: 0x029f, 0xe9f: 0x029f, 0xea0: 0x029f, 0xea1: 0x029f, 0xea2: 0x02a8, 0xea3: 0x02a8, @@ -5178,9 +5174,9 @@ var nfkcValues = [5888]uint16{ 0xed2: 0x02db, 0xed3: 0x02db, 0xed4: 0x02db, 0xed5: 0x02db, 0xed6: 0x02e1, 0xed7: 0x02e1, 0xed8: 0x02e1, 0xed9: 0x02e1, 0xeda: 0x02de, 0xedb: 0x02de, 0xedc: 0x02de, 0xedd: 0x02de, 0xede: 0x02e4, 0xedf: 0x02e4, 0xee0: 0x02e7, 0xee1: 0x02e7, 0xee2: 0x02e7, 0xee3: 0x02e7, - 0xee4: 0x446e, 0xee5: 0x446e, 0xee6: 0x02ed, 0xee7: 0x02ed, 0xee8: 0x02ed, 0xee9: 0x02ed, + 0xee4: 0x4504, 0xee5: 0x4504, 0xee6: 0x02ed, 0xee7: 0x02ed, 0xee8: 0x02ed, 0xee9: 0x02ed, 0xeea: 0x02ea, 0xeeb: 0x02ea, 0xeec: 0x02ea, 0xeed: 0x02ea, 0xeee: 0x0308, 0xeef: 0x0308, - 0xef0: 0x4468, 0xef1: 0x4468, + 0xef0: 0x44fe, 0xef1: 0x44fe, // Block 0x3c, offset 0xf00 0xf13: 0x02d8, 0xf14: 0x02d8, 0xf15: 0x02d8, 0xf16: 0x02d8, 0xf17: 0x02f6, 0xf18: 0x02f6, 0xf19: 0x02f3, 0xf1a: 0x02f3, 0xf1b: 0x02f9, 0xf1c: 0x02f9, 0xf1d: 0x204f, @@ -5207,8 +5203,8 @@ var nfkcValues = [5888]uint16{ 0xf86: 0x1fb4, 0xf87: 0x1fb9, 0xf88: 0x1fbe, 0xf89: 0x1fc3, 0xf8a: 0x1fc8, 0xf8b: 0x1fcd, 0xf8c: 0x1fd2, 0xf8d: 0x1fd7, 0xf8e: 0x1fe6, 0xf8f: 0x1ff5, 0xf90: 0x1ffa, 0xf91: 0x1fff, 0xf92: 0x2004, 0xf93: 0x2009, 0xf94: 0x200e, 0xf95: 0x2018, 0xf96: 0x201d, 0xf97: 0x2022, - 0xf98: 0x2031, 0xf99: 0x2040, 0xf9a: 0x2045, 0xf9b: 0x4420, 0xf9c: 0x4426, 0xf9d: 0x445c, - 0xf9e: 0x44b3, 0xf9f: 0x44ba, 0xfa0: 0x44c1, 0xfa1: 0x44c8, 0xfa2: 0x44cf, 0xfa3: 0x44d6, + 0xf98: 0x2031, 0xf99: 0x2040, 0xf9a: 0x2045, 0xf9b: 0x44b6, 0xf9c: 0x44bc, 0xf9d: 0x44f2, + 0xf9e: 0x4549, 0xf9f: 0x4550, 0xfa0: 0x4557, 0xfa1: 0x455e, 0xfa2: 0x4565, 0xfa3: 0x456c, 0xfa4: 0x25c6, 0xfa5: 0x25cd, 0xfa6: 0x25d4, 0xfa7: 0x25db, 0xfa8: 0x25f0, 0xfa9: 0x25f7, 0xfaa: 0x1d98, 0xfab: 0x1d9d, 0xfac: 0x1da2, 0xfad: 0x1da7, 0xfae: 0x1db1, 0xfaf: 0x1db6, 0xfb0: 0x1dca, 0xfb1: 0x1dcf, 0xfb2: 0x1dd4, 0xfb3: 0x1dd9, 0xfb4: 0x1de3, 0xfb5: 0x1de8, @@ -5217,7 +5213,7 @@ var nfkcValues = [5888]uint16{ // Block 0x3f, offset 0xfc0 0xfc0: 0x1f5a, 0xfc1: 0x1f6e, 0xfc2: 0x1f73, 0xfc3: 0x1f78, 0xfc4: 0x1f7d, 0xfc5: 0x1f96, 0xfc6: 0x1fa0, 0xfc7: 0x1fa5, 0xfc8: 0x1faa, 0xfc9: 0x1fbe, 0xfca: 0x1fdc, 0xfcb: 0x1fe1, - 0xfcc: 0x1fe6, 0xfcd: 0x1feb, 0xfce: 0x1ff5, 0xfcf: 0x1ffa, 0xfd0: 0x445c, 0xfd1: 0x2027, + 0xfcc: 0x1fe6, 0xfcd: 0x1feb, 0xfce: 0x1ff5, 0xfcf: 0x1ffa, 0xfd0: 0x44f2, 0xfd1: 0x2027, 0xfd2: 0x202c, 0xfd3: 0x2031, 0xfd4: 0x2036, 0xfd5: 0x2040, 0xfd6: 0x2045, 0xfd7: 0x25b1, 0xfd8: 0x25b8, 0xfd9: 0x25bf, 0xfda: 0x25d4, 0xfdb: 0x25e2, 0xfdc: 0x1d89, 0xfdd: 0x1d8e, 0xfde: 0x1d93, 0xfdf: 0x1da2, 0xfe0: 0x1dac, 0xfe1: 0x1dbb, 0xfe2: 0x1dc0, 0xfe3: 0x1dc5, @@ -5231,11 +5227,11 @@ var nfkcValues = [5888]uint16{ 0x1006: 0x1f69, 0x1007: 0x1f6e, 0x1008: 0x1f73, 0x1009: 0x1f87, 0x100a: 0x1f8c, 0x100b: 0x1f91, 0x100c: 0x1f96, 0x100d: 0x1f9b, 0x100e: 0x1faf, 0x100f: 0x1fb4, 0x1010: 0x1fb9, 0x1011: 0x1fbe, 0x1012: 0x1fcd, 0x1013: 0x1fd2, 0x1014: 0x1fd7, 0x1015: 0x1fe6, 0x1016: 0x1ff0, 0x1017: 0x1fff, - 0x1018: 0x2004, 0x1019: 0x4450, 0x101a: 0x2018, 0x101b: 0x201d, 0x101c: 0x2022, 0x101d: 0x2031, + 0x1018: 0x2004, 0x1019: 0x44e6, 0x101a: 0x2018, 0x101b: 0x201d, 0x101c: 0x2022, 0x101d: 0x2031, 0x101e: 0x203b, 0x101f: 0x25d4, 0x1020: 0x25e2, 0x1021: 0x1da2, 0x1022: 0x1dac, 0x1023: 0x1dd4, 0x1024: 0x1dde, 0x1025: 0x1dfc, 0x1026: 0x1e06, 0x1027: 0x1e6a, 0x1028: 0x1e6f, 0x1029: 0x1e92, 0x102a: 0x1e97, 0x102b: 0x1f6e, 0x102c: 0x1f73, 0x102d: 0x1f96, 0x102e: 0x1fe6, 0x102f: 0x1ff0, - 0x1030: 0x2031, 0x1031: 0x203b, 0x1032: 0x4504, 0x1033: 0x450c, 0x1034: 0x4514, 0x1035: 0x1ef1, + 0x1030: 0x2031, 0x1031: 0x203b, 0x1032: 0x459a, 0x1033: 0x45a2, 0x1034: 0x45aa, 0x1035: 0x1ef1, 0x1036: 0x1ef6, 0x1037: 0x1f0a, 0x1038: 0x1f0f, 0x1039: 0x1f1e, 0x103a: 0x1f23, 0x103b: 0x1e74, 0x103c: 0x1e79, 0x103d: 0x1e9c, 0x103e: 0x1ea1, 0x103f: 0x1e33, // Block 0x41, offset 0x1040 @@ -5249,7 +5245,7 @@ var nfkcValues = [5888]uint16{ 0x106a: 0x1e65, 0x106b: 0x1eb0, 0x106c: 0x1ed3, 0x106d: 0x1e7e, 0x106e: 0x1e83, 0x106f: 0x1e88, 0x1070: 0x1e92, 0x1071: 0x1e6f, 0x1072: 0x1e97, 0x1073: 0x1eec, 0x1074: 0x1e56, 0x1075: 0x1e5b, 0x1076: 0x1e60, 0x1077: 0x1e7e, 0x1078: 0x1e83, 0x1079: 0x1e88, 0x107a: 0x1eec, 0x107b: 0x1efb, - 0x107c: 0x4408, 0x107d: 0x4408, + 0x107c: 0x449e, 0x107d: 0x449e, // Block 0x42, offset 0x1080 0x1090: 0x2311, 0x1091: 0x2326, 0x1092: 0x2326, 0x1093: 0x232d, 0x1094: 0x2334, 0x1095: 0x2349, 0x1096: 0x2350, 0x1097: 0x2357, @@ -5297,13 +5293,13 @@ var nfkcValues = [5888]uint16{ 0x119e: 0x04bb, 0x119f: 0x0007, 0x11a0: 0x000d, 0x11a1: 0x0015, 0x11a2: 0x0017, 0x11a3: 0x001b, 0x11a4: 0x0039, 0x11a5: 0x003d, 0x11a6: 0x003b, 0x11a8: 0x0079, 0x11a9: 0x0009, 0x11aa: 0x000b, 0x11ab: 0x0041, - 0x11b0: 0x42aa, 0x11b1: 0x442c, 0x11b2: 0x42af, 0x11b4: 0x42b4, - 0x11b6: 0x42b9, 0x11b7: 0x4432, 0x11b8: 0x42be, 0x11b9: 0x4438, 0x11ba: 0x42c3, 0x11bb: 0x443e, - 0x11bc: 0x42c8, 0x11bd: 0x4444, 0x11be: 0x42cd, 0x11bf: 0x444a, + 0x11b0: 0x42aa, 0x11b1: 0x44c2, 0x11b2: 0x42af, 0x11b4: 0x42b4, + 0x11b6: 0x42b9, 0x11b7: 0x44c8, 0x11b8: 0x42be, 0x11b9: 0x44ce, 0x11ba: 0x42c3, 0x11bb: 0x44d4, + 0x11bc: 0x42c8, 0x11bd: 0x44da, 0x11be: 0x42cd, 0x11bf: 0x44e0, // Block 0x47, offset 0x11c0 - 0x11c0: 0x0236, 0x11c1: 0x440e, 0x11c2: 0x440e, 0x11c3: 0x4414, 0x11c4: 0x4414, 0x11c5: 0x4456, - 0x11c6: 0x4456, 0x11c7: 0x441a, 0x11c8: 0x441a, 0x11c9: 0x4462, 0x11ca: 0x4462, 0x11cb: 0x4462, - 0x11cc: 0x4462, 0x11cd: 0x0239, 0x11ce: 0x0239, 0x11cf: 0x023c, 0x11d0: 0x023c, 0x11d1: 0x023c, + 0x11c0: 0x0236, 0x11c1: 0x44a4, 0x11c2: 0x44a4, 0x11c3: 0x44aa, 0x11c4: 0x44aa, 0x11c5: 0x44ec, + 0x11c6: 0x44ec, 0x11c7: 0x44b0, 0x11c8: 0x44b0, 0x11c9: 0x44f8, 0x11ca: 0x44f8, 0x11cb: 0x44f8, + 0x11cc: 0x44f8, 0x11cd: 0x0239, 0x11ce: 0x0239, 0x11cf: 0x023c, 0x11d0: 0x023c, 0x11d1: 0x023c, 0x11d2: 0x023c, 0x11d3: 0x023f, 0x11d4: 0x023f, 0x11d5: 0x0242, 0x11d6: 0x0242, 0x11d7: 0x0242, 0x11d8: 0x0242, 0x11d9: 0x0245, 0x11da: 0x0245, 0x11db: 0x0245, 0x11dc: 0x0245, 0x11dd: 0x0248, 0x11de: 0x0248, 0x11df: 0x0248, 0x11e0: 0x0248, 0x11e1: 0x024b, 0x11e2: 0x024b, 0x11e3: 0x024b, @@ -5342,18 +5338,18 @@ var nfkcValues = [5888]uint16{ 0x128c: 0x054b, 0x128d: 0x054f, 0x128e: 0x0553, 0x128f: 0x0557, 0x1290: 0x055b, 0x1291: 0x055f, 0x1292: 0x0563, 0x1293: 0x0567, 0x1294: 0x056f, 0x1295: 0x0577, 0x1296: 0x057f, 0x1297: 0x0583, 0x1298: 0x0587, 0x1299: 0x058b, 0x129a: 0x058f, 0x129b: 0x0593, 0x129c: 0x0597, 0x129d: 0x05a7, - 0x129e: 0x4a78, 0x129f: 0x4a7e, 0x12a0: 0x03c3, 0x12a1: 0x0313, 0x12a2: 0x0317, 0x12a3: 0x4a3b, - 0x12a4: 0x031b, 0x12a5: 0x4a41, 0x12a6: 0x4a47, 0x12a7: 0x031f, 0x12a8: 0x0323, 0x12a9: 0x0327, - 0x12aa: 0x4a4d, 0x12ab: 0x4a53, 0x12ac: 0x4a59, 0x12ad: 0x4a5f, 0x12ae: 0x4a65, 0x12af: 0x4a6b, + 0x129e: 0x4a5a, 0x129f: 0x4a60, 0x12a0: 0x03c3, 0x12a1: 0x0313, 0x12a2: 0x0317, 0x12a3: 0x4345, + 0x12a4: 0x031b, 0x12a5: 0x434a, 0x12a6: 0x434f, 0x12a7: 0x031f, 0x12a8: 0x0323, 0x12a9: 0x0327, + 0x12aa: 0x4354, 0x12ab: 0x4359, 0x12ac: 0x435e, 0x12ad: 0x4363, 0x12ae: 0x4368, 0x12af: 0x436d, 0x12b0: 0x0367, 0x12b1: 0x032b, 0x12b2: 0x032f, 0x12b3: 0x0333, 0x12b4: 0x037b, 0x12b5: 0x0337, 0x12b6: 0x033b, 0x12b7: 0x033f, 0x12b8: 0x0343, 0x12b9: 0x0347, 0x12ba: 0x034b, 0x12bb: 0x034f, 0x12bc: 0x0353, 0x12bd: 0x0357, 0x12be: 0x035b, // Block 0x4b, offset 0x12c0 - 0x12c2: 0x49bd, 0x12c3: 0x49c3, 0x12c4: 0x49c9, 0x12c5: 0x49cf, - 0x12c6: 0x49d5, 0x12c7: 0x49db, 0x12ca: 0x49e1, 0x12cb: 0x49e7, - 0x12cc: 0x49ed, 0x12cd: 0x49f3, 0x12ce: 0x49f9, 0x12cf: 0x49ff, - 0x12d2: 0x4a05, 0x12d3: 0x4a0b, 0x12d4: 0x4a11, 0x12d5: 0x4a17, 0x12d6: 0x4a1d, 0x12d7: 0x4a23, - 0x12da: 0x4a29, 0x12db: 0x4a2f, 0x12dc: 0x4a35, + 0x12c2: 0x42dc, 0x12c3: 0x42e1, 0x12c4: 0x42e6, 0x12c5: 0x42eb, + 0x12c6: 0x42f0, 0x12c7: 0x42f5, 0x12ca: 0x42fa, 0x12cb: 0x42ff, + 0x12cc: 0x4304, 0x12cd: 0x4309, 0x12ce: 0x430e, 0x12cf: 0x4313, + 0x12d2: 0x4318, 0x12d3: 0x431d, 0x12d4: 0x4322, 0x12d5: 0x4327, 0x12d6: 0x432c, 0x12d7: 0x4331, + 0x12da: 0x4336, 0x12db: 0x433b, 0x12dc: 0x4340, 0x12e0: 0x00bf, 0x12e1: 0x00c2, 0x12e2: 0x00cb, 0x12e3: 0x4264, 0x12e4: 0x00c8, 0x12e5: 0x00c5, 0x12e6: 0x0447, 0x12e8: 0x046b, 0x12e9: 0x044b, 0x12ea: 0x044f, 0x12eb: 0x0453, 0x12ec: 0x0457, 0x12ed: 0x046f, 0x12ee: 0x0473, @@ -5430,7 +5426,7 @@ var nfkcValues = [5888]uint16{ // Block 0x52, offset 0x1480 0x1480: 0x26ad, 0x1481: 0x26c2, 0x1482: 0x0503, 0x1490: 0x0c0f, 0x1491: 0x0a47, - 0x1492: 0x08d3, 0x1493: 0x45c4, 0x1494: 0x071b, 0x1495: 0x09ef, 0x1496: 0x132f, 0x1497: 0x09ff, + 0x1492: 0x08d3, 0x1493: 0x465a, 0x1494: 0x071b, 0x1495: 0x09ef, 0x1496: 0x132f, 0x1497: 0x09ff, 0x1498: 0x0727, 0x1499: 0x0cd7, 0x149a: 0x0eaf, 0x149b: 0x0caf, 0x149c: 0x0827, 0x149d: 0x0b6b, 0x149e: 0x07bf, 0x149f: 0x0cb7, 0x14a0: 0x0813, 0x14a1: 0x1117, 0x14a2: 0x0f83, 0x14a3: 0x138b, 0x14a4: 0x09d3, 0x14a5: 0x090b, 0x14a6: 0x0e63, 0x14a7: 0x0c1b, 0x14a8: 0x0c47, 0x14a9: 0x06bf, @@ -5669,8 +5665,8 @@ var nfkcSparseValues = [875]valueRange{ {value: 0x22b2, lo: 0xbe, hi: 0xbe}, // Block 0x1, offset 0xe {value: 0x0091, lo: 0x03}, - {value: 0x46e2, lo: 0xa0, hi: 0xa1}, - {value: 0x4714, lo: 0xaf, hi: 0xb0}, + {value: 0x4778, lo: 0xa0, hi: 0xa1}, + {value: 0x47aa, lo: 0xaf, hi: 0xb0}, {value: 0xa000, lo: 0xb7, hi: 0xb7}, // Block 0x2, offset 0x12 {value: 0x0003, lo: 0x08}, @@ -5818,7 +5814,7 @@ var nfkcSparseValues = [875]valueRange{ {value: 0x812d, lo: 0x92, hi: 0x92}, {value: 0x8132, lo: 0x93, hi: 0x93}, {value: 0x8132, lo: 0x94, hi: 0x94}, - {value: 0x451c, lo: 0x98, hi: 0x9f}, + {value: 0x45b2, lo: 0x98, hi: 0x9f}, // Block 0x11, offset 0x96 {value: 0x0000, lo: 0x02}, {value: 0x8102, lo: 0xbc, hi: 0xbc}, @@ -5829,18 +5825,18 @@ var nfkcSparseValues = [875]valueRange{ {value: 0x2c9e, lo: 0x8b, hi: 0x8c}, {value: 0x8104, lo: 0x8d, hi: 0x8d}, {value: 0x9900, lo: 0x97, hi: 0x97}, - {value: 0x455c, lo: 0x9c, hi: 0x9d}, - {value: 0x456c, lo: 0x9f, hi: 0x9f}, + {value: 0x45f2, lo: 0x9c, hi: 0x9d}, + {value: 0x4602, lo: 0x9f, hi: 0x9f}, // Block 0x13, offset 0xa0 {value: 0x0000, lo: 0x03}, - {value: 0x4594, lo: 0xb3, hi: 0xb3}, - {value: 0x459c, lo: 0xb6, hi: 0xb6}, + {value: 0x462a, lo: 0xb3, hi: 0xb3}, + {value: 0x4632, lo: 0xb6, hi: 0xb6}, {value: 0x8102, lo: 0xbc, hi: 0xbc}, // Block 0x14, offset 0xa4 {value: 0x0008, lo: 0x03}, {value: 0x8104, lo: 0x8d, hi: 0x8d}, - {value: 0x4574, lo: 0x99, hi: 0x9b}, - {value: 0x458c, lo: 0x9e, hi: 0x9e}, + {value: 0x460a, lo: 0x99, hi: 0x9b}, + {value: 0x4622, lo: 0x9e, hi: 0x9e}, // Block 0x15, offset 0xa8 {value: 0x0000, lo: 0x01}, {value: 0x8102, lo: 0xbc, hi: 0xbc}, @@ -5855,8 +5851,8 @@ var nfkcSparseValues = [875]valueRange{ {value: 0x2cbe, lo: 0x8c, hi: 0x8c}, {value: 0x8104, lo: 0x8d, hi: 0x8d}, {value: 0x9900, lo: 0x96, hi: 0x97}, - {value: 0x45a4, lo: 0x9c, hi: 0x9c}, - {value: 0x45ac, lo: 0x9d, hi: 0x9d}, + {value: 0x463a, lo: 0x9c, hi: 0x9c}, + {value: 0x4642, lo: 0x9d, hi: 0x9d}, // Block 0x18, offset 0xb5 {value: 0x0000, lo: 0x03}, {value: 0xa000, lo: 0x92, hi: 0x92}, @@ -5945,18 +5941,18 @@ var nfkcSparseValues = [875]valueRange{ {value: 0x263d, lo: 0xa9, hi: 0xa9}, {value: 0x8126, lo: 0xb1, hi: 0xb1}, {value: 0x8127, lo: 0xb2, hi: 0xb2}, - {value: 0x4a84, lo: 0xb3, hi: 0xb3}, + {value: 0x4a66, lo: 0xb3, hi: 0xb3}, {value: 0x8128, lo: 0xb4, hi: 0xb4}, - {value: 0x4a8d, lo: 0xb5, hi: 0xb5}, - {value: 0x45b4, lo: 0xb6, hi: 0xb6}, - {value: 0x45f4, lo: 0xb7, hi: 0xb7}, - {value: 0x45bc, lo: 0xb8, hi: 0xb8}, - {value: 0x45ff, lo: 0xb9, hi: 0xb9}, + {value: 0x4a6f, lo: 0xb5, hi: 0xb5}, + {value: 0x464a, lo: 0xb6, hi: 0xb6}, + {value: 0x468a, lo: 0xb7, hi: 0xb7}, + {value: 0x4652, lo: 0xb8, hi: 0xb8}, + {value: 0x4695, lo: 0xb9, hi: 0xb9}, {value: 0x8127, lo: 0xba, hi: 0xbd}, // Block 0x26, offset 0x107 {value: 0x0000, lo: 0x0b}, {value: 0x8127, lo: 0x80, hi: 0x80}, - {value: 0x4a96, lo: 0x81, hi: 0x81}, + {value: 0x4a78, lo: 0x81, hi: 0x81}, {value: 0x8132, lo: 0x82, hi: 0x83}, {value: 0x8104, lo: 0x84, hi: 0x84}, {value: 0x8132, lo: 0x86, hi: 0x87}, @@ -6203,7 +6199,7 @@ var nfkcSparseValues = [875]valueRange{ {value: 0x192d, lo: 0xb5, hi: 0xb6}, // Block 0x4a, offset 0x1db {value: 0x0000, lo: 0x01}, - {value: 0x44dd, lo: 0x9c, hi: 0x9c}, + {value: 0x4573, lo: 0x9c, hi: 0x9c}, // Block 0x4b, offset 0x1dd {value: 0x0000, lo: 0x02}, {value: 0x0095, lo: 0xbc, hi: 0xbc}, @@ -6249,16 +6245,16 @@ var nfkcSparseValues = [875]valueRange{ {value: 0x04b3, lo: 0xb6, hi: 0xb6}, {value: 0x0887, lo: 0xb8, hi: 0xba}, // Block 0x53, offset 0x201 - {value: 0x0006, lo: 0x09}, + {value: 0x0005, lo: 0x09}, {value: 0x0313, lo: 0xb1, hi: 0xb1}, {value: 0x0317, lo: 0xb2, hi: 0xb2}, - {value: 0x4a3b, lo: 0xb3, hi: 0xb3}, + {value: 0x4345, lo: 0xb3, hi: 0xb3}, {value: 0x031b, lo: 0xb4, hi: 0xb4}, - {value: 0x4a41, lo: 0xb5, hi: 0xb6}, + {value: 0x434a, lo: 0xb5, hi: 0xb6}, {value: 0x031f, lo: 0xb7, hi: 0xb7}, {value: 0x0323, lo: 0xb8, hi: 0xb8}, {value: 0x0327, lo: 0xb9, hi: 0xb9}, - {value: 0x4a4d, lo: 0xba, hi: 0xbf}, + {value: 0x4354, lo: 0xba, hi: 0xbf}, // Block 0x54, offset 0x20b {value: 0x0000, lo: 0x02}, {value: 0x8132, lo: 0xaf, hi: 0xaf}, @@ -6483,13 +6479,13 @@ var nfkcSparseValues = [875]valueRange{ {value: 0x8101, lo: 0x9e, hi: 0x9e}, // Block 0x83, offset 0x2ba {value: 0x0000, lo: 0x0c}, - {value: 0x45cc, lo: 0x9e, hi: 0x9e}, - {value: 0x45d6, lo: 0x9f, hi: 0x9f}, - {value: 0x460a, lo: 0xa0, hi: 0xa0}, - {value: 0x4618, lo: 0xa1, hi: 0xa1}, - {value: 0x4626, lo: 0xa2, hi: 0xa2}, - {value: 0x4634, lo: 0xa3, hi: 0xa3}, - {value: 0x4642, lo: 0xa4, hi: 0xa4}, + {value: 0x4662, lo: 0x9e, hi: 0x9e}, + {value: 0x466c, lo: 0x9f, hi: 0x9f}, + {value: 0x46a0, lo: 0xa0, hi: 0xa0}, + {value: 0x46ae, lo: 0xa1, hi: 0xa1}, + {value: 0x46bc, lo: 0xa2, hi: 0xa2}, + {value: 0x46ca, lo: 0xa3, hi: 0xa3}, + {value: 0x46d8, lo: 0xa4, hi: 0xa4}, {value: 0x812b, lo: 0xa5, hi: 0xa6}, {value: 0x8101, lo: 0xa7, hi: 0xa9}, {value: 0x8130, lo: 0xad, hi: 0xad}, @@ -6501,14 +6497,14 @@ var nfkcSparseValues = [875]valueRange{ {value: 0x8132, lo: 0x85, hi: 0x89}, {value: 0x812d, lo: 0x8a, hi: 0x8b}, {value: 0x8132, lo: 0xaa, hi: 0xad}, - {value: 0x45e0, lo: 0xbb, hi: 0xbb}, - {value: 0x45ea, lo: 0xbc, hi: 0xbc}, - {value: 0x4650, lo: 0xbd, hi: 0xbd}, - {value: 0x466c, lo: 0xbe, hi: 0xbe}, - {value: 0x465e, lo: 0xbf, hi: 0xbf}, + {value: 0x4676, lo: 0xbb, hi: 0xbb}, + {value: 0x4680, lo: 0xbc, hi: 0xbc}, + {value: 0x46e6, lo: 0xbd, hi: 0xbd}, + {value: 0x4702, lo: 0xbe, hi: 0xbe}, + {value: 0x46f4, lo: 0xbf, hi: 0xbf}, // Block 0x85, offset 0x2d1 {value: 0x0000, lo: 0x01}, - {value: 0x467a, lo: 0x80, hi: 0x80}, + {value: 0x4710, lo: 0x80, hi: 0x80}, // Block 0x86, offset 0x2d3 {value: 0x0000, lo: 0x01}, {value: 0x8132, lo: 0x82, hi: 0x84}, @@ -7628,4 +7624,4 @@ var recompMap = map[uint32]rune{ 0x15B915AF: 0x115BB, } -// Total size of tables: 53KB (54006 bytes) +// Total size of tables: 53KB (53976 bytes) diff --git a/vendor/golang.org/x/text/unicode/rangetable/tables.go b/vendor/golang.org/x/text/unicode/rangetable/tables.go index 61c989b..25c4dfb 100644 --- a/vendor/golang.org/x/text/unicode/rangetable/tables.go +++ b/vendor/golang.org/x/text/unicode/rangetable/tables.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package rangetable diff --git a/vendor/golang.org/x/text/unicode/runenames/bits.go b/vendor/golang.org/x/text/unicode/runenames/bits.go index 48cc2c0..1ec1d82 100644 --- a/vendor/golang.org/x/text/unicode/runenames/bits.go +++ b/vendor/golang.org/x/text/unicode/runenames/bits.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package runenames diff --git a/vendor/golang.org/x/text/unicode/runenames/tables.go b/vendor/golang.org/x/text/unicode/runenames/tables.go index 99c4926..0e9db91 100644 --- a/vendor/golang.org/x/text/unicode/runenames/tables.go +++ b/vendor/golang.org/x/text/unicode/runenames/tables.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package runenames diff --git a/vendor/golang.org/x/text/width/common_test.go b/vendor/golang.org/x/text/width/common_test.go index 9ebb782..fb5545e 100644 --- a/vendor/golang.org/x/text/width/common_test.go +++ b/vendor/golang.org/x/text/width/common_test.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package width diff --git a/vendor/golang.org/x/text/width/runes_test.go b/vendor/golang.org/x/text/width/runes_test.go index 587dab4..2a48c40 100644 --- a/vendor/golang.org/x/text/width/runes_test.go +++ b/vendor/golang.org/x/text/width/runes_test.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package width diff --git a/vendor/golang.org/x/text/width/tables.go b/vendor/golang.org/x/text/width/tables.go index e21f0b8..242da0f 100644 --- a/vendor/golang.org/x/text/width/tables.go +++ b/vendor/golang.org/x/text/width/tables.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package width diff --git a/vendor/golang.org/x/text/width/trieval.go b/vendor/golang.org/x/text/width/trieval.go index ca8e45f..0ecffb4 100644 --- a/vendor/golang.org/x/text/width/trieval.go +++ b/vendor/golang.org/x/text/width/trieval.go @@ -1,4 +1,4 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +// This file was generated by go generate; DO NOT EDIT package width diff --git a/vendor/google.golang.org/genproto/.travis.yml b/vendor/google.golang.org/genproto/.travis.yml index 0a0f71c..8ea5b23 100644 --- a/vendor/google.golang.org/genproto/.travis.yml +++ b/vendor/google.golang.org/genproto/.travis.yml @@ -1,5 +1,6 @@ language: go go: - - 1.5 - 1.6 + - 1.7 + - 1.8 go_import_path: google.golang.org/genproto diff --git a/vendor/google.golang.org/genproto/googleapis/api/metric/metric.pb.go b/vendor/google.golang.org/genproto/googleapis/api/metric/metric.pb.go index 93abe41..738ff43 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/metric/metric.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/metric/metric.pb.go @@ -125,12 +125,12 @@ type MetricDescriptor struct { // that defines the scope of the metric type or of its data; and (2) the // metric's URL-encoded type, which also appears in the `type` field of this // descriptor. For example, following is the resource name of a custom - // metric within the GCP project 123456789: + // metric within the GCP project `my-project-id`: // - // "projects/123456789/metricDescriptors/custom.googleapis.com%2Finvoice%2Fpaid%2Famount" + // "projects/my-project-id/metricDescriptors/custom.googleapis.com%2Finvoice%2Fpaid%2Famount" Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` // The metric type, including its DNS name prefix. The type is not - // URL-encoded. All user-defined metric types have the DNS name + // URL-encoded. All user-defined custom metric types have the DNS name // `custom.googleapis.com`. Metric types should use a natural hierarchical // grouping. For example: // diff --git a/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/auth.pb.go b/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/auth.pb.go index 6db5ec4..f489929 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/auth.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/auth.pb.go @@ -17,7 +17,9 @@ It is generated from these files: google/api/log.proto google/api/logging.proto google/api/monitoring.proto + google/api/quota.proto google/api/service.proto + google/api/source_info.proto google/api/system_parameter.proto google/api/usage.proto @@ -43,7 +45,11 @@ It has these top-level messages: LogDescriptor Logging Monitoring + Quota + MetricRule + QuotaLimit Service + SourceInfo SystemParameters SystemParameterRule SystemParameter diff --git a/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/endpoint.pb.go b/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/endpoint.pb.go index c726472..d30d1ad 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/endpoint.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/endpoint.pb.go @@ -43,6 +43,11 @@ type Endpoint struct { Apis []string `protobuf:"bytes,3,rep,name=apis" json:"apis,omitempty"` // The list of features enabled on this endpoint. Features []string `protobuf:"bytes,4,rep,name=features" json:"features,omitempty"` + // The specification of an Internet routable address of API frontend that will + // handle requests to this [API Endpoint](https://cloud.google.com/apis/design/glossary). + // It should be either a valid IPv4 address or a fully-qualified domain name. + // For example, "8.8.8.8" or "myservice.appspot.com". + Target string `protobuf:"bytes,101,opt,name=target" json:"target,omitempty"` // Allowing // [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka // cross-domain traffic, would allow the backends served from this endpoint to @@ -85,6 +90,13 @@ func (m *Endpoint) GetFeatures() []string { return nil } +func (m *Endpoint) GetTarget() string { + if m != nil { + return m.Target + } + return "" +} + func (m *Endpoint) GetAllowCors() bool { if m != nil { return m.AllowCors @@ -99,21 +111,21 @@ func init() { func init() { proto.RegisterFile("google/api/endpoint.proto", fileDescriptor7) } var fileDescriptor7 = []byte{ - // 241 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00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, 0x86, 0x1d, 0x90, - 0x69, 0x39, 0x98, 0xce, 0x20, 0xe5, 0x21, 0xdd, 0x1c, 0x4d, 0x10, 0x79, 0x69, 0xc4, 0xf0, 0x61, - 0x47, 0x1c, 0x99, 0xb6, 0xd6, 0xdc, 0x1d, 0xa9, 0xef, 0x45, 0xf1, 0x78, 0xdf, 0x3f, 0xbd, 0x9e, - 0xe6, 0xc7, 0xdb, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfb, 0x43, 0xb9, 0x21, 0x48, 0x01, 0x00, - 0x00, + // 253 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x90, 0x41, 0x4b, 0xc4, 0x30, + 0x10, 0x85, 0xe9, 0x6e, 0x5d, 0xdb, 0x01, 0x3d, 0xe4, 0x20, 0x71, 0x51, 0x28, 0x9e, 0x7a, 0x6a, + 0x0f, 0x1e, 0x3d, 0xb9, 0xb2, 0x88, 0xb7, 0xd2, 0xa3, 0x17, 0x19, 0xeb, 0x6c, 0x08, 0x64, 0x33, + 0x21, 0x89, 0xfa, 0x73, 0x04, 0x7f, 0xa9, 0x34, 0xed, 0xaa, 0x7b, 0x9b, 0xef, 0xbd, 0x37, 0x61, + 0x5e, 0xe0, 0x52, 0x31, 0x2b, 0x43, 0x2d, 0x3a, 0xdd, 0x92, 0x7d, 0x73, 0xac, 0x6d, 0x6c, 0x9c, + 0xe7, 0xc8, 0x02, 0x26, 0xab, 0x41, 0xa7, 0xd7, 0x57, 0xff, 0x62, 0x68, 0x2d, 0x47, 0x8c, 0x9a, + 0x6d, 0x98, 0x92, 0x37, 0x5f, 0x19, 0x14, 0xdb, 0x79, 0x59, 0x08, 0xc8, 0x2d, 0xee, 0x49, 0x66, + 0x55, 0x56, 0x97, 0x7d, 0x9a, 0x85, 0x84, 0x53, 0x34, 0x1a, 0x03, 0x05, 0xb9, 0xa8, 0x96, 0x75, + 0xd9, 0x1f, 0x70, 0x4c, 0xa3, 0xd3, 0x41, 0x2e, 0x93, 0x9c, 0x66, 0xb1, 0x86, 0x62, 0x47, 0x18, + 0xdf, 0x3d, 0x05, 0x99, 0x27, 0xfd, 0x97, 0xc5, 0x05, 0xac, 0x22, 0x7a, 0x45, 0x51, 0x52, 0x7a, + 0x7f, 0x26, 0x71, 0x0d, 0x80, 0xc6, 0xf0, 0xe7, 0xcb, 0xc0, 0x3e, 0xc8, 0x93, 0x2a, 0xab, 0x8b, + 0xbe, 0x4c, 0xca, 0x03, 0xfb, 0xb0, 0x61, 0x38, 0x1f, 0x78, 0xdf, 0xfc, 0x35, 0xda, 0x9c, 0x1d, + 0x0e, 0xee, 0xc6, 0x0a, 0x5d, 0xf6, 0xbc, 0x9d, 0x4d, 0xc5, 0x06, 0xad, 0x6a, 0xd8, 0xab, 0x56, + 0x91, 0x4d, 0x05, 0xdb, 0xc9, 0x1a, 0x8f, 0x4b, 0x3f, 0x10, 0xc8, 0x7f, 0xe8, 0x81, 0x06, 0xb6, + 0x3b, 0xad, 0xee, 0x8e, 0xe8, 0x7b, 0x91, 0x3f, 0xde, 0x77, 0x4f, 0xaf, 0xab, 0xb4, 0x78, 0xfb, + 0x13, 0x00, 0x00, 0xff, 0xff, 0x34, 0x0e, 0xdd, 0x70, 0x60, 0x01, 0x00, 0x00, } diff --git a/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/quota.pb.go b/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/quota.pb.go new file mode 100644 index 0000000..f5f18ed --- /dev/null +++ b/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/quota.pb.go @@ -0,0 +1,392 @@ +// Code generated by protoc-gen-go. +// source: google/api/quota.proto +// DO NOT EDIT! + +package serviceconfig + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "google.golang.org/genproto/googleapis/api/annotations" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// Quota configuration helps to achieve fairness and budgeting in service +// usage. +// +// The quota configuration works this way: +// - The service configuration defines a set of metrics. +// - For API calls, the quota.metric_rules maps methods to metrics with +// corresponding costs. +// - The quota.limits defines limits on the metrics, which will be used for +// quota checks at runtime. +// +// An example quota configuration in yaml format: +// +// quota: +// limits: +// +// - name: apiWriteQpsPerProject +// metric: library.googleapis.com/write_calls +// unit: "1/min/{project}" # rate limit for consumer projects +// values: +// STANDARD: 10000 +// +// # The metric rules bind all methods to the read_calls metric, +// # except for the UpdateBook and DeleteBook methods. These two methods +// # are mapped to the write_calls metric, with the UpdateBook method +// # consuming at twice rate as the DeleteBook method. +// metric_rules: +// - selector: "*" +// metric_costs: +// library.googleapis.com/read_calls: 1 +// - selector: google.example.library.v1.LibraryService.UpdateBook +// metric_costs: +// library.googleapis.com/write_calls: 2 +// - selector: google.example.library.v1.LibraryService.DeleteBook +// metric_costs: +// library.googleapis.com/write_calls: 1 +// +// Corresponding Metric definition: +// +// metrics: +// - name: library.googleapis.com/read_calls +// display_name: Read requests +// metric_kind: DELTA +// value_type: INT64 +// +// - name: library.googleapis.com/write_calls +// display_name: Write requests +// metric_kind: DELTA +// value_type: INT64 +// +type Quota struct { + // List of `QuotaLimit` definitions for the service. + // + // Used by metric-based quotas only. + Limits []*QuotaLimit `protobuf:"bytes,3,rep,name=limits" json:"limits,omitempty"` + // List of `MetricRule` definitions, each one mapping a selected method to one + // or more metrics. + // + // Used by metric-based quotas only. + MetricRules []*MetricRule `protobuf:"bytes,4,rep,name=metric_rules,json=metricRules" json:"metric_rules,omitempty"` +} + +func (m *Quota) Reset() { *m = Quota{} } +func (m *Quota) String() string { return proto.CompactTextString(m) } +func (*Quota) ProtoMessage() {} +func (*Quota) Descriptor() ([]byte, []int) { return fileDescriptor11, []int{0} } + +func (m *Quota) GetLimits() []*QuotaLimit { + if m != nil { + return m.Limits + } + return nil +} + +func (m *Quota) GetMetricRules() []*MetricRule { + if m != nil { + return m.MetricRules + } + return nil +} + +// Bind API methods to metrics. Binding a method to a metric causes that +// metric's configured quota, billing, and monitoring behaviors to apply to the +// method call. +// +// Used by metric-based quotas only. +type MetricRule struct { + // Selects the methods to which this rule applies. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + Selector string `protobuf:"bytes,1,opt,name=selector" json:"selector,omitempty"` + // Metrics to update when the selected methods are called, and the associated + // cost applied to each metric. + // + // The key of the map is the metric name, and the values are the amount + // increased for the metric against which the quota limits are defined. + // The value must not be negative. + MetricCosts map[string]int64 `protobuf:"bytes,2,rep,name=metric_costs,json=metricCosts" json:"metric_costs,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` +} + +func (m *MetricRule) Reset() { *m = MetricRule{} } +func (m *MetricRule) String() string { return proto.CompactTextString(m) } +func (*MetricRule) ProtoMessage() {} +func (*MetricRule) Descriptor() ([]byte, []int) { return fileDescriptor11, []int{1} } + +func (m *MetricRule) GetSelector() string { + if m != nil { + return m.Selector + } + return "" +} + +func (m *MetricRule) GetMetricCosts() map[string]int64 { + if m != nil { + return m.MetricCosts + } + return nil +} + +// `QuotaLimit` defines a specific limit that applies over a specified duration +// for a limit type. There can be at most one limit for a duration and limit +// type combination defined within a `QuotaGroup`. +type QuotaLimit struct { + // Name of the quota limit. The name is used to refer to the limit when + // overriding the default limit on per-consumer basis. + // + // For group-based quota limits, the name must be unique within the quota + // group. If a name is not provided, it will be generated from the limit_by + // and duration fields. + // + // For metric-based quota limits, the name must be provided, and it must be + // unique within the service. The name can only include alphanumeric + // characters as well as '-'. + // + // The maximum length of the limit name is 64 characters. + // + // The name of a limit is used as a unique identifier for this limit. + // Therefore, once a limit has been put into use, its name should be + // immutable. You can use the display_name field to provide a user-friendly + // name for the limit. The display name can be evolved over time without + // affecting the identity of the limit. + Name string `protobuf:"bytes,6,opt,name=name" json:"name,omitempty"` + // Optional. User-visible, extended description for this quota limit. + // Should be used only when more context is needed to understand this limit + // than provided by the limit's display name (see: `display_name`). + Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` + // Default number of tokens that can be consumed during the specified + // duration. This is the number of tokens assigned when a client + // application developer activates the service for his/her project. + // + // Specifying a value of 0 will block all requests. This can be used if you + // are provisioning quota to selected consumers and blocking others. + // Similarly, a value of -1 will indicate an unlimited quota. No other + // negative values are allowed. + // + // Used by group-based quotas only. + DefaultLimit int64 `protobuf:"varint,3,opt,name=default_limit,json=defaultLimit" json:"default_limit,omitempty"` + // Maximum number of tokens that can be consumed during the specified + // duration. Client application developers can override the default limit up + // to this maximum. If specified, this value cannot be set to a value less + // than the default limit. If not specified, it is set to the default limit. + // + // To allow clients to apply overrides with no upper bound, set this to -1, + // indicating unlimited maximum quota. + // + // Used by group-based quotas only. + MaxLimit int64 `protobuf:"varint,4,opt,name=max_limit,json=maxLimit" json:"max_limit,omitempty"` + // Free tier value displayed in the Developers Console for this limit. + // The free tier is the number of tokens that will be subtracted from the + // billed amount when billing is enabled. + // This field can only be set on a limit with duration "1d", in a billable + // group; it is invalid on any other limit. If this field is not set, it + // defaults to 0, indicating that there is no free tier for this service. + // + // Used by group-based quotas only. + FreeTier int64 `protobuf:"varint,7,opt,name=free_tier,json=freeTier" json:"free_tier,omitempty"` + // Duration of this limit in textual notation. Example: "100s", "24h", "1d". + // For duration longer than a day, only multiple of days is supported. We + // support only "100s" and "1d" for now. Additional support will be added in + // the future. "0" indicates indefinite duration. + // + // Used by group-based quotas only. + Duration string `protobuf:"bytes,5,opt,name=duration" json:"duration,omitempty"` + // The name of the metric this quota limit applies to. The quota limits with + // the same metric will be checked together during runtime. The metric must be + // defined within the service config. + // + // Used by metric-based quotas only. + Metric string `protobuf:"bytes,8,opt,name=metric" json:"metric,omitempty"` + // Specify the unit of the quota limit. It uses the same syntax as + // [Metric.unit][]. The supported unit kinds are determined by the quota + // backend system. + // + // The [Google Service Control](https://cloud.google.com/service-control) + // supports the following unit components: + // * One of the time intevals: + // * "/min" for quota every minute. + // * "/d" for quota every 24 hours, starting 00:00 US Pacific Time. + // * Otherwise the quota won't be reset by time, such as storage limit. + // * One and only one of the granted containers: + // * "/{organization}" quota for an organization. + // * "/{project}" quota for a project. + // * "/{folder}" quota for a folder. + // * "/{resource}" quota for a universal resource. + // * Zero or more quota segmentation dimension. Not all combos are valid. + // * "/{region}" quota for every region. Not to be used with time intervals. + // * Otherwise the resources granted on the target is not segmented. + // * "/{zone}" quota for every zone. Not to be used with time intervals. + // * Otherwise the resources granted on the target is not segmented. + // * "/{resource}" quota for a resource associated with a project or org. + // + // Here are some examples: + // * "1/min/{project}" for quota per minute per project. + // * "1/min/{user}" for quota per minute per user. + // * "1/min/{organization}" for quota per minute per organization. + // + // Note: the order of unit components is insignificant. + // The "1" at the beginning is required to follow the metric unit syntax. + // + // Used by metric-based quotas only. + Unit string `protobuf:"bytes,9,opt,name=unit" json:"unit,omitempty"` + // Tiered limit values. Also allows for regional or zone overrides for these + // values if "/{region}" or "/{zone}" is specified in the unit field. + // + // Currently supported tiers from low to high: + // VERY_LOW, LOW, STANDARD, HIGH, VERY_HIGH + // + // To apply different limit values for users according to their tiers, specify + // the values for the tiers you want to differentiate. For example: + // {LOW:100, STANDARD:500, HIGH:1000, VERY_HIGH:5000} + // + // The limit value for each tier is optional except for the tier STANDARD. + // The limit value for an unspecified tier falls to the value of its next + // tier towards tier STANDARD. For the above example, the limit value for tier + // STANDARD is 500. + // + // To apply the same limit value for all users, just specify limit value for + // tier STANDARD. For example: {STANDARD:500}. + // + // To apply a regional overide for a tier, add a map entry with key + // "/", where is a region name. Similarly, for a zone + // override, add a map entry with key "/{zone}". + // Further, a wildcard can be used at the end of a zone name in order to + // specify zone level overrides. For example: + // LOW: 10, STANDARD: 50, HIGH: 100, + // LOW/us-central1: 20, STANDARD/us-central1: 60, HIGH/us-central1: 200, + // LOW/us-central1-*: 10, STANDARD/us-central1-*: 20, HIGH/us-central1-*: 80 + // + // The regional overrides tier set for each region must be the same as + // the tier set for default limit values. Same rule applies for zone overrides + // tier as well. + // + // Used by metric-based quotas only. + Values map[string]int64 `protobuf:"bytes,10,rep,name=values" json:"values,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` + // User-visible display name for this limit. + // Optional. If not set, the UI will provide a default display name based on + // the quota configuration. This field can be used to override the default + // display name generated from the configuration. + DisplayName string `protobuf:"bytes,12,opt,name=display_name,json=displayName" json:"display_name,omitempty"` +} + +func (m *QuotaLimit) Reset() { *m = QuotaLimit{} } +func (m *QuotaLimit) String() string { return proto.CompactTextString(m) } +func (*QuotaLimit) ProtoMessage() {} +func (*QuotaLimit) Descriptor() ([]byte, []int) { return fileDescriptor11, []int{2} } + +func (m *QuotaLimit) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *QuotaLimit) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *QuotaLimit) GetDefaultLimit() int64 { + if m != nil { + return m.DefaultLimit + } + return 0 +} + +func (m *QuotaLimit) GetMaxLimit() int64 { + if m != nil { + return m.MaxLimit + } + return 0 +} + +func (m *QuotaLimit) GetFreeTier() int64 { + if m != nil { + return m.FreeTier + } + return 0 +} + +func (m *QuotaLimit) GetDuration() string { + if m != nil { + return m.Duration + } + return "" +} + +func (m *QuotaLimit) GetMetric() string { + if m != nil { + return m.Metric + } + return "" +} + +func (m *QuotaLimit) GetUnit() string { + if m != nil { + return m.Unit + } + return "" +} + +func (m *QuotaLimit) GetValues() map[string]int64 { + if m != nil { + return m.Values + } + return nil +} + +func (m *QuotaLimit) GetDisplayName() string { + if m != nil { + return m.DisplayName + } + return "" +} + +func init() { + proto.RegisterType((*Quota)(nil), "google.api.Quota") + proto.RegisterType((*MetricRule)(nil), "google.api.MetricRule") + proto.RegisterType((*QuotaLimit)(nil), "google.api.QuotaLimit") +} + +func init() { proto.RegisterFile("google/api/quota.proto", fileDescriptor11) } + +var fileDescriptor11 = []byte{ + // 466 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0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12, 0xbb, 0x35, 0x05, 0x34, 0x8e, 0x29, 0x84, 0xd9, 0x47, 0x51, 0xe1, 0xf4, + 0x14, 0x46, 0x47, 0xca, 0xdb, 0xbc, 0xc2, 0xb9, 0x82, 0x7b, 0x85, 0xae, 0x8e, 0x3e, 0xe7, 0x3c, + 0x3c, 0xca, 0xca, 0xaf, 0xf3, 0x2a, 0xf9, 0x7a, 0x11, 0x91, 0x52, 0x2b, 0x51, 0x97, 0x99, 0x36, + 0xe5, 0xb2, 0xc4, 0x9a, 0x96, 0x7d, 0x19, 0x20, 0xd1, 0x48, 0x4b, 0x7f, 0x83, 0x45, 0x73, 0x29, + 0x0b, 0x2c, 0x74, 0xbd, 0x95, 0xe5, 0x8b, 0xbf, 0xba, 0x5f, 0x9d, 0xee, 0x9b, 0x57, 0xab, 0xb7, + 0xdf, 0xfa, 0x24, 0x7c, 0xf6, 0x27, 0x00, 0x00, 0xff, 0xff, 0x90, 0x7e, 0xf5, 0xab, 0x69, 0x03, + 0x00, 0x00, +} diff --git a/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/service.pb.go b/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/service.pb.go index e2ce14d..43c3777 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/service.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/service.pb.go @@ -94,6 +94,8 @@ type Service struct { Backend *Backend `protobuf:"bytes,8,opt,name=backend" json:"backend,omitempty"` // HTTP configuration. Http *google_api.Http `protobuf:"bytes,9,opt,name=http" json:"http,omitempty"` + // Quota configuration. + Quota *Quota `protobuf:"bytes,10,opt,name=quota" json:"quota,omitempty"` // Auth configuration. Authentication *Authentication `protobuf:"bytes,11,opt,name=authentication" json:"authentication,omitempty"` // Context configuration. @@ -119,6 +121,8 @@ type Service struct { Monitoring *Monitoring `protobuf:"bytes,28,opt,name=monitoring" json:"monitoring,omitempty"` // System parameter configuration. SystemParameters *SystemParameters `protobuf:"bytes,29,opt,name=system_parameters,json=systemParameters" json:"system_parameters,omitempty"` + // Output only. The source information for this configuration if available. + SourceInfo *SourceInfo `protobuf:"bytes,37,opt,name=source_info,json=sourceInfo" json:"source_info,omitempty"` // Experimental configuration. Experimental *google_api5.Experimental `protobuf:"bytes,101,opt,name=experimental" json:"experimental,omitempty"` } @@ -126,7 +130,7 @@ type Service struct { func (m *Service) Reset() { *m = Service{} } func (m *Service) String() string { return proto.CompactTextString(m) } func (*Service) ProtoMessage() {} -func (*Service) Descriptor() ([]byte, []int) { return fileDescriptor11, []int{0} } +func (*Service) Descriptor() ([]byte, []int) { return fileDescriptor12, []int{0} } func (m *Service) GetConfigVersion() *google_protobuf5.UInt32Value { if m != nil { @@ -205,6 +209,13 @@ func (m *Service) GetHttp() *google_api.Http { return nil } +func (m *Service) GetQuota() *Quota { + if m != nil { + return m.Quota + } + return nil +} + func (m *Service) GetAuthentication() *Authentication { if m != nil { return m.Authentication @@ -282,6 +293,13 @@ func (m *Service) GetSystemParameters() *SystemParameters { return nil } +func (m *Service) GetSourceInfo() *SourceInfo { + if m != nil { + return m.SourceInfo + } + return nil +} + func (m *Service) GetExperimental() *google_api5.Experimental { if m != nil { return m.Experimental @@ -293,56 +311,59 @@ func init() { proto.RegisterType((*Service)(nil), "google.api.Service") } -func init() { proto.RegisterFile("google/api/service.proto", fileDescriptor11) } +func init() { proto.RegisterFile("google/api/service.proto", fileDescriptor12) } -var fileDescriptor11 = []byte{ - // 756 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x95, 0x5f, 0x4f, 0xdb, 0x3a, - 0x14, 0xc0, 0xd5, 0xd2, 0xc2, 0xad, 0xf9, 0x73, 0xc1, 0x14, 0x30, 0xa5, 0xf7, 0x0a, 0xb6, 0x49, - 0x54, 0x9b, 0x48, 0xa5, 0x22, 0xf1, 0xb2, 0x49, 0x13, 0x05, 0xb4, 0x55, 0x62, 0x52, 0x65, 0x06, - 0x9a, 0xf6, 0x52, 0xa5, 0x89, 0x09, 0xde, 0x12, 0xdb, 0xb2, 0x1d, 0x46, 0x5f, 0xf7, 0x51, 0xf6, - 0x49, 0xa7, 0xd8, 0x09, 0x75, 0xda, 0xf2, 0x86, 0xfd, 0xfb, 0x9d, 0xc3, 0x71, 0xec, 0x73, 0x0a, - 0x50, 0xc4, 0x79, 0x14, 0x93, 0xae, 0x2f, 0x68, 0x57, 0x11, 0xf9, 0x48, 0x03, 0xe2, 0x09, 0xc9, - 0x35, 0x87, 0xc0, 0x12, 0xcf, 0x17, 0xb4, 0xd5, 0x76, 0x2c, 0x9f, 0x31, 0xae, 0x7d, 0x4d, 0x39, - 0x53, 0xd6, 0x6c, 0xed, 0xb8, 0x34, 0xd5, 0x0f, 0xf9, 0xb6, 0x9b, 0x7a, 0xec, 0x07, 0x3f, 0x09, - 0x0b, 0x17, 0x90, 0x80, 0x33, 0x4d, 0x9e, 0xf4, 0x0b, 0x44, 0xf2, 0x38, 0x27, 0xff, 0x3b, 0x24, - 0xe4, 0x41, 0x9a, 0x10, 0x66, 0xab, 0xc8, 0xf9, 0xbe, 0xc3, 0x09, 0x0b, 0x05, 0xa7, 0xac, 0x48, - 0xfa, 0xd6, 0x45, 0x4f, 0x82, 0x48, 0x6a, 0x82, 0xe3, 0xd2, 0x62, 0xc1, 0x59, 0x1e, 0xb4, 0x16, - 0xf9, 0xf6, 0xae, 0xb3, 0x1d, 0xfb, 0x63, 0x52, 0xe8, 0x4d, 0x77, 0x9f, 0x47, 0x0b, 0x4e, 0x11, - 0xf3, 0x28, 0xa2, 0xac, 0x20, 0x7b, 0x0e, 0x49, 0x88, 0x96, 0x34, 0xc8, 0xc1, 0x6b, 0x17, 0x70, - 0x46, 0x35, 0x97, 0x24, 0x1c, 0x49, 0xa2, 0x78, 0x2a, 0x8b, 0x2b, 0x69, 0x1d, 0xcc, 0x4b, 0xd3, - 0xd4, 0x47, 0xee, 0x4d, 0x4e, 0x94, 0x26, 0xc9, 0x48, 0xf8, 0xd2, 0x4f, 0x88, 0x26, 0x72, 0xc1, - 0x29, 0x52, 0xe5, 0x47, 0x64, 0xe6, 0xdb, 0x99, 0xd5, 0x38, 0xbd, 0xef, 0xfa, 0x6c, 0xf2, 0x22, - 0x12, 0x34, 0x47, 0xad, 0x59, 0xa4, 0x27, 0x82, 0xcc, 0xdc, 0xd6, 0x33, 0xfb, 0x25, 0x7d, 0x21, - 0x88, 0xcc, 0x9f, 0xcc, 0xab, 0xdf, 0x0d, 0xb0, 0x72, 0x63, 0x9f, 0x1b, 0xbc, 0x00, 0x1b, 0x01, - 0x67, 0xf7, 0x34, 0x1a, 0x3d, 0x12, 0xa9, 0x28, 0x67, 0xa8, 0x79, 0x58, 0xe9, 0xac, 0xf6, 0xda, - 0x5e, 0xfe, 0x02, 0x8b, 0x24, 0xde, 0xed, 0x80, 0xe9, 0xd3, 0xde, 0x9d, 0x1f, 0xa7, 0x04, 0xaf, - 0xdb, 0x98, 0x3b, 0x1b, 0x02, 0x21, 0xa8, 0x31, 0x3f, 0x21, 0xa8, 0x72, 0x58, 0xe9, 0x34, 0xb0, - 0xf9, 0x1b, 0x6e, 0x80, 0x2a, 0x0d, 0xd1, 0x91, 0xd9, 0xa9, 0xd2, 0x10, 0x36, 0x41, 0x5d, 0x53, - 0x1d, 0x13, 0x54, 0x35, 0x5b, 0x76, 0x01, 0x3d, 0xb0, 0x2d, 0x24, 0x0f, 0xd3, 0x80, 0xc8, 0x91, - 0x90, 0xfc, 0x07, 0x09, 0xf4, 0x88, 0x86, 0x68, 0xd7, 0x38, 0x5b, 0x05, 0x1a, 0x5a, 0x32, 0x08, - 0x61, 0x07, 0xd4, 0x7c, 0x41, 0x15, 0x5a, 0x3a, 0x5c, 0xea, 0xac, 0xf6, 0x9a, 0x73, 0x45, 0x9e, - 0x0b, 0x8a, 0x8d, 0x01, 0xdf, 0x81, 0x7a, 0xf6, 0x49, 0x14, 0xaa, 0x19, 0x75, 0x67,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0x2f, 0x06, 0x39, 0x41, 0x85, 0x0c, 0xbf, 0x81, 0xed, 0xf9, 0x01, 0xa1, - 0xd0, 0xbe, 0xc9, 0x71, 0x5c, 0xca, 0x51, 0x68, 0x38, 0xb7, 0x9c, 0x74, 0x30, 0x99, 0x85, 0xe6, - 0xbc, 0xf9, 0xb4, 0x42, 0x07, 0xf3, 0xe7, 0xbd, 0xb6, 0x08, 0x17, 0x0e, 0x3c, 0x03, 0x60, 0x3a, - 0x84, 0x50, 0xdb, 0x44, 0xec, 0x2e, 0xf8, 0xff, 0x59, 0x90, 0x63, 0xc2, 0x01, 0xd8, 0x9a, 0x9d, - 0x4f, 0x0a, 0xfd, 0x57, 0x6e, 0xf9, 0x2c, 0xfc, 0xc6, 0x48, 0xc3, 0x67, 0x07, 0x6f, 0xaa, 0x99, - 0x1d, 0xf8, 0x01, 0xac, 0xb9, 0x33, 0x1c, 0x11, 0x93, 0x05, 0x95, 0x2e, 0xd6, 0xe1, 0xb8, 0x64, - 0xf7, 0x59, 0x36, 0x78, 0x12, 0x47, 0xee, 0xaf, 0xe5, 0x33, 0x69, 0x98, 0x35, 0xdd, 0xb0, 0xf2, - 0xfd, 0x2a, 0x67, 0x11, 0x8f, 0x7d, 0x16, 0x79, 0x5c, 0x46, 0xdd, 0x88, 0x30, 0xd3, 0x92, 0x5d, - 0x8b, 0xb2, 0x46, 0x77, 0x7f, 0x3c, 0xed, 0x54, 0x7a, 0x5f, 0x5a, 0xfd, 0xa9, 0xd6, 0x3e, 0x9d, - 0x0f, 0x07, 0xe3, 0x65, 0x13, 0x78, 0xfa, 0x37, 0x00, 0x00, 0xff, 0xff, 0xe7, 0xee, 0x78, 0x1f, - 0x74, 0x07, 0x00, 0x00, +var fileDescriptor12 = []byte{ + // 809 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x95, 0xdd, 0x6e, 0xdb, 0x36, + 0x14, 0x80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0x43, 0x3f, 0xf5, 0x16, 0xe5, + 0xb5, 0x5e, 0xb4, 0xfe, 0xb8, 0xf2, 0x2c, 0x15, 0x19, 0xe1, 0x69, 0x24, 0x54, 0x3a, 0x49, 0x29, + 0xb7, 0x97, 0x7e, 0xe2, 0x50, 0x39, 0x4a, 0xc2, 0x8f, 0xba, 0x9b, 0x7b, 0xdf, 0xd7, 0x9e, 0xfe, + 0x6d, 0x77, 0x7e, 0xba, 0x5c, 0xcc, 0x57, 0x8f, 0x6d, 0xe2, 0xeb, 0xff, 0x03, 0x00, 0x00, 0xff, + 0xff, 0xcc, 0xae, 0xb3, 0x8f, 0x0c, 0x08, 0x00, 0x00, } diff --git a/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/source_info.pb.go b/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/source_info.pb.go new file mode 100644 index 0000000..7bcd3bc --- /dev/null +++ b/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/source_info.pb.go @@ -0,0 +1,56 @@ +// Code generated by protoc-gen-go. +// source: google/api/source_info.proto +// DO NOT EDIT! + +package serviceconfig + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import google_protobuf1 "github.com/golang/protobuf/ptypes/any" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// Source information used to create a Service Config +type SourceInfo struct { + // All files used during config generation. + SourceFiles []*google_protobuf1.Any `protobuf:"bytes,1,rep,name=source_files,json=sourceFiles" json:"source_files,omitempty"` +} + +func (m *SourceInfo) Reset() { *m = SourceInfo{} } +func (m *SourceInfo) String() string { return proto.CompactTextString(m) } +func (*SourceInfo) ProtoMessage() {} +func (*SourceInfo) Descriptor() ([]byte, []int) { return fileDescriptor13, []int{0} } + +func (m *SourceInfo) GetSourceFiles() []*google_protobuf1.Any { + if m != nil { + return m.SourceFiles + } + return nil +} + +func init() { + proto.RegisterType((*SourceInfo)(nil), "google.api.SourceInfo") +} + +func init() { proto.RegisterFile("google/api/source_info.proto", fileDescriptor13) } + +var fileDescriptor13 = []byte{ + // 198 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xcf, 0xcf, 0x4f, + 0xcf, 0x49, 0xd5, 0x4f, 0x2c, 0xc8, 0xd4, 0x2f, 0xce, 0x2f, 0x2d, 0x4a, 0x4e, 0x8d, 0xcf, 0xcc, + 0x4b, 0xcb, 0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x82, 0xc8, 0xea, 0x25, 0x16, 0x64, + 0x4a, 0x49, 0x42, 0x55, 0x82, 0x65, 0x92, 0x4a, 0xd3, 0xf4, 0x13, 0xf3, 0x2a, 0x21, 0xca, 0x94, + 0x5c, 0xb9, 0xb8, 0x82, 0xc1, 0x7a, 0x3d, 0xf3, 0xd2, 0xf2, 0x85, 0xcc, 0xb9, 0x78, 0xa0, 0x26, + 0xa5, 0x65, 0xe6, 0xa4, 0x16, 0x4b, 0x30, 0x2a, 0x30, 0x6b, 0x70, 0x1b, 0x89, 0xe8, 0x41, 0xcd, + 0x82, 0xe9, 0xd7, 0x73, 0xcc, 0xab, 0x0c, 0xe2, 0x86, 0xa8, 0x74, 0x03, 0x29, 0x74, 0x2a, 0xe4, + 0xe2, 0x4b, 0xce, 0xcf, 0xd5, 0x43, 0xd8, 0xe9, 0xc4, 0x8f, 0x30, 0x36, 0x00, 0xa4, 0x2d, 0x80, + 0x31, 0xca, 0x15, 0x2a, 0x9d, 0x9e, 0x9f, 0x93, 0x98, 0x97, 0xae, 0x97, 0x5f, 0x94, 0xae, 0x9f, + 0x9e, 0x9a, 0x07, 0x36, 0x54, 0x1f, 0x22, 0x95, 0x58, 0x90, 0x59, 0x0c, 0xf1, 0x4f, 0x6a, 0x51, + 0x59, 0x66, 0x72, 0x6a, 0x72, 0x7e, 0x5e, 0x5a, 0x66, 0xba, 0x35, 0x0a, 0x6f, 0x11, 0x13, 0x8b, + 0xbb, 0x63, 0x80, 0x67, 0x12, 0x1b, 0x58, 0xa3, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xd4, 0x78, + 0x5d, 0xab, 0x07, 0x01, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/system_parameter.pb.go b/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/system_parameter.pb.go index 937416e..9f9366d 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/system_parameter.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/system_parameter.pb.go @@ -55,7 +55,7 @@ type SystemParameters struct { func (m *SystemParameters) Reset() { *m = SystemParameters{} } func (m *SystemParameters) String() string { return proto.CompactTextString(m) } func (*SystemParameters) ProtoMessage() {} -func (*SystemParameters) Descriptor() ([]byte, []int) { return fileDescriptor12, []int{0} } +func (*SystemParameters) Descriptor() ([]byte, []int) { return fileDescriptor14, []int{0} } func (m *SystemParameters) GetRules() []*SystemParameterRule { if m != nil { @@ -83,7 +83,7 @@ type SystemParameterRule struct { func (m *SystemParameterRule) Reset() { *m = SystemParameterRule{} } func (m *SystemParameterRule) String() string { return proto.CompactTextString(m) } func (*SystemParameterRule) ProtoMessage() {} -func (*SystemParameterRule) Descriptor() ([]byte, []int) { return fileDescriptor12, []int{1} } +func (*SystemParameterRule) Descriptor() ([]byte, []int) { return fileDescriptor14, []int{1} } func (m *SystemParameterRule) GetSelector() string { if m != nil { @@ -116,7 +116,7 @@ type SystemParameter struct { func (m *SystemParameter) Reset() { *m = SystemParameter{} } func (m *SystemParameter) String() string { return proto.CompactTextString(m) } func (*SystemParameter) ProtoMessage() {} -func (*SystemParameter) Descriptor() ([]byte, []int) { return fileDescriptor12, []int{2} } +func (*SystemParameter) Descriptor() ([]byte, []int) { return fileDescriptor14, []int{2} } func (m *SystemParameter) GetName() string { if m != nil { @@ -145,9 +145,9 @@ func init() { proto.RegisterType((*SystemParameter)(nil), "google.api.SystemParameter") } -func init() { proto.RegisterFile("google/api/system_parameter.proto", fileDescriptor12) } +func init() { proto.RegisterFile("google/api/system_parameter.proto", fileDescriptor14) } -var fileDescriptor12 = []byte{ +var fileDescriptor14 = []byte{ // 286 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xbf, 0x4e, 0xc3, 0x30, 0x10, 0x87, 0x95, 0xb6, 0x20, 0xb8, 0x4a, 0xfc, 0x71, 0x19, 0x22, 0x18, 0x5a, 0x3a, 0x75, 0x72, diff --git a/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/usage.pb.go b/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/usage.pb.go index cabacf8..e09a7e7 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/usage.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/usage.pb.go @@ -38,7 +38,7 @@ type Usage struct { func (m *Usage) Reset() { *m = Usage{} } func (m *Usage) String() string { return proto.CompactTextString(m) } func (*Usage) ProtoMessage() {} -func (*Usage) Descriptor() ([]byte, []int) { return fileDescriptor13, []int{0} } +func (*Usage) Descriptor() ([]byte, []int) { return fileDescriptor15, []int{0} } func (m *Usage) GetRequirements() []string { if m != nil { @@ -99,7 +99,7 @@ type UsageRule struct { func (m *UsageRule) Reset() { *m = UsageRule{} } func (m *UsageRule) String() string { return proto.CompactTextString(m) } func (*UsageRule) ProtoMessage() {} -func (*UsageRule) Descriptor() ([]byte, []int) { return fileDescriptor13, []int{1} } +func (*UsageRule) Descriptor() ([]byte, []int) { return fileDescriptor15, []int{1} } func (m *UsageRule) GetSelector() string { if m != nil { @@ -120,9 +120,9 @@ func init() { proto.RegisterType((*UsageRule)(nil), "google.api.UsageRule") } -func init() { proto.RegisterFile("google/api/usage.proto", fileDescriptor13) } +func init() { proto.RegisterFile("google/api/usage.proto", fileDescriptor15) } -var fileDescriptor13 = []byte{ +var fileDescriptor15 = []byte{ // 303 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x90, 0xcf, 0x4b, 0x3b, 0x31, 0x10, 0xc5, 0x49, 0xfb, 0x6d, 0xbf, 0x6d, 0x14, 0x0f, 0x01, 0x4b, 0xa8, 0x0a, 0x4b, 0x4f, 0x0b, diff --git a/vendor/google.golang.org/genproto/googleapis/api/servicemanagement/v1/servicemanager.pb.go b/vendor/google.golang.org/genproto/googleapis/api/servicemanagement/v1/servicemanager.pb.go index 55aa67f..0468128 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/servicemanagement/v1/servicemanager.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/servicemanagement/v1/servicemanager.pb.go @@ -8,10 +8,10 @@ import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" import _ "google.golang.org/genproto/googleapis/api/annotations" -import google_api19 "google.golang.org/genproto/googleapis/api/serviceconfig" +import _ "google.golang.org/genproto/googleapis/api/serviceconfig" +import google_api21 "google.golang.org/genproto/googleapis/api/serviceconfig" import google_longrunning "google.golang.org/genproto/googleapis/longrunning" import google_protobuf1 "github.com/golang/protobuf/ptypes/any" -import _ "github.com/golang/protobuf/ptypes/empty" import _ "google.golang.org/genproto/protobuf/field_mask" import _ "github.com/golang/protobuf/ptypes/struct" import _ "google.golang.org/genproto/googleapis/rpc/status" @@ -26,6 +26,34 @@ var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +type GetServiceConfigRequest_ConfigView int32 + +const ( + // Server response includes all fields except SourceInfo. + GetServiceConfigRequest_BASIC GetServiceConfigRequest_ConfigView = 0 + // Server response includes all fields including SourceInfo. + // SourceFiles are of type 'google.api.servicemanagement.v1.ConfigFile' + // and are only available for configs created using the + // SubmitConfigSource method. + GetServiceConfigRequest_FULL GetServiceConfigRequest_ConfigView = 1 +) + +var GetServiceConfigRequest_ConfigView_name = map[int32]string{ + 0: "BASIC", + 1: "FULL", +} +var GetServiceConfigRequest_ConfigView_value = map[string]int32{ + "BASIC": 0, + "FULL": 1, +} + +func (x GetServiceConfigRequest_ConfigView) String() string { + return proto.EnumName(GetServiceConfigRequest_ConfigView_name, int32(x)) +} +func (GetServiceConfigRequest_ConfigView) EnumDescriptor() ([]byte, []int) { + return fileDescriptor1, []int{7, 0} +} + // Request message for `ListServices` method. type ListServicesRequest struct { // Include services produced by the specified project. @@ -35,6 +63,12 @@ type ListServicesRequest struct { // Token identifying which result to start with; returned by a previous list // call. PageToken string `protobuf:"bytes,6,opt,name=page_token,json=pageToken" json:"page_token,omitempty"` + // Include services consumed by the specified consumer. + // + // The Google Service Management implementation accepts the following + // forms: + // - project: + ConsumerId string `protobuf:"bytes,7,opt,name=consumer_id,json=consumerId" json:"consumer_id,omitempty"` } func (m *ListServicesRequest) Reset() { *m = ListServicesRequest{} } @@ -63,9 +97,16 @@ func (m *ListServicesRequest) GetPageToken() string { return "" } +func (m *ListServicesRequest) GetConsumerId() string { + if m != nil { + return m.ConsumerId + } + return "" +} + // Response message for `ListServices` method. type ListServicesResponse struct { - // The results of the query. + // The returned services will only have the name field set. Services []*ManagedService `protobuf:"bytes,1,rep,name=services" json:"services,omitempty"` // Token that can be passed to `ListServices` to resume a paginated query. NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken" json:"next_page_token,omitempty"` @@ -188,7 +229,11 @@ type GetServiceConfigRequest struct { // The name of the service. See the [overview](/service-management/overview) // for naming requirements. For example: `example.googleapis.com`. ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName" json:"service_name,omitempty"` - ConfigId string `protobuf:"bytes,2,opt,name=config_id,json=configId" json:"config_id,omitempty"` + // The id of the service configuration resource. + ConfigId string `protobuf:"bytes,2,opt,name=config_id,json=configId" json:"config_id,omitempty"` + // Specifies which parts of the Service Config should be returned in the + // response. + View GetServiceConfigRequest_ConfigView `protobuf:"varint,3,opt,name=view,enum=google.api.servicemanagement.v1.GetServiceConfigRequest_ConfigView" json:"view,omitempty"` } func (m *GetServiceConfigRequest) Reset() { *m = GetServiceConfigRequest{} } @@ -210,6 +255,13 @@ func (m *GetServiceConfigRequest) GetConfigId() string { return "" } +func (m *GetServiceConfigRequest) GetView() GetServiceConfigRequest_ConfigView { + if m != nil { + return m.View + } + return GetServiceConfigRequest_BASIC +} + // Request message for ListServiceConfigs method. type ListServiceConfigsRequest struct { // The name of the service. See the [overview](/service-management/overview) @@ -250,7 +302,7 @@ func (m *ListServiceConfigsRequest) GetPageSize() int32 { // Response message for ListServiceConfigs method. type ListServiceConfigsResponse struct { // The list of service configuration resources. - ServiceConfigs []*google_api19.Service `protobuf:"bytes,1,rep,name=service_configs,json=serviceConfigs" json:"service_configs,omitempty"` + ServiceConfigs []*google_api21.Service `protobuf:"bytes,1,rep,name=service_configs,json=serviceConfigs" json:"service_configs,omitempty"` // The token of the next page of results. NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken" json:"next_page_token,omitempty"` } @@ -260,7 +312,7 @@ func (m *ListServiceConfigsResponse) String() string { return proto.C func (*ListServiceConfigsResponse) ProtoMessage() {} func (*ListServiceConfigsResponse) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{9} } -func (m *ListServiceConfigsResponse) GetServiceConfigs() []*google_api19.Service { +func (m *ListServiceConfigsResponse) GetServiceConfigs() []*google_api21.Service { if m != nil { return m.ServiceConfigs } @@ -280,7 +332,7 @@ type CreateServiceConfigRequest struct { // for naming requirements. For example: `example.googleapis.com`. ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName" json:"service_name,omitempty"` // The service configuration resource. - ServiceConfig *google_api19.Service `protobuf:"bytes,2,opt,name=service_config,json=serviceConfig" json:"service_config,omitempty"` + ServiceConfig *google_api21.Service `protobuf:"bytes,2,opt,name=service_config,json=serviceConfig" json:"service_config,omitempty"` } func (m *CreateServiceConfigRequest) Reset() { *m = CreateServiceConfigRequest{} } @@ -295,7 +347,7 @@ func (m *CreateServiceConfigRequest) GetServiceName() string { return "" } -func (m *CreateServiceConfigRequest) GetServiceConfig() *google_api19.Service { +func (m *CreateServiceConfigRequest) GetServiceConfig() *google_api21.Service { if m != nil { return m.ServiceConfig } @@ -344,7 +396,7 @@ func (m *SubmitConfigSourceRequest) GetValidateOnly() bool { // Response message for SubmitConfigSource method. type SubmitConfigSourceResponse struct { // The generated service configuration. - ServiceConfig *google_api19.Service `protobuf:"bytes,1,opt,name=service_config,json=serviceConfig" json:"service_config,omitempty"` + ServiceConfig *google_api21.Service `protobuf:"bytes,1,opt,name=service_config,json=serviceConfig" json:"service_config,omitempty"` } func (m *SubmitConfigSourceResponse) Reset() { *m = SubmitConfigSourceResponse{} } @@ -352,7 +404,7 @@ func (m *SubmitConfigSourceResponse) String() string { return proto.C func (*SubmitConfigSourceResponse) ProtoMessage() {} func (*SubmitConfigSourceResponse) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{12} } -func (m *SubmitConfigSourceResponse) GetServiceConfig() *google_api19.Service { +func (m *SubmitConfigSourceResponse) GetServiceConfig() *google_api21.Service { if m != nil { return m.ServiceConfig } @@ -396,6 +448,15 @@ type ListServiceRolloutsRequest struct { PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken" json:"page_token,omitempty"` // The max number of items to include in the response list. PageSize int32 `protobuf:"varint,3,opt,name=page_size,json=pageSize" json:"page_size,omitempty"` + // Use `filter` to return subset of rollouts. + // The following filters are supported: + // -- To limit the results to only those in + // [status](google.api.servicemanagement.v1.RolloutStatus) 'SUCCESS', + // use filter='status=SUCCESS' + // -- To limit the results to those in + // [status](google.api.servicemanagement.v1.RolloutStatus) 'CANCELLED' + // or 'FAILED', use filter='status=CANCELLED OR status=FAILED' + Filter string `protobuf:"bytes,4,opt,name=filter" json:"filter,omitempty"` } func (m *ListServiceRolloutsRequest) Reset() { *m = ListServiceRolloutsRequest{} } @@ -424,6 +485,13 @@ func (m *ListServiceRolloutsRequest) GetPageSize() int32 { return 0 } +func (m *ListServiceRolloutsRequest) GetFilter() string { + if m != nil { + return m.Filter + } + return "" +} + // Response message for ListServiceRollouts method. type ListServiceRolloutsResponse struct { // The list of rollout resources. @@ -488,7 +556,8 @@ type EnableServiceRequest struct { // applied to. // // The Google Service Management implementation accepts the following - // forms: "project:", "project_number:". + // forms: + // - "project:" // // Note: this is made compatible with // google.api.servicecontrol.v1.Operation.consumer_id. @@ -523,7 +592,8 @@ type DisableServiceRequest struct { // applied to. // // The Google Service Management implementation accepts the following - // forms: "project:", "project_number:". + // forms: + // - "project:" // // Note: this is made compatible with // google.api.servicecontrol.v1.Operation.consumer_id. @@ -654,6 +724,7 @@ func init() { proto.RegisterType((*DisableServiceRequest)(nil), "google.api.servicemanagement.v1.DisableServiceRequest") proto.RegisterType((*GenerateConfigReportRequest)(nil), "google.api.servicemanagement.v1.GenerateConfigReportRequest") proto.RegisterType((*GenerateConfigReportResponse)(nil), "google.api.servicemanagement.v1.GenerateConfigReportResponse") + proto.RegisterEnum("google.api.servicemanagement.v1.GetServiceConfigRequest_ConfigView", GetServiceConfigRequest_ConfigView_name, GetServiceConfigRequest_ConfigView_value) } // Reference imports to suppress errors if they are not otherwise used. @@ -667,16 +738,25 @@ const _ = grpc.SupportPackageIsVersion4 // Client API for ServiceManager service type ServiceManagerClient interface { - // Lists all managed services. + // Lists managed services. + // + // Returns all public services. For authenticated users, also returns all + // services the calling user has "servicemanagement.services.get" permission + // for. + // + // **BETA:** If the caller specifies the `consumer_id`, it returns only the + // services enabled on the consumer. The `consumer_id` must have the format + // of "project:{PROJECT-ID}". ListServices(ctx context.Context, in *ListServicesRequest, opts ...grpc.CallOption) (*ListServicesResponse, error) - // Gets a managed service. + // Gets a managed service. Authentication is required unless the service is + // public. GetService(ctx context.Context, in *GetServiceRequest, opts ...grpc.CallOption) (*ManagedService, error) // Creates a new managed service. // Please note one producer project can own no more than 20 services. // // Operation CreateService(ctx context.Context, in *CreateServiceRequest, opts ...grpc.CallOption) (*google_longrunning.Operation, error) - // Deletes a managed service. This method will change the serivce in the + // Deletes a managed service. This method will change the service to the // `Soft-Delete` state for 30 days. Within this period, service producers may // call [UndeleteService][google.api.servicemanagement.v1.ServiceManager.UndeleteService] to restore the service. // After 30 days, the service will be permanently deleted. @@ -694,12 +774,12 @@ type ServiceManagerClient interface { // from the newest to the oldest. ListServiceConfigs(ctx context.Context, in *ListServiceConfigsRequest, opts ...grpc.CallOption) (*ListServiceConfigsResponse, error) // Gets a service configuration (version) for a managed service. - GetServiceConfig(ctx context.Context, in *GetServiceConfigRequest, opts ...grpc.CallOption) (*google_api19.Service, error) + GetServiceConfig(ctx context.Context, in *GetServiceConfigRequest, opts ...grpc.CallOption) (*google_api21.Service, error) // Creates a new service configuration (version) for a managed service. // This method only stores the service configuration. To roll out the service // configuration to backend systems please call // [CreateServiceRollout][google.api.servicemanagement.v1.ServiceManager.CreateServiceRollout]. - CreateServiceConfig(ctx context.Context, in *CreateServiceConfigRequest, opts ...grpc.CallOption) (*google_api19.Service, error) + CreateServiceConfig(ctx context.Context, in *CreateServiceConfigRequest, opts ...grpc.CallOption) (*google_api21.Service, error) // Creates a new service configuration (version) for a managed service based // on // user-supplied configuration source files (for example: OpenAPI @@ -738,14 +818,16 @@ type ServiceManagerClient interface { // will compare GenerateConfigReportRequest.new_value with the last pushed // service configuration. GenerateConfigReport(ctx context.Context, in *GenerateConfigReportRequest, opts ...grpc.CallOption) (*GenerateConfigReportResponse, error) - // Enable a managed service for a project with default setting. + // Enables a [service][google.api.servicemanagement.v1.ManagedService] for a project, so it can be used + // for the project. See + // [Cloud Auth Guide](https://cloud.google.com/docs/authentication) for + // more information. // // Operation - // - // [google.rpc.Status][google.rpc.Status] errors may contain a - // [google.rpc.PreconditionFailure][] error detail. EnableService(ctx context.Context, in *EnableServiceRequest, opts ...grpc.CallOption) (*google_longrunning.Operation, error) - // Disable a managed service for a project. + // Disables a [service][google.api.servicemanagement.v1.ManagedService] for a project, so it can no longer be + // be used for the project. It prevents accidental usage that may cause + // unexpected billing charges or security leaks. // // Operation DisableService(ctx context.Context, in *DisableServiceRequest, opts ...grpc.CallOption) (*google_longrunning.Operation, error) @@ -813,8 +895,8 @@ func (c *serviceManagerClient) ListServiceConfigs(ctx context.Context, in *ListS return out, nil } -func (c *serviceManagerClient) GetServiceConfig(ctx context.Context, in *GetServiceConfigRequest, opts ...grpc.CallOption) (*google_api19.Service, error) { - out := new(google_api19.Service) +func (c *serviceManagerClient) GetServiceConfig(ctx context.Context, in *GetServiceConfigRequest, opts ...grpc.CallOption) (*google_api21.Service, error) { + out := new(google_api21.Service) err := grpc.Invoke(ctx, "/google.api.servicemanagement.v1.ServiceManager/GetServiceConfig", in, out, c.cc, opts...) if err != nil { return nil, err @@ -822,8 +904,8 @@ func (c *serviceManagerClient) GetServiceConfig(ctx context.Context, in *GetServ return out, nil } -func (c *serviceManagerClient) CreateServiceConfig(ctx context.Context, in *CreateServiceConfigRequest, opts ...grpc.CallOption) (*google_api19.Service, error) { - out := new(google_api19.Service) +func (c *serviceManagerClient) CreateServiceConfig(ctx context.Context, in *CreateServiceConfigRequest, opts ...grpc.CallOption) (*google_api21.Service, error) { + out := new(google_api21.Service) err := grpc.Invoke(ctx, "/google.api.servicemanagement.v1.ServiceManager/CreateServiceConfig", in, out, c.cc, opts...) if err != nil { return nil, err @@ -897,16 +979,25 @@ func (c *serviceManagerClient) DisableService(ctx context.Context, in *DisableSe // Server API for ServiceManager service type ServiceManagerServer interface { - // Lists all managed services. + // Lists managed services. + // + // Returns all public services. For authenticated users, also returns all + // services the calling user has "servicemanagement.services.get" permission + // for. + // + // **BETA:** If the caller specifies the `consumer_id`, it returns only the + // services enabled on the consumer. The `consumer_id` must have the format + // of "project:{PROJECT-ID}". ListServices(context.Context, *ListServicesRequest) (*ListServicesResponse, error) - // Gets a managed service. + // Gets a managed service. Authentication is required unless the service is + // public. GetService(context.Context, *GetServiceRequest) (*ManagedService, error) // Creates a new managed service. // Please note one producer project can own no more than 20 services. // // Operation CreateService(context.Context, *CreateServiceRequest) (*google_longrunning.Operation, error) - // Deletes a managed service. This method will change the serivce in the + // Deletes a managed service. This method will change the service to the // `Soft-Delete` state for 30 days. Within this period, service producers may // call [UndeleteService][google.api.servicemanagement.v1.ServiceManager.UndeleteService] to restore the service. // After 30 days, the service will be permanently deleted. @@ -924,12 +1015,12 @@ type ServiceManagerServer interface { // from the newest to the oldest. ListServiceConfigs(context.Context, *ListServiceConfigsRequest) (*ListServiceConfigsResponse, error) // Gets a service configuration (version) for a managed service. - GetServiceConfig(context.Context, *GetServiceConfigRequest) (*google_api19.Service, error) + GetServiceConfig(context.Context, *GetServiceConfigRequest) (*google_api21.Service, error) // Creates a new service configuration (version) for a managed service. // This method only stores the service configuration. To roll out the service // configuration to backend systems please call // [CreateServiceRollout][google.api.servicemanagement.v1.ServiceManager.CreateServiceRollout]. - CreateServiceConfig(context.Context, *CreateServiceConfigRequest) (*google_api19.Service, error) + CreateServiceConfig(context.Context, *CreateServiceConfigRequest) (*google_api21.Service, error) // Creates a new service configuration (version) for a managed service based // on // user-supplied configuration source files (for example: OpenAPI @@ -968,14 +1059,16 @@ type ServiceManagerServer interface { // will compare GenerateConfigReportRequest.new_value with the last pushed // service configuration. GenerateConfigReport(context.Context, *GenerateConfigReportRequest) (*GenerateConfigReportResponse, error) - // Enable a managed service for a project with default setting. + // Enables a [service][google.api.servicemanagement.v1.ManagedService] for a project, so it can be used + // for the project. See + // [Cloud Auth Guide](https://cloud.google.com/docs/authentication) for + // more information. // // Operation - // - // [google.rpc.Status][google.rpc.Status] errors may contain a - // [google.rpc.PreconditionFailure][] error detail. EnableService(context.Context, *EnableServiceRequest) (*google_longrunning.Operation, error) - // Disable a managed service for a project. + // Disables a [service][google.api.servicemanagement.v1.ManagedService] for a project, so it can no longer be + // be used for the project. It prevents accidental usage that may cause + // unexpected billing charges or security leaks. // // Operation DisableService(context.Context, *DisableServiceRequest) (*google_longrunning.Operation, error) @@ -1329,89 +1422,94 @@ func init() { } var fileDescriptor1 = []byte{ - // 1343 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcf, 0x6f, 0xdc, 0x44, - 0x14, 0xd6, 0x6c, 0x7f, 0x25, 0x2f, 0xd9, 0x2d, 0x9d, 0x5d, 0xc8, 0xd6, 0xdb, 0xa8, 0xa9, 0x03, - 0x25, 0x4a, 0xe9, 0x5a, 0xe9, 0x4f, 0xba, 0x29, 0x87, 0xb6, 0x41, 0x55, 0x04, 0xa5, 0xd1, 0xa6, - 0x48, 0x50, 0x90, 0x56, 0x8e, 0x3d, 0x31, 0xa6, 0xde, 0x19, 0xe3, 0xf1, 0xa6, 0x24, 0x51, 0x0e, - 0x54, 0x95, 0x90, 0xe8, 0x09, 0xf1, 0xa3, 0x12, 0x47, 0x84, 0x38, 0x70, 0xe0, 0xc2, 0x01, 0x89, - 0x03, 0x12, 0x7f, 0x03, 0xff, 0x02, 0x7f, 0x03, 0x67, 0xb4, 0xe3, 0xf1, 0xc6, 0xb3, 0xeb, 0xac, - 0xed, 0x08, 0x38, 0xfa, 0x8d, 0xbf, 0xf7, 0xbe, 0x79, 0xf3, 0xcd, 0xf3, 0xb7, 0x0b, 0x57, 0x1c, - 0xc6, 0x1c, 0x8f, 0x18, 0xa6, 0xef, 0x1a, 0x9c, 0x04, 0x5b, 0xae, 0x45, 0xba, 0x26, 0x35, 0x1d, - 0xd2, 0x25, 0x34, 0x34, 0xb6, 0x96, 0xd4, 0x60, 0xd0, 0xf4, 0x03, 0x16, 0x32, 0x7c, 0x36, 0x42, - 0x35, 0x4d, 0xdf, 0x6d, 0x8e, 0xa0, 0x9a, 0x5b, 0x4b, 0xda, 0x99, 0x44, 0x5a, 0x93, 0x52, 0x16, - 0x9a, 0xa1, 0xcb, 0x28, 0x8f, 0xe0, 0x5a, 0x7d, 0xb4, 0xa8, 0x5c, 0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d7, 0x25, 0xc1, - 0x7e, 0x6a, 0x88, 0x43, 0xab, 0xb6, 0xfe, 0x01, 0xbc, 0xb8, 0xe2, 0xf2, 0xff, 0x28, 0xf9, 0xe7, - 0x08, 0x1a, 0x77, 0x09, 0xed, 0xfb, 0x98, 0xc1, 0xd4, 0xf0, 0x59, 0x30, 0x68, 0xcd, 0x65, 0x00, - 0x4a, 0x1e, 0xab, 0x17, 0xa0, 0x16, 0x1f, 0x53, 0x6c, 0x46, 0x9a, 0xb7, 0xe8, 0x76, 0x7b, 0x92, - 0x92, 0xc7, 0x51, 0x86, 0x3e, 0x88, 0x79, 0xb6, 0x3a, 0x49, 0x0e, 0x00, 0x31, 0xcf, 0x96, 0x57, - 0xe6, 0x6f, 0x04, 0x67, 0xd2, 0x99, 0x48, 0xbd, 0xe4, 0xd8, 0x6e, 0x05, 0x4a, 0x83, 0x5d, 0x96, - 0x5c, 0x1b, 0x3f, 0x80, 0x8a, 0xf5, 0x91, 0x49, 0x1d, 0xd2, 0x09, 0x44, 0x2e, 0x5e, 0x3f, 0x22, - 0x84, 0x96, 0x63, 0xb4, 0x08, 0x98, 0x64, 0x50, 0xb6, 0x12, 0x4f, 0x1c, 0xdf, 0x83, 0x29, 0xdb, - 0x35, 0x1d, 0xca, 0x78, 0xe8, 0x5a, 0xbc, 0x7e, 0x54, 0xa4, 0xbc, 0x90, 0x99, 0x72, 0x65, 0x80, - 0x69, 0x27, 0xf1, 0x97, 0x7e, 0xae, 0x42, 0x45, 0x9e, 0x6c, 0xf4, 0xed, 0x0c, 0xf0, 0x97, 0x08, - 0xa6, 0x93, 0x96, 0x09, 0x5f, 0xc9, 0xcc, 0x9e, 0xe2, 0xf2, 0xb4, 0xab, 0x05, 0x51, 0x51, 0xa3, - 0xf5, 0xda, 0x93, 0x3f, 0xff, 0xfa, 0xaa, 0x54, 0xc1, 0xd3, 0x09, 0x5b, 0xce, 0xf1, 0xb7, 0x08, - 0x60, 0xff, 0x06, 0xe1, 0x4b, 0x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- 0x96, 0x1d, 0x65, 0x6e, 0xa1, 0xc5, 0xdb, 0xdf, 0x20, 0x98, 0xb7, 0x58, 0x37, 0x8b, 0xcc, 0xed, - 0xaa, 0xea, 0xea, 0xd6, 0xfa, 0xc6, 0x77, 0x0d, 0x3d, 0x5c, 0x93, 0x38, 0x87, 0x79, 0x26, 0x75, - 0x9a, 0x2c, 0x70, 0x0c, 0x87, 0x50, 0x61, 0x8b, 0xe5, 0xbf, 0x92, 0xa6, 0xef, 0xf2, 0x03, 0xff, - 0x99, 0x5c, 0x1e, 0x09, 0x7e, 0x5f, 0x3a, 0x7a, 0xf7, 0xd6, 0xfa, 0xbd, 0x8d, 0xe3, 0x22, 0xc7, - 0xe5, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xb2, 0xf0, 0x70, 0x6f, 0x6b, 0x15, 0x00, 0x00, + // 1420 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0x67, 0x9c, 0xb4, 0x4d, 0x5e, 0x62, 0xb7, 0x9d, 0xb8, 0x8d, 0xeb, 0x34, 0x6a, 0xba, 0x81, + 0x12, 0xa5, 0xd4, 0xab, 0xa4, 0xff, 0xa8, 0x53, 0x0e, 0x4d, 0x02, 0x55, 0x44, 0x4b, 0x23, 0xa7, + 0x05, 0x54, 0x90, 0xac, 0xcd, 0xee, 0x64, 0xbb, 0x74, 0x3d, 0x63, 0x76, 0xd6, 0x09, 0x69, 0x94, + 0x4b, 0x55, 0x09, 0x09, 0x4e, 0xa8, 0x40, 0x25, 0x8e, 0x15, 0xe2, 0xc0, 0x81, 0x0b, 0x07, 0x24, + 0x0e, 0x48, 0x7c, 0x06, 0xc4, 0x37, 0xe0, 0x33, 0x70, 0x46, 0x9e, 0x9d, 0x75, 0x76, 0xec, 0x8d, + 0x77, 0xd7, 0x02, 0x8e, 0xfb,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 0x2a, 0x64, 0xb1, 0xfc, 0x5f, 0x6a, 0x34, 0x1d, 0x7e, 0xe8, 0x3f, 0xd3, 0xa5, + 0x1e, 0xe3, 0xcb, 0xdc, 0xf0, 0xed, 0x5b, 0x1b, 0x77, 0x37, 0x8f, 0x0a, 0x1f, 0x97, 0xff, 0x09, + 0x00, 0x00, 0xff, 0xff, 0x50, 0x43, 0x0b, 0xb9, 0x1c, 0x16, 0x00, 0x00, } diff --git a/vendor/google.golang.org/genproto/googleapis/assistant/embedded/v1alpha1/embedded_assistant.pb.go b/vendor/google.golang.org/genproto/googleapis/assistant/embedded/v1alpha1/embedded_assistant.pb.go new file mode 100644 index 0000000..94df28b --- /dev/null +++ b/vendor/google.golang.org/genproto/googleapis/assistant/embedded/v1alpha1/embedded_assistant.pb.go @@ -0,0 +1,970 @@ +// Code generated by protoc-gen-go. +// source: google/assistant/embedded/v1alpha1/embedded_assistant.proto +// DO NOT EDIT! + +/* +Package embedded is a generated protocol buffer package. + +It is generated from these files: + google/assistant/embedded/v1alpha1/embedded_assistant.proto + +It has these top-level messages: + ConverseConfig + AudioInConfig + AudioOutConfig + ConverseState + AudioOut + ConverseResult + ConverseRequest + ConverseResponse +*/ +package embedded + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "google.golang.org/genproto/googleapis/api/annotations" +import google_rpc "google.golang.org/genproto/googleapis/rpc/status" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +// Audio encoding of the data sent in the audio message. +// Audio must be one-channel (mono). The only language supported is "en-US". +type AudioInConfig_Encoding int32 + +const ( + // Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][]. + AudioInConfig_ENCODING_UNSPECIFIED AudioInConfig_Encoding = 0 + // Uncompressed 16-bit signed little-endian samples (Linear PCM). + // This encoding includes no header, only the raw audio bytes. + AudioInConfig_LINEAR16 AudioInConfig_Encoding = 1 + // [`FLAC`](https://xiph.org/flac/documentation.html) (Free Lossless Audio + // Codec) is the recommended encoding because it is + // lossless--therefore recognition is not compromised--and + // requires only about half the bandwidth of `LINEAR16`. This encoding + // includes the `FLAC` stream header followed by audio data. It supports + // 16-bit and 24-bit samples, however, not all fields in `STREAMINFO` are + // supported. + AudioInConfig_FLAC AudioInConfig_Encoding = 2 +) + +var AudioInConfig_Encoding_name = map[int32]string{ + 0: "ENCODING_UNSPECIFIED", + 1: "LINEAR16", + 2: "FLAC", +} +var AudioInConfig_Encoding_value = map[string]int32{ + "ENCODING_UNSPECIFIED": 0, + "LINEAR16": 1, + "FLAC": 2, +} + +func (x AudioInConfig_Encoding) String() string { + return proto.EnumName(AudioInConfig_Encoding_name, int32(x)) +} +func (AudioInConfig_Encoding) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1, 0} } + +// Audio encoding of the data returned in the audio message. All encodings are +// raw audio bytes with no header, except as indicated below. +type AudioOutConfig_Encoding int32 + +const ( + // Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][]. + AudioOutConfig_ENCODING_UNSPECIFIED AudioOutConfig_Encoding = 0 + // Uncompressed 16-bit signed little-endian samples (Linear PCM). + AudioOutConfig_LINEAR16 AudioOutConfig_Encoding = 1 + // MP3 audio encoding. The sample rate is encoded in the payload. + AudioOutConfig_MP3 AudioOutConfig_Encoding = 2 + // Opus-encoded audio wrapped in an ogg container. The result will be a + // file which can be played natively on Android and in some browsers (such + // as Chrome). The quality of the encoding is considerably higher than MP3 + // while using the same bitrate. The sample rate is encoded in the payload. + AudioOutConfig_OPUS_IN_OGG AudioOutConfig_Encoding = 3 +) + +var AudioOutConfig_Encoding_name = map[int32]string{ + 0: "ENCODING_UNSPECIFIED", + 1: "LINEAR16", + 2: "MP3", + 3: "OPUS_IN_OGG", +} +var AudioOutConfig_Encoding_value = map[string]int32{ + "ENCODING_UNSPECIFIED": 0, + "LINEAR16": 1, + "MP3": 2, + "OPUS_IN_OGG": 3, +} + +func (x AudioOutConfig_Encoding) String() string { + return proto.EnumName(AudioOutConfig_Encoding_name, int32(x)) +} +func (AudioOutConfig_Encoding) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} } + +// Possible states of the microphone after a `Converse` RPC completes. +type ConverseResult_MicrophoneMode int32 + +const ( + // No mode specified. + ConverseResult_MICROPHONE_MODE_UNSPECIFIED ConverseResult_MicrophoneMode = 0 + // The service is not expecting a follow-on question from the user. + // The microphone should remain off until the user re-activates it. + ConverseResult_CLOSE_MICROPHONE ConverseResult_MicrophoneMode = 1 + // The service is expecting a follow-on question from the user. The + // microphone should be re-opened when the `AudioOut` playback completes + // (by starting a new `Converse` RPC call to send the new audio). + ConverseResult_DIALOG_FOLLOW_ON ConverseResult_MicrophoneMode = 2 +) + +var ConverseResult_MicrophoneMode_name = map[int32]string{ + 0: "MICROPHONE_MODE_UNSPECIFIED", + 1: "CLOSE_MICROPHONE", + 2: "DIALOG_FOLLOW_ON", +} +var ConverseResult_MicrophoneMode_value = map[string]int32{ + "MICROPHONE_MODE_UNSPECIFIED": 0, + "CLOSE_MICROPHONE": 1, + "DIALOG_FOLLOW_ON": 2, +} + +func (x ConverseResult_MicrophoneMode) String() string { + return proto.EnumName(ConverseResult_MicrophoneMode_name, int32(x)) +} +func (ConverseResult_MicrophoneMode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{5, 0} +} + +// Indicates the type of event. +type ConverseResponse_EventType int32 + +const ( + // No event specified. + ConverseResponse_EVENT_TYPE_UNSPECIFIED ConverseResponse_EventType = 0 + // This event indicates that the server has detected the end of the user's + // speech utterance and expects no additional speech. Therefore, the server + // will not process additional audio (although it may subsequently return + // additional results). The client should stop sending additional audio + // data, half-close the gRPC connection, and wait for any additional results + // until the server closes the gRPC connection. + ConverseResponse_END_OF_UTTERANCE ConverseResponse_EventType = 1 +) + +var ConverseResponse_EventType_name = map[int32]string{ + 0: "EVENT_TYPE_UNSPECIFIED", + 1: "END_OF_UTTERANCE", +} +var ConverseResponse_EventType_value = map[string]int32{ + "EVENT_TYPE_UNSPECIFIED": 0, + "END_OF_UTTERANCE": 1, +} + +func (x ConverseResponse_EventType) String() string { + return proto.EnumName(ConverseResponse_EventType_name, int32(x)) +} +func (ConverseResponse_EventType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{7, 0} +} + +// Specifies how to process the `ConverseRequest` messages. +type ConverseConfig struct { + // *Required* Specifies how to process the subsequent incoming audio. + AudioInConfig *AudioInConfig `protobuf:"bytes,1,opt,name=audio_in_config,json=audioInConfig" json:"audio_in_config,omitempty"` + // *Required* Specifies how to format the audio that will be returned. + AudioOutConfig *AudioOutConfig `protobuf:"bytes,2,opt,name=audio_out_config,json=audioOutConfig" json:"audio_out_config,omitempty"` + // *Required* Represents the current dialog state. + ConverseState *ConverseState `protobuf:"bytes,3,opt,name=converse_state,json=converseState" json:"converse_state,omitempty"` +} + +func (m *ConverseConfig) Reset() { *m = ConverseConfig{} } +func (m *ConverseConfig) String() string { return proto.CompactTextString(m) } +func (*ConverseConfig) ProtoMessage() {} +func (*ConverseConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *ConverseConfig) GetAudioInConfig() *AudioInConfig { + if m != nil { + return m.AudioInConfig + } + return nil +} + +func (m *ConverseConfig) GetAudioOutConfig() *AudioOutConfig { + if m != nil { + return m.AudioOutConfig + } + return nil +} + +func (m *ConverseConfig) GetConverseState() *ConverseState { + if m != nil { + return m.ConverseState + } + return nil +} + +// Specifies how to process the `audio_in` data that will be provided in +// subsequent requests. For recommended settings, see the Google Assistant SDK +// [best practices](https://developers.google.com/assistant/best-practices). +type AudioInConfig struct { + // *Required* Encoding of audio data sent in all `audio_in` messages. + Encoding AudioInConfig_Encoding `protobuf:"varint,1,opt,name=encoding,enum=google.assistant.embedded.v1alpha1.AudioInConfig_Encoding" json:"encoding,omitempty"` + // *Required* Sample rate (in Hertz) of the audio data sent in all `audio_in` + // messages. Valid values are from 16000-24000, but 16000 is optimal. + // For best results, set the sampling rate of the audio source to 16000 Hz. + // If that's not possible, use the native sample rate of the audio source + // (instead of re-sampling). + SampleRateHertz int32 `protobuf:"varint,2,opt,name=sample_rate_hertz,json=sampleRateHertz" json:"sample_rate_hertz,omitempty"` +} + +func (m *AudioInConfig) Reset() { *m = AudioInConfig{} } +func (m *AudioInConfig) String() string { return proto.CompactTextString(m) } +func (*AudioInConfig) ProtoMessage() {} +func (*AudioInConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *AudioInConfig) GetEncoding() AudioInConfig_Encoding { + if m != nil { + return m.Encoding + } + return AudioInConfig_ENCODING_UNSPECIFIED +} + +func (m *AudioInConfig) GetSampleRateHertz() int32 { + if m != nil { + return m.SampleRateHertz + } + return 0 +} + +// Specifies the desired format for the server to use when it returns +// `audio_out` messages. +type AudioOutConfig struct { + // *Required* The encoding of audio data to be returned in all `audio_out` + // messages. + Encoding AudioOutConfig_Encoding `protobuf:"varint,1,opt,name=encoding,enum=google.assistant.embedded.v1alpha1.AudioOutConfig_Encoding" json:"encoding,omitempty"` + // *Required* The sample rate in Hertz of the audio data returned in + // `audio_out` messages. Valid values are: 16000-24000. + SampleRateHertz int32 `protobuf:"varint,2,opt,name=sample_rate_hertz,json=sampleRateHertz" json:"sample_rate_hertz,omitempty"` + // *Required* Current volume setting of the device's audio output. + // Valid values are 1 to 100 (corresponding to 1% to 100%). + VolumePercentage int32 `protobuf:"varint,3,opt,name=volume_percentage,json=volumePercentage" json:"volume_percentage,omitempty"` +} + +func (m *AudioOutConfig) Reset() { *m = AudioOutConfig{} } +func (m *AudioOutConfig) String() string { return proto.CompactTextString(m) } +func (*AudioOutConfig) ProtoMessage() {} +func (*AudioOutConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *AudioOutConfig) GetEncoding() AudioOutConfig_Encoding { + if m != nil { + return m.Encoding + } + return AudioOutConfig_ENCODING_UNSPECIFIED +} + +func (m *AudioOutConfig) GetSampleRateHertz() int32 { + if m != nil { + return m.SampleRateHertz + } + return 0 +} + +func (m *AudioOutConfig) GetVolumePercentage() int32 { + if m != nil { + return m.VolumePercentage + } + return 0 +} + +// Provides information about the current dialog state. +type ConverseState struct { + // *Required* The `conversation_state` value returned in the prior + // `ConverseResponse`. Omit (do not set the field) if there was no prior + // `ConverseResponse`. If there was a prior `ConverseResponse`, do not omit + // this field; doing so will end that conversation (and this new request will + // start a new conversation). + ConversationState []byte `protobuf:"bytes,1,opt,name=conversation_state,json=conversationState,proto3" json:"conversation_state,omitempty"` +} + +func (m *ConverseState) Reset() { *m = ConverseState{} } +func (m *ConverseState) String() string { return proto.CompactTextString(m) } +func (*ConverseState) ProtoMessage() {} +func (*ConverseState) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *ConverseState) GetConversationState() []byte { + if m != nil { + return m.ConversationState + } + return nil +} + +// The audio containing the assistant's response to the query. Sequential chunks +// of audio data are received in sequential `ConverseResponse` messages. +type AudioOut struct { + // *Output-only* The audio data containing the assistant's response to the + // query. Sequential chunks of audio data are received in sequential + // `ConverseResponse` messages. + AudioData []byte `protobuf:"bytes,1,opt,name=audio_data,json=audioData,proto3" json:"audio_data,omitempty"` +} + +func (m *AudioOut) Reset() { *m = AudioOut{} } +func (m *AudioOut) String() string { return proto.CompactTextString(m) } +func (*AudioOut) ProtoMessage() {} +func (*AudioOut) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } + +func (m *AudioOut) GetAudioData() []byte { + if m != nil { + return m.AudioData + } + return nil +} + +// The semantic result for the user's spoken query. +type ConverseResult struct { + // *Output-only* The recognized transcript of what the user said. + SpokenRequestText string `protobuf:"bytes,1,opt,name=spoken_request_text,json=spokenRequestText" json:"spoken_request_text,omitempty"` + // *Output-only* The text of the assistant's spoken response. This is only + // returned for an IFTTT action. + SpokenResponseText string `protobuf:"bytes,2,opt,name=spoken_response_text,json=spokenResponseText" json:"spoken_response_text,omitempty"` + // *Output-only* State information for subsequent `ConverseRequest`. This + // value should be saved in the client and returned in the + // `conversation_state` with the next `ConverseRequest`. (The client does not + // need to interpret or otherwise use this value.) There is no need to save + // this information across device restarts. + ConversationState []byte `protobuf:"bytes,3,opt,name=conversation_state,json=conversationState,proto3" json:"conversation_state,omitempty"` + // *Output-only* Specifies the mode of the microphone after this `Converse` + // RPC is processed. + MicrophoneMode ConverseResult_MicrophoneMode `protobuf:"varint,4,opt,name=microphone_mode,json=microphoneMode,enum=google.assistant.embedded.v1alpha1.ConverseResult_MicrophoneMode" json:"microphone_mode,omitempty"` + // *Output-only* Updated volume level. The value will be 0 or omitted + // (indicating no change) unless a voice command such as "Increase the volume" + // or "Set volume level 4" was recognized, in which case the value will be + // between 1 and 100 (corresponding to the new volume level of 1% to 100%). + // Typically, a client should use this volume level when playing the + // `audio_out` data, and retain this value as the current volume level and + // supply it in the `AudioOutConfig` of the next `ConverseRequest`. (Some + // clients may also implement other ways to allow the current volume level to + // be changed, for example, by providing a knob that the user can turn.) + VolumePercentage int32 `protobuf:"varint,5,opt,name=volume_percentage,json=volumePercentage" json:"volume_percentage,omitempty"` +} + +func (m *ConverseResult) Reset() { *m = ConverseResult{} } +func (m *ConverseResult) String() string { return proto.CompactTextString(m) } +func (*ConverseResult) ProtoMessage() {} +func (*ConverseResult) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } + +func (m *ConverseResult) GetSpokenRequestText() string { + if m != nil { + return m.SpokenRequestText + } + return "" +} + +func (m *ConverseResult) GetSpokenResponseText() string { + if m != nil { + return m.SpokenResponseText + } + return "" +} + +func (m *ConverseResult) GetConversationState() []byte { + if m != nil { + return m.ConversationState + } + return nil +} + +func (m *ConverseResult) GetMicrophoneMode() ConverseResult_MicrophoneMode { + if m != nil { + return m.MicrophoneMode + } + return ConverseResult_MICROPHONE_MODE_UNSPECIFIED +} + +func (m *ConverseResult) GetVolumePercentage() int32 { + if m != nil { + return m.VolumePercentage + } + return 0 +} + +// The top-level message sent by the client. Clients must send at least two, and +// typically numerous `ConverseRequest` messages. The first message must +// contain a `config` message and must not contain `audio_in` data. All +// subsequent messages must contain `audio_in` data and must not contain a +// `config` message. +type ConverseRequest struct { + // Exactly one of these fields must be specified in each `ConverseRequest`. + // + // Types that are valid to be assigned to ConverseRequest: + // *ConverseRequest_Config + // *ConverseRequest_AudioIn + ConverseRequest isConverseRequest_ConverseRequest `protobuf_oneof:"converse_request"` +} + +func (m *ConverseRequest) Reset() { *m = ConverseRequest{} } +func (m *ConverseRequest) String() string { return proto.CompactTextString(m) } +func (*ConverseRequest) ProtoMessage() {} +func (*ConverseRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } + +type isConverseRequest_ConverseRequest interface { + isConverseRequest_ConverseRequest() +} + +type ConverseRequest_Config struct { + Config *ConverseConfig `protobuf:"bytes,1,opt,name=config,oneof"` +} +type ConverseRequest_AudioIn struct { + AudioIn []byte `protobuf:"bytes,2,opt,name=audio_in,json=audioIn,proto3,oneof"` +} + +func (*ConverseRequest_Config) isConverseRequest_ConverseRequest() {} +func (*ConverseRequest_AudioIn) isConverseRequest_ConverseRequest() {} + +func (m *ConverseRequest) GetConverseRequest() isConverseRequest_ConverseRequest { + if m != nil { + return m.ConverseRequest + } + return nil +} + +func (m *ConverseRequest) GetConfig() *ConverseConfig { + if x, ok := m.GetConverseRequest().(*ConverseRequest_Config); ok { + return x.Config + } + return nil +} + +func (m *ConverseRequest) GetAudioIn() []byte { + if x, ok := m.GetConverseRequest().(*ConverseRequest_AudioIn); ok { + return x.AudioIn + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*ConverseRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _ConverseRequest_OneofMarshaler, _ConverseRequest_OneofUnmarshaler, _ConverseRequest_OneofSizer, []interface{}{ + (*ConverseRequest_Config)(nil), + (*ConverseRequest_AudioIn)(nil), + } +} + +func _ConverseRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*ConverseRequest) + // converse_request + switch x := m.ConverseRequest.(type) { + case *ConverseRequest_Config: + b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Config); err != nil { + return err + } + case *ConverseRequest_AudioIn: + b.EncodeVarint(2<<3 | proto.WireBytes) + b.EncodeRawBytes(x.AudioIn) + case nil: + default: + return fmt.Errorf("ConverseRequest.ConverseRequest has unexpected type %T", x) + } + return nil +} + +func _ConverseRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*ConverseRequest) + switch tag { + case 1: // converse_request.config + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ConverseConfig) + err := b.DecodeMessage(msg) + m.ConverseRequest = &ConverseRequest_Config{msg} + return true, err + case 2: // converse_request.audio_in + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeRawBytes(true) + m.ConverseRequest = &ConverseRequest_AudioIn{x} + return true, err + default: + return false, nil + } +} + +func _ConverseRequest_OneofSizer(msg proto.Message) (n int) { + m := msg.(*ConverseRequest) + // converse_request + switch x := m.ConverseRequest.(type) { + case *ConverseRequest_Config: + s := proto.Size(x.Config) + n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *ConverseRequest_AudioIn: + n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.AudioIn))) + n += len(x.AudioIn) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// The top-level message received by the client. A series of one or more +// `ConverseResponse` messages are streamed back to the client. +type ConverseResponse struct { + // Exactly one of these fields will be populated in each `ConverseResponse`. + // + // Types that are valid to be assigned to ConverseResponse: + // *ConverseResponse_Error + // *ConverseResponse_EventType_ + // *ConverseResponse_AudioOut + // *ConverseResponse_Result + ConverseResponse isConverseResponse_ConverseResponse `protobuf_oneof:"converse_response"` +} + +func (m *ConverseResponse) Reset() { *m = ConverseResponse{} } +func (m *ConverseResponse) String() string { return proto.CompactTextString(m) } +func (*ConverseResponse) ProtoMessage() {} +func (*ConverseResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } + +type isConverseResponse_ConverseResponse interface { + isConverseResponse_ConverseResponse() +} + +type ConverseResponse_Error struct { + Error *google_rpc.Status `protobuf:"bytes,1,opt,name=error,oneof"` +} +type ConverseResponse_EventType_ struct { + EventType ConverseResponse_EventType `protobuf:"varint,2,opt,name=event_type,json=eventType,enum=google.assistant.embedded.v1alpha1.ConverseResponse_EventType,oneof"` +} +type ConverseResponse_AudioOut struct { + AudioOut *AudioOut `protobuf:"bytes,3,opt,name=audio_out,json=audioOut,oneof"` +} +type ConverseResponse_Result struct { + Result *ConverseResult `protobuf:"bytes,5,opt,name=result,oneof"` +} + +func (*ConverseResponse_Error) isConverseResponse_ConverseResponse() {} +func (*ConverseResponse_EventType_) isConverseResponse_ConverseResponse() {} +func (*ConverseResponse_AudioOut) isConverseResponse_ConverseResponse() {} +func (*ConverseResponse_Result) isConverseResponse_ConverseResponse() {} + +func (m *ConverseResponse) GetConverseResponse() isConverseResponse_ConverseResponse { + if m != nil { + return m.ConverseResponse + } + return nil +} + +func (m *ConverseResponse) GetError() *google_rpc.Status { + if x, ok := m.GetConverseResponse().(*ConverseResponse_Error); ok { + return x.Error + } + return nil +} + +func (m *ConverseResponse) GetEventType() ConverseResponse_EventType { + if x, ok := m.GetConverseResponse().(*ConverseResponse_EventType_); ok { + return x.EventType + } + return ConverseResponse_EVENT_TYPE_UNSPECIFIED +} + +func (m *ConverseResponse) GetAudioOut() *AudioOut { + if x, ok := m.GetConverseResponse().(*ConverseResponse_AudioOut); ok { + return x.AudioOut + } + return nil +} + +func (m *ConverseResponse) GetResult() *ConverseResult { + if x, ok := m.GetConverseResponse().(*ConverseResponse_Result); ok { + return x.Result + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*ConverseResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _ConverseResponse_OneofMarshaler, _ConverseResponse_OneofUnmarshaler, _ConverseResponse_OneofSizer, []interface{}{ + (*ConverseResponse_Error)(nil), + (*ConverseResponse_EventType_)(nil), + (*ConverseResponse_AudioOut)(nil), + (*ConverseResponse_Result)(nil), + } +} + +func _ConverseResponse_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*ConverseResponse) + // converse_response + switch x := m.ConverseResponse.(type) { + case *ConverseResponse_Error: + b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Error); err != nil { + return err + } + case *ConverseResponse_EventType_: + b.EncodeVarint(2<<3 | proto.WireVarint) + b.EncodeVarint(uint64(x.EventType)) + case *ConverseResponse_AudioOut: + b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.AudioOut); err != nil { + return err + } + case *ConverseResponse_Result: + b.EncodeVarint(5<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Result); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("ConverseResponse.ConverseResponse has unexpected type %T", x) + } + return nil +} + +func _ConverseResponse_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*ConverseResponse) + switch tag { + case 1: // converse_response.error + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(google_rpc.Status) + err := b.DecodeMessage(msg) + m.ConverseResponse = &ConverseResponse_Error{msg} + return true, err + case 2: // converse_response.event_type + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.ConverseResponse = &ConverseResponse_EventType_{ConverseResponse_EventType(x)} + return true, err + case 3: // converse_response.audio_out + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(AudioOut) + err := b.DecodeMessage(msg) + m.ConverseResponse = &ConverseResponse_AudioOut{msg} + return true, err + case 5: // converse_response.result + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ConverseResult) + err := b.DecodeMessage(msg) + m.ConverseResponse = &ConverseResponse_Result{msg} + return true, err + default: + return false, nil + } +} + +func _ConverseResponse_OneofSizer(msg proto.Message) (n int) { + m := msg.(*ConverseResponse) + // converse_response + switch x := m.ConverseResponse.(type) { + case *ConverseResponse_Error: + s := proto.Size(x.Error) + n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *ConverseResponse_EventType_: + n += proto.SizeVarint(2<<3 | proto.WireVarint) + n += proto.SizeVarint(uint64(x.EventType)) + case *ConverseResponse_AudioOut: + s := proto.Size(x.AudioOut) + n += proto.SizeVarint(3<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *ConverseResponse_Result: + s := proto.Size(x.Result) + n += proto.SizeVarint(5<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +func init() { + proto.RegisterType((*ConverseConfig)(nil), "google.assistant.embedded.v1alpha1.ConverseConfig") + proto.RegisterType((*AudioInConfig)(nil), "google.assistant.embedded.v1alpha1.AudioInConfig") + proto.RegisterType((*AudioOutConfig)(nil), "google.assistant.embedded.v1alpha1.AudioOutConfig") + proto.RegisterType((*ConverseState)(nil), "google.assistant.embedded.v1alpha1.ConverseState") + proto.RegisterType((*AudioOut)(nil), "google.assistant.embedded.v1alpha1.AudioOut") + proto.RegisterType((*ConverseResult)(nil), "google.assistant.embedded.v1alpha1.ConverseResult") + proto.RegisterType((*ConverseRequest)(nil), "google.assistant.embedded.v1alpha1.ConverseRequest") + proto.RegisterType((*ConverseResponse)(nil), "google.assistant.embedded.v1alpha1.ConverseResponse") + proto.RegisterEnum("google.assistant.embedded.v1alpha1.AudioInConfig_Encoding", AudioInConfig_Encoding_name, AudioInConfig_Encoding_value) + proto.RegisterEnum("google.assistant.embedded.v1alpha1.AudioOutConfig_Encoding", AudioOutConfig_Encoding_name, AudioOutConfig_Encoding_value) + proto.RegisterEnum("google.assistant.embedded.v1alpha1.ConverseResult_MicrophoneMode", ConverseResult_MicrophoneMode_name, ConverseResult_MicrophoneMode_value) + proto.RegisterEnum("google.assistant.embedded.v1alpha1.ConverseResponse_EventType", ConverseResponse_EventType_name, ConverseResponse_EventType_value) +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for EmbeddedAssistant service + +type EmbeddedAssistantClient interface { + // Initiates or continues a conversation with the embedded assistant service. + // Each call performs one round-trip, sending an audio request to the service + // and receiving the audio response. Uses bidirectional streaming to receive + // results, such as the `END_OF_UTTERANCE` event, while sending audio. + // + // A conversation is one or more gRPC connections, each consisting of several + // streamed requests and responses. + // For example, the user says *Add to my shopping list* and the assistant + // responds *What do you want to add?*. The sequence of streamed requests and + // responses in the first gRPC message could be: + // + // * ConverseRequest.config + // * ConverseRequest.audio_in + // * ConverseRequest.audio_in + // * ConverseRequest.audio_in + // * ConverseRequest.audio_in + // * ConverseResponse.event_type.END_OF_UTTERANCE + // * ConverseResponse.result.microphone_mode.DIALOG_FOLLOW_ON + // * ConverseResponse.audio_out + // * ConverseResponse.audio_out + // * ConverseResponse.audio_out + // + // The user then says *bagels* and the assistant responds + // *OK, I've added bagels to your shopping list*. This is sent as another gRPC + // connection call to the `Converse` method, again with streamed requests and + // responses, such as: + // + // * ConverseRequest.config + // * ConverseRequest.audio_in + // * ConverseRequest.audio_in + // * ConverseRequest.audio_in + // * ConverseResponse.event_type.END_OF_UTTERANCE + // * ConverseResponse.result.microphone_mode.CLOSE_MICROPHONE + // * ConverseResponse.audio_out + // * ConverseResponse.audio_out + // * ConverseResponse.audio_out + // * ConverseResponse.audio_out + // + // Although the precise order of responses is not guaranteed, sequential + // ConverseResponse.audio_out messages will always contain sequential portions + // of audio. + Converse(ctx context.Context, opts ...grpc.CallOption) (EmbeddedAssistant_ConverseClient, error) +} + +type embeddedAssistantClient struct { + cc *grpc.ClientConn +} + +func NewEmbeddedAssistantClient(cc *grpc.ClientConn) EmbeddedAssistantClient { + return &embeddedAssistantClient{cc} +} + +func (c *embeddedAssistantClient) Converse(ctx context.Context, opts ...grpc.CallOption) (EmbeddedAssistant_ConverseClient, error) { + stream, err := grpc.NewClientStream(ctx, &_EmbeddedAssistant_serviceDesc.Streams[0], c.cc, "/google.assistant.embedded.v1alpha1.EmbeddedAssistant/Converse", opts...) + if err != nil { + return nil, err + } + x := &embeddedAssistantConverseClient{stream} + return x, nil +} + +type EmbeddedAssistant_ConverseClient interface { + Send(*ConverseRequest) error + Recv() (*ConverseResponse, error) + grpc.ClientStream +} + +type embeddedAssistantConverseClient struct { + grpc.ClientStream +} + +func (x *embeddedAssistantConverseClient) Send(m *ConverseRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *embeddedAssistantConverseClient) Recv() (*ConverseResponse, error) { + m := new(ConverseResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// Server API for EmbeddedAssistant service + +type EmbeddedAssistantServer interface { + // Initiates or continues a conversation with the embedded assistant service. + // Each call performs one round-trip, sending an audio request to the service + // and receiving the audio response. Uses bidirectional streaming to receive + // results, such as the `END_OF_UTTERANCE` event, while sending audio. + // + // A conversation is one or more gRPC connections, each consisting of several + // streamed requests and responses. + // For example, the user says *Add to my shopping list* and the assistant + // responds *What do you want to add?*. The sequence of streamed requests and + // responses in the first gRPC message could be: + // + // * ConverseRequest.config + // * ConverseRequest.audio_in + // * ConverseRequest.audio_in + // * ConverseRequest.audio_in + // * ConverseRequest.audio_in + // * ConverseResponse.event_type.END_OF_UTTERANCE + // * ConverseResponse.result.microphone_mode.DIALOG_FOLLOW_ON + // * ConverseResponse.audio_out + // * ConverseResponse.audio_out + // * ConverseResponse.audio_out + // + // The user then says *bagels* and the assistant responds + // *OK, I've added bagels to your shopping list*. This is sent as another gRPC + // connection call to the `Converse` method, again with streamed requests and + // responses, such as: + // + // * ConverseRequest.config + // * ConverseRequest.audio_in + // * ConverseRequest.audio_in + // * ConverseRequest.audio_in + // * ConverseResponse.event_type.END_OF_UTTERANCE + // * ConverseResponse.result.microphone_mode.CLOSE_MICROPHONE + // * ConverseResponse.audio_out + // * ConverseResponse.audio_out + // * ConverseResponse.audio_out + // * ConverseResponse.audio_out + // + // Although the precise order of responses is not guaranteed, sequential + // ConverseResponse.audio_out messages will always contain sequential portions + // of audio. + Converse(EmbeddedAssistant_ConverseServer) error +} + +func RegisterEmbeddedAssistantServer(s *grpc.Server, srv EmbeddedAssistantServer) { + s.RegisterService(&_EmbeddedAssistant_serviceDesc, srv) +} + +func _EmbeddedAssistant_Converse_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(EmbeddedAssistantServer).Converse(&embeddedAssistantConverseServer{stream}) +} + +type EmbeddedAssistant_ConverseServer interface { + Send(*ConverseResponse) error + Recv() (*ConverseRequest, error) + grpc.ServerStream +} + +type embeddedAssistantConverseServer struct { + grpc.ServerStream +} + +func (x *embeddedAssistantConverseServer) Send(m *ConverseResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *embeddedAssistantConverseServer) Recv() (*ConverseRequest, error) { + m := new(ConverseRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +var _EmbeddedAssistant_serviceDesc = grpc.ServiceDesc{ + ServiceName: "google.assistant.embedded.v1alpha1.EmbeddedAssistant", + HandlerType: (*EmbeddedAssistantServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "Converse", + Handler: _EmbeddedAssistant_Converse_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "google/assistant/embedded/v1alpha1/embedded_assistant.proto", +} + +func init() { + proto.RegisterFile("google/assistant/embedded/v1alpha1/embedded_assistant.proto", fileDescriptor0) +} + +var fileDescriptor0 = []byte{ + // 892 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x51, 0x73, 0xdb, 0x44, + 0x10, 0xb6, 0xec, 0xa6, 0xb5, 0xb7, 0x89, 0x2c, 0x5f, 0x33, 0x90, 0x49, 0x61, 0x60, 0xf4, 0xc0, + 0x94, 0x02, 0x72, 0xe3, 0x30, 0x3c, 0x10, 0xe8, 0x8c, 0x63, 0x2b, 0xb1, 0xc1, 0x96, 0x3c, 0x67, + 0xa7, 0xa5, 0x0c, 0xcc, 0xcd, 0x55, 0x3e, 0x1c, 0x81, 0x7d, 0x27, 0xa4, 0x73, 0xa6, 0xe1, 0x07, + 0xf0, 0xd8, 0xe1, 0x95, 0x67, 0x7e, 0x11, 0xff, 0x88, 0xd1, 0x9d, 0xa4, 0xd8, 0x90, 0x42, 0x1c, + 0x1e, 0x6f, 0xf7, 0xbe, 0x4f, 0xbb, 0xdf, 0x7e, 0xb7, 0x23, 0x38, 0x9a, 0x09, 0x31, 0x9b, 0xb3, + 0x26, 0x4d, 0x92, 0x30, 0x91, 0x94, 0xcb, 0x26, 0x5b, 0xbc, 0x64, 0xd3, 0x29, 0x9b, 0x36, 0x2f, + 0x0e, 0xe8, 0x3c, 0x3a, 0xa7, 0x07, 0x45, 0x84, 0x14, 0x97, 0x9c, 0x28, 0x16, 0x52, 0x20, 0x5b, + 0x83, 0x9d, 0xab, 0x78, 0x7e, 0xd5, 0xc9, 0xc1, 0xfb, 0xef, 0xe4, 0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, 0xe7, 0xe5, 0x28, 0x8f, 0xbc, 0xbc, 0xab, 0x60, 0x87, 0x7f, 0x05, + 0x00, 0x00, 0xff, 0xff, 0xec, 0x7a, 0x68, 0xfa, 0xf2, 0x08, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/genproto/googleapis/cloud/language/v1/language_service.pb.go b/vendor/google.golang.org/genproto/googleapis/cloud/language/v1/language_service.pb.go index 59b8393..c3c62bf 100644 --- a/vendor/google.golang.org/genproto/googleapis/cloud/language/v1/language_service.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/cloud/language/v1/language_service.pb.go @@ -1065,11 +1065,8 @@ type Document struct { // The language of the document (if not specified, the language is // automatically detected). Both ISO and BCP-47 language codes are // accepted.
    - // **Current Language Restrictions:** - // - // * Only English, Spanish, and Japanese textual content - // are supported, with the following additional restriction: - // * `analyzeSentiment` only supports English text. + // [Language Support](https://cloud.google.com/natural-language/docs/languages) + // lists currently supported languages for each API method. // If the language (either specified by the caller or automatically detected) // is not supported by the called API method, an `INVALID_ARGUMENT` error // is returned. @@ -1343,7 +1340,7 @@ type Sentiment struct { // negative). Magnitude float32 `protobuf:"fixed32,2,opt,name=magnitude" json:"magnitude,omitempty"` // Sentiment score between -1.0 (negative sentiment) and 1.0 - // (positive sentiment.) + // (positive sentiment). Score float32 `protobuf:"fixed32,3,opt,name=score" json:"score,omitempty"` } @@ -1576,8 +1573,7 @@ func (m *TextSpan) GetBeginOffset() int32 { // The sentiment analysis request message. type AnalyzeSentimentRequest struct { - // Input document. Currently, `analyzeSentiment` only supports English text - // ([Document.language][google.cloud.language.v1.Document.language]="EN"). + // Input document. Document *Document `protobuf:"bytes,1,opt,name=document" json:"document,omitempty"` // The encoding type used by the API to calculate sentence offsets. EncodingType EncodingType `protobuf:"varint,2,opt,name=encoding_type,json=encodingType,enum=google.cloud.language.v1.EncodingType" json:"encoding_type,omitempty"` @@ -1608,7 +1604,7 @@ type AnalyzeSentimentResponse struct { DocumentSentiment *Sentiment `protobuf:"bytes,1,opt,name=document_sentiment,json=documentSentiment" json:"document_sentiment,omitempty"` // The language of the text, which will be the same as the language specified // in the request or, if not specified, the automatically-detected language. - // See `Document.language` field for more details. + // See [Document.language][google.cloud.language.v1.Document.language] field for more details. Language string `protobuf:"bytes,2,opt,name=language" json:"language,omitempty"` // The sentiment for all the sentences in the document. Sentences []*Sentence `protobuf:"bytes,3,rep,name=sentences" json:"sentences,omitempty"` @@ -1673,7 +1669,7 @@ type AnalyzeEntitiesResponse struct { Entities []*Entity `protobuf:"bytes,1,rep,name=entities" json:"entities,omitempty"` // The language of the text, which will be the same as the language specified // in the request or, if not specified, the automatically-detected language. - // See `Document.language` field for more details. + // See [Document.language][google.cloud.language.v1.Document.language] field for more details. Language string `protobuf:"bytes,2,opt,name=language" json:"language,omitempty"` } @@ -1731,7 +1727,7 @@ type AnalyzeSyntaxResponse struct { Tokens []*Token `protobuf:"bytes,2,rep,name=tokens" json:"tokens,omitempty"` // The language of the text, which will be the same as the language specified // in the request or, if not specified, the automatically-detected language. - // See `Document.language` field for more details. + // See [Document.language][google.cloud.language.v1.Document.language] field for more details. Language string `protobuf:"bytes,3,opt,name=language" json:"language,omitempty"` } @@ -1855,7 +1851,7 @@ type AnnotateTextResponse struct { DocumentSentiment *Sentiment `protobuf:"bytes,4,opt,name=document_sentiment,json=documentSentiment" json:"document_sentiment,omitempty"` // The language of the text, which will be the same as the language specified // in the request or, if not specified, the automatically-detected language. - // See `Document.language` field for more details. + // See [Document.language][google.cloud.language.v1.Document.language] field for more details. Language string `protobuf:"bytes,5,opt,name=language" json:"language,omitempty"` } @@ -1950,8 +1946,9 @@ const _ = grpc.SupportPackageIsVersion4 type LanguageServiceClient interface { // Analyzes the sentiment of the provided text. AnalyzeSentiment(ctx context.Context, in *AnalyzeSentimentRequest, opts ...grpc.CallOption) (*AnalyzeSentimentResponse, error) - // Finds named entities (currently finds proper names) in the text, - // entity types, salience, mentions for each entity, and other properties. + // Finds named entities (currently proper names and common nouns) in the text + // along with entity types, salience, mentions for each entity, and + // other properties. AnalyzeEntities(ctx context.Context, in *AnalyzeEntitiesRequest, opts ...grpc.CallOption) (*AnalyzeEntitiesResponse, error) // Analyzes the syntax of the text and provides sentence boundaries and // tokenization along with part of speech tags, dependency trees, and other @@ -2011,8 +2008,9 @@ func (c *languageServiceClient) AnnotateText(ctx context.Context, in *AnnotateTe type LanguageServiceServer interface { // Analyzes the sentiment of the provided text. AnalyzeSentiment(context.Context, *AnalyzeSentimentRequest) (*AnalyzeSentimentResponse, error) - // Finds named entities (currently finds proper names) in the text, - // entity types, salience, mentions for each entity, and other properties. + // Finds named entities (currently proper names and common nouns) in the text + // along with entity types, salience, mentions for each entity, and + // other properties. AnalyzeEntities(context.Context, *AnalyzeEntitiesRequest) (*AnalyzeEntitiesResponse, error) // Analyzes the syntax of the text and provides sentence boundaries and // tokenization along with part of speech tags, dependency trees, and other diff --git a/vendor/google.golang.org/genproto/googleapis/cloud/language/v1beta1/language_service.pb.go b/vendor/google.golang.org/genproto/googleapis/cloud/language/v1beta1/language_service.pb.go index 7ae6078..55156d4 100644 --- a/vendor/google.golang.org/genproto/googleapis/cloud/language/v1beta1/language_service.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/cloud/language/v1beta1/language_service.pb.go @@ -1065,11 +1065,8 @@ type Document struct { // The language of the document (if not specified, the language is // automatically detected). Both ISO and BCP-47 language codes are // accepted.
    - // **Current Language Restrictions:** - // - // * Only English, Spanish, and Japanese textual content - // are supported, with the following additional restriction: - // * `analyzeSentiment` only supports English text. + // [Language Support](https://cloud.google.com/natural-language/docs/languages) + // lists currently supported languages for each API method. // If the language (either specified by the caller or automatically detected) // is not supported by the called API method, an `INVALID_ARGUMENT` error // is returned. @@ -1347,7 +1344,7 @@ type Sentiment struct { // negative). Magnitude float32 `protobuf:"fixed32,2,opt,name=magnitude" json:"magnitude,omitempty"` // Sentiment score between -1.0 (negative sentiment) and 1.0 - // (positive sentiment.) + // (positive sentiment). Score float32 `protobuf:"fixed32,3,opt,name=score" json:"score,omitempty"` } @@ -1583,8 +1580,7 @@ func (m *TextSpan) GetBeginOffset() int32 { // The sentiment analysis request message. type AnalyzeSentimentRequest struct { - // Input document. Currently, `analyzeSentiment` only supports English text - // ([Document.language][google.cloud.language.v1beta1.Document.language]="EN"). + // Input document. Document *Document `protobuf:"bytes,1,opt,name=document" json:"document,omitempty"` // The encoding type used by the API to calculate sentence offsets for the // sentence sentiment. @@ -1616,6 +1612,7 @@ type AnalyzeSentimentResponse struct { DocumentSentiment *Sentiment `protobuf:"bytes,1,opt,name=document_sentiment,json=documentSentiment" json:"document_sentiment,omitempty"` // The language of the text, which will be the same as the language specified // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1beta1.Document.language] field for more details. Language string `protobuf:"bytes,2,opt,name=language" json:"language,omitempty"` // The sentiment for all the sentences in the document. Sentences []*Sentence `protobuf:"bytes,3,rep,name=sentences" json:"sentences,omitempty"` @@ -1957,8 +1954,9 @@ const _ = grpc.SupportPackageIsVersion4 type LanguageServiceClient interface { // Analyzes the sentiment of the provided text. AnalyzeSentiment(ctx context.Context, in *AnalyzeSentimentRequest, opts ...grpc.CallOption) (*AnalyzeSentimentResponse, error) - // Finds named entities (currently finds proper names) in the text, - // entity types, salience, mentions for each entity, and other properties. + // Finds named entities (currently proper names and common nouns) in the text + // along with entity types, salience, mentions for each entity, and + // other properties. AnalyzeEntities(ctx context.Context, in *AnalyzeEntitiesRequest, opts ...grpc.CallOption) (*AnalyzeEntitiesResponse, error) // Analyzes the syntax of the text and provides sentence boundaries and // tokenization along with part of speech tags, dependency trees, and other @@ -2018,8 +2016,9 @@ func (c *languageServiceClient) AnnotateText(ctx context.Context, in *AnnotateTe type LanguageServiceServer interface { // Analyzes the sentiment of the provided text. AnalyzeSentiment(context.Context, *AnalyzeSentimentRequest) (*AnalyzeSentimentResponse, error) - // Finds named entities (currently finds proper names) in the text, - // entity types, salience, mentions for each entity, and other properties. + // Finds named entities (currently proper names and common nouns) in the text + // along with entity types, salience, mentions for each entity, and + // other properties. AnalyzeEntities(context.Context, *AnalyzeEntitiesRequest) (*AnalyzeEntitiesResponse, error) // Analyzes the syntax of the text and provides sentence boundaries and // tokenization along with part of speech tags, dependency trees, and other diff --git a/vendor/google.golang.org/genproto/googleapis/cloud/language/v1beta2/language_service.pb.go b/vendor/google.golang.org/genproto/googleapis/cloud/language/v1beta2/language_service.pb.go new file mode 100644 index 0000000..3239e06 --- /dev/null +++ b/vendor/google.golang.org/genproto/googleapis/cloud/language/v1beta2/language_service.pb.go @@ -0,0 +1,2441 @@ +// Code generated by protoc-gen-go. +// source: google/cloud/language/v1beta2/language_service.proto +// DO NOT EDIT! + +/* +Package language is a generated protocol buffer package. + +It is generated from these files: + google/cloud/language/v1beta2/language_service.proto + +It has these top-level messages: + Document + Sentence + Entity + Token + Sentiment + PartOfSpeech + DependencyEdge + EntityMention + TextSpan + AnalyzeSentimentRequest + AnalyzeSentimentResponse + AnalyzeEntitySentimentRequest + AnalyzeEntitySentimentResponse + AnalyzeEntitiesRequest + AnalyzeEntitiesResponse + AnalyzeSyntaxRequest + AnalyzeSyntaxResponse + AnnotateTextRequest + AnnotateTextResponse +*/ +package language + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "google.golang.org/genproto/googleapis/api/annotations" +import _ "google.golang.org/genproto/googleapis/longrunning" +import _ "github.com/golang/protobuf/ptypes/timestamp" +import _ "google.golang.org/genproto/googleapis/rpc/status" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +// Represents the text encoding that the caller uses to process the output. +// Providing an `EncodingType` is recommended because the API provides the +// beginning offsets for various outputs, such as tokens and mentions, and +// languages that natively use different text encodings may access offsets +// differently. +type EncodingType int32 + +const ( + // If `EncodingType` is not specified, encoding-dependent information (such as + // `begin_offset`) will be set at `-1`. + EncodingType_NONE EncodingType = 0 + // Encoding-dependent information (such as `begin_offset`) is calculated based + // on the UTF-8 encoding of the input. C++ and Go are examples of languages + // that use this encoding natively. + EncodingType_UTF8 EncodingType = 1 + // Encoding-dependent information (such as `begin_offset`) is calculated based + // on the UTF-16 encoding of the input. Java and Javascript are examples of + // languages that use this encoding natively. + EncodingType_UTF16 EncodingType = 2 + // Encoding-dependent information (such as `begin_offset`) is calculated based + // on the UTF-32 encoding of the input. Python is an example of a language + // that uses this encoding natively. + EncodingType_UTF32 EncodingType = 3 +) + +var EncodingType_name = map[int32]string{ + 0: "NONE", + 1: "UTF8", + 2: "UTF16", + 3: "UTF32", +} +var EncodingType_value = map[string]int32{ + "NONE": 0, + "UTF8": 1, + "UTF16": 2, + "UTF32": 3, +} + +func (x EncodingType) String() string { + return proto.EnumName(EncodingType_name, int32(x)) +} +func (EncodingType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +// The document types enum. +type Document_Type int32 + +const ( + // The content type is not specified. + Document_TYPE_UNSPECIFIED Document_Type = 0 + // Plain text + Document_PLAIN_TEXT Document_Type = 1 + // HTML + Document_HTML Document_Type = 2 +) + +var Document_Type_name = map[int32]string{ + 0: "TYPE_UNSPECIFIED", + 1: "PLAIN_TEXT", + 2: "HTML", +} +var Document_Type_value = map[string]int32{ + "TYPE_UNSPECIFIED": 0, + "PLAIN_TEXT": 1, + "HTML": 2, +} + +func (x Document_Type) String() string { + return proto.EnumName(Document_Type_name, int32(x)) +} +func (Document_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} } + +// The type of the entity. +type Entity_Type int32 + +const ( + // Unknown + Entity_UNKNOWN Entity_Type = 0 + // Person + Entity_PERSON Entity_Type = 1 + // Location + Entity_LOCATION Entity_Type = 2 + // Organization + Entity_ORGANIZATION Entity_Type = 3 + // Event + Entity_EVENT Entity_Type = 4 + // Work of art + Entity_WORK_OF_ART Entity_Type = 5 + // Consumer goods + Entity_CONSUMER_GOOD Entity_Type = 6 + // Other types + Entity_OTHER Entity_Type = 7 +) + +var Entity_Type_name = map[int32]string{ + 0: "UNKNOWN", + 1: "PERSON", + 2: "LOCATION", + 3: "ORGANIZATION", + 4: "EVENT", + 5: "WORK_OF_ART", + 6: "CONSUMER_GOOD", + 7: "OTHER", +} +var Entity_Type_value = map[string]int32{ + "UNKNOWN": 0, + "PERSON": 1, + "LOCATION": 2, + "ORGANIZATION": 3, + "EVENT": 4, + "WORK_OF_ART": 5, + "CONSUMER_GOOD": 6, + "OTHER": 7, +} + +func (x Entity_Type) String() string { + return proto.EnumName(Entity_Type_name, int32(x)) +} +func (Entity_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} } + +// The part of speech tags enum. +type PartOfSpeech_Tag int32 + +const ( + // Unknown + PartOfSpeech_UNKNOWN PartOfSpeech_Tag = 0 + // Adjective + PartOfSpeech_ADJ PartOfSpeech_Tag = 1 + // Adposition (preposition and postposition) + PartOfSpeech_ADP PartOfSpeech_Tag = 2 + // Adverb + PartOfSpeech_ADV PartOfSpeech_Tag = 3 + // Conjunction + PartOfSpeech_CONJ PartOfSpeech_Tag = 4 + // Determiner + PartOfSpeech_DET PartOfSpeech_Tag = 5 + // Noun (common and proper) + PartOfSpeech_NOUN PartOfSpeech_Tag = 6 + // Cardinal number + PartOfSpeech_NUM PartOfSpeech_Tag = 7 + // Pronoun + PartOfSpeech_PRON PartOfSpeech_Tag = 8 + // Particle or other function word + PartOfSpeech_PRT PartOfSpeech_Tag = 9 + // Punctuation + PartOfSpeech_PUNCT PartOfSpeech_Tag = 10 + // Verb (all tenses and modes) + PartOfSpeech_VERB PartOfSpeech_Tag = 11 + // Other: foreign words, typos, abbreviations + PartOfSpeech_X PartOfSpeech_Tag = 12 + // Affix + PartOfSpeech_AFFIX PartOfSpeech_Tag = 13 +) + +var PartOfSpeech_Tag_name = map[int32]string{ + 0: "UNKNOWN", + 1: "ADJ", + 2: "ADP", + 3: "ADV", + 4: "CONJ", + 5: "DET", + 6: "NOUN", + 7: "NUM", + 8: "PRON", + 9: "PRT", + 10: "PUNCT", + 11: "VERB", + 12: "X", + 13: "AFFIX", +} +var PartOfSpeech_Tag_value = map[string]int32{ + "UNKNOWN": 0, + "ADJ": 1, + "ADP": 2, + "ADV": 3, + "CONJ": 4, + "DET": 5, + "NOUN": 6, + "NUM": 7, + "PRON": 8, + "PRT": 9, + "PUNCT": 10, + "VERB": 11, + "X": 12, + "AFFIX": 13, +} + +func (x PartOfSpeech_Tag) String() string { + return proto.EnumName(PartOfSpeech_Tag_name, int32(x)) +} +func (PartOfSpeech_Tag) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{5, 0} } + +// The characteristic of a verb that expresses time flow during an event. +type PartOfSpeech_Aspect int32 + +const ( + // Aspect is not applicable in the analyzed language or is not predicted. + PartOfSpeech_ASPECT_UNKNOWN PartOfSpeech_Aspect = 0 + // Perfective + PartOfSpeech_PERFECTIVE PartOfSpeech_Aspect = 1 + // Imperfective + PartOfSpeech_IMPERFECTIVE PartOfSpeech_Aspect = 2 + // Progressive + PartOfSpeech_PROGRESSIVE PartOfSpeech_Aspect = 3 +) + +var PartOfSpeech_Aspect_name = map[int32]string{ + 0: "ASPECT_UNKNOWN", + 1: "PERFECTIVE", + 2: "IMPERFECTIVE", + 3: "PROGRESSIVE", +} +var PartOfSpeech_Aspect_value = map[string]int32{ + "ASPECT_UNKNOWN": 0, + "PERFECTIVE": 1, + "IMPERFECTIVE": 2, + "PROGRESSIVE": 3, +} + +func (x PartOfSpeech_Aspect) String() string { + return proto.EnumName(PartOfSpeech_Aspect_name, int32(x)) +} +func (PartOfSpeech_Aspect) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{5, 1} } + +// The grammatical function performed by a noun or pronoun in a phrase, +// clause, or sentence. In some languages, other parts of speech, such as +// adjective and determiner, take case inflection in agreement with the noun. +type PartOfSpeech_Case int32 + +const ( + // Case is not applicable in the analyzed language or is not predicted. + PartOfSpeech_CASE_UNKNOWN PartOfSpeech_Case = 0 + // Accusative + PartOfSpeech_ACCUSATIVE PartOfSpeech_Case = 1 + // Adverbial + PartOfSpeech_ADVERBIAL PartOfSpeech_Case = 2 + // Complementive + PartOfSpeech_COMPLEMENTIVE PartOfSpeech_Case = 3 + // Dative + PartOfSpeech_DATIVE PartOfSpeech_Case = 4 + // Genitive + PartOfSpeech_GENITIVE PartOfSpeech_Case = 5 + // Instrumental + PartOfSpeech_INSTRUMENTAL PartOfSpeech_Case = 6 + // Locative + PartOfSpeech_LOCATIVE PartOfSpeech_Case = 7 + // Nominative + PartOfSpeech_NOMINATIVE PartOfSpeech_Case = 8 + // Oblique + PartOfSpeech_OBLIQUE PartOfSpeech_Case = 9 + // Partitive + PartOfSpeech_PARTITIVE PartOfSpeech_Case = 10 + // Prepositional + PartOfSpeech_PREPOSITIONAL PartOfSpeech_Case = 11 + // Reflexive + PartOfSpeech_REFLEXIVE_CASE PartOfSpeech_Case = 12 + // Relative + PartOfSpeech_RELATIVE_CASE PartOfSpeech_Case = 13 + // Vocative + PartOfSpeech_VOCATIVE PartOfSpeech_Case = 14 +) + +var PartOfSpeech_Case_name = map[int32]string{ + 0: "CASE_UNKNOWN", + 1: "ACCUSATIVE", + 2: "ADVERBIAL", + 3: "COMPLEMENTIVE", + 4: "DATIVE", + 5: "GENITIVE", + 6: "INSTRUMENTAL", + 7: "LOCATIVE", + 8: "NOMINATIVE", + 9: "OBLIQUE", + 10: "PARTITIVE", + 11: "PREPOSITIONAL", + 12: "REFLEXIVE_CASE", + 13: "RELATIVE_CASE", + 14: "VOCATIVE", +} +var PartOfSpeech_Case_value = map[string]int32{ + "CASE_UNKNOWN": 0, + "ACCUSATIVE": 1, + "ADVERBIAL": 2, + "COMPLEMENTIVE": 3, + "DATIVE": 4, + "GENITIVE": 5, + "INSTRUMENTAL": 6, + "LOCATIVE": 7, + "NOMINATIVE": 8, + "OBLIQUE": 9, + "PARTITIVE": 10, + "PREPOSITIONAL": 11, + "REFLEXIVE_CASE": 12, + "RELATIVE_CASE": 13, + "VOCATIVE": 14, +} + +func (x PartOfSpeech_Case) String() string { + return proto.EnumName(PartOfSpeech_Case_name, int32(x)) +} +func (PartOfSpeech_Case) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{5, 2} } + +// Depending on the language, Form can be categorizing different forms of +// verbs, adjectives, adverbs, etc. For example, categorizing inflected +// endings of verbs and adjectives or distinguishing between short and long +// forms of adjectives and participles +type PartOfSpeech_Form int32 + +const ( + // Form is not applicable in the analyzed language or is not predicted. + PartOfSpeech_FORM_UNKNOWN PartOfSpeech_Form = 0 + // Adnomial + PartOfSpeech_ADNOMIAL PartOfSpeech_Form = 1 + // Auxiliary + PartOfSpeech_AUXILIARY PartOfSpeech_Form = 2 + // Complementizer + PartOfSpeech_COMPLEMENTIZER PartOfSpeech_Form = 3 + // Final ending + PartOfSpeech_FINAL_ENDING PartOfSpeech_Form = 4 + // Gerund + PartOfSpeech_GERUND PartOfSpeech_Form = 5 + // Realis + PartOfSpeech_REALIS PartOfSpeech_Form = 6 + // Irrealis + PartOfSpeech_IRREALIS PartOfSpeech_Form = 7 + // Short form + PartOfSpeech_SHORT PartOfSpeech_Form = 8 + // Long form + PartOfSpeech_LONG PartOfSpeech_Form = 9 + // Order form + PartOfSpeech_ORDER PartOfSpeech_Form = 10 + // Specific form + PartOfSpeech_SPECIFIC PartOfSpeech_Form = 11 +) + +var PartOfSpeech_Form_name = map[int32]string{ + 0: "FORM_UNKNOWN", + 1: "ADNOMIAL", + 2: "AUXILIARY", + 3: "COMPLEMENTIZER", + 4: "FINAL_ENDING", + 5: "GERUND", + 6: "REALIS", + 7: "IRREALIS", + 8: "SHORT", + 9: "LONG", + 10: "ORDER", + 11: "SPECIFIC", +} +var PartOfSpeech_Form_value = map[string]int32{ + "FORM_UNKNOWN": 0, + "ADNOMIAL": 1, + "AUXILIARY": 2, + "COMPLEMENTIZER": 3, + "FINAL_ENDING": 4, + "GERUND": 5, + "REALIS": 6, + "IRREALIS": 7, + "SHORT": 8, + "LONG": 9, + "ORDER": 10, + "SPECIFIC": 11, +} + +func (x PartOfSpeech_Form) String() string { + return proto.EnumName(PartOfSpeech_Form_name, int32(x)) +} +func (PartOfSpeech_Form) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{5, 3} } + +// Gender classes of nouns reflected in the behaviour of associated words. +type PartOfSpeech_Gender int32 + +const ( + // Gender is not applicable in the analyzed language or is not predicted. + PartOfSpeech_GENDER_UNKNOWN PartOfSpeech_Gender = 0 + // Feminine + PartOfSpeech_FEMININE PartOfSpeech_Gender = 1 + // Masculine + PartOfSpeech_MASCULINE PartOfSpeech_Gender = 2 + // Neuter + PartOfSpeech_NEUTER PartOfSpeech_Gender = 3 +) + +var PartOfSpeech_Gender_name = map[int32]string{ + 0: "GENDER_UNKNOWN", + 1: "FEMININE", + 2: "MASCULINE", + 3: "NEUTER", +} +var PartOfSpeech_Gender_value = map[string]int32{ + "GENDER_UNKNOWN": 0, + "FEMININE": 1, + "MASCULINE": 2, + "NEUTER": 3, +} + +func (x PartOfSpeech_Gender) String() string { + return proto.EnumName(PartOfSpeech_Gender_name, int32(x)) +} +func (PartOfSpeech_Gender) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{5, 4} } + +// The grammatical feature of verbs, used for showing modality and attitude. +type PartOfSpeech_Mood int32 + +const ( + // Mood is not applicable in the analyzed language or is not predicted. + PartOfSpeech_MOOD_UNKNOWN PartOfSpeech_Mood = 0 + // Conditional + PartOfSpeech_CONDITIONAL_MOOD PartOfSpeech_Mood = 1 + // Imperative + PartOfSpeech_IMPERATIVE PartOfSpeech_Mood = 2 + // Indicative + PartOfSpeech_INDICATIVE PartOfSpeech_Mood = 3 + // Interrogative + PartOfSpeech_INTERROGATIVE PartOfSpeech_Mood = 4 + // Jussive + PartOfSpeech_JUSSIVE PartOfSpeech_Mood = 5 + // Subjunctive + PartOfSpeech_SUBJUNCTIVE PartOfSpeech_Mood = 6 +) + +var PartOfSpeech_Mood_name = map[int32]string{ + 0: "MOOD_UNKNOWN", + 1: "CONDITIONAL_MOOD", + 2: "IMPERATIVE", + 3: "INDICATIVE", + 4: "INTERROGATIVE", + 5: "JUSSIVE", + 6: "SUBJUNCTIVE", +} +var PartOfSpeech_Mood_value = map[string]int32{ + "MOOD_UNKNOWN": 0, + "CONDITIONAL_MOOD": 1, + "IMPERATIVE": 2, + "INDICATIVE": 3, + "INTERROGATIVE": 4, + "JUSSIVE": 5, + "SUBJUNCTIVE": 6, +} + +func (x PartOfSpeech_Mood) String() string { + return proto.EnumName(PartOfSpeech_Mood_name, int32(x)) +} +func (PartOfSpeech_Mood) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{5, 5} } + +// Count distinctions. +type PartOfSpeech_Number int32 + +const ( + // Number is not applicable in the analyzed language or is not predicted. + PartOfSpeech_NUMBER_UNKNOWN PartOfSpeech_Number = 0 + // Singular + PartOfSpeech_SINGULAR PartOfSpeech_Number = 1 + // Plural + PartOfSpeech_PLURAL PartOfSpeech_Number = 2 + // Dual + PartOfSpeech_DUAL PartOfSpeech_Number = 3 +) + +var PartOfSpeech_Number_name = map[int32]string{ + 0: "NUMBER_UNKNOWN", + 1: "SINGULAR", + 2: "PLURAL", + 3: "DUAL", +} +var PartOfSpeech_Number_value = map[string]int32{ + "NUMBER_UNKNOWN": 0, + "SINGULAR": 1, + "PLURAL": 2, + "DUAL": 3, +} + +func (x PartOfSpeech_Number) String() string { + return proto.EnumName(PartOfSpeech_Number_name, int32(x)) +} +func (PartOfSpeech_Number) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{5, 6} } + +// The distinction between the speaker, second person, third person, etc. +type PartOfSpeech_Person int32 + +const ( + // Person is not applicable in the analyzed language or is not predicted. + PartOfSpeech_PERSON_UNKNOWN PartOfSpeech_Person = 0 + // First + PartOfSpeech_FIRST PartOfSpeech_Person = 1 + // Second + PartOfSpeech_SECOND PartOfSpeech_Person = 2 + // Third + PartOfSpeech_THIRD PartOfSpeech_Person = 3 + // Reflexive + PartOfSpeech_REFLEXIVE_PERSON PartOfSpeech_Person = 4 +) + +var PartOfSpeech_Person_name = map[int32]string{ + 0: "PERSON_UNKNOWN", + 1: "FIRST", + 2: "SECOND", + 3: "THIRD", + 4: "REFLEXIVE_PERSON", +} +var PartOfSpeech_Person_value = map[string]int32{ + "PERSON_UNKNOWN": 0, + "FIRST": 1, + "SECOND": 2, + "THIRD": 3, + "REFLEXIVE_PERSON": 4, +} + +func (x PartOfSpeech_Person) String() string { + return proto.EnumName(PartOfSpeech_Person_name, int32(x)) +} +func (PartOfSpeech_Person) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{5, 7} } + +// This category shows if the token is part of a proper name. +type PartOfSpeech_Proper int32 + +const ( + // Proper is not applicable in the analyzed language or is not predicted. + PartOfSpeech_PROPER_UNKNOWN PartOfSpeech_Proper = 0 + // Proper + PartOfSpeech_PROPER PartOfSpeech_Proper = 1 + // Not proper + PartOfSpeech_NOT_PROPER PartOfSpeech_Proper = 2 +) + +var PartOfSpeech_Proper_name = map[int32]string{ + 0: "PROPER_UNKNOWN", + 1: "PROPER", + 2: "NOT_PROPER", +} +var PartOfSpeech_Proper_value = map[string]int32{ + "PROPER_UNKNOWN": 0, + "PROPER": 1, + "NOT_PROPER": 2, +} + +func (x PartOfSpeech_Proper) String() string { + return proto.EnumName(PartOfSpeech_Proper_name, int32(x)) +} +func (PartOfSpeech_Proper) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{5, 8} } + +// Reciprocal features of a pronoun. +type PartOfSpeech_Reciprocity int32 + +const ( + // Reciprocity is not applicable in the analyzed language or is not + // predicted. + PartOfSpeech_RECIPROCITY_UNKNOWN PartOfSpeech_Reciprocity = 0 + // Reciprocal + PartOfSpeech_RECIPROCAL PartOfSpeech_Reciprocity = 1 + // Non-reciprocal + PartOfSpeech_NON_RECIPROCAL PartOfSpeech_Reciprocity = 2 +) + +var PartOfSpeech_Reciprocity_name = map[int32]string{ + 0: "RECIPROCITY_UNKNOWN", + 1: "RECIPROCAL", + 2: "NON_RECIPROCAL", +} +var PartOfSpeech_Reciprocity_value = map[string]int32{ + "RECIPROCITY_UNKNOWN": 0, + "RECIPROCAL": 1, + "NON_RECIPROCAL": 2, +} + +func (x PartOfSpeech_Reciprocity) String() string { + return proto.EnumName(PartOfSpeech_Reciprocity_name, int32(x)) +} +func (PartOfSpeech_Reciprocity) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{5, 9} } + +// Time reference. +type PartOfSpeech_Tense int32 + +const ( + // Tense is not applicable in the analyzed language or is not predicted. + PartOfSpeech_TENSE_UNKNOWN PartOfSpeech_Tense = 0 + // Conditional + PartOfSpeech_CONDITIONAL_TENSE PartOfSpeech_Tense = 1 + // Future + PartOfSpeech_FUTURE PartOfSpeech_Tense = 2 + // Past + PartOfSpeech_PAST PartOfSpeech_Tense = 3 + // Present + PartOfSpeech_PRESENT PartOfSpeech_Tense = 4 + // Imperfect + PartOfSpeech_IMPERFECT PartOfSpeech_Tense = 5 + // Pluperfect + PartOfSpeech_PLUPERFECT PartOfSpeech_Tense = 6 +) + +var PartOfSpeech_Tense_name = map[int32]string{ + 0: "TENSE_UNKNOWN", + 1: "CONDITIONAL_TENSE", + 2: "FUTURE", + 3: "PAST", + 4: "PRESENT", + 5: "IMPERFECT", + 6: "PLUPERFECT", +} +var PartOfSpeech_Tense_value = map[string]int32{ + "TENSE_UNKNOWN": 0, + "CONDITIONAL_TENSE": 1, + "FUTURE": 2, + "PAST": 3, + "PRESENT": 4, + "IMPERFECT": 5, + "PLUPERFECT": 6, +} + +func (x PartOfSpeech_Tense) String() string { + return proto.EnumName(PartOfSpeech_Tense_name, int32(x)) +} +func (PartOfSpeech_Tense) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{5, 10} } + +// The relationship between the action that a verb expresses and the +// participants identified by its arguments. +type PartOfSpeech_Voice int32 + +const ( + // Voice is not applicable in the analyzed language or is not predicted. + PartOfSpeech_VOICE_UNKNOWN PartOfSpeech_Voice = 0 + // Active + PartOfSpeech_ACTIVE PartOfSpeech_Voice = 1 + // Causative + PartOfSpeech_CAUSATIVE PartOfSpeech_Voice = 2 + // Passive + PartOfSpeech_PASSIVE PartOfSpeech_Voice = 3 +) + +var PartOfSpeech_Voice_name = map[int32]string{ + 0: "VOICE_UNKNOWN", + 1: "ACTIVE", + 2: "CAUSATIVE", + 3: "PASSIVE", +} +var PartOfSpeech_Voice_value = map[string]int32{ + "VOICE_UNKNOWN": 0, + "ACTIVE": 1, + "CAUSATIVE": 2, + "PASSIVE": 3, +} + +func (x PartOfSpeech_Voice) String() string { + return proto.EnumName(PartOfSpeech_Voice_name, int32(x)) +} +func (PartOfSpeech_Voice) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{5, 11} } + +// The parse label enum for the token. +type DependencyEdge_Label int32 + +const ( + // Unknown + DependencyEdge_UNKNOWN DependencyEdge_Label = 0 + // Abbreviation modifier + DependencyEdge_ABBREV DependencyEdge_Label = 1 + // Adjectival complement + DependencyEdge_ACOMP DependencyEdge_Label = 2 + // Adverbial clause modifier + DependencyEdge_ADVCL DependencyEdge_Label = 3 + // Adverbial modifier + DependencyEdge_ADVMOD DependencyEdge_Label = 4 + // Adjectival modifier of an NP + DependencyEdge_AMOD DependencyEdge_Label = 5 + // Appositional modifier of an NP + DependencyEdge_APPOS DependencyEdge_Label = 6 + // Attribute dependent of a copular verb + DependencyEdge_ATTR DependencyEdge_Label = 7 + // Auxiliary (non-main) verb + DependencyEdge_AUX DependencyEdge_Label = 8 + // Passive auxiliary + DependencyEdge_AUXPASS DependencyEdge_Label = 9 + // Coordinating conjunction + DependencyEdge_CC DependencyEdge_Label = 10 + // Clausal complement of a verb or adjective + DependencyEdge_CCOMP DependencyEdge_Label = 11 + // Conjunct + DependencyEdge_CONJ DependencyEdge_Label = 12 + // Clausal subject + DependencyEdge_CSUBJ DependencyEdge_Label = 13 + // Clausal passive subject + DependencyEdge_CSUBJPASS DependencyEdge_Label = 14 + // Dependency (unable to determine) + DependencyEdge_DEP DependencyEdge_Label = 15 + // Determiner + DependencyEdge_DET DependencyEdge_Label = 16 + // Discourse + DependencyEdge_DISCOURSE DependencyEdge_Label = 17 + // Direct object + DependencyEdge_DOBJ DependencyEdge_Label = 18 + // Expletive + DependencyEdge_EXPL DependencyEdge_Label = 19 + // Goes with (part of a word in a text not well edited) + DependencyEdge_GOESWITH DependencyEdge_Label = 20 + // Indirect object + DependencyEdge_IOBJ DependencyEdge_Label = 21 + // Marker (word introducing a subordinate clause) + DependencyEdge_MARK DependencyEdge_Label = 22 + // Multi-word expression + DependencyEdge_MWE DependencyEdge_Label = 23 + // Multi-word verbal expression + DependencyEdge_MWV DependencyEdge_Label = 24 + // Negation modifier + DependencyEdge_NEG DependencyEdge_Label = 25 + // Noun compound modifier + DependencyEdge_NN DependencyEdge_Label = 26 + // Noun phrase used as an adverbial modifier + DependencyEdge_NPADVMOD DependencyEdge_Label = 27 + // Nominal subject + DependencyEdge_NSUBJ DependencyEdge_Label = 28 + // Passive nominal subject + DependencyEdge_NSUBJPASS DependencyEdge_Label = 29 + // Numeric modifier of a noun + DependencyEdge_NUM DependencyEdge_Label = 30 + // Element of compound number + DependencyEdge_NUMBER DependencyEdge_Label = 31 + // Punctuation mark + DependencyEdge_P DependencyEdge_Label = 32 + // Parataxis relation + DependencyEdge_PARATAXIS DependencyEdge_Label = 33 + // Participial modifier + DependencyEdge_PARTMOD DependencyEdge_Label = 34 + // The complement of a preposition is a clause + DependencyEdge_PCOMP DependencyEdge_Label = 35 + // Object of a preposition + DependencyEdge_POBJ DependencyEdge_Label = 36 + // Possession modifier + DependencyEdge_POSS DependencyEdge_Label = 37 + // Postverbal negative particle + DependencyEdge_POSTNEG DependencyEdge_Label = 38 + // Predicate complement + DependencyEdge_PRECOMP DependencyEdge_Label = 39 + // Preconjunt + DependencyEdge_PRECONJ DependencyEdge_Label = 40 + // Predeterminer + DependencyEdge_PREDET DependencyEdge_Label = 41 + // Prefix + DependencyEdge_PREF DependencyEdge_Label = 42 + // Prepositional modifier + DependencyEdge_PREP DependencyEdge_Label = 43 + // The relationship between a verb and verbal morpheme + DependencyEdge_PRONL DependencyEdge_Label = 44 + // Particle + DependencyEdge_PRT DependencyEdge_Label = 45 + // Associative or possessive marker + DependencyEdge_PS DependencyEdge_Label = 46 + // Quantifier phrase modifier + DependencyEdge_QUANTMOD DependencyEdge_Label = 47 + // Relative clause modifier + DependencyEdge_RCMOD DependencyEdge_Label = 48 + // Complementizer in relative clause + DependencyEdge_RCMODREL DependencyEdge_Label = 49 + // Ellipsis without a preceding predicate + DependencyEdge_RDROP DependencyEdge_Label = 50 + // Referent + DependencyEdge_REF DependencyEdge_Label = 51 + // Remnant + DependencyEdge_REMNANT DependencyEdge_Label = 52 + // Reparandum + DependencyEdge_REPARANDUM DependencyEdge_Label = 53 + // Root + DependencyEdge_ROOT DependencyEdge_Label = 54 + // Suffix specifying a unit of number + DependencyEdge_SNUM DependencyEdge_Label = 55 + // Suffix + DependencyEdge_SUFF DependencyEdge_Label = 56 + // Temporal modifier + DependencyEdge_TMOD DependencyEdge_Label = 57 + // Topic marker + DependencyEdge_TOPIC DependencyEdge_Label = 58 + // Clause headed by an infinite form of the verb that modifies a noun + DependencyEdge_VMOD DependencyEdge_Label = 59 + // Vocative + DependencyEdge_VOCATIVE DependencyEdge_Label = 60 + // Open clausal complement + DependencyEdge_XCOMP DependencyEdge_Label = 61 + // Name suffix + DependencyEdge_SUFFIX DependencyEdge_Label = 62 + // Name title + DependencyEdge_TITLE DependencyEdge_Label = 63 + // Adverbial phrase modifier + DependencyEdge_ADVPHMOD DependencyEdge_Label = 64 + // Causative auxiliary + DependencyEdge_AUXCAUS DependencyEdge_Label = 65 + // Helper auxiliary + DependencyEdge_AUXVV DependencyEdge_Label = 66 + // Rentaishi (Prenominal modifier) + DependencyEdge_DTMOD DependencyEdge_Label = 67 + // Foreign words + DependencyEdge_FOREIGN DependencyEdge_Label = 68 + // Keyword + DependencyEdge_KW DependencyEdge_Label = 69 + // List for chains of comparable items + DependencyEdge_LIST DependencyEdge_Label = 70 + // Nominalized clause + DependencyEdge_NOMC DependencyEdge_Label = 71 + // Nominalized clausal subject + DependencyEdge_NOMCSUBJ DependencyEdge_Label = 72 + // Nominalized clausal passive + DependencyEdge_NOMCSUBJPASS DependencyEdge_Label = 73 + // Compound of numeric modifier + DependencyEdge_NUMC DependencyEdge_Label = 74 + // Copula + DependencyEdge_COP DependencyEdge_Label = 75 + // Dislocated relation (for fronted/topicalized elements) + DependencyEdge_DISLOCATED DependencyEdge_Label = 76 +) + +var DependencyEdge_Label_name = map[int32]string{ + 0: "UNKNOWN", + 1: "ABBREV", + 2: "ACOMP", + 3: "ADVCL", + 4: "ADVMOD", + 5: "AMOD", + 6: "APPOS", + 7: "ATTR", + 8: "AUX", + 9: "AUXPASS", + 10: "CC", + 11: "CCOMP", + 12: "CONJ", + 13: "CSUBJ", + 14: "CSUBJPASS", + 15: "DEP", + 16: "DET", + 17: "DISCOURSE", + 18: "DOBJ", + 19: "EXPL", + 20: "GOESWITH", + 21: "IOBJ", + 22: "MARK", + 23: "MWE", + 24: "MWV", + 25: "NEG", + 26: "NN", + 27: "NPADVMOD", + 28: "NSUBJ", + 29: "NSUBJPASS", + 30: "NUM", + 31: "NUMBER", + 32: "P", + 33: "PARATAXIS", + 34: "PARTMOD", + 35: "PCOMP", + 36: "POBJ", + 37: "POSS", + 38: "POSTNEG", + 39: "PRECOMP", + 40: "PRECONJ", + 41: "PREDET", + 42: "PREF", + 43: "PREP", + 44: "PRONL", + 45: "PRT", + 46: "PS", + 47: "QUANTMOD", + 48: "RCMOD", + 49: "RCMODREL", + 50: "RDROP", + 51: "REF", + 52: "REMNANT", + 53: "REPARANDUM", + 54: "ROOT", + 55: "SNUM", + 56: "SUFF", + 57: "TMOD", + 58: "TOPIC", + 59: "VMOD", + 60: "VOCATIVE", + 61: "XCOMP", + 62: "SUFFIX", + 63: "TITLE", + 64: "ADVPHMOD", + 65: "AUXCAUS", + 66: "AUXVV", + 67: "DTMOD", + 68: "FOREIGN", + 69: "KW", + 70: "LIST", + 71: "NOMC", + 72: "NOMCSUBJ", + 73: "NOMCSUBJPASS", + 74: "NUMC", + 75: "COP", + 76: "DISLOCATED", +} +var DependencyEdge_Label_value = map[string]int32{ + "UNKNOWN": 0, + "ABBREV": 1, + "ACOMP": 2, + "ADVCL": 3, + "ADVMOD": 4, + "AMOD": 5, + "APPOS": 6, + "ATTR": 7, + "AUX": 8, + "AUXPASS": 9, + "CC": 10, + "CCOMP": 11, + "CONJ": 12, + "CSUBJ": 13, + "CSUBJPASS": 14, + "DEP": 15, + "DET": 16, + "DISCOURSE": 17, + "DOBJ": 18, + "EXPL": 19, + "GOESWITH": 20, + "IOBJ": 21, + "MARK": 22, + "MWE": 23, + "MWV": 24, + "NEG": 25, + "NN": 26, + "NPADVMOD": 27, + "NSUBJ": 28, + "NSUBJPASS": 29, + "NUM": 30, + "NUMBER": 31, + "P": 32, + "PARATAXIS": 33, + "PARTMOD": 34, + "PCOMP": 35, + "POBJ": 36, + "POSS": 37, + "POSTNEG": 38, + "PRECOMP": 39, + "PRECONJ": 40, + "PREDET": 41, + "PREF": 42, + "PREP": 43, + "PRONL": 44, + "PRT": 45, + "PS": 46, + "QUANTMOD": 47, + "RCMOD": 48, + "RCMODREL": 49, + "RDROP": 50, + "REF": 51, + "REMNANT": 52, + "REPARANDUM": 53, + "ROOT": 54, + "SNUM": 55, + "SUFF": 56, + "TMOD": 57, + "TOPIC": 58, + "VMOD": 59, + "VOCATIVE": 60, + "XCOMP": 61, + "SUFFIX": 62, + "TITLE": 63, + "ADVPHMOD": 64, + "AUXCAUS": 65, + "AUXVV": 66, + "DTMOD": 67, + "FOREIGN": 68, + "KW": 69, + "LIST": 70, + "NOMC": 71, + "NOMCSUBJ": 72, + "NOMCSUBJPASS": 73, + "NUMC": 74, + "COP": 75, + "DISLOCATED": 76, +} + +func (x DependencyEdge_Label) String() string { + return proto.EnumName(DependencyEdge_Label_name, int32(x)) +} +func (DependencyEdge_Label) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{6, 0} } + +// The supported types of mentions. +type EntityMention_Type int32 + +const ( + // Unknown + EntityMention_TYPE_UNKNOWN EntityMention_Type = 0 + // Proper name + EntityMention_PROPER EntityMention_Type = 1 + // Common noun (or noun compound) + EntityMention_COMMON EntityMention_Type = 2 +) + +var EntityMention_Type_name = map[int32]string{ + 0: "TYPE_UNKNOWN", + 1: "PROPER", + 2: "COMMON", +} +var EntityMention_Type_value = map[string]int32{ + "TYPE_UNKNOWN": 0, + "PROPER": 1, + "COMMON": 2, +} + +func (x EntityMention_Type) String() string { + return proto.EnumName(EntityMention_Type_name, int32(x)) +} +func (EntityMention_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{7, 0} } + +// ################################################################ # +// +// Represents the input to API methods. +type Document struct { + // Required. If the type is not set or is `TYPE_UNSPECIFIED`, + // returns an `INVALID_ARGUMENT` error. + Type Document_Type `protobuf:"varint,1,opt,name=type,enum=google.cloud.language.v1beta2.Document_Type" json:"type,omitempty"` + // The source of the document: a string containing the content or a + // Google Cloud Storage URI. + // + // Types that are valid to be assigned to Source: + // *Document_Content + // *Document_GcsContentUri + Source isDocument_Source `protobuf_oneof:"source"` + // The language of the document (if not specified, the language is + // automatically detected). Both ISO and BCP-47 language codes are + // accepted.
    + // [Language Support](https://cloud.google.com/natural-language/docs/languages) + // lists currently supported languages for each API method. + // If the language (either specified by the caller or automatically detected) + // is not supported by the called API method, an `INVALID_ARGUMENT` error + // is returned. + Language string `protobuf:"bytes,4,opt,name=language" json:"language,omitempty"` +} + +func (m *Document) Reset() { *m = Document{} } +func (m *Document) String() string { return proto.CompactTextString(m) } +func (*Document) ProtoMessage() {} +func (*Document) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +type isDocument_Source interface { + isDocument_Source() +} + +type Document_Content struct { + Content string `protobuf:"bytes,2,opt,name=content,oneof"` +} +type Document_GcsContentUri struct { + GcsContentUri string `protobuf:"bytes,3,opt,name=gcs_content_uri,json=gcsContentUri,oneof"` +} + +func (*Document_Content) isDocument_Source() {} +func (*Document_GcsContentUri) isDocument_Source() {} + +func (m *Document) GetSource() isDocument_Source { + if m != nil { + return m.Source + } + return nil +} + +func (m *Document) GetType() Document_Type { + if m != nil { + return m.Type + } + return Document_TYPE_UNSPECIFIED +} + +func (m *Document) GetContent() string { + if x, ok := m.GetSource().(*Document_Content); ok { + return x.Content + } + return "" +} + +func (m *Document) GetGcsContentUri() string { + if x, ok := m.GetSource().(*Document_GcsContentUri); ok { + return x.GcsContentUri + } + return "" +} + +func (m *Document) GetLanguage() string { + if m != nil { + return m.Language + } + return "" +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Document) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Document_OneofMarshaler, _Document_OneofUnmarshaler, _Document_OneofSizer, []interface{}{ + (*Document_Content)(nil), + (*Document_GcsContentUri)(nil), + } +} + +func _Document_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Document) + // source + switch x := m.Source.(type) { + case *Document_Content: + b.EncodeVarint(2<<3 | proto.WireBytes) + b.EncodeStringBytes(x.Content) + case *Document_GcsContentUri: + b.EncodeVarint(3<<3 | proto.WireBytes) + b.EncodeStringBytes(x.GcsContentUri) + case nil: + default: + return fmt.Errorf("Document.Source has unexpected type %T", x) + } + return nil +} + +func _Document_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Document) + switch tag { + case 2: // source.content + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Source = &Document_Content{x} + return true, err + case 3: // source.gcs_content_uri + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Source = &Document_GcsContentUri{x} + return true, err + default: + return false, nil + } +} + +func _Document_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Document) + // source + switch x := m.Source.(type) { + case *Document_Content: + n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.Content))) + n += len(x.Content) + case *Document_GcsContentUri: + n += proto.SizeVarint(3<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.GcsContentUri))) + n += len(x.GcsContentUri) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// Represents a sentence in the input document. +type Sentence struct { + // The sentence text. + Text *TextSpan `protobuf:"bytes,1,opt,name=text" json:"text,omitempty"` + // For calls to [AnalyzeSentiment][] or if + // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment] is set to + // true, this field will contain the sentiment for the sentence. + Sentiment *Sentiment `protobuf:"bytes,2,opt,name=sentiment" json:"sentiment,omitempty"` +} + +func (m *Sentence) Reset() { *m = Sentence{} } +func (m *Sentence) String() string { return proto.CompactTextString(m) } +func (*Sentence) ProtoMessage() {} +func (*Sentence) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *Sentence) GetText() *TextSpan { + if m != nil { + return m.Text + } + return nil +} + +func (m *Sentence) GetSentiment() *Sentiment { + if m != nil { + return m.Sentiment + } + return nil +} + +// Represents a phrase in the text that is a known entity, such as +// a person, an organization, or location. The API associates information, such +// as salience and mentions, with entities. +type Entity struct { + // The representative name for the entity. + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // The entity type. + Type Entity_Type `protobuf:"varint,2,opt,name=type,enum=google.cloud.language.v1beta2.Entity_Type" json:"type,omitempty"` + // Metadata associated with the entity. + // + // Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if + // available. The associated keys are "wikipedia_url" and "mid", respectively. + Metadata map[string]string `protobuf:"bytes,3,rep,name=metadata" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // The salience score associated with the entity in the [0, 1.0] range. + // + // The salience score for an entity provides information about the + // importance or centrality of that entity to the entire document text. + // Scores closer to 0 are less salient, while scores closer to 1.0 are highly + // salient. + Salience float32 `protobuf:"fixed32,4,opt,name=salience" json:"salience,omitempty"` + // The mentions of this entity in the input document. The API currently + // supports proper noun mentions. + Mentions []*EntityMention `protobuf:"bytes,5,rep,name=mentions" json:"mentions,omitempty"` + // For calls to [AnalyzeEntitySentiment][] or if + // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to + // true, this field will contain the aggregate sentiment expressed for this + // entity in the provided document. + Sentiment *Sentiment `protobuf:"bytes,6,opt,name=sentiment" json:"sentiment,omitempty"` +} + +func (m *Entity) Reset() { *m = Entity{} } +func (m *Entity) String() string { return proto.CompactTextString(m) } +func (*Entity) ProtoMessage() {} +func (*Entity) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *Entity) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Entity) GetType() Entity_Type { + if m != nil { + return m.Type + } + return Entity_UNKNOWN +} + +func (m *Entity) GetMetadata() map[string]string { + if m != nil { + return m.Metadata + } + return nil +} + +func (m *Entity) GetSalience() float32 { + if m != nil { + return m.Salience + } + return 0 +} + +func (m *Entity) GetMentions() []*EntityMention { + if m != nil { + return m.Mentions + } + return nil +} + +func (m *Entity) GetSentiment() *Sentiment { + if m != nil { + return m.Sentiment + } + return nil +} + +// Represents the smallest syntactic building block of the text. +type Token struct { + // The token text. + Text *TextSpan `protobuf:"bytes,1,opt,name=text" json:"text,omitempty"` + // Parts of speech tag for this token. + PartOfSpeech *PartOfSpeech `protobuf:"bytes,2,opt,name=part_of_speech,json=partOfSpeech" json:"part_of_speech,omitempty"` + // Dependency tree parse for this token. + DependencyEdge *DependencyEdge `protobuf:"bytes,3,opt,name=dependency_edge,json=dependencyEdge" json:"dependency_edge,omitempty"` + // [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. + Lemma string `protobuf:"bytes,4,opt,name=lemma" json:"lemma,omitempty"` +} + +func (m *Token) Reset() { *m = Token{} } +func (m *Token) String() string { return proto.CompactTextString(m) } +func (*Token) ProtoMessage() {} +func (*Token) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *Token) GetText() *TextSpan { + if m != nil { + return m.Text + } + return nil +} + +func (m *Token) GetPartOfSpeech() *PartOfSpeech { + if m != nil { + return m.PartOfSpeech + } + return nil +} + +func (m *Token) GetDependencyEdge() *DependencyEdge { + if m != nil { + return m.DependencyEdge + } + return nil +} + +func (m *Token) GetLemma() string { + if m != nil { + return m.Lemma + } + return "" +} + +// Represents the feeling associated with the entire text or entities in +// the text. +type Sentiment struct { + // A non-negative number in the [0, +inf) range, which represents + // the absolute magnitude of sentiment regardless of score (positive or + // negative). + Magnitude float32 `protobuf:"fixed32,2,opt,name=magnitude" json:"magnitude,omitempty"` + // Sentiment score between -1.0 (negative sentiment) and 1.0 + // (positive sentiment). + Score float32 `protobuf:"fixed32,3,opt,name=score" json:"score,omitempty"` +} + +func (m *Sentiment) Reset() { *m = Sentiment{} } +func (m *Sentiment) String() string { return proto.CompactTextString(m) } +func (*Sentiment) ProtoMessage() {} +func (*Sentiment) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } + +func (m *Sentiment) GetMagnitude() float32 { + if m != nil { + return m.Magnitude + } + return 0 +} + +func (m *Sentiment) GetScore() float32 { + if m != nil { + return m.Score + } + return 0 +} + +// Represents part of speech information for a token. +type PartOfSpeech struct { + // The part of speech tag. + Tag PartOfSpeech_Tag `protobuf:"varint,1,opt,name=tag,enum=google.cloud.language.v1beta2.PartOfSpeech_Tag" json:"tag,omitempty"` + // The grammatical aspect. + Aspect PartOfSpeech_Aspect `protobuf:"varint,2,opt,name=aspect,enum=google.cloud.language.v1beta2.PartOfSpeech_Aspect" json:"aspect,omitempty"` + // The grammatical case. + Case PartOfSpeech_Case `protobuf:"varint,3,opt,name=case,enum=google.cloud.language.v1beta2.PartOfSpeech_Case" json:"case,omitempty"` + // The grammatical form. + Form PartOfSpeech_Form `protobuf:"varint,4,opt,name=form,enum=google.cloud.language.v1beta2.PartOfSpeech_Form" json:"form,omitempty"` + // The grammatical gender. + Gender PartOfSpeech_Gender `protobuf:"varint,5,opt,name=gender,enum=google.cloud.language.v1beta2.PartOfSpeech_Gender" json:"gender,omitempty"` + // The grammatical mood. + Mood PartOfSpeech_Mood `protobuf:"varint,6,opt,name=mood,enum=google.cloud.language.v1beta2.PartOfSpeech_Mood" json:"mood,omitempty"` + // The grammatical number. + Number PartOfSpeech_Number `protobuf:"varint,7,opt,name=number,enum=google.cloud.language.v1beta2.PartOfSpeech_Number" json:"number,omitempty"` + // The grammatical person. + Person PartOfSpeech_Person `protobuf:"varint,8,opt,name=person,enum=google.cloud.language.v1beta2.PartOfSpeech_Person" json:"person,omitempty"` + // The grammatical properness. + Proper PartOfSpeech_Proper `protobuf:"varint,9,opt,name=proper,enum=google.cloud.language.v1beta2.PartOfSpeech_Proper" json:"proper,omitempty"` + // The grammatical reciprocity. + Reciprocity PartOfSpeech_Reciprocity `protobuf:"varint,10,opt,name=reciprocity,enum=google.cloud.language.v1beta2.PartOfSpeech_Reciprocity" json:"reciprocity,omitempty"` + // The grammatical tense. + Tense PartOfSpeech_Tense `protobuf:"varint,11,opt,name=tense,enum=google.cloud.language.v1beta2.PartOfSpeech_Tense" json:"tense,omitempty"` + // The grammatical voice. + Voice PartOfSpeech_Voice `protobuf:"varint,12,opt,name=voice,enum=google.cloud.language.v1beta2.PartOfSpeech_Voice" json:"voice,omitempty"` +} + +func (m *PartOfSpeech) Reset() { *m = PartOfSpeech{} } +func (m *PartOfSpeech) String() string { return proto.CompactTextString(m) } +func (*PartOfSpeech) ProtoMessage() {} +func (*PartOfSpeech) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } + +func (m *PartOfSpeech) GetTag() PartOfSpeech_Tag { + if m != nil { + return m.Tag + } + return PartOfSpeech_UNKNOWN +} + +func (m *PartOfSpeech) GetAspect() PartOfSpeech_Aspect { + if m != nil { + return m.Aspect + } + return PartOfSpeech_ASPECT_UNKNOWN +} + +func (m *PartOfSpeech) GetCase() PartOfSpeech_Case { + if m != nil { + return m.Case + } + return PartOfSpeech_CASE_UNKNOWN +} + +func (m *PartOfSpeech) GetForm() PartOfSpeech_Form { + if m != nil { + return m.Form + } + return PartOfSpeech_FORM_UNKNOWN +} + +func (m *PartOfSpeech) GetGender() PartOfSpeech_Gender { + if m != nil { + return m.Gender + } + return PartOfSpeech_GENDER_UNKNOWN +} + +func (m *PartOfSpeech) GetMood() PartOfSpeech_Mood { + if m != nil { + return m.Mood + } + return PartOfSpeech_MOOD_UNKNOWN +} + +func (m *PartOfSpeech) GetNumber() PartOfSpeech_Number { + if m != nil { + return m.Number + } + return PartOfSpeech_NUMBER_UNKNOWN +} + +func (m *PartOfSpeech) GetPerson() PartOfSpeech_Person { + if m != nil { + return m.Person + } + return PartOfSpeech_PERSON_UNKNOWN +} + +func (m *PartOfSpeech) GetProper() PartOfSpeech_Proper { + if m != nil { + return m.Proper + } + return PartOfSpeech_PROPER_UNKNOWN +} + +func (m *PartOfSpeech) GetReciprocity() PartOfSpeech_Reciprocity { + if m != nil { + return m.Reciprocity + } + return PartOfSpeech_RECIPROCITY_UNKNOWN +} + +func (m *PartOfSpeech) GetTense() PartOfSpeech_Tense { + if m != nil { + return m.Tense + } + return PartOfSpeech_TENSE_UNKNOWN +} + +func (m *PartOfSpeech) GetVoice() PartOfSpeech_Voice { + if m != nil { + return m.Voice + } + return PartOfSpeech_VOICE_UNKNOWN +} + +// Represents dependency parse tree information for a token. +type DependencyEdge struct { + // Represents the head of this token in the dependency tree. + // This is the index of the token which has an arc going to this token. + // The index is the position of the token in the array of tokens returned + // by the API method. If this token is a root token, then the + // `head_token_index` is its own index. + HeadTokenIndex int32 `protobuf:"varint,1,opt,name=head_token_index,json=headTokenIndex" json:"head_token_index,omitempty"` + // The parse label for the token. + Label DependencyEdge_Label `protobuf:"varint,2,opt,name=label,enum=google.cloud.language.v1beta2.DependencyEdge_Label" json:"label,omitempty"` +} + +func (m *DependencyEdge) Reset() { *m = DependencyEdge{} } +func (m *DependencyEdge) String() string { return proto.CompactTextString(m) } +func (*DependencyEdge) ProtoMessage() {} +func (*DependencyEdge) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } + +func (m *DependencyEdge) GetHeadTokenIndex() int32 { + if m != nil { + return m.HeadTokenIndex + } + return 0 +} + +func (m *DependencyEdge) GetLabel() DependencyEdge_Label { + if m != nil { + return m.Label + } + return DependencyEdge_UNKNOWN +} + +// Represents a mention for an entity in the text. Currently, proper noun +// mentions are supported. +type EntityMention struct { + // The mention text. + Text *TextSpan `protobuf:"bytes,1,opt,name=text" json:"text,omitempty"` + // The type of the entity mention. + Type EntityMention_Type `protobuf:"varint,2,opt,name=type,enum=google.cloud.language.v1beta2.EntityMention_Type" json:"type,omitempty"` + // For calls to [AnalyzeEntitySentiment][] or if + // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to + // true, this field will contain the sentiment expressed for this mention of + // the entity in the provided document. + Sentiment *Sentiment `protobuf:"bytes,3,opt,name=sentiment" json:"sentiment,omitempty"` +} + +func (m *EntityMention) Reset() { *m = EntityMention{} } +func (m *EntityMention) String() string { return proto.CompactTextString(m) } +func (*EntityMention) ProtoMessage() {} +func (*EntityMention) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } + +func (m *EntityMention) GetText() *TextSpan { + if m != nil { + return m.Text + } + return nil +} + +func (m *EntityMention) GetType() EntityMention_Type { + if m != nil { + return m.Type + } + return EntityMention_TYPE_UNKNOWN +} + +func (m *EntityMention) GetSentiment() *Sentiment { + if m != nil { + return m.Sentiment + } + return nil +} + +// Represents an output piece of text. +type TextSpan struct { + // The content of the output text. + Content string `protobuf:"bytes,1,opt,name=content" json:"content,omitempty"` + // The API calculates the beginning offset of the content in the original + // document according to the [EncodingType][google.cloud.language.v1beta2.EncodingType] specified in the API request. + BeginOffset int32 `protobuf:"varint,2,opt,name=begin_offset,json=beginOffset" json:"begin_offset,omitempty"` +} + +func (m *TextSpan) Reset() { *m = TextSpan{} } +func (m *TextSpan) String() string { return proto.CompactTextString(m) } +func (*TextSpan) ProtoMessage() {} +func (*TextSpan) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } + +func (m *TextSpan) GetContent() string { + if m != nil { + return m.Content + } + return "" +} + +func (m *TextSpan) GetBeginOffset() int32 { + if m != nil { + return m.BeginOffset + } + return 0 +} + +// The sentiment analysis request message. +type AnalyzeSentimentRequest struct { + // Input document. + Document *Document `protobuf:"bytes,1,opt,name=document" json:"document,omitempty"` + // The encoding type used by the API to calculate sentence offsets for the + // sentence sentiment. + EncodingType EncodingType `protobuf:"varint,2,opt,name=encoding_type,json=encodingType,enum=google.cloud.language.v1beta2.EncodingType" json:"encoding_type,omitempty"` +} + +func (m *AnalyzeSentimentRequest) Reset() { *m = AnalyzeSentimentRequest{} } +func (m *AnalyzeSentimentRequest) String() string { return proto.CompactTextString(m) } +func (*AnalyzeSentimentRequest) ProtoMessage() {} +func (*AnalyzeSentimentRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } + +func (m *AnalyzeSentimentRequest) GetDocument() *Document { + if m != nil { + return m.Document + } + return nil +} + +func (m *AnalyzeSentimentRequest) GetEncodingType() EncodingType { + if m != nil { + return m.EncodingType + } + return EncodingType_NONE +} + +// The sentiment analysis response message. +type AnalyzeSentimentResponse struct { + // The overall sentiment of the input document. + DocumentSentiment *Sentiment `protobuf:"bytes,1,opt,name=document_sentiment,json=documentSentiment" json:"document_sentiment,omitempty"` + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + Language string `protobuf:"bytes,2,opt,name=language" json:"language,omitempty"` + // The sentiment for all the sentences in the document. + Sentences []*Sentence `protobuf:"bytes,3,rep,name=sentences" json:"sentences,omitempty"` +} + +func (m *AnalyzeSentimentResponse) Reset() { *m = AnalyzeSentimentResponse{} } +func (m *AnalyzeSentimentResponse) String() string { return proto.CompactTextString(m) } +func (*AnalyzeSentimentResponse) ProtoMessage() {} +func (*AnalyzeSentimentResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } + +func (m *AnalyzeSentimentResponse) GetDocumentSentiment() *Sentiment { + if m != nil { + return m.DocumentSentiment + } + return nil +} + +func (m *AnalyzeSentimentResponse) GetLanguage() string { + if m != nil { + return m.Language + } + return "" +} + +func (m *AnalyzeSentimentResponse) GetSentences() []*Sentence { + if m != nil { + return m.Sentences + } + return nil +} + +// The entity-level sentiment analysis request message. +type AnalyzeEntitySentimentRequest struct { + // Input document. + Document *Document `protobuf:"bytes,1,opt,name=document" json:"document,omitempty"` + // The encoding type used by the API to calculate offsets. + EncodingType EncodingType `protobuf:"varint,2,opt,name=encoding_type,json=encodingType,enum=google.cloud.language.v1beta2.EncodingType" json:"encoding_type,omitempty"` +} + +func (m *AnalyzeEntitySentimentRequest) Reset() { *m = AnalyzeEntitySentimentRequest{} } +func (m *AnalyzeEntitySentimentRequest) String() string { return proto.CompactTextString(m) } +func (*AnalyzeEntitySentimentRequest) ProtoMessage() {} +func (*AnalyzeEntitySentimentRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } + +func (m *AnalyzeEntitySentimentRequest) GetDocument() *Document { + if m != nil { + return m.Document + } + return nil +} + +func (m *AnalyzeEntitySentimentRequest) GetEncodingType() EncodingType { + if m != nil { + return m.EncodingType + } + return EncodingType_NONE +} + +// The entity-level sentiment analysis response message. +type AnalyzeEntitySentimentResponse struct { + // The recognized entities in the input document with associated sentiments. + Entities []*Entity `protobuf:"bytes,1,rep,name=entities" json:"entities,omitempty"` + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + Language string `protobuf:"bytes,2,opt,name=language" json:"language,omitempty"` +} + +func (m *AnalyzeEntitySentimentResponse) Reset() { *m = AnalyzeEntitySentimentResponse{} } +func (m *AnalyzeEntitySentimentResponse) String() string { return proto.CompactTextString(m) } +func (*AnalyzeEntitySentimentResponse) ProtoMessage() {} +func (*AnalyzeEntitySentimentResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } + +func (m *AnalyzeEntitySentimentResponse) GetEntities() []*Entity { + if m != nil { + return m.Entities + } + return nil +} + +func (m *AnalyzeEntitySentimentResponse) GetLanguage() string { + if m != nil { + return m.Language + } + return "" +} + +// The entity analysis request message. +type AnalyzeEntitiesRequest struct { + // Input document. + Document *Document `protobuf:"bytes,1,opt,name=document" json:"document,omitempty"` + // The encoding type used by the API to calculate offsets. + EncodingType EncodingType `protobuf:"varint,2,opt,name=encoding_type,json=encodingType,enum=google.cloud.language.v1beta2.EncodingType" json:"encoding_type,omitempty"` +} + +func (m *AnalyzeEntitiesRequest) Reset() { *m = AnalyzeEntitiesRequest{} } +func (m *AnalyzeEntitiesRequest) String() string { return proto.CompactTextString(m) } +func (*AnalyzeEntitiesRequest) ProtoMessage() {} +func (*AnalyzeEntitiesRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } + +func (m *AnalyzeEntitiesRequest) GetDocument() *Document { + if m != nil { + return m.Document + } + return nil +} + +func (m *AnalyzeEntitiesRequest) GetEncodingType() EncodingType { + if m != nil { + return m.EncodingType + } + return EncodingType_NONE +} + +// The entity analysis response message. +type AnalyzeEntitiesResponse struct { + // The recognized entities in the input document. + Entities []*Entity `protobuf:"bytes,1,rep,name=entities" json:"entities,omitempty"` + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + Language string `protobuf:"bytes,2,opt,name=language" json:"language,omitempty"` +} + +func (m *AnalyzeEntitiesResponse) Reset() { *m = AnalyzeEntitiesResponse{} } +func (m *AnalyzeEntitiesResponse) String() string { return proto.CompactTextString(m) } +func (*AnalyzeEntitiesResponse) ProtoMessage() {} +func (*AnalyzeEntitiesResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } + +func (m *AnalyzeEntitiesResponse) GetEntities() []*Entity { + if m != nil { + return m.Entities + } + return nil +} + +func (m *AnalyzeEntitiesResponse) GetLanguage() string { + if m != nil { + return m.Language + } + return "" +} + +// The syntax analysis request message. +type AnalyzeSyntaxRequest struct { + // Input document. + Document *Document `protobuf:"bytes,1,opt,name=document" json:"document,omitempty"` + // The encoding type used by the API to calculate offsets. + EncodingType EncodingType `protobuf:"varint,2,opt,name=encoding_type,json=encodingType,enum=google.cloud.language.v1beta2.EncodingType" json:"encoding_type,omitempty"` +} + +func (m *AnalyzeSyntaxRequest) Reset() { *m = AnalyzeSyntaxRequest{} } +func (m *AnalyzeSyntaxRequest) String() string { return proto.CompactTextString(m) } +func (*AnalyzeSyntaxRequest) ProtoMessage() {} +func (*AnalyzeSyntaxRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } + +func (m *AnalyzeSyntaxRequest) GetDocument() *Document { + if m != nil { + return m.Document + } + return nil +} + +func (m *AnalyzeSyntaxRequest) GetEncodingType() EncodingType { + if m != nil { + return m.EncodingType + } + return EncodingType_NONE +} + +// The syntax analysis response message. +type AnalyzeSyntaxResponse struct { + // Sentences in the input document. + Sentences []*Sentence `protobuf:"bytes,1,rep,name=sentences" json:"sentences,omitempty"` + // Tokens, along with their syntactic information, in the input document. + Tokens []*Token `protobuf:"bytes,2,rep,name=tokens" json:"tokens,omitempty"` + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + Language string `protobuf:"bytes,3,opt,name=language" json:"language,omitempty"` +} + +func (m *AnalyzeSyntaxResponse) Reset() { *m = AnalyzeSyntaxResponse{} } +func (m *AnalyzeSyntaxResponse) String() string { return proto.CompactTextString(m) } +func (*AnalyzeSyntaxResponse) ProtoMessage() {} +func (*AnalyzeSyntaxResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } + +func (m *AnalyzeSyntaxResponse) GetSentences() []*Sentence { + if m != nil { + return m.Sentences + } + return nil +} + +func (m *AnalyzeSyntaxResponse) GetTokens() []*Token { + if m != nil { + return m.Tokens + } + return nil +} + +func (m *AnalyzeSyntaxResponse) GetLanguage() string { + if m != nil { + return m.Language + } + return "" +} + +// The request message for the text annotation API, which can perform multiple +// analysis types (sentiment, entities, and syntax) in one call. +type AnnotateTextRequest struct { + // Input document. + Document *Document `protobuf:"bytes,1,opt,name=document" json:"document,omitempty"` + // The enabled features. + Features *AnnotateTextRequest_Features `protobuf:"bytes,2,opt,name=features" json:"features,omitempty"` + // The encoding type used by the API to calculate offsets. + EncodingType EncodingType `protobuf:"varint,3,opt,name=encoding_type,json=encodingType,enum=google.cloud.language.v1beta2.EncodingType" json:"encoding_type,omitempty"` +} + +func (m *AnnotateTextRequest) Reset() { *m = AnnotateTextRequest{} } +func (m *AnnotateTextRequest) String() string { return proto.CompactTextString(m) } +func (*AnnotateTextRequest) ProtoMessage() {} +func (*AnnotateTextRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } + +func (m *AnnotateTextRequest) GetDocument() *Document { + if m != nil { + return m.Document + } + return nil +} + +func (m *AnnotateTextRequest) GetFeatures() *AnnotateTextRequest_Features { + if m != nil { + return m.Features + } + return nil +} + +func (m *AnnotateTextRequest) GetEncodingType() EncodingType { + if m != nil { + return m.EncodingType + } + return EncodingType_NONE +} + +// All available features for sentiment, syntax, and semantic analysis. +// Setting each one to true will enable that specific analysis for the input. +type AnnotateTextRequest_Features struct { + // Extract syntax information. + ExtractSyntax bool `protobuf:"varint,1,opt,name=extract_syntax,json=extractSyntax" json:"extract_syntax,omitempty"` + // Extract entities. + ExtractEntities bool `protobuf:"varint,2,opt,name=extract_entities,json=extractEntities" json:"extract_entities,omitempty"` + // Extract document-level sentiment. + ExtractDocumentSentiment bool `protobuf:"varint,3,opt,name=extract_document_sentiment,json=extractDocumentSentiment" json:"extract_document_sentiment,omitempty"` + // Extract entities and their associated sentiment. + ExtractEntitySentiment bool `protobuf:"varint,4,opt,name=extract_entity_sentiment,json=extractEntitySentiment" json:"extract_entity_sentiment,omitempty"` +} + +func (m *AnnotateTextRequest_Features) Reset() { *m = AnnotateTextRequest_Features{} } +func (m *AnnotateTextRequest_Features) String() string { return proto.CompactTextString(m) } +func (*AnnotateTextRequest_Features) ProtoMessage() {} +func (*AnnotateTextRequest_Features) Descriptor() ([]byte, []int) { + return fileDescriptor0, []int{17, 0} +} + +func (m *AnnotateTextRequest_Features) GetExtractSyntax() bool { + if m != nil { + return m.ExtractSyntax + } + return false +} + +func (m *AnnotateTextRequest_Features) GetExtractEntities() bool { + if m != nil { + return m.ExtractEntities + } + return false +} + +func (m *AnnotateTextRequest_Features) GetExtractDocumentSentiment() bool { + if m != nil { + return m.ExtractDocumentSentiment + } + return false +} + +func (m *AnnotateTextRequest_Features) GetExtractEntitySentiment() bool { + if m != nil { + return m.ExtractEntitySentiment + } + return false +} + +// The text annotations response message. +type AnnotateTextResponse struct { + // Sentences in the input document. Populated if the user enables + // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_syntax]. + Sentences []*Sentence `protobuf:"bytes,1,rep,name=sentences" json:"sentences,omitempty"` + // Tokens, along with their syntactic information, in the input document. + // Populated if the user enables + // [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_syntax]. + Tokens []*Token `protobuf:"bytes,2,rep,name=tokens" json:"tokens,omitempty"` + // Entities, along with their semantic information, in the input document. + // Populated if the user enables + // [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entities]. + Entities []*Entity `protobuf:"bytes,3,rep,name=entities" json:"entities,omitempty"` + // The overall sentiment for the document. Populated if the user enables + // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment]. + DocumentSentiment *Sentiment `protobuf:"bytes,4,opt,name=document_sentiment,json=documentSentiment" json:"document_sentiment,omitempty"` + // The language of the text, which will be the same as the language specified + // in the request or, if not specified, the automatically-detected language. + // See [Document.language][google.cloud.language.v1beta2.Document.language] field for more details. + Language string `protobuf:"bytes,5,opt,name=language" json:"language,omitempty"` +} + +func (m *AnnotateTextResponse) Reset() { *m = AnnotateTextResponse{} } +func (m *AnnotateTextResponse) String() string { return proto.CompactTextString(m) } +func (*AnnotateTextResponse) ProtoMessage() {} +func (*AnnotateTextResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} } + +func (m *AnnotateTextResponse) GetSentences() []*Sentence { + if m != nil { + return m.Sentences + } + return nil +} + +func (m *AnnotateTextResponse) GetTokens() []*Token { + if m != nil { + return m.Tokens + } + return nil +} + +func (m *AnnotateTextResponse) GetEntities() []*Entity { + if m != nil { + return m.Entities + } + return nil +} + +func (m *AnnotateTextResponse) GetDocumentSentiment() *Sentiment { + if m != nil { + return m.DocumentSentiment + } + return nil +} + +func (m *AnnotateTextResponse) GetLanguage() string { + if m != nil { + return m.Language + } + return "" +} + +func init() { + proto.RegisterType((*Document)(nil), "google.cloud.language.v1beta2.Document") + proto.RegisterType((*Sentence)(nil), "google.cloud.language.v1beta2.Sentence") + proto.RegisterType((*Entity)(nil), "google.cloud.language.v1beta2.Entity") + proto.RegisterType((*Token)(nil), "google.cloud.language.v1beta2.Token") + proto.RegisterType((*Sentiment)(nil), "google.cloud.language.v1beta2.Sentiment") + proto.RegisterType((*PartOfSpeech)(nil), "google.cloud.language.v1beta2.PartOfSpeech") + proto.RegisterType((*DependencyEdge)(nil), "google.cloud.language.v1beta2.DependencyEdge") + proto.RegisterType((*EntityMention)(nil), "google.cloud.language.v1beta2.EntityMention") + proto.RegisterType((*TextSpan)(nil), "google.cloud.language.v1beta2.TextSpan") + proto.RegisterType((*AnalyzeSentimentRequest)(nil), "google.cloud.language.v1beta2.AnalyzeSentimentRequest") + proto.RegisterType((*AnalyzeSentimentResponse)(nil), "google.cloud.language.v1beta2.AnalyzeSentimentResponse") + proto.RegisterType((*AnalyzeEntitySentimentRequest)(nil), "google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest") + proto.RegisterType((*AnalyzeEntitySentimentResponse)(nil), "google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse") + proto.RegisterType((*AnalyzeEntitiesRequest)(nil), "google.cloud.language.v1beta2.AnalyzeEntitiesRequest") + proto.RegisterType((*AnalyzeEntitiesResponse)(nil), "google.cloud.language.v1beta2.AnalyzeEntitiesResponse") + proto.RegisterType((*AnalyzeSyntaxRequest)(nil), "google.cloud.language.v1beta2.AnalyzeSyntaxRequest") + proto.RegisterType((*AnalyzeSyntaxResponse)(nil), "google.cloud.language.v1beta2.AnalyzeSyntaxResponse") + proto.RegisterType((*AnnotateTextRequest)(nil), "google.cloud.language.v1beta2.AnnotateTextRequest") + proto.RegisterType((*AnnotateTextRequest_Features)(nil), "google.cloud.language.v1beta2.AnnotateTextRequest.Features") + proto.RegisterType((*AnnotateTextResponse)(nil), "google.cloud.language.v1beta2.AnnotateTextResponse") + proto.RegisterEnum("google.cloud.language.v1beta2.EncodingType", EncodingType_name, EncodingType_value) + proto.RegisterEnum("google.cloud.language.v1beta2.Document_Type", Document_Type_name, Document_Type_value) + proto.RegisterEnum("google.cloud.language.v1beta2.Entity_Type", Entity_Type_name, Entity_Type_value) + proto.RegisterEnum("google.cloud.language.v1beta2.PartOfSpeech_Tag", PartOfSpeech_Tag_name, PartOfSpeech_Tag_value) + proto.RegisterEnum("google.cloud.language.v1beta2.PartOfSpeech_Aspect", PartOfSpeech_Aspect_name, PartOfSpeech_Aspect_value) + proto.RegisterEnum("google.cloud.language.v1beta2.PartOfSpeech_Case", PartOfSpeech_Case_name, PartOfSpeech_Case_value) + proto.RegisterEnum("google.cloud.language.v1beta2.PartOfSpeech_Form", PartOfSpeech_Form_name, PartOfSpeech_Form_value) + proto.RegisterEnum("google.cloud.language.v1beta2.PartOfSpeech_Gender", PartOfSpeech_Gender_name, PartOfSpeech_Gender_value) + proto.RegisterEnum("google.cloud.language.v1beta2.PartOfSpeech_Mood", PartOfSpeech_Mood_name, PartOfSpeech_Mood_value) + proto.RegisterEnum("google.cloud.language.v1beta2.PartOfSpeech_Number", PartOfSpeech_Number_name, PartOfSpeech_Number_value) + proto.RegisterEnum("google.cloud.language.v1beta2.PartOfSpeech_Person", PartOfSpeech_Person_name, PartOfSpeech_Person_value) + proto.RegisterEnum("google.cloud.language.v1beta2.PartOfSpeech_Proper", PartOfSpeech_Proper_name, PartOfSpeech_Proper_value) + proto.RegisterEnum("google.cloud.language.v1beta2.PartOfSpeech_Reciprocity", PartOfSpeech_Reciprocity_name, PartOfSpeech_Reciprocity_value) + proto.RegisterEnum("google.cloud.language.v1beta2.PartOfSpeech_Tense", PartOfSpeech_Tense_name, PartOfSpeech_Tense_value) + proto.RegisterEnum("google.cloud.language.v1beta2.PartOfSpeech_Voice", PartOfSpeech_Voice_name, PartOfSpeech_Voice_value) + proto.RegisterEnum("google.cloud.language.v1beta2.DependencyEdge_Label", DependencyEdge_Label_name, DependencyEdge_Label_value) + proto.RegisterEnum("google.cloud.language.v1beta2.EntityMention_Type", EntityMention_Type_name, EntityMention_Type_value) +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for LanguageService service + +type LanguageServiceClient interface { + // Analyzes the sentiment of the provided text. + AnalyzeSentiment(ctx context.Context, in *AnalyzeSentimentRequest, opts ...grpc.CallOption) (*AnalyzeSentimentResponse, error) + // Finds named entities (currently proper names and common nouns) in the text + // along with entity types, salience, mentions for each entity, and + // other properties. + AnalyzeEntities(ctx context.Context, in *AnalyzeEntitiesRequest, opts ...grpc.CallOption) (*AnalyzeEntitiesResponse, error) + // Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1beta2.LanguageService.AnalyzeEntities] in the text and analyzes + // sentiment associated with each entity and its mentions. + AnalyzeEntitySentiment(ctx context.Context, in *AnalyzeEntitySentimentRequest, opts ...grpc.CallOption) (*AnalyzeEntitySentimentResponse, error) + // Analyzes the syntax of the text and provides sentence boundaries and + // tokenization along with part of speech tags, dependency trees, and other + // properties. + AnalyzeSyntax(ctx context.Context, in *AnalyzeSyntaxRequest, opts ...grpc.CallOption) (*AnalyzeSyntaxResponse, error) + // A convenience method that provides all syntax, sentiment, and entity + // features in one call. + AnnotateText(ctx context.Context, in *AnnotateTextRequest, opts ...grpc.CallOption) (*AnnotateTextResponse, error) +} + +type languageServiceClient struct { + cc *grpc.ClientConn +} + +func NewLanguageServiceClient(cc *grpc.ClientConn) LanguageServiceClient { + return &languageServiceClient{cc} +} + +func (c *languageServiceClient) AnalyzeSentiment(ctx context.Context, in *AnalyzeSentimentRequest, opts ...grpc.CallOption) (*AnalyzeSentimentResponse, error) { + out := new(AnalyzeSentimentResponse) + err := grpc.Invoke(ctx, "/google.cloud.language.v1beta2.LanguageService/AnalyzeSentiment", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *languageServiceClient) AnalyzeEntities(ctx context.Context, in *AnalyzeEntitiesRequest, opts ...grpc.CallOption) (*AnalyzeEntitiesResponse, error) { + out := new(AnalyzeEntitiesResponse) + err := grpc.Invoke(ctx, "/google.cloud.language.v1beta2.LanguageService/AnalyzeEntities", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *languageServiceClient) AnalyzeEntitySentiment(ctx context.Context, in *AnalyzeEntitySentimentRequest, opts ...grpc.CallOption) (*AnalyzeEntitySentimentResponse, error) { + out := new(AnalyzeEntitySentimentResponse) + err := grpc.Invoke(ctx, "/google.cloud.language.v1beta2.LanguageService/AnalyzeEntitySentiment", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *languageServiceClient) AnalyzeSyntax(ctx context.Context, in *AnalyzeSyntaxRequest, opts ...grpc.CallOption) (*AnalyzeSyntaxResponse, error) { + out := new(AnalyzeSyntaxResponse) + err := grpc.Invoke(ctx, "/google.cloud.language.v1beta2.LanguageService/AnalyzeSyntax", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *languageServiceClient) AnnotateText(ctx context.Context, in *AnnotateTextRequest, opts ...grpc.CallOption) (*AnnotateTextResponse, error) { + out := new(AnnotateTextResponse) + err := grpc.Invoke(ctx, "/google.cloud.language.v1beta2.LanguageService/AnnotateText", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for LanguageService service + +type LanguageServiceServer interface { + // Analyzes the sentiment of the provided text. + AnalyzeSentiment(context.Context, *AnalyzeSentimentRequest) (*AnalyzeSentimentResponse, error) + // Finds named entities (currently proper names and common nouns) in the text + // along with entity types, salience, mentions for each entity, and + // other properties. + AnalyzeEntities(context.Context, *AnalyzeEntitiesRequest) (*AnalyzeEntitiesResponse, error) + // Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1beta2.LanguageService.AnalyzeEntities] in the text and analyzes + // sentiment associated with each entity and its mentions. + AnalyzeEntitySentiment(context.Context, *AnalyzeEntitySentimentRequest) (*AnalyzeEntitySentimentResponse, error) + // Analyzes the syntax of the text and provides sentence boundaries and + // tokenization along with part of speech tags, dependency trees, and other + // properties. + AnalyzeSyntax(context.Context, *AnalyzeSyntaxRequest) (*AnalyzeSyntaxResponse, error) + // A convenience method that provides all syntax, sentiment, and entity + // features in one call. + AnnotateText(context.Context, *AnnotateTextRequest) (*AnnotateTextResponse, error) +} + +func RegisterLanguageServiceServer(s *grpc.Server, srv LanguageServiceServer) { + s.RegisterService(&_LanguageService_serviceDesc, srv) +} + +func _LanguageService_AnalyzeSentiment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AnalyzeSentimentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LanguageServiceServer).AnalyzeSentiment(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.cloud.language.v1beta2.LanguageService/AnalyzeSentiment", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LanguageServiceServer).AnalyzeSentiment(ctx, req.(*AnalyzeSentimentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _LanguageService_AnalyzeEntities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AnalyzeEntitiesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LanguageServiceServer).AnalyzeEntities(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.cloud.language.v1beta2.LanguageService/AnalyzeEntities", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LanguageServiceServer).AnalyzeEntities(ctx, req.(*AnalyzeEntitiesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _LanguageService_AnalyzeEntitySentiment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AnalyzeEntitySentimentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LanguageServiceServer).AnalyzeEntitySentiment(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.cloud.language.v1beta2.LanguageService/AnalyzeEntitySentiment", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LanguageServiceServer).AnalyzeEntitySentiment(ctx, req.(*AnalyzeEntitySentimentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _LanguageService_AnalyzeSyntax_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AnalyzeSyntaxRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LanguageServiceServer).AnalyzeSyntax(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.cloud.language.v1beta2.LanguageService/AnalyzeSyntax", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LanguageServiceServer).AnalyzeSyntax(ctx, req.(*AnalyzeSyntaxRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _LanguageService_AnnotateText_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AnnotateTextRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LanguageServiceServer).AnnotateText(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.cloud.language.v1beta2.LanguageService/AnnotateText", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LanguageServiceServer).AnnotateText(ctx, req.(*AnnotateTextRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _LanguageService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "google.cloud.language.v1beta2.LanguageService", + HandlerType: (*LanguageServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "AnalyzeSentiment", + Handler: _LanguageService_AnalyzeSentiment_Handler, + }, + { + MethodName: "AnalyzeEntities", + Handler: _LanguageService_AnalyzeEntities_Handler, + }, + { + MethodName: "AnalyzeEntitySentiment", + Handler: _LanguageService_AnalyzeEntitySentiment_Handler, + }, + { + MethodName: "AnalyzeSyntax", + Handler: _LanguageService_AnalyzeSyntax_Handler, + }, + { + MethodName: "AnnotateText", + Handler: _LanguageService_AnnotateText_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "google/cloud/language/v1beta2/language_service.proto", +} + +func init() { + proto.RegisterFile("google/cloud/language/v1beta2/language_service.proto", fileDescriptor0) +} + +var fileDescriptor0 = []byte{ + // 2873 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x5a, 0x4d, 0x73, 0xdb, 0xc6, + 0xf9, 0x37, 0xf8, 0x26, 0x72, 0x29, 0xc9, 0x6b, 0xc4, 0x89, 0xf9, 0xd7, 0x3f, 0x2f, 0x0e, 0x12, + 0xd7, 0x8a, 0x9d, 0x50, 0xb1, 0xec, 0x38, 0xae, 0xed, 0xbc, 0x40, 0xc0, 0x92, 0x82, 0x4c, 0x02, + 0xc8, 0x02, 0xa0, 0xe5, 0x5c, 0x38, 0x30, 0xb9, 0x62, 0x38, 0x91, 0x00, 0x96, 0x80, 0x3c, 0x56, + 0x2f, 0x99, 0xc9, 0x4c, 0x8f, 0x99, 0x1e, 0x72, 0xe8, 0x07, 0xe8, 0xa1, 0xa7, 0x4e, 0x3a, 0xd3, + 0x99, 0x4e, 0xfb, 0x19, 0x7a, 0x4c, 0xa7, 0xa7, 0x1e, 0x7b, 0xec, 0xa1, 0x87, 0x1e, 0x7a, 0xec, + 0x3c, 0xbb, 0x0b, 0xbe, 0xc8, 0x8e, 0x25, 0x3a, 0x99, 0x4e, 0x7a, 0xdb, 0x7d, 0xf0, 0xfc, 0x9e, + 0x7d, 0xde, 0x9f, 0x05, 0x48, 0x74, 0x63, 0x10, 0xc7, 0x83, 0x7d, 0xb6, 0xd1, 0xdb, 0x8f, 0x0f, + 0xfb, 0x1b, 0xfb, 0x61, 0x34, 0x38, 0x0c, 0x07, 0x6c, 0xe3, 0xd1, 0xb5, 0x87, 0x2c, 0x0d, 0x37, + 0x27, 0x84, 0x6e, 0xc2,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e, + 0xa4, 0x52, 0x02, 0xc8, 0x1a, 0xb1, 0x71, 0x12, 0x47, 0xb5, 0xf2, 0xe2, 0xb2, 0x5c, 0x8e, 0xa4, + 0x52, 0x02, 0x97, 0x35, 0x86, 0x49, 0x5c, 0xab, 0x3c, 0x87, 0x2c, 0x8e, 0xa4, 0x52, 0x82, 0xfa, + 0x00, 0x55, 0xc7, 0xac, 0x37, 0x1c, 0x8d, 0xe3, 0xde, 0x30, 0x3d, 0xaa, 0x21, 0x2e, 0xf0, 0xfd, + 0x45, 0x04, 0xd2, 0x29, 0x9c, 0xce, 0xca, 0x52, 0x9b, 0xa8, 0x98, 0xb2, 0x28, 0x61, 0xb5, 0x2a, + 0x17, 0x7a, 0x6d, 0xa1, 0x6c, 0x07, 0x20, 0x15, 0x78, 0x10, 0xf4, 0x28, 0x1e, 0xf6, 0x58, 0x6d, + 0x79, 0x71, 0x41, 0x1d, 0x00, 0x52, 0x81, 0xd7, 0xbe, 0x52, 0x50, 0xde, 0x0f, 0x07, 0xf3, 0x2d, + 0x75, 0x09, 0xe5, 0x75, 0x73, 0x07, 0x2b, 0x62, 0xe1, 0xe2, 0x9c, 0x58, 0x74, 0x70, 0x1e, 0x66, + 0xb8, 0xe1, 0xd8, 0x3b, 0xb8, 0x00, 0x24, 0x93, 0x40, 0xe3, 0x2c, 0xa3, 0x82, 0xed, 0x04, 0x36, + 0x2e, 0x01, 0xc9, 0x0e, 0xda, 0x78, 0x09, 0x48, 0x2e, 0x75, 0x6c, 0x5c, 0x06, 0x92, 0x4b, 0x7d, + 0x5c, 0x81, 0x5e, 0xea, 0x06, 0xb6, 0xe1, 0x63, 0x04, 0x4f, 0x3b, 0x84, 0x6e, 0xe1, 0xaa, 0x5a, + 0x44, 0xca, 0x2e, 0x5e, 0x86, 0x67, 0x7a, 0xa3, 0x61, 0xed, 0xe2, 0x15, 0xcd, 0x41, 0x25, 0x51, + 0x90, 0xaa, 0x8a, 0x56, 0x75, 0xb8, 0x4d, 0xf8,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x55, 0xbe, 0xac, 0x69, + 0xdf, 0xad, 0x72, 0x86, 0x01, 0x8d, 0xff, 0x7c, 0x6c, 0x02, 0x4f, 0xcb, 0x44, 0xbd, 0xbb, 0x80, + 0x06, 0x4f, 0x5c, 0x79, 0xd6, 0x3e, 0x78, 0x4e, 0xb4, 0x34, 0xe3, 0x06, 0x37, 0xa3, 0xae, 0xbd, + 0x75, 0x82, 0x19, 0x47, 0x73, 0xfe, 0xff, 0x8d, 0x82, 0x56, 0xe6, 0x66, 0x8e, 0x7a, 0xfd, 0x94, + 0xa1, 0x9f, 0x9d, 0xa8, 0x6b, 0x37, 0x16, 0x03, 0x49, 0x95, 0xaf, 0x72, 0x95, 0x2f, 0x69, 0x17, + 0x9f, 0x91, 0x2c, 0x1c, 0x01, 0x9a, 0xfe, 0x5a, 0x41, 0xcb, 0xb3, 0x3d, 0x48, 0xdd, 0x5c, 0x7c, + 0x08, 0xac, 0x5d, 0x5f, 0x08, 0x23, 0xd5, 0xbc, 0xc2, 0xd5, 0x7c, 0x53, 0x7b, 0xed, 0xa9, 0x6a, + 0x4e, 0x01, 0xb7, 0x95, 0x2b, 0x5b, 0x5f, 0x2a, 0xe8, 0xf5, 0x5e, 0x7c, 0xf0, 0xec, 0x63, 0xb6, + 0xce, 0x1f, 0x2b, 0x5e, 0x77, 0x1c, 0xa7, 0xb1, 0xab, 0x7c, 0x4a, 0x24, 0x6c, 0x10, 0x03, 0xa4, + 0x1e, 0x8f, 0x07, 0x1b, 0x03, 0x16, 0xf1, 0xdf, 0xeb, 0x37, 0xc4, 0xa3, 0x70, 0x34, 0x4c, 0xbe, + 0xe3, 0x4f, 0x08, 0x77, 0x32, 0xc2, 0xc3, 0x12, 0x47, 0x5c, 0xff, 0x4f, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x55, 0xc3, 0xe3, 0x00, 0xb5, 0x20, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/genproto/googleapis/cloud/speech/v1/cloud_speech.pb.go b/vendor/google.golang.org/genproto/googleapis/cloud/speech/v1/cloud_speech.pb.go new file mode 100644 index 0000000..51de3f2 --- /dev/null +++ b/vendor/google.golang.org/genproto/googleapis/cloud/speech/v1/cloud_speech.pb.go @@ -0,0 +1,1171 @@ +// Code generated by protoc-gen-go. +// source: google/cloud/speech/v1/cloud_speech.proto +// DO NOT EDIT! + +/* +Package speech is a generated protocol buffer package. + +It is generated from these files: + google/cloud/speech/v1/cloud_speech.proto + +It has these top-level messages: + RecognizeRequest + LongRunningRecognizeRequest + StreamingRecognizeRequest + StreamingRecognitionConfig + RecognitionConfig + SpeechContext + RecognitionAudio + RecognizeResponse + LongRunningRecognizeResponse + LongRunningRecognizeMetadata + StreamingRecognizeResponse + StreamingRecognitionResult + SpeechRecognitionResult + SpeechRecognitionAlternative +*/ +package speech + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "google.golang.org/genproto/googleapis/api/annotations" +import google_longrunning "google.golang.org/genproto/googleapis/longrunning" +import _ "github.com/golang/protobuf/ptypes/any" +import _ "github.com/golang/protobuf/ptypes/duration" +import google_protobuf4 "github.com/golang/protobuf/ptypes/timestamp" +import google_rpc "google.golang.org/genproto/googleapis/rpc/status" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +// Audio encoding of the data sent in the audio message. All encodings support +// only 1 channel (mono) audio. Only `FLAC` includes a header that describes +// the bytes of audio that follow the header. The other encodings are raw +// audio bytes with no header. +// +// For best results, the audio source should be captured and transmitted using +// a lossless encoding (`FLAC` or `LINEAR16`). Recognition accuracy may be +// reduced if lossy codecs, which include the other codecs listed in +// this section, are used to capture or transmit the audio, particularly if +// background noise is present. +type RecognitionConfig_AudioEncoding int32 + +const ( + // Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][]. + RecognitionConfig_ENCODING_UNSPECIFIED RecognitionConfig_AudioEncoding = 0 + // Uncompressed 16-bit signed little-endian samples (Linear PCM). + RecognitionConfig_LINEAR16 RecognitionConfig_AudioEncoding = 1 + // [`FLAC`](https://xiph.org/flac/documentation.html) (Free Lossless Audio + // Codec) is the recommended encoding because it is + // lossless--therefore recognition is not compromised--and + // requires only about half the bandwidth of `LINEAR16`. `FLAC` stream + // encoding supports 16-bit and 24-bit samples, however, not all fields in + // `STREAMINFO` are supported. + RecognitionConfig_FLAC RecognitionConfig_AudioEncoding = 2 + // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + RecognitionConfig_MULAW RecognitionConfig_AudioEncoding = 3 + // Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000. + RecognitionConfig_AMR RecognitionConfig_AudioEncoding = 4 + // Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000. + RecognitionConfig_AMR_WB RecognitionConfig_AudioEncoding = 5 + // Opus encoded audio frames in Ogg container + // ([OggOpus](https://wiki.xiph.org/OggOpus)). + // `sample_rate_hertz` must be 16000. + RecognitionConfig_OGG_OPUS RecognitionConfig_AudioEncoding = 6 + // Although the use of lossy encodings is not recommended, if a very low + // bitrate encoding is required, `OGG_OPUS` is highly preferred over + // Speex encoding. The [Speex](https://speex.org/) encoding supported by + // Cloud Speech API has a header byte in each block, as in MIME type + // `audio/x-speex-with-header-byte`. + // It is a variant of the RTP Speex encoding defined in + // [RFC 5574](https://tools.ietf.org/html/rfc5574). + // The stream is a sequence of blocks, one block per RTP packet. Each block + // starts with a byte containing the length of the block, in bytes, followed + // by one or more frames of Speex data, padded to an integral number of + // bytes (octets) as specified in RFC 5574. In other words, each RTP header + // is replaced with a single byte containing the block length. Only Speex + // wideband is supported. `sample_rate_hertz` must be 16000. + RecognitionConfig_SPEEX_WITH_HEADER_BYTE RecognitionConfig_AudioEncoding = 7 +) + +var RecognitionConfig_AudioEncoding_name = map[int32]string{ + 0: "ENCODING_UNSPECIFIED", + 1: "LINEAR16", + 2: "FLAC", + 3: "MULAW", + 4: "AMR", + 5: "AMR_WB", + 6: "OGG_OPUS", + 7: "SPEEX_WITH_HEADER_BYTE", +} +var RecognitionConfig_AudioEncoding_value = map[string]int32{ + "ENCODING_UNSPECIFIED": 0, + "LINEAR16": 1, + "FLAC": 2, + "MULAW": 3, + "AMR": 4, + "AMR_WB": 5, + "OGG_OPUS": 6, + "SPEEX_WITH_HEADER_BYTE": 7, +} + +func (x RecognitionConfig_AudioEncoding) String() string { + return proto.EnumName(RecognitionConfig_AudioEncoding_name, int32(x)) +} +func (RecognitionConfig_AudioEncoding) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{4, 0} +} + +// Indicates the type of speech event. +type StreamingRecognizeResponse_SpeechEventType int32 + +const ( + // No speech event specified. + StreamingRecognizeResponse_SPEECH_EVENT_UNSPECIFIED StreamingRecognizeResponse_SpeechEventType = 0 + // This event indicates that the server has detected the end of the user's + // speech utterance and expects no additional speech. Therefore, the server + // will not process additional audio (although it may subsequently return + // additional results). The client should stop sending additional audio + // data, half-close the gRPC connection, and wait for any additional results + // until the server closes the gRPC connection. This event is only sent if + // `single_utterance` was set to `true`, and is not used otherwise. + StreamingRecognizeResponse_END_OF_SINGLE_UTTERANCE StreamingRecognizeResponse_SpeechEventType = 1 +) + +var StreamingRecognizeResponse_SpeechEventType_name = map[int32]string{ + 0: "SPEECH_EVENT_UNSPECIFIED", + 1: "END_OF_SINGLE_UTTERANCE", +} +var StreamingRecognizeResponse_SpeechEventType_value = map[string]int32{ + "SPEECH_EVENT_UNSPECIFIED": 0, + "END_OF_SINGLE_UTTERANCE": 1, +} + +func (x StreamingRecognizeResponse_SpeechEventType) String() string { + return proto.EnumName(StreamingRecognizeResponse_SpeechEventType_name, int32(x)) +} +func (StreamingRecognizeResponse_SpeechEventType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{10, 0} +} + +// The top-level message sent by the client for the `Recognize` method. +type RecognizeRequest struct { + // *Required* Provides information to the recognizer that specifies how to + // process the request. + Config *RecognitionConfig `protobuf:"bytes,1,opt,name=config" json:"config,omitempty"` + // *Required* The audio data to be recognized. + Audio *RecognitionAudio `protobuf:"bytes,2,opt,name=audio" json:"audio,omitempty"` +} + +func (m *RecognizeRequest) Reset() { *m = RecognizeRequest{} } +func (m *RecognizeRequest) String() string { return proto.CompactTextString(m) } +func (*RecognizeRequest) ProtoMessage() {} +func (*RecognizeRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *RecognizeRequest) GetConfig() *RecognitionConfig { + if m != nil { + return m.Config + } + return nil +} + +func (m *RecognizeRequest) GetAudio() *RecognitionAudio { + if m != nil { + return m.Audio + } + return nil +} + +// The top-level message sent by the client for the `LongRunningRecognize` +// method. +type LongRunningRecognizeRequest struct { + // *Required* Provides information to the recognizer that specifies how to + // process the request. + Config *RecognitionConfig `protobuf:"bytes,1,opt,name=config" json:"config,omitempty"` + // *Required* The audio data to be recognized. + Audio *RecognitionAudio `protobuf:"bytes,2,opt,name=audio" json:"audio,omitempty"` +} + +func (m *LongRunningRecognizeRequest) Reset() { *m = LongRunningRecognizeRequest{} } +func (m *LongRunningRecognizeRequest) String() string { return proto.CompactTextString(m) } +func (*LongRunningRecognizeRequest) ProtoMessage() {} +func (*LongRunningRecognizeRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *LongRunningRecognizeRequest) GetConfig() *RecognitionConfig { + if m != nil { + return m.Config + } + return nil +} + +func (m *LongRunningRecognizeRequest) GetAudio() *RecognitionAudio { + if m != nil { + return m.Audio + } + return nil +} + +// The top-level message sent by the client for the `StreamingRecognize` method. +// Multiple `StreamingRecognizeRequest` messages are sent. The first message +// must contain a `streaming_config` message and must not contain `audio` data. +// All subsequent messages must contain `audio` data and must not contain a +// `streaming_config` message. +type StreamingRecognizeRequest struct { + // Types that are valid to be assigned to StreamingRequest: + // *StreamingRecognizeRequest_StreamingConfig + // *StreamingRecognizeRequest_AudioContent + StreamingRequest isStreamingRecognizeRequest_StreamingRequest `protobuf_oneof:"streaming_request"` +} + +func (m *StreamingRecognizeRequest) Reset() { *m = StreamingRecognizeRequest{} } +func (m *StreamingRecognizeRequest) String() string { return proto.CompactTextString(m) } +func (*StreamingRecognizeRequest) ProtoMessage() {} +func (*StreamingRecognizeRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +type isStreamingRecognizeRequest_StreamingRequest interface { + isStreamingRecognizeRequest_StreamingRequest() +} + +type StreamingRecognizeRequest_StreamingConfig struct { + StreamingConfig *StreamingRecognitionConfig `protobuf:"bytes,1,opt,name=streaming_config,json=streamingConfig,oneof"` +} +type StreamingRecognizeRequest_AudioContent struct { + AudioContent []byte `protobuf:"bytes,2,opt,name=audio_content,json=audioContent,proto3,oneof"` +} + +func (*StreamingRecognizeRequest_StreamingConfig) isStreamingRecognizeRequest_StreamingRequest() {} +func (*StreamingRecognizeRequest_AudioContent) isStreamingRecognizeRequest_StreamingRequest() {} + +func (m *StreamingRecognizeRequest) GetStreamingRequest() isStreamingRecognizeRequest_StreamingRequest { + if m != nil { + return m.StreamingRequest + } + return nil +} + +func (m *StreamingRecognizeRequest) GetStreamingConfig() *StreamingRecognitionConfig { + if x, ok := m.GetStreamingRequest().(*StreamingRecognizeRequest_StreamingConfig); ok { + return x.StreamingConfig + } + return nil +} + +func (m *StreamingRecognizeRequest) GetAudioContent() []byte { + if x, ok := m.GetStreamingRequest().(*StreamingRecognizeRequest_AudioContent); ok { + return x.AudioContent + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*StreamingRecognizeRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _StreamingRecognizeRequest_OneofMarshaler, _StreamingRecognizeRequest_OneofUnmarshaler, _StreamingRecognizeRequest_OneofSizer, []interface{}{ + (*StreamingRecognizeRequest_StreamingConfig)(nil), + (*StreamingRecognizeRequest_AudioContent)(nil), + } +} + +func _StreamingRecognizeRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*StreamingRecognizeRequest) + // streaming_request + switch x := m.StreamingRequest.(type) { + case *StreamingRecognizeRequest_StreamingConfig: + b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.StreamingConfig); err != nil { + return err + } + case *StreamingRecognizeRequest_AudioContent: + b.EncodeVarint(2<<3 | proto.WireBytes) + b.EncodeRawBytes(x.AudioContent) + case nil: + default: + return fmt.Errorf("StreamingRecognizeRequest.StreamingRequest has unexpected type %T", x) + } + return nil +} + +func _StreamingRecognizeRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*StreamingRecognizeRequest) + switch tag { + case 1: // streaming_request.streaming_config + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(StreamingRecognitionConfig) + err := b.DecodeMessage(msg) + m.StreamingRequest = &StreamingRecognizeRequest_StreamingConfig{msg} + return true, err + case 2: // streaming_request.audio_content + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeRawBytes(true) + m.StreamingRequest = &StreamingRecognizeRequest_AudioContent{x} + return true, err + default: + return false, nil + } +} + +func _StreamingRecognizeRequest_OneofSizer(msg proto.Message) (n int) { + m := msg.(*StreamingRecognizeRequest) + // streaming_request + switch x := m.StreamingRequest.(type) { + case *StreamingRecognizeRequest_StreamingConfig: + s := proto.Size(x.StreamingConfig) + n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *StreamingRecognizeRequest_AudioContent: + n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.AudioContent))) + n += len(x.AudioContent) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// Provides information to the recognizer that specifies how to process the +// request. +type StreamingRecognitionConfig struct { + // *Required* Provides information to the recognizer that specifies how to + // process the request. + Config *RecognitionConfig `protobuf:"bytes,1,opt,name=config" json:"config,omitempty"` + // *Optional* If `false` or omitted, the recognizer will perform continuous + // recognition (continuing to wait for and process audio even if the user + // pauses speaking) until the client closes the input stream (gRPC API) or + // until the maximum time limit has been reached. May return multiple + // `StreamingRecognitionResult`s with the `is_final` flag set to `true`. + // + // If `true`, the recognizer will detect a single spoken utterance. When it + // detects that the user has paused or stopped speaking, it will return an + // `END_OF_SINGLE_UTTERANCE` event and cease recognition. It will return no + // more than one `StreamingRecognitionResult` with the `is_final` flag set to + // `true`. + SingleUtterance bool `protobuf:"varint,2,opt,name=single_utterance,json=singleUtterance" json:"single_utterance,omitempty"` + // *Optional* If `true`, interim results (tentative hypotheses) may be + // returned as they become available (these interim results are indicated with + // the `is_final=false` flag). + // If `false` or omitted, only `is_final=true` result(s) are returned. + InterimResults bool `protobuf:"varint,3,opt,name=interim_results,json=interimResults" json:"interim_results,omitempty"` +} + +func (m *StreamingRecognitionConfig) Reset() { *m = StreamingRecognitionConfig{} } +func (m *StreamingRecognitionConfig) String() string { return proto.CompactTextString(m) } +func (*StreamingRecognitionConfig) ProtoMessage() {} +func (*StreamingRecognitionConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *StreamingRecognitionConfig) GetConfig() *RecognitionConfig { + if m != nil { + return m.Config + } + return nil +} + +func (m *StreamingRecognitionConfig) GetSingleUtterance() bool { + if m != nil { + return m.SingleUtterance + } + return false +} + +func (m *StreamingRecognitionConfig) GetInterimResults() bool { + if m != nil { + return m.InterimResults + } + return false +} + +// Provides information to the recognizer that specifies how to process the +// request. +type RecognitionConfig struct { + // *Required* Encoding of audio data sent in all `RecognitionAudio` messages. + Encoding RecognitionConfig_AudioEncoding `protobuf:"varint,1,opt,name=encoding,enum=google.cloud.speech.v1.RecognitionConfig_AudioEncoding" json:"encoding,omitempty"` + // *Required* Sample rate in Hertz of the audio data sent in all + // `RecognitionAudio` messages. Valid values are: 8000-48000. + // 16000 is optimal. For best results, set the sampling rate of the audio + // source to 16000 Hz. If that's not possible, use the native sample rate of + // the audio source (instead of re-sampling). + SampleRateHertz int32 `protobuf:"varint,2,opt,name=sample_rate_hertz,json=sampleRateHertz" json:"sample_rate_hertz,omitempty"` + // *Required* The language of the supplied audio as a + // [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + // Example: "en-US". + // See [Language Support](https://cloud.google.com/speech/docs/languages) + // for a list of the currently supported language codes. + LanguageCode string `protobuf:"bytes,3,opt,name=language_code,json=languageCode" json:"language_code,omitempty"` + // *Optional* Maximum number of recognition hypotheses to be returned. + // Specifically, the maximum number of `SpeechRecognitionAlternative` messages + // within each `SpeechRecognitionResult`. + // The server may return fewer than `max_alternatives`. + // Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of + // one. If omitted, will return a maximum of one. + MaxAlternatives int32 `protobuf:"varint,4,opt,name=max_alternatives,json=maxAlternatives" json:"max_alternatives,omitempty"` + // *Optional* If set to `true`, the server will attempt to filter out + // profanities, replacing all but the initial character in each filtered word + // with asterisks, e.g. "f***". If set to `false` or omitted, profanities + // won't be filtered out. + ProfanityFilter bool `protobuf:"varint,5,opt,name=profanity_filter,json=profanityFilter" json:"profanity_filter,omitempty"` + // *Optional* A means to provide context to assist the speech recognition. + SpeechContexts []*SpeechContext `protobuf:"bytes,6,rep,name=speech_contexts,json=speechContexts" json:"speech_contexts,omitempty"` +} + +func (m *RecognitionConfig) Reset() { *m = RecognitionConfig{} } +func (m *RecognitionConfig) String() string { return proto.CompactTextString(m) } +func (*RecognitionConfig) ProtoMessage() {} +func (*RecognitionConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } + +func (m *RecognitionConfig) GetEncoding() RecognitionConfig_AudioEncoding { + if m != nil { + return m.Encoding + } + return RecognitionConfig_ENCODING_UNSPECIFIED +} + +func (m *RecognitionConfig) GetSampleRateHertz() int32 { + if m != nil { + return m.SampleRateHertz + } + return 0 +} + +func (m *RecognitionConfig) GetLanguageCode() string { + if m != nil { + return m.LanguageCode + } + return "" +} + +func (m *RecognitionConfig) GetMaxAlternatives() int32 { + if m != nil { + return m.MaxAlternatives + } + return 0 +} + +func (m *RecognitionConfig) GetProfanityFilter() bool { + if m != nil { + return m.ProfanityFilter + } + return false +} + +func (m *RecognitionConfig) GetSpeechContexts() []*SpeechContext { + if m != nil { + return m.SpeechContexts + } + return nil +} + +// Provides "hints" to the speech recognizer to favor specific words and phrases +// in the results. +type SpeechContext struct { + // *Optional* A list of strings containing words and phrases "hints" so that + // the speech recognition is more likely to recognize them. This can be used + // to improve the accuracy for specific words and phrases, for example, if + // specific commands are typically spoken by the user. This can also be used + // to add additional words to the vocabulary of the recognizer. See + // [usage limits](https://cloud.google.com/speech/limits#content). + Phrases []string `protobuf:"bytes,1,rep,name=phrases" json:"phrases,omitempty"` +} + +func (m *SpeechContext) Reset() { *m = SpeechContext{} } +func (m *SpeechContext) String() string { return proto.CompactTextString(m) } +func (*SpeechContext) ProtoMessage() {} +func (*SpeechContext) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } + +func (m *SpeechContext) GetPhrases() []string { + if m != nil { + return m.Phrases + } + return nil +} + +// Contains audio data in the encoding specified in the `RecognitionConfig`. +// Either `content` or `uri` must be supplied. Supplying both or neither +// returns [google.rpc.Code.INVALID_ARGUMENT][]. See +// [audio limits](https://cloud.google.com/speech/limits#content). +type RecognitionAudio struct { + // Types that are valid to be assigned to AudioSource: + // *RecognitionAudio_Content + // *RecognitionAudio_Uri + AudioSource isRecognitionAudio_AudioSource `protobuf_oneof:"audio_source"` +} + +func (m *RecognitionAudio) Reset() { *m = RecognitionAudio{} } +func (m *RecognitionAudio) String() string { return proto.CompactTextString(m) } +func (*RecognitionAudio) ProtoMessage() {} +func (*RecognitionAudio) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } + +type isRecognitionAudio_AudioSource interface { + isRecognitionAudio_AudioSource() +} + +type RecognitionAudio_Content struct { + Content []byte `protobuf:"bytes,1,opt,name=content,proto3,oneof"` +} +type RecognitionAudio_Uri struct { + Uri string `protobuf:"bytes,2,opt,name=uri,oneof"` +} + +func (*RecognitionAudio_Content) isRecognitionAudio_AudioSource() {} +func (*RecognitionAudio_Uri) isRecognitionAudio_AudioSource() {} + +func (m *RecognitionAudio) GetAudioSource() isRecognitionAudio_AudioSource { + if m != nil { + return m.AudioSource + } + return nil +} + +func (m *RecognitionAudio) GetContent() []byte { + if x, ok := m.GetAudioSource().(*RecognitionAudio_Content); ok { + return x.Content + } + return nil +} + +func (m *RecognitionAudio) GetUri() string { + if x, ok := m.GetAudioSource().(*RecognitionAudio_Uri); ok { + return x.Uri + } + return "" +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*RecognitionAudio) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _RecognitionAudio_OneofMarshaler, _RecognitionAudio_OneofUnmarshaler, _RecognitionAudio_OneofSizer, []interface{}{ + (*RecognitionAudio_Content)(nil), + (*RecognitionAudio_Uri)(nil), + } +} + +func _RecognitionAudio_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*RecognitionAudio) + // audio_source + switch x := m.AudioSource.(type) { + case *RecognitionAudio_Content: + b.EncodeVarint(1<<3 | proto.WireBytes) + b.EncodeRawBytes(x.Content) + case *RecognitionAudio_Uri: + b.EncodeVarint(2<<3 | proto.WireBytes) + b.EncodeStringBytes(x.Uri) + case nil: + default: + return fmt.Errorf("RecognitionAudio.AudioSource has unexpected type %T", x) + } + return nil +} + +func _RecognitionAudio_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*RecognitionAudio) + switch tag { + case 1: // audio_source.content + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeRawBytes(true) + m.AudioSource = &RecognitionAudio_Content{x} + return true, err + case 2: // audio_source.uri + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.AudioSource = &RecognitionAudio_Uri{x} + return true, err + default: + return false, nil + } +} + +func _RecognitionAudio_OneofSizer(msg proto.Message) (n int) { + m := msg.(*RecognitionAudio) + // audio_source + switch x := m.AudioSource.(type) { + case *RecognitionAudio_Content: + n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.Content))) + n += len(x.Content) + case *RecognitionAudio_Uri: + n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.Uri))) + n += len(x.Uri) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// The only message returned to the client by the `Recognize` method. It +// contains the result as zero or more sequential `SpeechRecognitionResult` +// messages. +type RecognizeResponse struct { + // *Output-only* Sequential list of transcription results corresponding to + // sequential portions of audio. + Results []*SpeechRecognitionResult `protobuf:"bytes,2,rep,name=results" json:"results,omitempty"` +} + +func (m *RecognizeResponse) Reset() { *m = RecognizeResponse{} } +func (m *RecognizeResponse) String() string { return proto.CompactTextString(m) } +func (*RecognizeResponse) ProtoMessage() {} +func (*RecognizeResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } + +func (m *RecognizeResponse) GetResults() []*SpeechRecognitionResult { + if m != nil { + return m.Results + } + return nil +} + +// The only message returned to the client by the `LongRunningRecognize` method. +// It contains the result as zero or more sequential `SpeechRecognitionResult` +// messages. It is included in the `result.response` field of the `Operation` +// returned by the `GetOperation` call of the `google::longrunning::Operations` +// service. +type LongRunningRecognizeResponse struct { + // *Output-only* Sequential list of transcription results corresponding to + // sequential portions of audio. + Results []*SpeechRecognitionResult `protobuf:"bytes,2,rep,name=results" json:"results,omitempty"` +} + +func (m *LongRunningRecognizeResponse) Reset() { *m = LongRunningRecognizeResponse{} } +func (m *LongRunningRecognizeResponse) String() string { return proto.CompactTextString(m) } +func (*LongRunningRecognizeResponse) ProtoMessage() {} +func (*LongRunningRecognizeResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } + +func (m *LongRunningRecognizeResponse) GetResults() []*SpeechRecognitionResult { + if m != nil { + return m.Results + } + return nil +} + +// Describes the progress of a long-running `LongRunningRecognize` call. It is +// included in the `metadata` field of the `Operation` returned by the +// `GetOperation` call of the `google::longrunning::Operations` service. +type LongRunningRecognizeMetadata struct { + // Approximate percentage of audio processed thus far. Guaranteed to be 100 + // when the audio is fully processed and the results are available. + ProgressPercent int32 `protobuf:"varint,1,opt,name=progress_percent,json=progressPercent" json:"progress_percent,omitempty"` + // Time when the request was received. + StartTime *google_protobuf4.Timestamp `protobuf:"bytes,2,opt,name=start_time,json=startTime" json:"start_time,omitempty"` + // Time of the most recent processing update. + LastUpdateTime *google_protobuf4.Timestamp `protobuf:"bytes,3,opt,name=last_update_time,json=lastUpdateTime" json:"last_update_time,omitempty"` +} + +func (m *LongRunningRecognizeMetadata) Reset() { *m = LongRunningRecognizeMetadata{} } +func (m *LongRunningRecognizeMetadata) String() string { return proto.CompactTextString(m) } +func (*LongRunningRecognizeMetadata) ProtoMessage() {} +func (*LongRunningRecognizeMetadata) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } + +func (m *LongRunningRecognizeMetadata) GetProgressPercent() int32 { + if m != nil { + return m.ProgressPercent + } + return 0 +} + +func (m *LongRunningRecognizeMetadata) GetStartTime() *google_protobuf4.Timestamp { + if m != nil { + return m.StartTime + } + return nil +} + +func (m *LongRunningRecognizeMetadata) GetLastUpdateTime() *google_protobuf4.Timestamp { + if m != nil { + return m.LastUpdateTime + } + return nil +} + +// `StreamingRecognizeResponse` is the only message returned to the client by +// `StreamingRecognize`. A series of one or more `StreamingRecognizeResponse` +// messages are streamed back to the client. +// +// Here's an example of a series of ten `StreamingRecognizeResponse`s that might +// be returned while processing audio: +// +// 1. results { alternatives { transcript: "tube" } stability: 0.01 } +// +// 2. results { alternatives { transcript: "to be a" } stability: 0.01 } +// +// 3. results { alternatives { transcript: "to be" } stability: 0.9 } +// results { alternatives { transcript: " or not to be" } stability: 0.01 } +// +// 4. results { alternatives { transcript: "to be or not to be" +// confidence: 0.92 } +// alternatives { transcript: "to bee or not to bee" } +// is_final: true } +// +// 5. results { alternatives { transcript: " that's" } stability: 0.01 } +// +// 6. results { alternatives { transcript: " that is" } stability: 0.9 } +// results { alternatives { transcript: " the question" } stability: 0.01 } +// +// 7. speech_event_type: END_OF_SINGLE_UTTERANCE +// +// 8. results { alternatives { transcript: " that is the question" +// confidence: 0.98 } +// alternatives { transcript: " that was the question" } +// is_final: true } +// +// Notes: +// +// - Only two of the above responses #4 and #8 contain final results; they are +// indicated by `is_final: true`. Concatenating these together generates the +// full transcript: "to be or not to be that is the question". +// +// - The others contain interim `results`. #3 and #6 contain two interim +// `results`: the first portion has a high stability and is less likely to +// change; the second portion has a low stability and is very likely to +// change. A UI designer might choose to show only high stability `results`. +// +// - The specific `stability` and `confidence` values shown above are only for +// illustrative purposes. Actual values may vary. +// +// - In each response, only one of these fields will be set: +// `error`, +// `speech_event_type`, or +// one or more (repeated) `results`. +type StreamingRecognizeResponse struct { + // *Output-only* If set, returns a [google.rpc.Status][] message that + // specifies the error for the operation. + Error *google_rpc.Status `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` + // *Output-only* This repeated list contains zero or more results that + // correspond to consecutive portions of the audio currently being processed. + // It contains zero or one `is_final=true` result (the newly settled portion), + // followed by zero or more `is_final=false` results. + Results []*StreamingRecognitionResult `protobuf:"bytes,2,rep,name=results" json:"results,omitempty"` + // *Output-only* Indicates the type of speech event. + SpeechEventType StreamingRecognizeResponse_SpeechEventType `protobuf:"varint,4,opt,name=speech_event_type,json=speechEventType,enum=google.cloud.speech.v1.StreamingRecognizeResponse_SpeechEventType" json:"speech_event_type,omitempty"` +} + +func (m *StreamingRecognizeResponse) Reset() { *m = StreamingRecognizeResponse{} } +func (m *StreamingRecognizeResponse) String() string { return proto.CompactTextString(m) } +func (*StreamingRecognizeResponse) ProtoMessage() {} +func (*StreamingRecognizeResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } + +func (m *StreamingRecognizeResponse) GetError() *google_rpc.Status { + if m != nil { + return m.Error + } + return nil +} + +func (m *StreamingRecognizeResponse) GetResults() []*StreamingRecognitionResult { + if m != nil { + return m.Results + } + return nil +} + +func (m *StreamingRecognizeResponse) GetSpeechEventType() StreamingRecognizeResponse_SpeechEventType { + if m != nil { + return m.SpeechEventType + } + return StreamingRecognizeResponse_SPEECH_EVENT_UNSPECIFIED +} + +// A streaming speech recognition result corresponding to a portion of the audio +// that is currently being processed. +type StreamingRecognitionResult struct { + // *Output-only* May contain one or more recognition hypotheses (up to the + // maximum specified in `max_alternatives`). + Alternatives []*SpeechRecognitionAlternative `protobuf:"bytes,1,rep,name=alternatives" json:"alternatives,omitempty"` + // *Output-only* If `false`, this `StreamingRecognitionResult` represents an + // interim result that may change. If `true`, this is the final time the + // speech service will return this particular `StreamingRecognitionResult`, + // the recognizer will not return any further hypotheses for this portion of + // the transcript and corresponding audio. + IsFinal bool `protobuf:"varint,2,opt,name=is_final,json=isFinal" json:"is_final,omitempty"` + // *Output-only* An estimate of the likelihood that the recognizer will not + // change its guess about this interim result. Values range from 0.0 + // (completely unstable) to 1.0 (completely stable). + // This field is only provided for interim results (`is_final=false`). + // The default of 0.0 is a sentinel value indicating `stability` was not set. + Stability float32 `protobuf:"fixed32,3,opt,name=stability" json:"stability,omitempty"` +} + +func (m *StreamingRecognitionResult) Reset() { *m = StreamingRecognitionResult{} } +func (m *StreamingRecognitionResult) String() string { return proto.CompactTextString(m) } +func (*StreamingRecognitionResult) ProtoMessage() {} +func (*StreamingRecognitionResult) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } + +func (m *StreamingRecognitionResult) GetAlternatives() []*SpeechRecognitionAlternative { + if m != nil { + return m.Alternatives + } + return nil +} + +func (m *StreamingRecognitionResult) GetIsFinal() bool { + if m != nil { + return m.IsFinal + } + return false +} + +func (m *StreamingRecognitionResult) GetStability() float32 { + if m != nil { + return m.Stability + } + return 0 +} + +// A speech recognition result corresponding to a portion of the audio. +type SpeechRecognitionResult struct { + // *Output-only* May contain one or more recognition hypotheses (up to the + // maximum specified in `max_alternatives`). + Alternatives []*SpeechRecognitionAlternative `protobuf:"bytes,1,rep,name=alternatives" json:"alternatives,omitempty"` +} + +func (m *SpeechRecognitionResult) Reset() { *m = SpeechRecognitionResult{} } +func (m *SpeechRecognitionResult) String() string { return proto.CompactTextString(m) } +func (*SpeechRecognitionResult) ProtoMessage() {} +func (*SpeechRecognitionResult) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } + +func (m *SpeechRecognitionResult) GetAlternatives() []*SpeechRecognitionAlternative { + if m != nil { + return m.Alternatives + } + return nil +} + +// Alternative hypotheses (a.k.a. n-best list). +type SpeechRecognitionAlternative struct { + // *Output-only* Transcript text representing the words that the user spoke. + Transcript string `protobuf:"bytes,1,opt,name=transcript" json:"transcript,omitempty"` + // *Output-only* The confidence estimate between 0.0 and 1.0. A higher number + // indicates an estimated greater likelihood that the recognized words are + // correct. This field is typically provided only for the top hypothesis, and + // only for `is_final=true` results. Clients should not rely on the + // `confidence` field as it is not guaranteed to be accurate, or even set, in + // any of the results. + // The default of 0.0 is a sentinel value indicating `confidence` was not set. + Confidence float32 `protobuf:"fixed32,2,opt,name=confidence" json:"confidence,omitempty"` +} + +func (m *SpeechRecognitionAlternative) Reset() { *m = SpeechRecognitionAlternative{} } +func (m *SpeechRecognitionAlternative) String() string { return proto.CompactTextString(m) } +func (*SpeechRecognitionAlternative) ProtoMessage() {} +func (*SpeechRecognitionAlternative) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } + +func (m *SpeechRecognitionAlternative) GetTranscript() string { + if m != nil { + return m.Transcript + } + return "" +} + +func (m *SpeechRecognitionAlternative) GetConfidence() float32 { + if m != nil { + return m.Confidence + } + return 0 +} + +func init() { + proto.RegisterType((*RecognizeRequest)(nil), "google.cloud.speech.v1.RecognizeRequest") + proto.RegisterType((*LongRunningRecognizeRequest)(nil), "google.cloud.speech.v1.LongRunningRecognizeRequest") + proto.RegisterType((*StreamingRecognizeRequest)(nil), "google.cloud.speech.v1.StreamingRecognizeRequest") + proto.RegisterType((*StreamingRecognitionConfig)(nil), "google.cloud.speech.v1.StreamingRecognitionConfig") + proto.RegisterType((*RecognitionConfig)(nil), "google.cloud.speech.v1.RecognitionConfig") + proto.RegisterType((*SpeechContext)(nil), "google.cloud.speech.v1.SpeechContext") + proto.RegisterType((*RecognitionAudio)(nil), "google.cloud.speech.v1.RecognitionAudio") + proto.RegisterType((*RecognizeResponse)(nil), "google.cloud.speech.v1.RecognizeResponse") + proto.RegisterType((*LongRunningRecognizeResponse)(nil), "google.cloud.speech.v1.LongRunningRecognizeResponse") + proto.RegisterType((*LongRunningRecognizeMetadata)(nil), "google.cloud.speech.v1.LongRunningRecognizeMetadata") + proto.RegisterType((*StreamingRecognizeResponse)(nil), "google.cloud.speech.v1.StreamingRecognizeResponse") + proto.RegisterType((*StreamingRecognitionResult)(nil), "google.cloud.speech.v1.StreamingRecognitionResult") + proto.RegisterType((*SpeechRecognitionResult)(nil), "google.cloud.speech.v1.SpeechRecognitionResult") + proto.RegisterType((*SpeechRecognitionAlternative)(nil), "google.cloud.speech.v1.SpeechRecognitionAlternative") + proto.RegisterEnum("google.cloud.speech.v1.RecognitionConfig_AudioEncoding", RecognitionConfig_AudioEncoding_name, RecognitionConfig_AudioEncoding_value) + proto.RegisterEnum("google.cloud.speech.v1.StreamingRecognizeResponse_SpeechEventType", StreamingRecognizeResponse_SpeechEventType_name, StreamingRecognizeResponse_SpeechEventType_value) +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for Speech service + +type SpeechClient interface { + // Performs synchronous speech recognition: receive results after all audio + // has been sent and processed. + Recognize(ctx context.Context, in *RecognizeRequest, opts ...grpc.CallOption) (*RecognizeResponse, error) + // Performs asynchronous speech recognition: receive results via the + // google.longrunning.Operations interface. Returns either an + // `Operation.error` or an `Operation.response` which contains + // a `LongRunningRecognizeResponse` message. + LongRunningRecognize(ctx context.Context, in *LongRunningRecognizeRequest, opts ...grpc.CallOption) (*google_longrunning.Operation, error) + // Performs bidirectional streaming speech recognition: receive results while + // sending audio. This method is only available via the gRPC API (not REST). + StreamingRecognize(ctx context.Context, opts ...grpc.CallOption) (Speech_StreamingRecognizeClient, error) +} + +type speechClient struct { + cc *grpc.ClientConn +} + +func NewSpeechClient(cc *grpc.ClientConn) SpeechClient { + return &speechClient{cc} +} + +func (c *speechClient) Recognize(ctx context.Context, in *RecognizeRequest, opts ...grpc.CallOption) (*RecognizeResponse, error) { + out := new(RecognizeResponse) + err := grpc.Invoke(ctx, "/google.cloud.speech.v1.Speech/Recognize", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *speechClient) LongRunningRecognize(ctx context.Context, in *LongRunningRecognizeRequest, opts ...grpc.CallOption) (*google_longrunning.Operation, error) { + out := new(google_longrunning.Operation) + err := grpc.Invoke(ctx, "/google.cloud.speech.v1.Speech/LongRunningRecognize", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *speechClient) StreamingRecognize(ctx context.Context, opts ...grpc.CallOption) (Speech_StreamingRecognizeClient, error) { + stream, err := grpc.NewClientStream(ctx, &_Speech_serviceDesc.Streams[0], c.cc, "/google.cloud.speech.v1.Speech/StreamingRecognize", opts...) + if err != nil { + return nil, err + } + x := &speechStreamingRecognizeClient{stream} + return x, nil +} + +type Speech_StreamingRecognizeClient interface { + Send(*StreamingRecognizeRequest) error + Recv() (*StreamingRecognizeResponse, error) + grpc.ClientStream +} + +type speechStreamingRecognizeClient struct { + grpc.ClientStream +} + +func (x *speechStreamingRecognizeClient) Send(m *StreamingRecognizeRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *speechStreamingRecognizeClient) Recv() (*StreamingRecognizeResponse, error) { + m := new(StreamingRecognizeResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// Server API for Speech service + +type SpeechServer interface { + // Performs synchronous speech recognition: receive results after all audio + // has been sent and processed. + Recognize(context.Context, *RecognizeRequest) (*RecognizeResponse, error) + // Performs asynchronous speech recognition: receive results via the + // google.longrunning.Operations interface. Returns either an + // `Operation.error` or an `Operation.response` which contains + // a `LongRunningRecognizeResponse` message. + LongRunningRecognize(context.Context, *LongRunningRecognizeRequest) (*google_longrunning.Operation, error) + // Performs bidirectional streaming speech recognition: receive results while + // sending audio. This method is only available via the gRPC API (not REST). + StreamingRecognize(Speech_StreamingRecognizeServer) error +} + +func RegisterSpeechServer(s *grpc.Server, srv SpeechServer) { + s.RegisterService(&_Speech_serviceDesc, srv) +} + +func _Speech_Recognize_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RecognizeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SpeechServer).Recognize(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.cloud.speech.v1.Speech/Recognize", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SpeechServer).Recognize(ctx, req.(*RecognizeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Speech_LongRunningRecognize_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LongRunningRecognizeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SpeechServer).LongRunningRecognize(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.cloud.speech.v1.Speech/LongRunningRecognize", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SpeechServer).LongRunningRecognize(ctx, req.(*LongRunningRecognizeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Speech_StreamingRecognize_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(SpeechServer).StreamingRecognize(&speechStreamingRecognizeServer{stream}) +} + +type Speech_StreamingRecognizeServer interface { + Send(*StreamingRecognizeResponse) error + Recv() (*StreamingRecognizeRequest, error) + grpc.ServerStream +} + +type speechStreamingRecognizeServer struct { + grpc.ServerStream +} + +func (x *speechStreamingRecognizeServer) Send(m *StreamingRecognizeResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *speechStreamingRecognizeServer) Recv() (*StreamingRecognizeRequest, error) { + m := new(StreamingRecognizeRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +var _Speech_serviceDesc = grpc.ServiceDesc{ + ServiceName: "google.cloud.speech.v1.Speech", + HandlerType: (*SpeechServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Recognize", + Handler: _Speech_Recognize_Handler, + }, + { + MethodName: "LongRunningRecognize", + Handler: _Speech_LongRunningRecognize_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "StreamingRecognize", + Handler: _Speech_StreamingRecognize_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "google/cloud/speech/v1/cloud_speech.proto", +} + +func init() { proto.RegisterFile("google/cloud/speech/v1/cloud_speech.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 1212 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0xc6, 0x75, 0x12, 0xbf, 0xe6, 0xcf, 0x66, 0xa8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 0xcf, 0x60, 0xe7, 0xbe, 0x56, + 0xf3, 0x9e, 0x73, 0x7b, 0x4c, 0xcd, 0x18, 0x73, 0x42, 0xd8, 0x37, 0x80, 0x5e, 0xee, 0x1d, 0xb4, + 0xf3, 0x26, 0x7d, 0x66, 0x34, 0x55, 0xdf, 0xbc, 0x35, 0xb7, 0xac, 0x0f, 0xac, 0x7a, 0x00, 0x25, + 0x2f, 0x1c, 0xce, 0x70, 0xae, 0x5f, 0x35, 0xdf, 0xf0, 0x28, 0x19, 0x66, 0x47, 0xd6, 0x57, 0x9f, + 0xa5, 0x34, 0x3f, 0x4c, 0xde, 0x04, 0xe5, 0x50, 0xf8, 0x15, 0x9f, 0x71, 0x3d, 0xea, 0x2a, 0xc6, + 0x44, 0xa3, 0x40, 0x4e, 0xff, 0xfd, 0xf8, 0xd4, 0xfc, 0x7a, 0xba, 0xa0, 0x89, 0x0f, 0xfe, 0x0d, + 0x00, 0x00, 0xff, 0xff, 0x1f, 0xdc, 0x74, 0x41, 0xa6, 0x0c, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/genproto/googleapis/cloud/speech/v1beta1/cloud_speech.pb.go b/vendor/google.golang.org/genproto/googleapis/cloud/speech/v1beta1/cloud_speech.pb.go index cd932d9..baf71e9 100644 --- a/vendor/google.golang.org/genproto/googleapis/cloud/speech/v1beta1/cloud_speech.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/cloud/speech/v1beta1/cloud_speech.pb.go @@ -31,7 +31,8 @@ import fmt "fmt" import math "math" import _ "google.golang.org/genproto/googleapis/api/annotations" import google_longrunning "google.golang.org/genproto/googleapis/longrunning" -import google_protobuf3 "github.com/golang/protobuf/ptypes/timestamp" +import _ "github.com/golang/protobuf/ptypes/duration" +import google_protobuf4 "github.com/golang/protobuf/ptypes/timestamp" import google_rpc "google.golang.org/genproto/googleapis/rpc/status" import ( @@ -114,16 +115,26 @@ type StreamingRecognizeResponse_EndpointerType int32 const ( // No endpointer event specified. StreamingRecognizeResponse_ENDPOINTER_EVENT_UNSPECIFIED StreamingRecognizeResponse_EndpointerType = 0 - // Speech has been detected in the audio stream. + // Speech has been detected in the audio stream, and the service is + // beginning to process it. StreamingRecognizeResponse_START_OF_SPEECH StreamingRecognizeResponse_EndpointerType = 1 - // Speech has ceased to be detected in the audio stream. + // Speech has ceased to be detected in the audio stream. (For example, the + // user may have paused after speaking.) If `single_utterance` is `false`, + // the service will continue to process audio, and if subsequent speech is + // detected, will send another START_OF_SPEECH event. StreamingRecognizeResponse_END_OF_SPEECH StreamingRecognizeResponse_EndpointerType = 2 - // The end of the audio stream has been reached. and it is being processed. + // This event is sent after the client has half-closed the input stream gRPC + // connection and the server has received all of the audio. (The server may + // still be processing the audio and may subsequently return additional + // results.) StreamingRecognizeResponse_END_OF_AUDIO StreamingRecognizeResponse_EndpointerType = 3 // This event is only sent when `single_utterance` is `true`. It indicates // that the server has detected the end of the user's speech utterance and // expects no additional speech. Therefore, the server will not process - // additional audio. The client should stop sending additional audio data. + // additional audio (although it may subsequently return additional + // results). The client should stop sending additional audio data, + // half-close the gRPC connection, and wait for any additional results + // until the server closes the gRPC connection. StreamingRecognizeResponse_END_OF_UTTERANCE StreamingRecognizeResponse_EndpointerType = 4 ) @@ -149,13 +160,12 @@ func (StreamingRecognizeResponse_EndpointerType) EnumDescriptor() ([]byte, []int return fileDescriptor0, []int{10, 0} } -// `SyncRecognizeRequest` is the top-level message sent by the client for -// the `SyncRecognize` method. +// The top-level message sent by the client for the `SyncRecognize` method. type SyncRecognizeRequest struct { - // [Required] The `config` message provides information to the recognizer - // that specifies how to process the request. + // *Required* Provides information to the recognizer that specifies how to + // process the request. Config *RecognitionConfig `protobuf:"bytes,1,opt,name=config" json:"config,omitempty"` - // [Required] The audio data to be recognized. + // *Required* The audio data to be recognized. Audio *RecognitionAudio `protobuf:"bytes,2,opt,name=audio" json:"audio,omitempty"` } @@ -178,13 +188,12 @@ func (m *SyncRecognizeRequest) GetAudio() *RecognitionAudio { return nil } -// `AsyncRecognizeRequest` is the top-level message sent by the client for -// the `AsyncRecognize` method. +// The top-level message sent by the client for the `AsyncRecognize` method. type AsyncRecognizeRequest struct { - // [Required] The `config` message provides information to the recognizer - // that specifies how to process the request. + // *Required* Provides information to the recognizer that specifies how to + // process the request. Config *RecognitionConfig `protobuf:"bytes,1,opt,name=config" json:"config,omitempty"` - // [Required] The audio data to be recognized. + // *Required* The audio data to be recognized. Audio *RecognitionAudio `protobuf:"bytes,2,opt,name=audio" json:"audio,omitempty"` } @@ -207,11 +216,11 @@ func (m *AsyncRecognizeRequest) GetAudio() *RecognitionAudio { return nil } -// `StreamingRecognizeRequest` is the top-level message sent by the client for -// the `StreamingRecognize`. Multiple `StreamingRecognizeRequest` messages are -// sent. The first message must contain a `streaming_config` message and must -// not contain `audio` data. All subsequent messages must contain `audio` data -// and must not contain a `streaming_config` message. +// The top-level message sent by the client for the `StreamingRecognize` method. +// Multiple `StreamingRecognizeRequest` messages are sent. The first message +// must contain a `streaming_config` message and must not contain `audio` data. +// All subsequent messages must contain `audio` data and must not contain a +// `streaming_config` message. type StreamingRecognizeRequest struct { // Types that are valid to be assigned to StreamingRequest: // *StreamingRecognizeRequest_StreamingConfig @@ -329,24 +338,24 @@ func _StreamingRecognizeRequest_OneofSizer(msg proto.Message) (n int) { return n } -// The `StreamingRecognitionConfig` message provides information to the -// recognizer that specifies how to process the request. +// Provides information to the recognizer that specifies how to process the +// request. type StreamingRecognitionConfig struct { - // [Required] The `config` message provides information to the recognizer - // that specifies how to process the request. + // *Required* Provides information to the recognizer that specifies how to + // process the request. Config *RecognitionConfig `protobuf:"bytes,1,opt,name=config" json:"config,omitempty"` - // [Optional] If `false` or omitted, the recognizer will perform continuous - // recognition (continuing to process audio even if the user pauses speaking) - // until the client closes the output stream (gRPC API) or when the maximum - // time limit has been reached. Multiple `StreamingRecognitionResult`s with - // the `is_final` flag set to `true` may be returned. + // *Optional* If `false` or omitted, the recognizer will perform continuous + // recognition (continuing to wait for and process audio even if the user + // pauses speaking) until the client closes the input stream (gRPC API) or + // until the maximum time limit has been reached. May return multiple + // `StreamingRecognitionResult`s with the `is_final` flag set to `true`. // // If `true`, the recognizer will detect a single spoken utterance. When it // detects that the user has paused or stopped speaking, it will return an // `END_OF_UTTERANCE` event and cease recognition. It will return no more than // one `StreamingRecognitionResult` with the `is_final` flag set to `true`. SingleUtterance bool `protobuf:"varint,2,opt,name=single_utterance,json=singleUtterance" json:"single_utterance,omitempty"` - // [Optional] If `true`, interim results (tentative hypotheses) may be + // *Optional* If `true`, interim results (tentative hypotheses) may be // returned as they become available (these interim results are indicated with // the `is_final=false` flag). // If `false` or omitted, only `is_final=true` result(s) are returned. @@ -379,36 +388,36 @@ func (m *StreamingRecognitionConfig) GetInterimResults() bool { return false } -// The `RecognitionConfig` message provides information to the recognizer -// that specifies how to process the request. +// Provides information to the recognizer that specifies how to process the +// request. type RecognitionConfig struct { - // [Required] Encoding of audio data sent in all `RecognitionAudio` messages. + // *Required* Encoding of audio data sent in all `RecognitionAudio` messages. Encoding RecognitionConfig_AudioEncoding `protobuf:"varint,1,opt,name=encoding,enum=google.cloud.speech.v1beta1.RecognitionConfig_AudioEncoding" json:"encoding,omitempty"` - // [Required] Sample rate in Hertz of the audio data sent in all + // *Required* Sample rate in Hertz of the audio data sent in all // `RecognitionAudio` messages. Valid values are: 8000-48000. // 16000 is optimal. For best results, set the sampling rate of the audio // source to 16000 Hz. If that's not possible, use the native sample rate of // the audio source (instead of re-sampling). SampleRate int32 `protobuf:"varint,2,opt,name=sample_rate,json=sampleRate" json:"sample_rate,omitempty"` - // [Optional] The language of the supplied audio as a BCP-47 language tag. + // *Optional* The language of the supplied audio as a BCP-47 language tag. // Example: "en-GB" https://www.rfc-editor.org/rfc/bcp/bcp47.txt // If omitted, defaults to "en-US". See - // [Language Support](https://cloud.google.com/speech/docs/best-practices#language_support) + // [Language Support](https://cloud.google.com/speech/docs/languages) // for a list of the currently supported language codes. LanguageCode string `protobuf:"bytes,3,opt,name=language_code,json=languageCode" json:"language_code,omitempty"` - // [Optional] Maximum number of recognition hypotheses to be returned. + // *Optional* Maximum number of recognition hypotheses to be returned. // Specifically, the maximum number of `SpeechRecognitionAlternative` messages // within each `SpeechRecognitionResult`. // The server may return fewer than `max_alternatives`. // Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of - // `1`. If omitted, defaults to `1`. + // one. If omitted, will return a maximum of one. MaxAlternatives int32 `protobuf:"varint,4,opt,name=max_alternatives,json=maxAlternatives" json:"max_alternatives,omitempty"` - // [Optional] If set to `true`, the server will attempt to filter out + // *Optional* If set to `true`, the server will attempt to filter out // profanities, replacing all but the initial character in each filtered word // with asterisks, e.g. "f***". If set to `false` or omitted, profanities // won't be filtered out. ProfanityFilter bool `protobuf:"varint,5,opt,name=profanity_filter,json=profanityFilter" json:"profanity_filter,omitempty"` - // [Optional] A means to provide context to assist the speech recognition. + // *Optional* A means to provide context to assist the speech recognition. SpeechContext *SpeechContext `protobuf:"bytes,6,opt,name=speech_context,json=speechContext" json:"speech_context,omitempty"` } @@ -462,7 +471,7 @@ func (m *RecognitionConfig) GetSpeechContext() *SpeechContext { // Provides "hints" to the speech recognizer to favor specific words and phrases // in the results. type SpeechContext struct { - // [Optional] A list of strings containing words and phrases "hints" so that + // *Optional* A list of strings containing words and phrases "hints" so that // the speech recognition is more likely to recognize them. This can be used // to improve the accuracy for specific words and phrases, for example, if // specific commands are typically spoken by the user. This can also be used @@ -600,11 +609,11 @@ func _RecognitionAudio_OneofSizer(msg proto.Message) (n int) { return n } -// `SyncRecognizeResponse` is the only message returned to the client by -// `SyncRecognize`. It contains the result as zero or more sequential -// `SpeechRecognitionResult` messages. +// The only message returned to the client by `SyncRecognize`. It +// contains the result as zero or more sequential `SpeechRecognitionResult` +// messages. type SyncRecognizeResponse struct { - // [Output-only] Sequential list of transcription results corresponding to + // *Output-only* Sequential list of transcription results corresponding to // sequential portions of audio. Results []*SpeechRecognitionResult `protobuf:"bytes,2,rep,name=results" json:"results,omitempty"` } @@ -621,13 +630,12 @@ func (m *SyncRecognizeResponse) GetResults() []*SpeechRecognitionResult { return nil } -// `AsyncRecognizeResponse` is the only message returned to the client by -// `AsyncRecognize`. It contains the result as zero or more sequential -// `SpeechRecognitionResult` messages. It is included in the `result.response` -// field of the `Operation` returned by the `GetOperation` call of the -// `google::longrunning::Operations` service. +// The only message returned to the client by `AsyncRecognize`. It contains the +// result as zero or more sequential `SpeechRecognitionResult` messages. It is +// included in the `result.response` field of the `Operation` returned by the +// `GetOperation` call of the `google::longrunning::Operations` service. type AsyncRecognizeResponse struct { - // [Output-only] Sequential list of transcription results corresponding to + // *Output-only* Sequential list of transcription results corresponding to // sequential portions of audio. Results []*SpeechRecognitionResult `protobuf:"bytes,2,rep,name=results" json:"results,omitempty"` } @@ -644,18 +652,17 @@ func (m *AsyncRecognizeResponse) GetResults() []*SpeechRecognitionResult { return nil } -// `AsyncRecognizeMetadata` describes the progress of a long-running -// `AsyncRecognize` call. It is included in the `metadata` field of the -// `Operation` returned by the `GetOperation` call of the -// `google::longrunning::Operations` service. +// Describes the progress of a long-running `AsyncRecognize` call. It is +// included in the `metadata` field of the `Operation` returned by the +// `GetOperation` call of the `google::longrunning::Operations` service. type AsyncRecognizeMetadata struct { // Approximate percentage of audio processed thus far. Guaranteed to be 100 // when the audio is fully processed and the results are available. ProgressPercent int32 `protobuf:"varint,1,opt,name=progress_percent,json=progressPercent" json:"progress_percent,omitempty"` // Time when the request was received. - StartTime *google_protobuf3.Timestamp `protobuf:"bytes,2,opt,name=start_time,json=startTime" json:"start_time,omitempty"` + StartTime *google_protobuf4.Timestamp `protobuf:"bytes,2,opt,name=start_time,json=startTime" json:"start_time,omitempty"` // Time of the most recent processing update. - LastUpdateTime *google_protobuf3.Timestamp `protobuf:"bytes,3,opt,name=last_update_time,json=lastUpdateTime" json:"last_update_time,omitempty"` + LastUpdateTime *google_protobuf4.Timestamp `protobuf:"bytes,3,opt,name=last_update_time,json=lastUpdateTime" json:"last_update_time,omitempty"` } func (m *AsyncRecognizeMetadata) Reset() { *m = AsyncRecognizeMetadata{} } @@ -670,14 +677,14 @@ func (m *AsyncRecognizeMetadata) GetProgressPercent() int32 { return 0 } -func (m *AsyncRecognizeMetadata) GetStartTime() *google_protobuf3.Timestamp { +func (m *AsyncRecognizeMetadata) GetStartTime() *google_protobuf4.Timestamp { if m != nil { return m.StartTime } return nil } -func (m *AsyncRecognizeMetadata) GetLastUpdateTime() *google_protobuf3.Timestamp { +func (m *AsyncRecognizeMetadata) GetLastUpdateTime() *google_protobuf4.Timestamp { if m != nil { return m.LastUpdateTime } @@ -737,24 +744,27 @@ func (m *AsyncRecognizeMetadata) GetLastUpdateTime() *google_protobuf3.Timestamp // change, the second portion has a low stability and is very likely to // change. A UI designer might choose to show only high stability `results`. // +// - The specific `stability` and `confidence` values shown above are only for +// illustrative purposes. Actual values may vary. +// // - The `result_index` indicates the portion of audio that has had final // results returned, and is no longer being processed. For example, the // `results` in #6 and later correspond to the portion of audio after // "to be or not to be". type StreamingRecognizeResponse struct { - // [Output-only] If set, returns a [google.rpc.Status][] message that + // *Output-only* If set, returns a [google.rpc.Status][google.rpc.Status] message that // specifies the error for the operation. Error *google_rpc.Status `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` - // [Output-only] This repeated list contains zero or more results that + // *Output-only* This repeated list contains zero or more results that // correspond to consecutive portions of the audio currently being processed. // It contains zero or one `is_final=true` result (the newly settled portion), // followed by zero or more `is_final=false` results. Results []*StreamingRecognitionResult `protobuf:"bytes,2,rep,name=results" json:"results,omitempty"` - // [Output-only] Indicates the lowest index in the `results` array that has + // *Output-only* Indicates the lowest index in the `results` array that has // changed. The repeated `StreamingRecognitionResult` results overwrite past // results at this index and higher. ResultIndex int32 `protobuf:"varint,3,opt,name=result_index,json=resultIndex" json:"result_index,omitempty"` - // [Output-only] Indicates the type of endpointer event. + // *Output-only* Indicates the type of endpointer event. EndpointerType StreamingRecognizeResponse_EndpointerType `protobuf:"varint,4,opt,name=endpointer_type,json=endpointerType,enum=google.cloud.speech.v1beta1.StreamingRecognizeResponse_EndpointerType" json:"endpointer_type,omitempty"` } @@ -794,22 +804,20 @@ func (m *StreamingRecognizeResponse) GetEndpointerType() StreamingRecognizeRespo // A streaming speech recognition result corresponding to a portion of the audio // that is currently being processed. type StreamingRecognitionResult struct { - // [Output-only] May contain one or more recognition hypotheses (up to the + // *Output-only* May contain one or more recognition hypotheses (up to the // maximum specified in `max_alternatives`). Alternatives []*SpeechRecognitionAlternative `protobuf:"bytes,1,rep,name=alternatives" json:"alternatives,omitempty"` - // [Output-only] If `false`, this `StreamingRecognitionResult` represents an + // *Output-only* If `false`, this `StreamingRecognitionResult` represents an // interim result that may change. If `true`, this is the final time the // speech service will return this particular `StreamingRecognitionResult`, // the recognizer will not return any further hypotheses for this portion of // the transcript and corresponding audio. IsFinal bool `protobuf:"varint,2,opt,name=is_final,json=isFinal" json:"is_final,omitempty"` - // [Output-only] An estimate of the probability that the recognizer will not + // *Output-only* An estimate of the likelihood that the recognizer will not // change its guess about this interim result. Values range from 0.0 - // (completely unstable) to 1.0 (completely stable). Note that this is not the - // same as `confidence`, which estimates the probability that a recognition - // result is correct. + // (completely unstable) to 1.0 (completely stable). // This field is only provided for interim results (`is_final=false`). - // The default of 0.0 is a sentinel value indicating stability was not set. + // The default of 0.0 is a sentinel value indicating `stability` was not set. Stability float32 `protobuf:"fixed32,3,opt,name=stability" json:"stability,omitempty"` } @@ -841,7 +849,7 @@ func (m *StreamingRecognitionResult) GetStability() float32 { // A speech recognition result corresponding to a portion of the audio. type SpeechRecognitionResult struct { - // [Output-only] May contain one or more recognition hypotheses (up to the + // *Output-only* May contain one or more recognition hypotheses (up to the // maximum specified in `max_alternatives`). Alternatives []*SpeechRecognitionAlternative `protobuf:"bytes,1,rep,name=alternatives" json:"alternatives,omitempty"` } @@ -860,13 +868,15 @@ func (m *SpeechRecognitionResult) GetAlternatives() []*SpeechRecognitionAlternat // Alternative hypotheses (a.k.a. n-best list). type SpeechRecognitionAlternative struct { - // [Output-only] Transcript text representing the words that the user spoke. + // *Output-only* Transcript text representing the words that the user spoke. Transcript string `protobuf:"bytes,1,opt,name=transcript" json:"transcript,omitempty"` - // [Output-only] The confidence estimate between 0.0 and 1.0. A higher number - // means the system is more confident that the recognition is correct. - // This field is typically provided only for the top hypothesis, and only for - // `is_final=true` results. - // The default of 0.0 is a sentinel value indicating confidence was not set. + // *Output-only* The confidence estimate between 0.0 and 1.0. A higher number + // indicates an estimated greater likelihood that the recognized words are + // correct. This field is typically provided only for the top hypothesis, and + // only for `is_final=true` results. Clients should not rely on the + // `confidence` field as it is not guaranteed to be accurate, or even set, in + // any of the results. + // The default of 0.0 is a sentinel value indicating `confidence` was not set. Confidence float32 `protobuf:"fixed32,2,opt,name=confidence" json:"confidence,omitempty"` } @@ -919,15 +929,17 @@ const _ = grpc.SupportPackageIsVersion4 // Client API for Speech service type SpeechClient interface { - // Perform synchronous speech-recognition: receive results after all audio + // Performs synchronous speech recognition: receive results after all audio // has been sent and processed. SyncRecognize(ctx context.Context, in *SyncRecognizeRequest, opts ...grpc.CallOption) (*SyncRecognizeResponse, error) - // Perform asynchronous speech-recognition: receive results via the - // google.longrunning.Operations interface. Returns either an + // Performs asynchronous speech recognition: receive results via the + // [google.longrunning.Operations] + // (/speech/reference/rest/v1beta1/operations#Operation) + // interface. Returns either an // `Operation.error` or an `Operation.response` which contains // an `AsyncRecognizeResponse` message. AsyncRecognize(ctx context.Context, in *AsyncRecognizeRequest, opts ...grpc.CallOption) (*google_longrunning.Operation, error) - // Perform bidirectional streaming speech-recognition: receive results while + // Performs bidirectional streaming speech recognition: receive results while // sending audio. This method is only available via the gRPC API (not REST). StreamingRecognize(ctx context.Context, opts ...grpc.CallOption) (Speech_StreamingRecognizeClient, error) } @@ -992,15 +1004,17 @@ func (x *speechStreamingRecognizeClient) Recv() (*StreamingRecognizeResponse, er // Server API for Speech service type SpeechServer interface { - // Perform synchronous speech-recognition: receive results after all audio + // Performs synchronous speech recognition: receive results after all audio // has been sent and processed. SyncRecognize(context.Context, *SyncRecognizeRequest) (*SyncRecognizeResponse, error) - // Perform asynchronous speech-recognition: receive results via the - // google.longrunning.Operations interface. Returns either an + // Performs asynchronous speech recognition: receive results via the + // [google.longrunning.Operations] + // (/speech/reference/rest/v1beta1/operations#Operation) + // interface. Returns either an // `Operation.error` or an `Operation.response` which contains // an `AsyncRecognizeResponse` message. AsyncRecognize(context.Context, *AsyncRecognizeRequest) (*google_longrunning.Operation, error) - // Perform bidirectional streaming speech-recognition: receive results while + // Performs bidirectional streaming speech recognition: receive results while // sending audio. This method is only available via the gRPC API (not REST). StreamingRecognize(Speech_StreamingRecognizeServer) error } @@ -1098,81 +1112,81 @@ var _Speech_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("google/cloud/speech/v1beta1/cloud_speech.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 1206 bytes of a gzipped FileDescriptorProto + // 1214 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0x4d, 0x6f, 0x1b, 0xc5, 0x1b, 0xcf, 0xda, 0x71, 0x5e, 0x9e, 0xd8, 0xce, 0x76, 0xda, 0xfe, 0xeb, 0xfa, 0x9f, 0xb6, 0x61, 0x2b, 0x44, 0x5a, 0x89, 0x35, 0x09, 0xa8, 0x55, 0x0b, 0x17, 0xc7, 0x59, 0x13, 0x4b, 0x8d, 0x93, 0x4e, 0x1c, 0x8a, 0x90, 0x60, 0x35, 0x59, 0x4f, 0xb6, 0x2b, 0xd9, 0x33, 0xcb, 0xcc, 0x6c, 0x95, 0x70, 0xec, 0x8d, 0x0b, 0x17, 0xbe, 0x00, 0x12, 0x7c, 0x02, 0xc4, 0x81, 0x0b, 0xe2, 0xc2, 0x81, 0x3b, 0x5f, 0x81, 0x0f, 0x82, 0x76, 0x66, 0x37, 0xb1, 0x9d, 0xc6, 0x34, 0x88, 0x4a, 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+ 0x34, 0x53, 0x27, 0x6c, 0x7c, 0x9d, 0x1f, 0x2c, 0xb8, 0xde, 0x94, 0xff, 0x79, 0x9a, 0xbf, 0x58, + 0x70, 0x73, 0x5f, 0x09, 0x4a, 0x86, 0x11, 0x0b, 0xcf, 0x51, 0xed, 0x83, 0x2d, 0x73, 0xa5, 0x3f, + 0x46, 0xfa, 0xe1, 0xd4, 0xd3, 0x26, 0x23, 0x9e, 0xb1, 0xdf, 0x9e, 0xc1, 0xcb, 0xa7, 0x21, 0x0d, + 0x84, 0xde, 0x86, 0x8a, 0x26, 0x93, 0x9e, 0xa0, 0x28, 0x53, 0xfa, 0x83, 0xca, 0xdb, 0x33, 0xb8, + 0xac, 0xe1, 0x96, 0x41, 0x37, 0xaf, 0xc2, 0x95, 0x33, 0x32, 0xc2, 0x30, 0x74, 0x7e, 0xb6, 0xa0, + 0x7e, 0xf1, 0x69, 0xff, 0x5a, 0xae, 0xef, 0x81, 0x2d, 0x23, 0x16, 0x0e, 0xa8, 0x9f, 0x28, 0x45, + 0x05, 0x61, 0x01, 0xd5, 0x2c, 0x17, 0xf0, 0xb2, 0xc1, 0x0f, 0x72, 0x18, 0xbd, 0x03, 0xcb, 0x11, + 0x53, 0x54, 0x44, 0x43, 0x5f, 0x50, 0x99, 0x0c, 0x94, 0xac, 0x15, 0xb5, 0x65, 0x35, 0x83, 0xb1, + 0x41, 0x9d, 0x5f, 0x8b, 0x70, 0xe5, 0x3c, 0xe3, 0x4f, 0x61, 0x81, 0xb2, 0x80, 0xf7, 0x23, 0x66, + 0x38, 0x57, 0x37, 0x3e, 0xba, 0x1c, 0x67, 0x57, 0xdf, 0xaf, 0x97, 0xc5, 0xc0, 0xa7, 0xd1, 0xd0, + 0x1d, 0x58, 0x92, 0x64, 0x18, 0x0f, 0xa8, 0x2f, 0x88, 0x32, 0xf4, 0x4b, 0x18, 0x0c, 0x84, 0x89, + 0xa2, 0xe8, 0x2e, 0x54, 0x06, 0x84, 0x85, 0x09, 0x09,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x2d, 0x88, + 0xea, 0x30, 0x9f, 0x57, 0xbc, 0x95, 0x55, 0x7c, 0x0e, 0x20, 0x04, 0xc5, 0x44, 0x44, 0xfa, 0x92, + 0x16, 0xb7, 0x67, 0x70, 0x2a, 0x6c, 0x56, 0xc1, 0x34, 0x84, 0x2f, 0x79, 0x22, 0x02, 0xea, 0x84, + 0x70, 0x7d, 0x62, 0x0e, 0xca, 0x98, 0x33, 0x49, 0x51, 0x17, 0xe6, 0xf3, 0xd2, 0x2b, 0xac, 0x16, + 0xd7, 0x96, 0x36, 0x3e, 0x78, 0x8d, 0x34, 0x8e, 0xd0, 0x33, 0x15, 0x8a, 0xf3, 0x20, 0xce, 0x73, + 0xf8, 0xdf, 0xe4, 0x28, 0x7b, 0x43, 0x27, 0xfd, 0x66, 0x4d, 0x1e, 0xb5, 0x43, 0x15, 0xe9, 0x13, + 0x45, 0xb2, 0x6a, 0x0a, 0x05, 0x95, 0xd2, 0x8f, 0xa9, 0x08, 0xf2, 0xb4, 0x95, 0x74, 0x35, 0x69, + 0x7c, 0xcf, 0xc0, 0xe8, 0x11, 0x80, 0x54, 0x44, 0x28, 0x3f, 0xdd, 0x29, 0xd9, 0x78, 0xac, 0xe7, + 0xc4, 0xf2, 0x85, 0xe3, 0xf6, 0xf2, 0x85, 0x83, 0x17, 0xb5, 0x75, 0x2a, 0xa3, 0x2d, 0xb0, 0x07, + 0x44, 0x2a, 0x3f, 0x89, 0xfb, 0x44, 0x51, 0x13, 0xa0, 0xf8, 0xb7, 0x01, 0xaa, 0xa9, 0xcf, 0x81, + 0x76, 0x49, 0x41, 0xe7, 0xc7, 0xe2, 0xf9, 0xa9, 0x34, 0x92, 0xb5, 0x35, 0x28, 0x51, 0x21, 0xb8, + 0xc8, 0x86, 0x12, 0xca, 0x23, 0x8b, 0x38, 0x70, 0xf7, 0xf5, 0xaa, 0xc3, 0xc6, 0x00, 0x3d, 0x9d, + 0xcc, 0xef, 0xe5, 0xe7, 0xee, 0x44, 0x8a,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8c, 0x8a, 0xc4, 0x91, 0x7c, 0xe5, 0xdf, 0x9d, 0x0f, 0x8d, 0x78, 0x38, 0xa7, 0xad, 0xdf, + 0xff, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x25, 0x0d, 0x06, 0x48, 0x1b, 0x0d, 0x00, 0x00, } diff --git a/vendor/google.golang.org/genproto/googleapis/cloud/support/common/common.pb.go b/vendor/google.golang.org/genproto/googleapis/cloud/support/common/common.pb.go new file mode 100644 index 0000000..9c9daaa --- /dev/null +++ b/vendor/google.golang.org/genproto/googleapis/cloud/support/common/common.pb.go @@ -0,0 +1,865 @@ +// Code generated by protoc-gen-go. +// source: google/cloud/support/common.proto +// DO NOT EDIT! + +/* +Package common is a generated protocol buffer package. + +It is generated from these files: + google/cloud/support/common.proto + +It has these top-level messages: + SupportAccount + Case + CustomerIssue + SupportRole + Comment + IssueTaxonomy +*/ +package common + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "google.golang.org/genproto/googleapis/api/annotations" +import google_protobuf1 "github.com/golang/protobuf/ptypes/timestamp" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +// The current state of this SupportAccount. +type SupportAccount_State int32 + +const ( + // Account is in an unknown state. + SupportAccount_STATE_UNSPECIFIED SupportAccount_State = 0 + // Account is in an active state. + SupportAccount_ACTIVE SupportAccount_State = 1 + // Account has been created but is being provisioned in support systems. + SupportAccount_PENDING SupportAccount_State = 2 + // Account deletion has been requested by the user. + SupportAccount_PENDING_DELETION SupportAccount_State = 3 +) + +var SupportAccount_State_name = map[int32]string{ + 0: "STATE_UNSPECIFIED", + 1: "ACTIVE", + 2: "PENDING", + 3: "PENDING_DELETION", +} +var SupportAccount_State_value = map[string]int32{ + "STATE_UNSPECIFIED": 0, + "ACTIVE": 1, + "PENDING": 2, + "PENDING_DELETION": 3, +} + +func (x SupportAccount_State) String() string { + return proto.EnumName(SupportAccount_State_name, int32(x)) +} +func (SupportAccount_State) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} } + +// Pricing model applicable to this support account. +type SupportAccount_PricingModel int32 + +const ( + // This account is subscribed to an unknown pricing model. + SupportAccount_PRICING_MODEL_UNKNOWN SupportAccount_PricingModel = 0 + // Package based pricing (Platinum, Gold, Silver, Bronze). + SupportAccount_PACKAGES SupportAccount_PricingModel = 1 + // Support charges are calculated based on user seats a.k.a, + // "Pick Your Team" model. + SupportAccount_USER_ROLES SupportAccount_PricingModel = 2 +) + +var SupportAccount_PricingModel_name = map[int32]string{ + 0: "PRICING_MODEL_UNKNOWN", + 1: "PACKAGES", + 2: "USER_ROLES", +} +var SupportAccount_PricingModel_value = map[string]int32{ + "PRICING_MODEL_UNKNOWN": 0, + "PACKAGES": 1, + "USER_ROLES": 2, +} + +func (x SupportAccount_PricingModel) String() string { + return proto.EnumName(SupportAccount_PricingModel_name, int32(x)) +} +func (SupportAccount_PricingModel) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{0, 1} +} + +// The case priority with P0 being the most urgent and P4 the least. +type Case_Priority int32 + +const ( + // Priority is undefined or has not been set yet. + Case_PRIORITY_UNSPECIFIED Case_Priority = 0 + // Extreme impact on a production service - Service is hard down. + Case_P0 Case_Priority = 1 + // Critical impact on a production service - Service is currently unusable. + Case_P1 Case_Priority = 2 + // Severe impact on a production service - Service is usable but greatly + // impaired. + Case_P2 Case_Priority = 3 + // Medium impact on a production service - Service is available, but + // moderately impaired. + Case_P3 Case_Priority = 4 + // General questions or minor issues - Production service is fully + // available. + Case_P4 Case_Priority = 5 +) + +var Case_Priority_name = map[int32]string{ + 0: "PRIORITY_UNSPECIFIED", + 1: "P0", + 2: "P1", + 3: "P2", + 4: "P3", + 5: "P4", +} +var Case_Priority_value = map[string]int32{ + "PRIORITY_UNSPECIFIED": 0, + "P0": 1, + "P1": 2, + "P2": 3, + "P3": 4, + "P4": 5, +} + +func (x Case_Priority) String() string { + return proto.EnumName(Case_Priority_name, int32(x)) +} +func (Case_Priority) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1, 0} } + +// The state of a case. +type Case_State int32 + +const ( + // Case is in an unknown state. + Case_STATE_UNSPECIFIED Case_State = 0 + // Case has been created but no one is assigned to work on it yet. + Case_NEW Case_State = 1 + // Case has been assigned to a support agent. + Case_ASSIGNED Case_State = 2 + // A support agent is currently investigating the case. + Case_IN_PROGRESS_GOOGLE_SUPPORT Case_State = 3 + // Case has been forwarded to product team for further investigation. + Case_IN_PROGRESS_GOOGLE_ENG Case_State = 4 + // Case is under investigation and relates to a known issue. + Case_IN_PROGRESS_KNOWN_ISSUE Case_State = 5 + // Case is waiting for a response from the customer. + Case_WAITING_FOR_CUSTOMER_RESPONSE Case_State = 6 + // A solution has been offered for the case but it isn't closed yet. + Case_SOLUTION_OFFERED Case_State = 7 + // Cases has been fully resolved and is in a closed state. + Case_CLOSED Case_State = 8 +) + +var Case_State_name = map[int32]string{ + 0: "STATE_UNSPECIFIED", + 1: "NEW", + 2: "ASSIGNED", + 3: "IN_PROGRESS_GOOGLE_SUPPORT", + 4: "IN_PROGRESS_GOOGLE_ENG", + 5: "IN_PROGRESS_KNOWN_ISSUE", + 6: "WAITING_FOR_CUSTOMER_RESPONSE", + 7: "SOLUTION_OFFERED", + 8: "CLOSED", +} +var Case_State_value = map[string]int32{ + "STATE_UNSPECIFIED": 0, + "NEW": 1, + "ASSIGNED": 2, + "IN_PROGRESS_GOOGLE_SUPPORT": 3, + "IN_PROGRESS_GOOGLE_ENG": 4, + "IN_PROGRESS_KNOWN_ISSUE": 5, + "WAITING_FOR_CUSTOMER_RESPONSE": 6, + "SOLUTION_OFFERED": 7, + "CLOSED": 8, +} + +func (x Case_State) String() string { + return proto.EnumName(Case_State_name, int32(x)) +} +func (Case_State) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1, 1} } + +// The status of a customer issue. +type CustomerIssue_IssueState int32 + +const ( + // Issue in an unknown state. + CustomerIssue_ISSUE_STATE_UNSPECIFIED CustomerIssue_IssueState = 0 + // Issue is currently open but the work on it has not been started. + CustomerIssue_OPEN CustomerIssue_IssueState = 1 + // Issue is currently being worked on. + CustomerIssue_IN_PROGRESS CustomerIssue_IssueState = 2 + // Issue is fixed. + CustomerIssue_FIXED CustomerIssue_IssueState = 3 + // Issue has been marked as invalid. + CustomerIssue_WONT_FIX CustomerIssue_IssueState = 4 + // Issue verified and in production. + CustomerIssue_VERIFIED CustomerIssue_IssueState = 5 +) + +var CustomerIssue_IssueState_name = map[int32]string{ + 0: "ISSUE_STATE_UNSPECIFIED", + 1: "OPEN", + 2: "IN_PROGRESS", + 3: "FIXED", + 4: "WONT_FIX", + 5: "VERIFIED", +} +var CustomerIssue_IssueState_value = map[string]int32{ + "ISSUE_STATE_UNSPECIFIED": 0, + "OPEN": 1, + "IN_PROGRESS": 2, + "FIXED": 3, + "WONT_FIX": 4, + "VERIFIED": 5, +} + +func (x CustomerIssue_IssueState) String() string { + return proto.EnumName(CustomerIssue_IssueState_name, int32(x)) +} +func (CustomerIssue_IssueState) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} } + +// A role which determines the support resources and features a user might +// get access to. +type SupportRole_Role int32 + +const ( + // An unknown role. + SupportRole_ROLE_UNSPECIFIED SupportRole_Role = 0 + // The basic support role. + SupportRole_BASIC SupportRole_Role = 1 + // The developer role. + SupportRole_DEVELOPER SupportRole_Role = 2 + // The operation role. + SupportRole_OPERATION SupportRole_Role = 3 + // The site reliability role. + SupportRole_SITE_RELIABILITY SupportRole_Role = 4 +) + +var SupportRole_Role_name = map[int32]string{ + 0: "ROLE_UNSPECIFIED", + 1: "BASIC", + 2: "DEVELOPER", + 3: "OPERATION", + 4: "SITE_RELIABILITY", +} +var SupportRole_Role_value = map[string]int32{ + "ROLE_UNSPECIFIED": 0, + "BASIC": 1, + "DEVELOPER": 2, + "OPERATION": 3, + "SITE_RELIABILITY": 4, +} + +func (x SupportRole_Role) String() string { + return proto.EnumName(SupportRole_Role_name, int32(x)) +} +func (SupportRole_Role) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{3, 0} } + +// A Google Cloud Platform account that identifies support eligibility for a +// Cloud resource. Currently the Cloud resource can only be an Organization +// but this might change in future. +type SupportAccount struct { + // The resource name for a support account in format + // `supportAccounts/{account_id}`. + // Output only. + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // Identifier for this entity that gets persisted in storage system. The + // resource name is populated using this field in format + // `supportAccounts/{account_id}`. + AccountId string `protobuf:"bytes,2,opt,name=account_id,json=accountId" json:"account_id,omitempty"` + // The Cloud resource with which this support account is associated. + CloudResource string `protobuf:"bytes,3,opt,name=cloud_resource,json=cloudResource" json:"cloud_resource,omitempty"` + // A user friendly display name assigned to this support account. + DisplayName string `protobuf:"bytes,4,opt,name=display_name,json=displayName" json:"display_name,omitempty"` + // Indicates the current state of an account. + State SupportAccount_State `protobuf:"varint,5,opt,name=state,enum=google.cloud.support.common.SupportAccount_State" json:"state,omitempty"` + // Time when this account was created. + // Output only. + CreateTime *google_protobuf1.Timestamp `protobuf:"bytes,6,opt,name=create_time,json=createTime" json:"create_time,omitempty"` + // The resource name of a billing account associated with this support + // account. For example, `billingAccounts/ABCDEF-012345-567890`. + BillingAccountName string `protobuf:"bytes,7,opt,name=billing_account_name,json=billingAccountName" json:"billing_account_name,omitempty"` + UnifyAccountId string `protobuf:"bytes,8,opt,name=unify_account_id,json=unifyAccountId" json:"unify_account_id,omitempty"` + // The PricingModel applicable to this support account. + PricingModel SupportAccount_PricingModel `protobuf:"varint,9,opt,name=pricing_model,json=pricingModel,enum=google.cloud.support.common.SupportAccount_PricingModel" json:"pricing_model,omitempty"` +} + +func (m *SupportAccount) Reset() { *m = SupportAccount{} } +func (m *SupportAccount) String() string { return proto.CompactTextString(m) } +func (*SupportAccount) ProtoMessage() {} +func (*SupportAccount) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *SupportAccount) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *SupportAccount) GetAccountId() string { + if m != nil { + return m.AccountId + } + return "" +} + +func (m *SupportAccount) GetCloudResource() string { + if m != nil { + return m.CloudResource + } + return "" +} + +func (m *SupportAccount) GetDisplayName() string { + if m != nil { + return m.DisplayName + } + return "" +} + +func (m *SupportAccount) GetState() SupportAccount_State { + if m != nil { + return m.State + } + return SupportAccount_STATE_UNSPECIFIED +} + +func (m *SupportAccount) GetCreateTime() *google_protobuf1.Timestamp { + if m != nil { + return m.CreateTime + } + return nil +} + +func (m *SupportAccount) GetBillingAccountName() string { + if m != nil { + return m.BillingAccountName + } + return "" +} + +func (m *SupportAccount) GetUnifyAccountId() string { + if m != nil { + return m.UnifyAccountId + } + return "" +} + +func (m *SupportAccount) GetPricingModel() SupportAccount_PricingModel { + if m != nil { + return m.PricingModel + } + return SupportAccount_PRICING_MODEL_UNKNOWN +} + +// A support case created by the user. +type Case struct { + // The resource name for the Case in format + // `supportAccounts/{account_id}/cases/{case_id}` + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // The short summary of the issue reported in this case. + DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName" json:"display_name,omitempty"` + // The board description of issue provided with initial summary. + Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` + // The product component for which this Case is reported. + Component string `protobuf:"bytes,4,opt,name=component" json:"component,omitempty"` + // The product subcomponent for which this Case is reported. + Subcomponent string `protobuf:"bytes,5,opt,name=subcomponent" json:"subcomponent,omitempty"` + // Timezone the client sending this request is in. + // It should be in a format IANA recognizes: https://www.iana.org/time-zone + // There is no additional validation done by the API. + ClientTimezone string `protobuf:"bytes,6,opt,name=client_timezone,json=clientTimezone" json:"client_timezone,omitempty"` + // The email addresses that can be copied to receive updates on this case. + // Users can specify a maximum of 10 email addresses. + CcAddresses []string `protobuf:"bytes,7,rep,name=cc_addresses,json=ccAddresses" json:"cc_addresses,omitempty"` + // The Google Cloud Platform project ID for which this case is created. + ProjectId string `protobuf:"bytes,8,opt,name=project_id,json=projectId" json:"project_id,omitempty"` + // List of customer issues associated with this case. + Issues []*CustomerIssue `protobuf:"bytes,10,rep,name=issues" json:"issues,omitempty"` + // The current priority of this case. + Priority Case_Priority `protobuf:"varint,11,opt,name=priority,enum=google.cloud.support.common.Case_Priority" json:"priority,omitempty"` + // The current state of this case. + State Case_State `protobuf:"varint,12,opt,name=state,enum=google.cloud.support.common.Case_State" json:"state,omitempty"` + // Time when this case was created. + // Output only. + CreateTime *google_protobuf1.Timestamp `protobuf:"bytes,13,opt,name=create_time,json=createTime" json:"create_time,omitempty"` + // Time when this case was last updated. + // Output only. + UpdateTime *google_protobuf1.Timestamp `protobuf:"bytes,14,opt,name=update_time,json=updateTime" json:"update_time,omitempty"` + // Email address of user who created this case. + // Output only. It is inferred from credentials supplied during case creation. + CreatorEmail string `protobuf:"bytes,15,opt,name=creator_email,json=creatorEmail" json:"creator_email,omitempty"` + // The issue category applicable to this case. + Category string `protobuf:"bytes,16,opt,name=category" json:"category,omitempty"` +} + +func (m *Case) Reset() { *m = Case{} } +func (m *Case) String() string { return proto.CompactTextString(m) } +func (*Case) ProtoMessage() {} +func (*Case) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *Case) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Case) GetDisplayName() string { + if m != nil { + return m.DisplayName + } + return "" +} + +func (m *Case) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *Case) GetComponent() string { + if m != nil { + return m.Component + } + return "" +} + +func (m *Case) GetSubcomponent() string { + if m != nil { + return m.Subcomponent + } + return "" +} + +func (m *Case) GetClientTimezone() string { + if m != nil { + return m.ClientTimezone + } + return "" +} + +func (m *Case) GetCcAddresses() []string { + if m != nil { + return m.CcAddresses + } + return nil +} + +func (m *Case) GetProjectId() string { + if m != nil { + return m.ProjectId + } + return "" +} + +func (m *Case) GetIssues() []*CustomerIssue { + if m != nil { + return m.Issues + } + return nil +} + +func (m *Case) GetPriority() Case_Priority { + if m != nil { + return m.Priority + } + return Case_PRIORITY_UNSPECIFIED +} + +func (m *Case) GetState() Case_State { + if m != nil { + return m.State + } + return Case_STATE_UNSPECIFIED +} + +func (m *Case) GetCreateTime() *google_protobuf1.Timestamp { + if m != nil { + return m.CreateTime + } + return nil +} + +func (m *Case) GetUpdateTime() *google_protobuf1.Timestamp { + if m != nil { + return m.UpdateTime + } + return nil +} + +func (m *Case) GetCreatorEmail() string { + if m != nil { + return m.CreatorEmail + } + return "" +} + +func (m *Case) GetCategory() string { + if m != nil { + return m.Category + } + return "" +} + +// Reference to a Google internal ticket used for investigating a support case. +// Not every support case will have an internal ticket associated with it. +// A support case can have multiple tickets linked to it. +type CustomerIssue struct { + // Unique identifier for the internal issue. + // Output only. + IssueId string `protobuf:"bytes,1,opt,name=issue_id,json=issueId" json:"issue_id,omitempty"` + // Represents current status of the internal ticket. + // Output only. + State CustomerIssue_IssueState `protobuf:"varint,2,opt,name=state,enum=google.cloud.support.common.CustomerIssue_IssueState" json:"state,omitempty"` + // Time when the internal issue was created. + // Output only. + CreateTime *google_protobuf1.Timestamp `protobuf:"bytes,3,opt,name=create_time,json=createTime" json:"create_time,omitempty"` + // Time when the internal issue was marked as resolved. + // Output only. + ResolveTime *google_protobuf1.Timestamp `protobuf:"bytes,4,opt,name=resolve_time,json=resolveTime" json:"resolve_time,omitempty"` + // Time when the internal issue was last updated. + // Output only. + UpdateTime *google_protobuf1.Timestamp `protobuf:"bytes,5,opt,name=update_time,json=updateTime" json:"update_time,omitempty"` +} + +func (m *CustomerIssue) Reset() { *m = CustomerIssue{} } +func (m *CustomerIssue) String() string { return proto.CompactTextString(m) } +func (*CustomerIssue) ProtoMessage() {} +func (*CustomerIssue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *CustomerIssue) GetIssueId() string { + if m != nil { + return m.IssueId + } + return "" +} + +func (m *CustomerIssue) GetState() CustomerIssue_IssueState { + if m != nil { + return m.State + } + return CustomerIssue_ISSUE_STATE_UNSPECIFIED +} + +func (m *CustomerIssue) GetCreateTime() *google_protobuf1.Timestamp { + if m != nil { + return m.CreateTime + } + return nil +} + +func (m *CustomerIssue) GetResolveTime() *google_protobuf1.Timestamp { + if m != nil { + return m.ResolveTime + } + return nil +} + +func (m *CustomerIssue) GetUpdateTime() *google_protobuf1.Timestamp { + if m != nil { + return m.UpdateTime + } + return nil +} + +// A message that contains mapping of a user and their role under a support +// account. +type SupportRole struct { + // Email address of user being added through this Role. + Email string `protobuf:"bytes,1,opt,name=email" json:"email,omitempty"` + // The type of role assigned to user. + Role SupportRole_Role `protobuf:"varint,2,opt,name=role,enum=google.cloud.support.common.SupportRole_Role" json:"role,omitempty"` +} + +func (m *SupportRole) Reset() { *m = SupportRole{} } +func (m *SupportRole) String() string { return proto.CompactTextString(m) } +func (*SupportRole) ProtoMessage() {} +func (*SupportRole) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *SupportRole) GetEmail() string { + if m != nil { + return m.Email + } + return "" +} + +func (m *SupportRole) GetRole() SupportRole_Role { + if m != nil { + return m.Role + } + return SupportRole_ROLE_UNSPECIFIED +} + +// The comment text associated with a `Case`. +type Comment struct { + // Text containing a maximum of 3000 characters. + Text string `protobuf:"bytes,1,opt,name=text" json:"text,omitempty"` + // Time when this update was created. + // Output only. + CreateTime *google_protobuf1.Timestamp `protobuf:"bytes,2,opt,name=create_time,json=createTime" json:"create_time,omitempty"` + // The email address/name of user who created this comment. + // Output only. + Author string `protobuf:"bytes,3,opt,name=author" json:"author,omitempty"` + // The resource name for this comment in format + // `supportAccounts/{account_id}/cases/{case_id}/{comment_id}`. + // Output only. + Name string `protobuf:"bytes,4,opt,name=name" json:"name,omitempty"` +} + +func (m *Comment) Reset() { *m = Comment{} } +func (m *Comment) String() string { return proto.CompactTextString(m) } +func (*Comment) ProtoMessage() {} +func (*Comment) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } + +func (m *Comment) GetText() string { + if m != nil { + return m.Text + } + return "" +} + +func (m *Comment) GetCreateTime() *google_protobuf1.Timestamp { + if m != nil { + return m.CreateTime + } + return nil +} + +func (m *Comment) GetAuthor() string { + if m != nil { + return m.Author + } + return "" +} + +func (m *Comment) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +// Represents the product component taxonomy that is to be used while creating +// or updating a `Case`. A client should obtain the list of issue categories, +// component/subcomponent from this object and specify it in `Case.category`, +// `Case.component` and `Case.subcomponent` fields respectively. +type IssueTaxonomy struct { + // Map of available categories. + Categories map[string]*IssueTaxonomy_Category `protobuf:"bytes,1,rep,name=categories" json:"categories,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` +} + +func (m *IssueTaxonomy) Reset() { *m = IssueTaxonomy{} } +func (m *IssueTaxonomy) String() string { return proto.CompactTextString(m) } +func (*IssueTaxonomy) ProtoMessage() {} +func (*IssueTaxonomy) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } + +func (m *IssueTaxonomy) GetCategories() map[string]*IssueTaxonomy_Category { + if m != nil { + return m.Categories + } + return nil +} + +// The representation of a product component. It is composed of a canonical +// name for the product (e.g., Google App Engine), languages in which a +// support ticket can be created under this component, a template that +// provides hints on important details to be filled out before submitting a +// case. It also contains an embedded list of product subcomponents that have +// similar attributes as top-level components. +// (e.g., Google App Engine > Memcache). +type IssueTaxonomy_Component struct { + // User friendly name of this component. + DisplayName string `protobuf:"bytes,1,opt,name=display_name,json=displayName" json:"display_name,omitempty"` + // List of languages in which a support case can be created under this + // component. Represented by language codes in ISO_639-1 standard. + Languages []string `protobuf:"bytes,2,rep,name=languages" json:"languages,omitempty"` + // Template to be used while filling the description of a support case. + Template string `protobuf:"bytes,3,opt,name=template" json:"template,omitempty"` + // List of subcomponents under this component. + Subcomponents []*IssueTaxonomy_Component `protobuf:"bytes,4,rep,name=subcomponents" json:"subcomponents,omitempty"` +} + +func (m *IssueTaxonomy_Component) Reset() { *m = IssueTaxonomy_Component{} } +func (m *IssueTaxonomy_Component) String() string { return proto.CompactTextString(m) } +func (*IssueTaxonomy_Component) ProtoMessage() {} +func (*IssueTaxonomy_Component) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5, 0} } + +func (m *IssueTaxonomy_Component) GetDisplayName() string { + if m != nil { + return m.DisplayName + } + return "" +} + +func (m *IssueTaxonomy_Component) GetLanguages() []string { + if m != nil { + return m.Languages + } + return nil +} + +func (m *IssueTaxonomy_Component) GetTemplate() string { + if m != nil { + return m.Template + } + return "" +} + +func (m *IssueTaxonomy_Component) GetSubcomponents() []*IssueTaxonomy_Component { + if m != nil { + return m.Subcomponents + } + return nil +} + +// Represents the category of issue (Technical or Non-Technical) +// reported through a support case. +type IssueTaxonomy_Category struct { + // User friendly name of this category. + DisplayName string `protobuf:"bytes,1,opt,name=display_name,json=displayName" json:"display_name,omitempty"` + // Map of product components under this category. + Components map[string]*IssueTaxonomy_Component `protobuf:"bytes,2,rep,name=components" json:"components,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` +} + +func (m *IssueTaxonomy_Category) Reset() { *m = IssueTaxonomy_Category{} } +func (m *IssueTaxonomy_Category) String() string { return proto.CompactTextString(m) } +func (*IssueTaxonomy_Category) ProtoMessage() {} +func (*IssueTaxonomy_Category) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5, 1} } + +func (m *IssueTaxonomy_Category) GetDisplayName() string { + if m != nil { + return m.DisplayName + } + return "" +} + +func (m *IssueTaxonomy_Category) GetComponents() map[string]*IssueTaxonomy_Component { + if m != nil { + return m.Components + } + return nil +} + +func init() { + proto.RegisterType((*SupportAccount)(nil), "google.cloud.support.common.SupportAccount") + proto.RegisterType((*Case)(nil), "google.cloud.support.common.Case") + proto.RegisterType((*CustomerIssue)(nil), "google.cloud.support.common.CustomerIssue") + proto.RegisterType((*SupportRole)(nil), "google.cloud.support.common.SupportRole") + proto.RegisterType((*Comment)(nil), "google.cloud.support.common.Comment") + proto.RegisterType((*IssueTaxonomy)(nil), "google.cloud.support.common.IssueTaxonomy") + proto.RegisterType((*IssueTaxonomy_Component)(nil), "google.cloud.support.common.IssueTaxonomy.Component") + proto.RegisterType((*IssueTaxonomy_Category)(nil), "google.cloud.support.common.IssueTaxonomy.Category") + proto.RegisterEnum("google.cloud.support.common.SupportAccount_State", SupportAccount_State_name, SupportAccount_State_value) + proto.RegisterEnum("google.cloud.support.common.SupportAccount_PricingModel", SupportAccount_PricingModel_name, SupportAccount_PricingModel_value) + proto.RegisterEnum("google.cloud.support.common.Case_Priority", Case_Priority_name, Case_Priority_value) + proto.RegisterEnum("google.cloud.support.common.Case_State", Case_State_name, Case_State_value) + proto.RegisterEnum("google.cloud.support.common.CustomerIssue_IssueState", CustomerIssue_IssueState_name, CustomerIssue_IssueState_value) + proto.RegisterEnum("google.cloud.support.common.SupportRole_Role", SupportRole_Role_name, SupportRole_Role_value) +} + +func init() { proto.RegisterFile("google/cloud/support/common.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 1336 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0x61, 0x6e, 0xdb, 0xc6, + 0x12, 0x0e, 0x29, 0xc9, 0x92, 0x46, 0x96, 0xbd, 0x59, 0x38, 0x79, 0x8c, 0x92, 0xbc, 0x38, 0x7a, + 0x78, 0x88, 0x51, 0xa0, 0x72, 0xe2, 0xa4, 0x40, 0x90, 0x20, 0x3f, 0x64, 0x6a, 0x2d, 0xb0, 0x91, + 0x49, 0x82, 0xa4, 0xe3, 0x24, 0x45, 0x41, 0xd0, 0xd4, 0x46, 0x65, 0x43, 0x72, 0x09, 0x92, 0x4a, + 0xa3, 0x1e, 0xa0, 0x3d, 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 0x27, 0x3e, 0x80, 0x46, 0x92, 0x06, 0x2c, 0x0d, 0xf2, 0x99, + 0xd2, 0x12, 0x20, 0xba, 0x22, 0x8a, 0x97, 0x51, 0x0e, 0x1d, 0xe1, 0x61, 0x2d, 0x7c, 0xf1, 0x8b, + 0x39, 0xe7, 0xd6, 0x45, 0x90, 0x07, 0x57, 0x07, 0xb9, 0x8c, 0x69, 0xed, 0x95, 0x98, 0xf6, 0x1c, + 0x5a, 0xd3, 0x64, 0xbc, 0x70, 0xde, 0xb8, 0xda, 0xb9, 0x30, 0x17, 0xce, 0xff, 0x83, 0xb6, 0x08, + 0xc5, 0x52, 0x97, 0x46, 0x5e, 0x10, 0x2a, 0x9b, 0xc5, 0xa5, 0x96, 0x4a, 0xc2, 0x75, 0xb8, 0x03, + 0x0d, 0xdf, 0xcb, 0xe9, 0x84, 0xa5, 0x33, 0x05, 0x89, 0xfd, 0x85, 0xdc, 0x1d, 0x41, 0x63, 0xde, + 0x0f, 0xac, 0xc0, 0x96, 0x69, 0x69, 0x86, 0xa5, 0x39, 0x6f, 0xce, 0x51, 0x66, 0x0d, 0x64, 0xf3, + 0x21, 0x92, 0xc4, 0xfa, 0x08, 0xc9, 0x62, 0xdd, 0x43, 0x15, 0xb1, 0x3e, 0x46, 0x55, 0xb1, 0x3e, + 0x41, 0xb5, 0xee, 0xdf, 0xd2, 0x15, 0xdc, 0xab, 0x43, 0x45, 0x27, 0xc7, 0x48, 0xe2, 0x54, 0xe9, + 0xdb, 0xb6, 0x36, 0xd4, 0xc9, 0x00, 0xc9, 0xf8, 0xbf, 0xd0, 0xd1, 0x74, 0xd7, 0xb4, 0x8c, 0xa1, + 0x45, 0x6c, 0xdb, 0x1d, 0x1a, 0xc6, 0x70, 0x44, 0x5c, 0xfb, 0xc8, 0x34, 0x0d, 0xcb, 0x41, 0x15, + 0xdc, 0x81, 0x9b, 0x17, 0xec, 0x13, 0x7d, 0x88, 0xaa, 0xf8, 0x36, 0xfc, 0x67, 0x79, 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59, 0x8c, 0x9d, 0x53, 0x05, 0x7f, + 0xeb, 0x72, 0x1a, 0x25, 0x21, 0x67, 0x60, 0x51, 0xea, 0x42, 0xc6, 0x6f, 0xa1, 0xbd, 0x3c, 0xec, + 0x32, 0xa5, 0x2a, 0x2a, 0x79, 0xb2, 0x4a, 0x25, 0x73, 0x67, 0xeb, 0x6c, 0xa8, 0xce, 0xaf, 0x32, + 0x34, 0xca, 0x32, 0x67, 0x9f, 0x53, 0x85, 0x0f, 0xb0, 0x94, 0x88, 0x2c, 0x12, 0x51, 0x57, 0x6f, + 0xe9, 0x52, 0x46, 0x8b, 0xde, 0x9e, 0x26, 0x95, 0xc1, 0xe6, 0xb9, 0x6d, 0x8c, 0xa0, 0xf2, 0x9e, + 0xce, 0xca, 0x8c, 0xf8, 0x27, 0xfe, 0x16, 0x6a, 0x1f, 0xbc, 0x70, 0x3a, 0x47, 0xd4, 0x97, 0x75, + 0xa3, 0x08, 0xf1, 0x4c, 0x7e, 0x2a, 0x75, 0x52, 0xd8, 0x3c, 0x77, 0xdf, 0x17, 0x1c, 0xaa, 0x9d, + 0x3d, 0xf4, 0xf1, 0x17, 0x54, 0xbe, 0x74, 0xe6, 0xfe, 0x4f, 0x70, 0xcf, 0x67, 0xd1, 0x65, 0x41, + 0xf6, 0xaf, 0xab, 0x5c, 0x5b, 0x12, 0xdb, 0xe4, 0x6c, 0x79, 0xdb, 0x2f, 0xed, 0x27, 0x8c, 0xe3, + 0xa7, 0xc7, 0xd2, 0xc9, 0xee, 0x84, 0xc6, 0x82, 0x49, 0xbb, 0xc5, 0x96, 0x97, 0x04, 0xd9, 0x85, + 0xff, 0x97, 0x3c, 0x2f, 0x96, 0x93, 0x35, 0x61, 0xfd, 0xf8, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x0c, 0xd0, 0x7b, 0x46, 0xc4, 0x0c, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/genproto/googleapis/cloud/support/v1alpha1/cloud_support.pb.go b/vendor/google.golang.org/genproto/googleapis/cloud/support/v1alpha1/cloud_support.pb.go new file mode 100644 index 0000000..71a1379 --- /dev/null +++ b/vendor/google.golang.org/genproto/googleapis/cloud/support/v1alpha1/cloud_support.pb.go @@ -0,0 +1,807 @@ +// Code generated by protoc-gen-go. +// source: google/cloud/support/v1alpha1/cloud_support.proto +// DO NOT EDIT! + +/* +Package support is a generated protocol buffer package. + +It is generated from these files: + google/cloud/support/v1alpha1/cloud_support.proto + +It has these top-level messages: + GetSupportAccountRequest + ListSupportAccountsRequest + ListSupportAccountsResponse + GetCaseRequest + ListCasesRequest + ListCasesResponse + ListCommentsRequest + ListCommentsResponse + CreateCaseRequest + UpdateCaseRequest + CreateCommentRequest + GetIssueTaxonomyRequest +*/ +package support + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "google.golang.org/genproto/googleapis/api/annotations" +import google_cloud_support_common "google.golang.org/genproto/googleapis/cloud/support/common" +import _ "github.com/golang/protobuf/ptypes/empty" +import google_protobuf3 "google.golang.org/genproto/protobuf/field_mask" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +// The request message for `GetSupportAccount`. +type GetSupportAccountRequest struct { + // The resource name of the support accounts. For example: + // `supportAccounts/accountA`. + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` +} + +func (m *GetSupportAccountRequest) Reset() { *m = GetSupportAccountRequest{} } +func (m *GetSupportAccountRequest) String() string { return proto.CompactTextString(m) } +func (*GetSupportAccountRequest) ProtoMessage() {} +func (*GetSupportAccountRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *GetSupportAccountRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +// The request message for `ListSupportAccount`. +type ListSupportAccountsRequest struct { + // The filter applied to search results. It only supports filtering a support + // account list by a cloud_resource. For example, to filter results by support + // accounts associated with an Organization, its value should be: + // "cloud_resource:organizations/" + Filter string `protobuf:"bytes,1,opt,name=filter" json:"filter,omitempty"` + // Maximum number of accounts fetched with each request. + PageSize int64 `protobuf:"varint,2,opt,name=page_size,json=pageSize" json:"page_size,omitempty"` + // A token identifying the page of results to return. If unspecified, the + // first page is retrieved. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken" json:"page_token,omitempty"` +} + +func (m *ListSupportAccountsRequest) Reset() { *m = ListSupportAccountsRequest{} } +func (m *ListSupportAccountsRequest) String() string { return proto.CompactTextString(m) } +func (*ListSupportAccountsRequest) ProtoMessage() {} +func (*ListSupportAccountsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *ListSupportAccountsRequest) GetFilter() string { + if m != nil { + return m.Filter + } + return "" +} + +func (m *ListSupportAccountsRequest) GetPageSize() int64 { + if m != nil { + return m.PageSize + } + return 0 +} + +func (m *ListSupportAccountsRequest) GetPageToken() string { + if m != nil { + return m.PageToken + } + return "" +} + +// The response message for `ListSupportAccount`. +type ListSupportAccountsResponse struct { + // A list of support accounts. + Accounts []*google_cloud_support_common.SupportAccount `protobuf:"bytes,1,rep,name=accounts" json:"accounts,omitempty"` + // A token to retrieve the next page of results. This should be passed on in + // `page_token` field of `ListSupportAccountRequest` for next request. If + // unspecified, there are no more results to retrieve. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken" json:"next_page_token,omitempty"` +} + +func (m *ListSupportAccountsResponse) Reset() { *m = ListSupportAccountsResponse{} } +func (m *ListSupportAccountsResponse) String() string { return proto.CompactTextString(m) } +func (*ListSupportAccountsResponse) ProtoMessage() {} +func (*ListSupportAccountsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *ListSupportAccountsResponse) GetAccounts() []*google_cloud_support_common.SupportAccount { + if m != nil { + return m.Accounts + } + return nil +} + +func (m *ListSupportAccountsResponse) GetNextPageToken() string { + if m != nil { + return m.NextPageToken + } + return "" +} + +// The request message for `GetCase` method. +type GetCaseRequest struct { + // Name of case resource requested. + // For example: "supportAccounts/accountA/cases/123" + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` +} + +func (m *GetCaseRequest) Reset() { *m = GetCaseRequest{} } +func (m *GetCaseRequest) String() string { return proto.CompactTextString(m) } +func (*GetCaseRequest) ProtoMessage() {} +func (*GetCaseRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *GetCaseRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +// The request message for `ListCase` method. +type ListCasesRequest struct { + // Name of the account resource for which cases are requested. For example: + // "supportAccounts/accountA" + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // The filter applied to the search results. Currently it only accepts "OPEN" + // or "CLOSED" strings, filtering out cases that are open or resolved. + Filter string `protobuf:"bytes,2,opt,name=filter" json:"filter,omitempty"` + // Maximum number of cases fetched with each request. + PageSize int64 `protobuf:"varint,3,opt,name=page_size,json=pageSize" json:"page_size,omitempty"` + // A token identifying the page of results to return. If unspecified, the + // first page is retrieved. + PageToken string `protobuf:"bytes,4,opt,name=page_token,json=pageToken" json:"page_token,omitempty"` +} + +func (m *ListCasesRequest) Reset() { *m = ListCasesRequest{} } +func (m *ListCasesRequest) String() string { return proto.CompactTextString(m) } +func (*ListCasesRequest) ProtoMessage() {} +func (*ListCasesRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } + +func (m *ListCasesRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *ListCasesRequest) GetFilter() string { + if m != nil { + return m.Filter + } + return "" +} + +func (m *ListCasesRequest) GetPageSize() int64 { + if m != nil { + return m.PageSize + } + return 0 +} + +func (m *ListCasesRequest) GetPageToken() string { + if m != nil { + return m.PageToken + } + return "" +} + +// The response message for `ListCase` method. +type ListCasesResponse struct { + // A list of cases. + Cases []*google_cloud_support_common.Case `protobuf:"bytes,1,rep,name=cases" json:"cases,omitempty"` + // A token to retrieve the next page of results. This should be passed on in + // `page_token` field of `ListCaseRequest` for next request. If unspecified, + // there are no more results to retrieve. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken" json:"next_page_token,omitempty"` +} + +func (m *ListCasesResponse) Reset() { *m = ListCasesResponse{} } +func (m *ListCasesResponse) String() string { return proto.CompactTextString(m) } +func (*ListCasesResponse) ProtoMessage() {} +func (*ListCasesResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } + +func (m *ListCasesResponse) GetCases() []*google_cloud_support_common.Case { + if m != nil { + return m.Cases + } + return nil +} + +func (m *ListCasesResponse) GetNextPageToken() string { + if m != nil { + return m.NextPageToken + } + return "" +} + +// The request message for `ListComments` method. +type ListCommentsRequest struct { + // The resource name of case for which comments should be listed. + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` +} + +func (m *ListCommentsRequest) Reset() { *m = ListCommentsRequest{} } +func (m *ListCommentsRequest) String() string { return proto.CompactTextString(m) } +func (*ListCommentsRequest) ProtoMessage() {} +func (*ListCommentsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } + +func (m *ListCommentsRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +// The response message for `ListComments` method. +type ListCommentsResponse struct { + // A list of comments. + Comments []*google_cloud_support_common.Comment `protobuf:"bytes,1,rep,name=comments" json:"comments,omitempty"` +} + +func (m *ListCommentsResponse) Reset() { *m = ListCommentsResponse{} } +func (m *ListCommentsResponse) String() string { return proto.CompactTextString(m) } +func (*ListCommentsResponse) ProtoMessage() {} +func (*ListCommentsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } + +func (m *ListCommentsResponse) GetComments() []*google_cloud_support_common.Comment { + if m != nil { + return m.Comments + } + return nil +} + +// The request message for `CreateCase` method. +type CreateCaseRequest struct { + // The resource name for `SupportAccount` under which this case is created. + Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` + // The case resource to create. + Case *google_cloud_support_common.Case `protobuf:"bytes,2,opt,name=case" json:"case,omitempty"` +} + +func (m *CreateCaseRequest) Reset() { *m = CreateCaseRequest{} } +func (m *CreateCaseRequest) String() string { return proto.CompactTextString(m) } +func (*CreateCaseRequest) ProtoMessage() {} +func (*CreateCaseRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } + +func (m *CreateCaseRequest) GetParent() string { + if m != nil { + return m.Parent + } + return "" +} + +func (m *CreateCaseRequest) GetCase() *google_cloud_support_common.Case { + if m != nil { + return m.Case + } + return nil +} + +// The request message for `UpdateCase` method. +type UpdateCaseRequest struct { + // The case resource to update. + Case *google_cloud_support_common.Case `protobuf:"bytes,1,opt,name=case" json:"case,omitempty"` + // A field that represents attributes of a Case object that should be updated + // as part of this request. + UpdateMask *google_protobuf3.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask" json:"update_mask,omitempty"` +} + +func (m *UpdateCaseRequest) Reset() { *m = UpdateCaseRequest{} } +func (m *UpdateCaseRequest) String() string { return proto.CompactTextString(m) } +func (*UpdateCaseRequest) ProtoMessage() {} +func (*UpdateCaseRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } + +func (m *UpdateCaseRequest) GetCase() *google_cloud_support_common.Case { + if m != nil { + return m.Case + } + return nil +} + +func (m *UpdateCaseRequest) GetUpdateMask() *google_protobuf3.FieldMask { + if m != nil { + return m.UpdateMask + } + return nil +} + +// The request message for `CreateComment` method. +type CreateCommentRequest struct { + // The resource name of case to which this comment should be added. + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // The `Comment` to be added to this case. + Comment *google_cloud_support_common.Comment `protobuf:"bytes,2,opt,name=comment" json:"comment,omitempty"` +} + +func (m *CreateCommentRequest) Reset() { *m = CreateCommentRequest{} } +func (m *CreateCommentRequest) String() string { return proto.CompactTextString(m) } +func (*CreateCommentRequest) ProtoMessage() {} +func (*CreateCommentRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } + +func (m *CreateCommentRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *CreateCommentRequest) GetComment() *google_cloud_support_common.Comment { + if m != nil { + return m.Comment + } + return nil +} + +// The request message for `GetIssueTaxonomy` method. +type GetIssueTaxonomyRequest struct { +} + +func (m *GetIssueTaxonomyRequest) Reset() { *m = GetIssueTaxonomyRequest{} } +func (m *GetIssueTaxonomyRequest) String() string { return proto.CompactTextString(m) } +func (*GetIssueTaxonomyRequest) ProtoMessage() {} +func (*GetIssueTaxonomyRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } + +func init() { + proto.RegisterType((*GetSupportAccountRequest)(nil), "google.cloud.support.v1alpha1.GetSupportAccountRequest") + proto.RegisterType((*ListSupportAccountsRequest)(nil), "google.cloud.support.v1alpha1.ListSupportAccountsRequest") + proto.RegisterType((*ListSupportAccountsResponse)(nil), "google.cloud.support.v1alpha1.ListSupportAccountsResponse") + proto.RegisterType((*GetCaseRequest)(nil), "google.cloud.support.v1alpha1.GetCaseRequest") + proto.RegisterType((*ListCasesRequest)(nil), "google.cloud.support.v1alpha1.ListCasesRequest") + proto.RegisterType((*ListCasesResponse)(nil), "google.cloud.support.v1alpha1.ListCasesResponse") + proto.RegisterType((*ListCommentsRequest)(nil), "google.cloud.support.v1alpha1.ListCommentsRequest") + proto.RegisterType((*ListCommentsResponse)(nil), "google.cloud.support.v1alpha1.ListCommentsResponse") + proto.RegisterType((*CreateCaseRequest)(nil), "google.cloud.support.v1alpha1.CreateCaseRequest") + proto.RegisterType((*UpdateCaseRequest)(nil), "google.cloud.support.v1alpha1.UpdateCaseRequest") + proto.RegisterType((*CreateCommentRequest)(nil), "google.cloud.support.v1alpha1.CreateCommentRequest") + proto.RegisterType((*GetIssueTaxonomyRequest)(nil), "google.cloud.support.v1alpha1.GetIssueTaxonomyRequest") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for CloudSupport service + +type CloudSupportClient interface { + // Retrieves the support account details given an account identifier. + // The authenticated user calling this method must be the account owner. + GetSupportAccount(ctx context.Context, in *GetSupportAccountRequest, opts ...grpc.CallOption) (*google_cloud_support_common.SupportAccount, error) + // Retrieves the list of accounts the current authenticated user has access + // to. + ListSupportAccounts(ctx context.Context, in *ListSupportAccountsRequest, opts ...grpc.CallOption) (*ListSupportAccountsResponse, error) + // Retrieves the details for a support case. The current authenticated user + // calling this method must have permissions to view this case. + GetCase(ctx context.Context, in *GetCaseRequest, opts ...grpc.CallOption) (*google_cloud_support_common.Case, error) + // Retrieves the list of support cases associated with an account. The current + // authenticated user must have the permission to list and view these cases. + ListCases(ctx context.Context, in *ListCasesRequest, opts ...grpc.CallOption) (*ListCasesResponse, error) + // Lists all comments from a case. + ListComments(ctx context.Context, in *ListCommentsRequest, opts ...grpc.CallOption) (*ListCommentsResponse, error) + // Creates a case and associates it with a + // [SupportAccount][google.cloud.support.v1alpha2.SupportAcccount]. The + // authenticated user attempting this action must have permissions to create a + // `Case` under that [SupportAccount]. + CreateCase(ctx context.Context, in *CreateCaseRequest, opts ...grpc.CallOption) (*google_cloud_support_common.Case, error) + // Updates a support case. Only a small set of details (priority, subject and + // cc_address) can be update after a case is created. + UpdateCase(ctx context.Context, in *UpdateCaseRequest, opts ...grpc.CallOption) (*google_cloud_support_common.Case, error) + // Adds a new comment to a case. + CreateComment(ctx context.Context, in *CreateCommentRequest, opts ...grpc.CallOption) (*google_cloud_support_common.Comment, error) + // Retrieves the taxonomy of product categories and components to be used + // while creating a support case. + GetIssueTaxonomy(ctx context.Context, in *GetIssueTaxonomyRequest, opts ...grpc.CallOption) (*google_cloud_support_common.IssueTaxonomy, error) +} + +type cloudSupportClient struct { + cc *grpc.ClientConn +} + +func NewCloudSupportClient(cc *grpc.ClientConn) CloudSupportClient { + return &cloudSupportClient{cc} +} + +func (c *cloudSupportClient) GetSupportAccount(ctx context.Context, in *GetSupportAccountRequest, opts ...grpc.CallOption) (*google_cloud_support_common.SupportAccount, error) { + out := new(google_cloud_support_common.SupportAccount) + err := grpc.Invoke(ctx, "/google.cloud.support.v1alpha1.CloudSupport/GetSupportAccount", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *cloudSupportClient) ListSupportAccounts(ctx context.Context, in *ListSupportAccountsRequest, opts ...grpc.CallOption) (*ListSupportAccountsResponse, error) { + out := new(ListSupportAccountsResponse) + err := grpc.Invoke(ctx, "/google.cloud.support.v1alpha1.CloudSupport/ListSupportAccounts", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *cloudSupportClient) GetCase(ctx context.Context, in *GetCaseRequest, opts ...grpc.CallOption) (*google_cloud_support_common.Case, error) { + out := new(google_cloud_support_common.Case) + err := grpc.Invoke(ctx, "/google.cloud.support.v1alpha1.CloudSupport/GetCase", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *cloudSupportClient) ListCases(ctx context.Context, in *ListCasesRequest, opts ...grpc.CallOption) (*ListCasesResponse, error) { + out := new(ListCasesResponse) + err := grpc.Invoke(ctx, "/google.cloud.support.v1alpha1.CloudSupport/ListCases", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *cloudSupportClient) ListComments(ctx context.Context, in *ListCommentsRequest, opts ...grpc.CallOption) (*ListCommentsResponse, error) { + out := new(ListCommentsResponse) + err := grpc.Invoke(ctx, "/google.cloud.support.v1alpha1.CloudSupport/ListComments", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *cloudSupportClient) CreateCase(ctx context.Context, in *CreateCaseRequest, opts ...grpc.CallOption) (*google_cloud_support_common.Case, error) { + out := new(google_cloud_support_common.Case) + err := grpc.Invoke(ctx, "/google.cloud.support.v1alpha1.CloudSupport/CreateCase", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *cloudSupportClient) UpdateCase(ctx context.Context, in *UpdateCaseRequest, opts ...grpc.CallOption) (*google_cloud_support_common.Case, error) { + out := new(google_cloud_support_common.Case) + err := grpc.Invoke(ctx, "/google.cloud.support.v1alpha1.CloudSupport/UpdateCase", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *cloudSupportClient) CreateComment(ctx context.Context, in *CreateCommentRequest, opts ...grpc.CallOption) (*google_cloud_support_common.Comment, error) { + out := new(google_cloud_support_common.Comment) + err := grpc.Invoke(ctx, "/google.cloud.support.v1alpha1.CloudSupport/CreateComment", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *cloudSupportClient) GetIssueTaxonomy(ctx context.Context, in *GetIssueTaxonomyRequest, opts ...grpc.CallOption) (*google_cloud_support_common.IssueTaxonomy, error) { + out := new(google_cloud_support_common.IssueTaxonomy) + err := grpc.Invoke(ctx, "/google.cloud.support.v1alpha1.CloudSupport/GetIssueTaxonomy", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for CloudSupport service + +type CloudSupportServer interface { + // Retrieves the support account details given an account identifier. + // The authenticated user calling this method must be the account owner. + GetSupportAccount(context.Context, *GetSupportAccountRequest) (*google_cloud_support_common.SupportAccount, error) + // Retrieves the list of accounts the current authenticated user has access + // to. + ListSupportAccounts(context.Context, *ListSupportAccountsRequest) (*ListSupportAccountsResponse, error) + // Retrieves the details for a support case. The current authenticated user + // calling this method must have permissions to view this case. + GetCase(context.Context, *GetCaseRequest) (*google_cloud_support_common.Case, error) + // Retrieves the list of support cases associated with an account. The current + // authenticated user must have the permission to list and view these cases. + ListCases(context.Context, *ListCasesRequest) (*ListCasesResponse, error) + // Lists all comments from a case. + ListComments(context.Context, *ListCommentsRequest) (*ListCommentsResponse, error) + // Creates a case and associates it with a + // [SupportAccount][google.cloud.support.v1alpha2.SupportAcccount]. The + // authenticated user attempting this action must have permissions to create a + // `Case` under that [SupportAccount]. + CreateCase(context.Context, *CreateCaseRequest) (*google_cloud_support_common.Case, error) + // Updates a support case. Only a small set of details (priority, subject and + // cc_address) can be update after a case is created. + UpdateCase(context.Context, *UpdateCaseRequest) (*google_cloud_support_common.Case, error) + // Adds a new comment to a case. + CreateComment(context.Context, *CreateCommentRequest) (*google_cloud_support_common.Comment, error) + // Retrieves the taxonomy of product categories and components to be used + // while creating a support case. + GetIssueTaxonomy(context.Context, *GetIssueTaxonomyRequest) (*google_cloud_support_common.IssueTaxonomy, error) +} + +func RegisterCloudSupportServer(s *grpc.Server, srv CloudSupportServer) { + s.RegisterService(&_CloudSupport_serviceDesc, srv) +} + +func _CloudSupport_GetSupportAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSupportAccountRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CloudSupportServer).GetSupportAccount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.cloud.support.v1alpha1.CloudSupport/GetSupportAccount", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CloudSupportServer).GetSupportAccount(ctx, req.(*GetSupportAccountRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CloudSupport_ListSupportAccounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListSupportAccountsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CloudSupportServer).ListSupportAccounts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.cloud.support.v1alpha1.CloudSupport/ListSupportAccounts", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CloudSupportServer).ListSupportAccounts(ctx, req.(*ListSupportAccountsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CloudSupport_GetCase_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCaseRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CloudSupportServer).GetCase(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.cloud.support.v1alpha1.CloudSupport/GetCase", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CloudSupportServer).GetCase(ctx, req.(*GetCaseRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CloudSupport_ListCases_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListCasesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CloudSupportServer).ListCases(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.cloud.support.v1alpha1.CloudSupport/ListCases", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CloudSupportServer).ListCases(ctx, req.(*ListCasesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CloudSupport_ListComments_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListCommentsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CloudSupportServer).ListComments(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.cloud.support.v1alpha1.CloudSupport/ListComments", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CloudSupportServer).ListComments(ctx, req.(*ListCommentsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CloudSupport_CreateCase_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateCaseRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CloudSupportServer).CreateCase(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.cloud.support.v1alpha1.CloudSupport/CreateCase", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CloudSupportServer).CreateCase(ctx, req.(*CreateCaseRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CloudSupport_UpdateCase_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateCaseRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CloudSupportServer).UpdateCase(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.cloud.support.v1alpha1.CloudSupport/UpdateCase", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CloudSupportServer).UpdateCase(ctx, req.(*UpdateCaseRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CloudSupport_CreateComment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateCommentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CloudSupportServer).CreateComment(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.cloud.support.v1alpha1.CloudSupport/CreateComment", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CloudSupportServer).CreateComment(ctx, req.(*CreateCommentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CloudSupport_GetIssueTaxonomy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetIssueTaxonomyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CloudSupportServer).GetIssueTaxonomy(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.cloud.support.v1alpha1.CloudSupport/GetIssueTaxonomy", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CloudSupportServer).GetIssueTaxonomy(ctx, req.(*GetIssueTaxonomyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _CloudSupport_serviceDesc = grpc.ServiceDesc{ + ServiceName: "google.cloud.support.v1alpha1.CloudSupport", + HandlerType: (*CloudSupportServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetSupportAccount", + Handler: _CloudSupport_GetSupportAccount_Handler, + }, + { + MethodName: "ListSupportAccounts", + Handler: _CloudSupport_ListSupportAccounts_Handler, + }, + { + MethodName: "GetCase", + Handler: _CloudSupport_GetCase_Handler, + }, + { + MethodName: "ListCases", + Handler: _CloudSupport_ListCases_Handler, + }, + { + MethodName: "ListComments", + Handler: _CloudSupport_ListComments_Handler, + }, + { + MethodName: "CreateCase", + Handler: _CloudSupport_CreateCase_Handler, + }, + { + MethodName: "UpdateCase", + Handler: _CloudSupport_UpdateCase_Handler, + }, + { + MethodName: "CreateComment", + Handler: _CloudSupport_CreateComment_Handler, + }, + { + MethodName: "GetIssueTaxonomy", + Handler: _CloudSupport_GetIssueTaxonomy_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "google/cloud/support/v1alpha1/cloud_support.proto", +} + +func init() { proto.RegisterFile("google/cloud/support/v1alpha1/cloud_support.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 863 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x41, 0x4f, 0x33, 0x45, + 0x18, 0xce, 0xb4, 0xc8, 0x07, 0x2f, 0xdf, 0xa7, 0x5f, 0x47, 0x82, 0x65, 0x0b, 0x49, 0x3b, 0x21, + 0xa6, 0x56, 0xdd, 0x85, 0x36, 0x88, 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0xb7, 0x23, 0x97, 0xc5, 0xbf, 0x21, 0x78, 0x99, 0xb4, 0x59, 0xfc, 0x5e, 0xf6, 0x45, 0x9f, 0xe5, + 0xcb, 0x46, 0x23, 0x95, 0xf8, 0x14, 0x84, 0x10, 0x45, 0x7f, 0x03, 0x1b, 0x63, 0xfa, 0x6d, 0x3b, + 0x51, 0xf6, 0xe8, 0x7b, 0xa8, 0xf5, 0xb9, 0x9b, 0x4e, 0xe6, 0xa8, 0x14, 0x7f, 0x09, 0x4e, 0x83, + 0xf7, 0xeb, 0xcb, 0x13, 0x8d, 0xb0, 0xf9, 0x80, 0x7a, 0xb6, 0xc9, 0x87, 0xb6, 0x65, 0x33, 0x4f, + 0xbd, 0x6d, 0x56, 0xb8, 0x44, 0x7d, 0x47, 0xcc, 0xf9, 0x57, 0xbd, 0xaf, 0x03, 0x17, 0x8b, 0x0a, + 0xd0, 0xfa, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xad, 0xe1, 0xf2, 0x57, 0x85, 0x0b, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta1/video_intelligence.pb.go b/vendor/google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta1/video_intelligence.pb.go new file mode 100644 index 0000000..dcc20b1 --- /dev/null +++ b/vendor/google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta1/video_intelligence.pb.go @@ -0,0 +1,990 @@ +// Code generated by protoc-gen-go. +// source: google/cloud/videointelligence/v1beta1/video_intelligence.proto +// DO NOT EDIT! + +/* +Package videointelligence is a generated protocol buffer package. + +It is generated from these files: + google/cloud/videointelligence/v1beta1/video_intelligence.proto + +It has these top-level messages: + AnnotateVideoRequest + VideoContext + VideoSegment + LabelLocation + LabelAnnotation + SafeSearchAnnotation + BoundingBox + FaceLocation + FaceAnnotation + VideoAnnotationResults + AnnotateVideoResponse + VideoAnnotationProgress + AnnotateVideoProgress +*/ +package videointelligence + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "google.golang.org/genproto/googleapis/api/annotations" +import google_longrunning "google.golang.org/genproto/googleapis/longrunning" +import google_protobuf3 "github.com/golang/protobuf/ptypes/timestamp" +import google_rpc "google.golang.org/genproto/googleapis/rpc/status" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +// Video annotation feature. +type Feature int32 + +const ( + // Unspecified. + Feature_FEATURE_UNSPECIFIED Feature = 0 + // Label detection. Detect objects, such as dog or flower. + Feature_LABEL_DETECTION Feature = 1 + // Human face detection and tracking. + Feature_FACE_DETECTION Feature = 2 + // Shot change detection. + Feature_SHOT_CHANGE_DETECTION Feature = 3 + // Safe search detection. + Feature_SAFE_SEARCH_DETECTION Feature = 4 +) + +var Feature_name = map[int32]string{ + 0: "FEATURE_UNSPECIFIED", + 1: "LABEL_DETECTION", + 2: "FACE_DETECTION", + 3: "SHOT_CHANGE_DETECTION", + 4: "SAFE_SEARCH_DETECTION", +} +var Feature_value = map[string]int32{ + "FEATURE_UNSPECIFIED": 0, + "LABEL_DETECTION": 1, + "FACE_DETECTION": 2, + "SHOT_CHANGE_DETECTION": 3, + "SAFE_SEARCH_DETECTION": 4, +} + +func (x Feature) String() string { + return proto.EnumName(Feature_name, int32(x)) +} +func (Feature) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +// Label level (scope). +type LabelLevel int32 + +const ( + // Unspecified. + LabelLevel_LABEL_LEVEL_UNSPECIFIED LabelLevel = 0 + // Video-level. Corresponds to the whole video. + LabelLevel_VIDEO_LEVEL LabelLevel = 1 + // Segment-level. Corresponds to one of `AnnotateSpec.segments`. + LabelLevel_SEGMENT_LEVEL LabelLevel = 2 + // Shot-level. Corresponds to a single shot (i.e. a series of frames + // without a major camera position or background change). + LabelLevel_SHOT_LEVEL LabelLevel = 3 + // Frame-level. Corresponds to a single video frame. + LabelLevel_FRAME_LEVEL LabelLevel = 4 +) + +var LabelLevel_name = map[int32]string{ + 0: "LABEL_LEVEL_UNSPECIFIED", + 1: "VIDEO_LEVEL", + 2: "SEGMENT_LEVEL", + 3: "SHOT_LEVEL", + 4: "FRAME_LEVEL", +} +var LabelLevel_value = map[string]int32{ + "LABEL_LEVEL_UNSPECIFIED": 0, + "VIDEO_LEVEL": 1, + "SEGMENT_LEVEL": 2, + "SHOT_LEVEL": 3, + "FRAME_LEVEL": 4, +} + +func (x LabelLevel) String() string { + return proto.EnumName(LabelLevel_name, int32(x)) +} +func (LabelLevel) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +// Label detection mode. +type LabelDetectionMode int32 + +const ( + // Unspecified. + LabelDetectionMode_LABEL_DETECTION_MODE_UNSPECIFIED LabelDetectionMode = 0 + // Detect shot-level labels. + LabelDetectionMode_SHOT_MODE LabelDetectionMode = 1 + // Detect frame-level labels. + LabelDetectionMode_FRAME_MODE LabelDetectionMode = 2 + // Detect both shot-level and frame-level labels. + LabelDetectionMode_SHOT_AND_FRAME_MODE LabelDetectionMode = 3 +) + +var LabelDetectionMode_name = map[int32]string{ + 0: "LABEL_DETECTION_MODE_UNSPECIFIED", + 1: "SHOT_MODE", + 2: "FRAME_MODE", + 3: "SHOT_AND_FRAME_MODE", +} +var LabelDetectionMode_value = map[string]int32{ + "LABEL_DETECTION_MODE_UNSPECIFIED": 0, + "SHOT_MODE": 1, + "FRAME_MODE": 2, + "SHOT_AND_FRAME_MODE": 3, +} + +func (x LabelDetectionMode) String() string { + return proto.EnumName(LabelDetectionMode_name, int32(x)) +} +func (LabelDetectionMode) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +// Bucketized representation of likelihood. +type Likelihood int32 + +const ( + // Unknown likelihood. + Likelihood_UNKNOWN Likelihood = 0 + // Very unlikely. + Likelihood_VERY_UNLIKELY Likelihood = 1 + // Unlikely. + Likelihood_UNLIKELY Likelihood = 2 + // Possible. + Likelihood_POSSIBLE Likelihood = 3 + // Likely. + Likelihood_LIKELY Likelihood = 4 + // Very likely. + Likelihood_VERY_LIKELY Likelihood = 5 +) + +var Likelihood_name = map[int32]string{ + 0: "UNKNOWN", + 1: "VERY_UNLIKELY", + 2: "UNLIKELY", + 3: "POSSIBLE", + 4: "LIKELY", + 5: "VERY_LIKELY", +} +var Likelihood_value = map[string]int32{ + "UNKNOWN": 0, + "VERY_UNLIKELY": 1, + "UNLIKELY": 2, + "POSSIBLE": 3, + "LIKELY": 4, + "VERY_LIKELY": 5, +} + +func (x Likelihood) String() string { + return proto.EnumName(Likelihood_name, int32(x)) +} +func (Likelihood) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +// Video annotation request. +type AnnotateVideoRequest struct { + // Input video location. Currently, only + // [Google Cloud Storage](https://cloud.google.com/storage/) URIs are + // supported, which must be specified in the following format: + // `gs://bucket-id/object-id` (other URI formats return + // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see + // [Request URIs](/storage/docs/reference-uris). + // A video URI may include wildcards in `object-id`, and thus identify + // multiple videos. Supported wildcards: '*' to match 0 or more characters; + // '?' to match 1 character. If unset, the input video should be embedded + // in the request as `input_content`. If set, `input_content` should be unset. + InputUri string `protobuf:"bytes,1,opt,name=input_uri,json=inputUri" json:"input_uri,omitempty"` + // The video data bytes. Encoding: base64. If unset, the input video(s) + // should be specified via `input_uri`. If set, `input_uri` should be unset. + InputContent string `protobuf:"bytes,6,opt,name=input_content,json=inputContent" json:"input_content,omitempty"` + // Requested video annotation features. + Features []Feature `protobuf:"varint,2,rep,packed,name=features,enum=google.cloud.videointelligence.v1beta1.Feature" json:"features,omitempty"` + // Additional video context and/or feature-specific parameters. + VideoContext *VideoContext `protobuf:"bytes,3,opt,name=video_context,json=videoContext" json:"video_context,omitempty"` + // Optional location where the output (in JSON format) should be stored. + // Currently, only [Google Cloud Storage](https://cloud.google.com/storage/) + // URIs are supported, which must be specified in the following format: + // `gs://bucket-id/object-id` (other URI formats return + // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see + // [Request URIs](/storage/docs/reference-uris). + OutputUri string `protobuf:"bytes,4,opt,name=output_uri,json=outputUri" json:"output_uri,omitempty"` + // Optional cloud region where annotation should take place. Supported cloud + // regions: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no region + // is specified, a region will be determined based on video file location. + LocationId string `protobuf:"bytes,5,opt,name=location_id,json=locationId" json:"location_id,omitempty"` +} + +func (m *AnnotateVideoRequest) Reset() { *m = AnnotateVideoRequest{} } +func (m *AnnotateVideoRequest) String() string { return proto.CompactTextString(m) } +func (*AnnotateVideoRequest) ProtoMessage() {} +func (*AnnotateVideoRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *AnnotateVideoRequest) GetInputUri() string { + if m != nil { + return m.InputUri + } + return "" +} + +func (m *AnnotateVideoRequest) GetInputContent() string { + if m != nil { + return m.InputContent + } + return "" +} + +func (m *AnnotateVideoRequest) GetFeatures() []Feature { + if m != nil { + return m.Features + } + return nil +} + +func (m *AnnotateVideoRequest) GetVideoContext() *VideoContext { + if m != nil { + return m.VideoContext + } + return nil +} + +func (m *AnnotateVideoRequest) GetOutputUri() string { + if m != nil { + return m.OutputUri + } + return "" +} + +func (m *AnnotateVideoRequest) GetLocationId() string { + if m != nil { + return m.LocationId + } + return "" +} + +// Video context and/or feature-specific parameters. +type VideoContext struct { + // Video segments to annotate. The segments may overlap and are not required + // to be contiguous or span the whole video. If unspecified, each video + // is treated as a single segment. + Segments []*VideoSegment `protobuf:"bytes,1,rep,name=segments" json:"segments,omitempty"` + // If label detection has been requested, what labels should be detected + // in addition to video-level labels or segment-level labels. If unspecified, + // defaults to `SHOT_MODE`. + LabelDetectionMode LabelDetectionMode `protobuf:"varint,2,opt,name=label_detection_mode,json=labelDetectionMode,enum=google.cloud.videointelligence.v1beta1.LabelDetectionMode" json:"label_detection_mode,omitempty"` + // Whether the video has been shot from a stationary (i.e. non-moving) camera. + // When set to true, might improve detection accuracy for moving objects. + StationaryCamera bool `protobuf:"varint,3,opt,name=stationary_camera,json=stationaryCamera" json:"stationary_camera,omitempty"` + // Model to use for label detection. + // Supported values: "latest" and "stable" (the default). + LabelDetectionModel string `protobuf:"bytes,4,opt,name=label_detection_model,json=labelDetectionModel" json:"label_detection_model,omitempty"` + // Model to use for face detection. + // Supported values: "latest" and "stable" (the default). + FaceDetectionModel string `protobuf:"bytes,5,opt,name=face_detection_model,json=faceDetectionModel" json:"face_detection_model,omitempty"` + // Model to use for shot change detection. + // Supported values: "latest" and "stable" (the default). + ShotChangeDetectionModel string `protobuf:"bytes,6,opt,name=shot_change_detection_model,json=shotChangeDetectionModel" json:"shot_change_detection_model,omitempty"` + // Model to use for safe search detection. + // Supported values: "latest" and "stable" (the default). + SafeSearchDetectionModel string `protobuf:"bytes,7,opt,name=safe_search_detection_model,json=safeSearchDetectionModel" json:"safe_search_detection_model,omitempty"` +} + +func (m *VideoContext) Reset() { *m = VideoContext{} } +func (m *VideoContext) String() string { return proto.CompactTextString(m) } +func (*VideoContext) ProtoMessage() {} +func (*VideoContext) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *VideoContext) GetSegments() []*VideoSegment { + if m != nil { + return m.Segments + } + return nil +} + +func (m *VideoContext) GetLabelDetectionMode() LabelDetectionMode { + if m != nil { + return m.LabelDetectionMode + } + return LabelDetectionMode_LABEL_DETECTION_MODE_UNSPECIFIED +} + +func (m *VideoContext) GetStationaryCamera() bool { + if m != nil { + return m.StationaryCamera + } + return false +} + +func (m *VideoContext) GetLabelDetectionModel() string { + if m != nil { + return m.LabelDetectionModel + } + return "" +} + +func (m *VideoContext) GetFaceDetectionModel() string { + if m != nil { + return m.FaceDetectionModel + } + return "" +} + +func (m *VideoContext) GetShotChangeDetectionModel() string { + if m != nil { + return m.ShotChangeDetectionModel + } + return "" +} + +func (m *VideoContext) GetSafeSearchDetectionModel() string { + if m != nil { + return m.SafeSearchDetectionModel + } + return "" +} + +// Video segment. +type VideoSegment struct { + // Start offset in microseconds (inclusive). Unset means 0. + StartTimeOffset int64 `protobuf:"varint,1,opt,name=start_time_offset,json=startTimeOffset" json:"start_time_offset,omitempty"` + // End offset in microseconds (inclusive). Unset means 0. + EndTimeOffset int64 `protobuf:"varint,2,opt,name=end_time_offset,json=endTimeOffset" json:"end_time_offset,omitempty"` +} + +func (m *VideoSegment) Reset() { *m = VideoSegment{} } +func (m *VideoSegment) String() string { return proto.CompactTextString(m) } +func (*VideoSegment) ProtoMessage() {} +func (*VideoSegment) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *VideoSegment) GetStartTimeOffset() int64 { + if m != nil { + return m.StartTimeOffset + } + return 0 +} + +func (m *VideoSegment) GetEndTimeOffset() int64 { + if m != nil { + return m.EndTimeOffset + } + return 0 +} + +// Label location. +type LabelLocation struct { + // Video segment. Set to [-1, -1] for video-level labels. + // Set to [timestamp, timestamp] for frame-level labels. + // Otherwise, corresponds to one of `AnnotateSpec.segments` + // (if specified) or to shot boundaries (if requested). + Segment *VideoSegment `protobuf:"bytes,1,opt,name=segment" json:"segment,omitempty"` + // Confidence that the label is accurate. Range: [0, 1]. + Confidence float32 `protobuf:"fixed32,2,opt,name=confidence" json:"confidence,omitempty"` + // Label level. + Level LabelLevel `protobuf:"varint,3,opt,name=level,enum=google.cloud.videointelligence.v1beta1.LabelLevel" json:"level,omitempty"` +} + +func (m *LabelLocation) Reset() { *m = LabelLocation{} } +func (m *LabelLocation) String() string { return proto.CompactTextString(m) } +func (*LabelLocation) ProtoMessage() {} +func (*LabelLocation) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *LabelLocation) GetSegment() *VideoSegment { + if m != nil { + return m.Segment + } + return nil +} + +func (m *LabelLocation) GetConfidence() float32 { + if m != nil { + return m.Confidence + } + return 0 +} + +func (m *LabelLocation) GetLevel() LabelLevel { + if m != nil { + return m.Level + } + return LabelLevel_LABEL_LEVEL_UNSPECIFIED +} + +// Label annotation. +type LabelAnnotation struct { + // Textual description, e.g. `Fixed-gear bicycle`. + Description string `protobuf:"bytes,1,opt,name=description" json:"description,omitempty"` + // Language code for `description` in BCP-47 format. + LanguageCode string `protobuf:"bytes,2,opt,name=language_code,json=languageCode" json:"language_code,omitempty"` + // Where the label was detected and with what confidence. + Locations []*LabelLocation `protobuf:"bytes,3,rep,name=locations" json:"locations,omitempty"` +} + +func (m *LabelAnnotation) Reset() { *m = LabelAnnotation{} } +func (m *LabelAnnotation) String() string { return proto.CompactTextString(m) } +func (*LabelAnnotation) ProtoMessage() {} +func (*LabelAnnotation) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } + +func (m *LabelAnnotation) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *LabelAnnotation) GetLanguageCode() string { + if m != nil { + return m.LanguageCode + } + return "" +} + +func (m *LabelAnnotation) GetLocations() []*LabelLocation { + if m != nil { + return m.Locations + } + return nil +} + +// Safe search annotation (based on per-frame visual signals only). +// If no unsafe content has been detected in a frame, no annotations +// are present for that frame. If only some types of unsafe content +// have been detected in a frame, the likelihood is set to `UNKNOWN` +// for all other types of unsafe content. +type SafeSearchAnnotation struct { + // Likelihood of adult content. + Adult Likelihood `protobuf:"varint,1,opt,name=adult,enum=google.cloud.videointelligence.v1beta1.Likelihood" json:"adult,omitempty"` + // Likelihood that an obvious modification was made to the original + // version to make it appear funny or offensive. + Spoof Likelihood `protobuf:"varint,2,opt,name=spoof,enum=google.cloud.videointelligence.v1beta1.Likelihood" json:"spoof,omitempty"` + // Likelihood of medical content. + Medical Likelihood `protobuf:"varint,3,opt,name=medical,enum=google.cloud.videointelligence.v1beta1.Likelihood" json:"medical,omitempty"` + // Likelihood of violent content. + Violent Likelihood `protobuf:"varint,4,opt,name=violent,enum=google.cloud.videointelligence.v1beta1.Likelihood" json:"violent,omitempty"` + // Likelihood of racy content. + Racy Likelihood `protobuf:"varint,5,opt,name=racy,enum=google.cloud.videointelligence.v1beta1.Likelihood" json:"racy,omitempty"` + // Video time offset in microseconds. + TimeOffset int64 `protobuf:"varint,6,opt,name=time_offset,json=timeOffset" json:"time_offset,omitempty"` +} + +func (m *SafeSearchAnnotation) Reset() { *m = SafeSearchAnnotation{} } +func (m *SafeSearchAnnotation) String() string { return proto.CompactTextString(m) } +func (*SafeSearchAnnotation) ProtoMessage() {} +func (*SafeSearchAnnotation) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } + +func (m *SafeSearchAnnotation) GetAdult() Likelihood { + if m != nil { + return m.Adult + } + return Likelihood_UNKNOWN +} + +func (m *SafeSearchAnnotation) GetSpoof() Likelihood { + if m != nil { + return m.Spoof + } + return Likelihood_UNKNOWN +} + +func (m *SafeSearchAnnotation) GetMedical() Likelihood { + if m != nil { + return m.Medical + } + return Likelihood_UNKNOWN +} + +func (m *SafeSearchAnnotation) GetViolent() Likelihood { + if m != nil { + return m.Violent + } + return Likelihood_UNKNOWN +} + +func (m *SafeSearchAnnotation) GetRacy() Likelihood { + if m != nil { + return m.Racy + } + return Likelihood_UNKNOWN +} + +func (m *SafeSearchAnnotation) GetTimeOffset() int64 { + if m != nil { + return m.TimeOffset + } + return 0 +} + +// Bounding box. +type BoundingBox struct { + // Left X coordinate. + Left int32 `protobuf:"varint,1,opt,name=left" json:"left,omitempty"` + // Right X coordinate. + Right int32 `protobuf:"varint,2,opt,name=right" json:"right,omitempty"` + // Bottom Y coordinate. + Bottom int32 `protobuf:"varint,3,opt,name=bottom" json:"bottom,omitempty"` + // Top Y coordinate. + Top int32 `protobuf:"varint,4,opt,name=top" json:"top,omitempty"` +} + +func (m *BoundingBox) Reset() { *m = BoundingBox{} } +func (m *BoundingBox) String() string { return proto.CompactTextString(m) } +func (*BoundingBox) ProtoMessage() {} +func (*BoundingBox) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } + +func (m *BoundingBox) GetLeft() int32 { + if m != nil { + return m.Left + } + return 0 +} + +func (m *BoundingBox) GetRight() int32 { + if m != nil { + return m.Right + } + return 0 +} + +func (m *BoundingBox) GetBottom() int32 { + if m != nil { + return m.Bottom + } + return 0 +} + +func (m *BoundingBox) GetTop() int32 { + if m != nil { + return m.Top + } + return 0 +} + +// Face location. +type FaceLocation struct { + // Bounding box in a frame. + BoundingBox *BoundingBox `protobuf:"bytes,1,opt,name=bounding_box,json=boundingBox" json:"bounding_box,omitempty"` + // Video time offset in microseconds. + TimeOffset int64 `protobuf:"varint,2,opt,name=time_offset,json=timeOffset" json:"time_offset,omitempty"` +} + +func (m *FaceLocation) Reset() { *m = FaceLocation{} } +func (m *FaceLocation) String() string { return proto.CompactTextString(m) } +func (*FaceLocation) ProtoMessage() {} +func (*FaceLocation) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } + +func (m *FaceLocation) GetBoundingBox() *BoundingBox { + if m != nil { + return m.BoundingBox + } + return nil +} + +func (m *FaceLocation) GetTimeOffset() int64 { + if m != nil { + return m.TimeOffset + } + return 0 +} + +// Face annotation. +type FaceAnnotation struct { + // Thumbnail of a representative face view (in JPEG format). Encoding: base64. + Thumbnail string `protobuf:"bytes,1,opt,name=thumbnail" json:"thumbnail,omitempty"` + // All locations where a face was detected. + // Faces are detected and tracked on a per-video basis + // (as opposed to across multiple videos). + Segments []*VideoSegment `protobuf:"bytes,2,rep,name=segments" json:"segments,omitempty"` + // Face locations at one frame per second. + Locations []*FaceLocation `protobuf:"bytes,3,rep,name=locations" json:"locations,omitempty"` +} + +func (m *FaceAnnotation) Reset() { *m = FaceAnnotation{} } +func (m *FaceAnnotation) String() string { return proto.CompactTextString(m) } +func (*FaceAnnotation) ProtoMessage() {} +func (*FaceAnnotation) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } + +func (m *FaceAnnotation) GetThumbnail() string { + if m != nil { + return m.Thumbnail + } + return "" +} + +func (m *FaceAnnotation) GetSegments() []*VideoSegment { + if m != nil { + return m.Segments + } + return nil +} + +func (m *FaceAnnotation) GetLocations() []*FaceLocation { + if m != nil { + return m.Locations + } + return nil +} + +// Annotation results for a single video. +type VideoAnnotationResults struct { + // Video file location in + // [Google Cloud Storage](https://cloud.google.com/storage/). + InputUri string `protobuf:"bytes,1,opt,name=input_uri,json=inputUri" json:"input_uri,omitempty"` + // Label annotations. There is exactly one element for each unique label. + LabelAnnotations []*LabelAnnotation `protobuf:"bytes,2,rep,name=label_annotations,json=labelAnnotations" json:"label_annotations,omitempty"` + // Face annotations. There is exactly one element for each unique face. + FaceAnnotations []*FaceAnnotation `protobuf:"bytes,3,rep,name=face_annotations,json=faceAnnotations" json:"face_annotations,omitempty"` + // Shot annotations. Each shot is represented as a video segment. + ShotAnnotations []*VideoSegment `protobuf:"bytes,4,rep,name=shot_annotations,json=shotAnnotations" json:"shot_annotations,omitempty"` + // Safe search annotations. + SafeSearchAnnotations []*SafeSearchAnnotation `protobuf:"bytes,6,rep,name=safe_search_annotations,json=safeSearchAnnotations" json:"safe_search_annotations,omitempty"` + // If set, indicates an error. Note that for a single `AnnotateVideoRequest` + // some videos may succeed and some may fail. + Error *google_rpc.Status `protobuf:"bytes,5,opt,name=error" json:"error,omitempty"` +} + +func (m *VideoAnnotationResults) Reset() { *m = VideoAnnotationResults{} } +func (m *VideoAnnotationResults) String() string { return proto.CompactTextString(m) } +func (*VideoAnnotationResults) ProtoMessage() {} +func (*VideoAnnotationResults) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } + +func (m *VideoAnnotationResults) GetInputUri() string { + if m != nil { + return m.InputUri + } + return "" +} + +func (m *VideoAnnotationResults) GetLabelAnnotations() []*LabelAnnotation { + if m != nil { + return m.LabelAnnotations + } + return nil +} + +func (m *VideoAnnotationResults) GetFaceAnnotations() []*FaceAnnotation { + if m != nil { + return m.FaceAnnotations + } + return nil +} + +func (m *VideoAnnotationResults) GetShotAnnotations() []*VideoSegment { + if m != nil { + return m.ShotAnnotations + } + return nil +} + +func (m *VideoAnnotationResults) GetSafeSearchAnnotations() []*SafeSearchAnnotation { + if m != nil { + return m.SafeSearchAnnotations + } + return nil +} + +func (m *VideoAnnotationResults) GetError() *google_rpc.Status { + if m != nil { + return m.Error + } + return nil +} + +// Video annotation response. Included in the `response` +// field of the `Operation` returned by the `GetOperation` +// call of the `google::longrunning::Operations` service. +type AnnotateVideoResponse struct { + // Annotation results for all videos specified in `AnnotateVideoRequest`. + AnnotationResults []*VideoAnnotationResults `protobuf:"bytes,1,rep,name=annotation_results,json=annotationResults" json:"annotation_results,omitempty"` +} + +func (m *AnnotateVideoResponse) Reset() { *m = AnnotateVideoResponse{} } +func (m *AnnotateVideoResponse) String() string { return proto.CompactTextString(m) } +func (*AnnotateVideoResponse) ProtoMessage() {} +func (*AnnotateVideoResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } + +func (m *AnnotateVideoResponse) GetAnnotationResults() []*VideoAnnotationResults { + if m != nil { + return m.AnnotationResults + } + return nil +} + +// Annotation progress for a single video. +type VideoAnnotationProgress struct { + // Video file location in + // [Google Cloud Storage](https://cloud.google.com/storage/). + InputUri string `protobuf:"bytes,1,opt,name=input_uri,json=inputUri" json:"input_uri,omitempty"` + // Approximate percentage processed thus far. + // Guaranteed to be 100 when fully processed. + ProgressPercent int32 `protobuf:"varint,2,opt,name=progress_percent,json=progressPercent" json:"progress_percent,omitempty"` + // Time when the request was received. + StartTime *google_protobuf3.Timestamp `protobuf:"bytes,3,opt,name=start_time,json=startTime" json:"start_time,omitempty"` + // Time of the most recent update. + UpdateTime *google_protobuf3.Timestamp `protobuf:"bytes,4,opt,name=update_time,json=updateTime" json:"update_time,omitempty"` +} + +func (m *VideoAnnotationProgress) Reset() { *m = VideoAnnotationProgress{} } +func (m *VideoAnnotationProgress) String() string { return proto.CompactTextString(m) } +func (*VideoAnnotationProgress) ProtoMessage() {} +func (*VideoAnnotationProgress) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } + +func (m *VideoAnnotationProgress) GetInputUri() string { + if m != nil { + return m.InputUri + } + return "" +} + +func (m *VideoAnnotationProgress) GetProgressPercent() int32 { + if m != nil { + return m.ProgressPercent + } + return 0 +} + +func (m *VideoAnnotationProgress) GetStartTime() *google_protobuf3.Timestamp { + if m != nil { + return m.StartTime + } + return nil +} + +func (m *VideoAnnotationProgress) GetUpdateTime() *google_protobuf3.Timestamp { + if m != nil { + return m.UpdateTime + } + return nil +} + +// Video annotation progress. Included in the `metadata` +// field of the `Operation` returned by the `GetOperation` +// call of the `google::longrunning::Operations` service. +type AnnotateVideoProgress struct { + // Progress metadata for all videos specified in `AnnotateVideoRequest`. + AnnotationProgress []*VideoAnnotationProgress `protobuf:"bytes,1,rep,name=annotation_progress,json=annotationProgress" json:"annotation_progress,omitempty"` +} + +func (m *AnnotateVideoProgress) Reset() { *m = AnnotateVideoProgress{} } +func (m *AnnotateVideoProgress) String() string { return proto.CompactTextString(m) } +func (*AnnotateVideoProgress) ProtoMessage() {} +func (*AnnotateVideoProgress) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } + +func (m *AnnotateVideoProgress) GetAnnotationProgress() []*VideoAnnotationProgress { + if m != nil { + return m.AnnotationProgress + } + return nil +} + +func init() { + proto.RegisterType((*AnnotateVideoRequest)(nil), "google.cloud.videointelligence.v1beta1.AnnotateVideoRequest") + proto.RegisterType((*VideoContext)(nil), "google.cloud.videointelligence.v1beta1.VideoContext") + proto.RegisterType((*VideoSegment)(nil), "google.cloud.videointelligence.v1beta1.VideoSegment") + proto.RegisterType((*LabelLocation)(nil), "google.cloud.videointelligence.v1beta1.LabelLocation") + proto.RegisterType((*LabelAnnotation)(nil), "google.cloud.videointelligence.v1beta1.LabelAnnotation") + proto.RegisterType((*SafeSearchAnnotation)(nil), "google.cloud.videointelligence.v1beta1.SafeSearchAnnotation") + proto.RegisterType((*BoundingBox)(nil), "google.cloud.videointelligence.v1beta1.BoundingBox") + proto.RegisterType((*FaceLocation)(nil), "google.cloud.videointelligence.v1beta1.FaceLocation") + proto.RegisterType((*FaceAnnotation)(nil), "google.cloud.videointelligence.v1beta1.FaceAnnotation") + proto.RegisterType((*VideoAnnotationResults)(nil), "google.cloud.videointelligence.v1beta1.VideoAnnotationResults") + proto.RegisterType((*AnnotateVideoResponse)(nil), "google.cloud.videointelligence.v1beta1.AnnotateVideoResponse") + proto.RegisterType((*VideoAnnotationProgress)(nil), "google.cloud.videointelligence.v1beta1.VideoAnnotationProgress") + proto.RegisterType((*AnnotateVideoProgress)(nil), "google.cloud.videointelligence.v1beta1.AnnotateVideoProgress") + proto.RegisterEnum("google.cloud.videointelligence.v1beta1.Feature", Feature_name, Feature_value) + proto.RegisterEnum("google.cloud.videointelligence.v1beta1.LabelLevel", LabelLevel_name, LabelLevel_value) + proto.RegisterEnum("google.cloud.videointelligence.v1beta1.LabelDetectionMode", LabelDetectionMode_name, LabelDetectionMode_value) + proto.RegisterEnum("google.cloud.videointelligence.v1beta1.Likelihood", Likelihood_name, Likelihood_value) +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for VideoIntelligenceService service + +type VideoIntelligenceServiceClient interface { + // Performs asynchronous video annotation. Progress and results can be + // retrieved through the `google.longrunning.Operations` interface. + // `Operation.metadata` contains `AnnotateVideoProgress` (progress). + // `Operation.response` contains `AnnotateVideoResponse` (results). + AnnotateVideo(ctx context.Context, in *AnnotateVideoRequest, opts ...grpc.CallOption) (*google_longrunning.Operation, error) +} + +type videoIntelligenceServiceClient struct { + cc *grpc.ClientConn +} + +func NewVideoIntelligenceServiceClient(cc *grpc.ClientConn) VideoIntelligenceServiceClient { + return &videoIntelligenceServiceClient{cc} +} + +func (c *videoIntelligenceServiceClient) AnnotateVideo(ctx context.Context, in *AnnotateVideoRequest, opts ...grpc.CallOption) (*google_longrunning.Operation, error) { + out := new(google_longrunning.Operation) + err := grpc.Invoke(ctx, "/google.cloud.videointelligence.v1beta1.VideoIntelligenceService/AnnotateVideo", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for VideoIntelligenceService service + +type VideoIntelligenceServiceServer interface { + // Performs asynchronous video annotation. Progress and results can be + // retrieved through the `google.longrunning.Operations` interface. + // `Operation.metadata` contains `AnnotateVideoProgress` (progress). + // `Operation.response` contains `AnnotateVideoResponse` (results). + AnnotateVideo(context.Context, *AnnotateVideoRequest) (*google_longrunning.Operation, error) +} + +func RegisterVideoIntelligenceServiceServer(s *grpc.Server, srv VideoIntelligenceServiceServer) { + s.RegisterService(&_VideoIntelligenceService_serviceDesc, srv) +} + +func _VideoIntelligenceService_AnnotateVideo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AnnotateVideoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(VideoIntelligenceServiceServer).AnnotateVideo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.cloud.videointelligence.v1beta1.VideoIntelligenceService/AnnotateVideo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(VideoIntelligenceServiceServer).AnnotateVideo(ctx, req.(*AnnotateVideoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _VideoIntelligenceService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "google.cloud.videointelligence.v1beta1.VideoIntelligenceService", + HandlerType: (*VideoIntelligenceServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "AnnotateVideo", + Handler: _VideoIntelligenceService_AnnotateVideo_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "google/cloud/videointelligence/v1beta1/video_intelligence.proto", +} + +func init() { + proto.RegisterFile("google/cloud/videointelligence/v1beta1/video_intelligence.proto", fileDescriptor0) +} + +var fileDescriptor0 = []byte{ + // 1503 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcb, 0x6f, 0x1b, 0x45, + 0x18, 0xef, 0xfa, 0x91, 0xc4, 0x9f, 0x93, 0xd8, 0x99, 0x24, 0x8d, 0x49, 0x1b, 0x1a, 0xb9, 0xa8, + 0x0a, 0x41, 0xb2, 0xa9, 0xcb, 0x43, 0xb4, 0x40, 0xe5, 0x38, 0xeb, 0xc6, 0xaa, 0x63, 0x47, 0xeb, + 0x24, 0x55, 0xb9, 0xac, 0xd6, 0xbb, 0x63, 0x67, 0xc5, 0x7a, 0x67, 0xd9, 0x9d, 0x8d, 0xda, 0x23, + 0x1c, 0x40, 0x1c, 0x11, 0xff, 0x05, 0x12, 0xf0, 0x2f, 0x70, 0xe5, 0xc4, 0x01, 0x2e, 0x9c, 0xb8, + 0xf0, 0x7f, 0x80, 0xe6, 0xb1, 0xf6, 0xda, 0x0e, 0xd4, 0x0e, 0xdc, 0x3c, 0xdf, 0xe3, 0xf7, 0xbd, + 0x67, 0xbe, 0x35, 0x3c, 0xee, 0x13, 0xd2, 0x77, 0x70, 0xd9, 0x74, 0x48, 0x68, 0x95, 0x2f, 0x6d, + 0x0b, 0x13, 0xdb, 0xa5, 0xd8, 0x71, 0xec, 0x3e, 0x76, 0x4d, 0x5c, 0xbe, 0xbc, 0xdf, 0xc5, 0xd4, + 0xb8, 0x2f, 0x38, 0x7a, 0x9c, 0x55, 0xf2, 0x7c, 0x42, 0x09, 0xba, 0x27, 0x00, 0x4a, 0x1c, 0xa0, + 0x34, 0x05, 0x50, 0x92, 0x00, 0xdb, 0xb7, 0xa5, 0x21, 0xc3, 0xb3, 0xcb, 0x86, 0xeb, 0x12, 0x6a, + 0x50, 0x9b, 0xb8, 0x81, 0x40, 0xd9, 0xbe, 0x2b, 0xb9, 0x0e, 0x71, 0xfb, 0x7e, 0xe8, 0xba, 0xb6, + 0xdb, 0x2f, 0x13, 0x0f, 0xfb, 0x63, 0x42, 0x77, 0xa4, 0x10, 0x3f, 0x75, 0xc3, 0x5e, 0x99, 0xda, + 0x03, 0x1c, 0x50, 0x63, 0xe0, 0x49, 0x81, 0x2d, 0x29, 0xe0, 0x7b, 0x66, 0x39, 0xa0, 0x06, 0x0d, + 0xa5, 0x66, 0xf1, 0xa7, 0x04, 0x6c, 0x54, 0x85, 0x51, 0x7c, 0xce, 0x5c, 0xd4, 0xf0, 0x67, 0x21, + 0x0e, 0x28, 0xba, 0x05, 0x19, 0xdb, 0xf5, 0x42, 0xaa, 0x87, 0xbe, 0x5d, 0x50, 0x76, 0x95, 0xbd, + 0x8c, 0xb6, 0xc4, 0x09, 0x67, 0xbe, 0x8d, 0xee, 0xc2, 0x8a, 0x60, 0x9a, 0xc4, 0xa5, 0xd8, 0xa5, + 0x85, 0x05, 0x2e, 0xb0, 0xcc, 0x89, 0x35, 0x41, 0x43, 0x4f, 0x61, 0xa9, 0x87, 0x0d, 0x1a, 0xfa, + 0x38, 0x28, 0x24, 0x76, 0x93, 0x7b, 0xab, 0x95, 0x72, 0x69, 0xb6, 0x94, 0x94, 0xea, 0x42, 0x4f, + 0x1b, 0x02, 0xa0, 0xe7, 0xb0, 0x22, 0x12, 0xcd, 0x2d, 0xbe, 0xa0, 0x85, 0xe4, 0xae, 0xb2, 0x97, + 0xad, 0xbc, 0x33, 0x2b, 0x22, 0x8f, 0xad, 0x26, 0x74, 0xb5, 0xe5, 0xcb, 0xd8, 0x09, 0xed, 0x00, + 0x90, 0x90, 0x46, 0xa1, 0xa6, 0x78, 0x24, 0x19, 0x41, 0x61, 0xb1, 0xde, 0x81, 0xac, 0x43, 0x4c, + 0x9e, 0x6e, 0xdd, 0xb6, 0x0a, 0x69, 0xce, 0x87, 0x88, 0xd4, 0xb0, 0x8a, 0x7f, 0x24, 0x61, 0x39,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3d, 0xc8, 0x61, 0xd7, 0x1a, 0x93, 0x4c, 0x70, 0xc9, 0x15, 0xec, + 0x5a, 0x23, 0xb9, 0xe2, 0xcf, 0x0a, 0xac, 0xf0, 0xfa, 0x34, 0x65, 0x67, 0xa1, 0x16, 0x2c, 0xca, + 0x06, 0xe0, 0xd8, 0xd7, 0xed, 0xa2, 0x08, 0x04, 0xbd, 0x0e, 0x60, 0x12, 0xb7, 0x67, 0x5b, 0x4c, + 0x96, 0x3b, 0x91, 0xd0, 0x62, 0x14, 0x74, 0x04, 0x69, 0x07, 0x5f, 0x62, 0x87, 0x97, 0x7a, 0xb5, + 0x52, 0x99, 0xab, 0xab, 0x9a, 0x4c, 0x53, 0x13, 0x00, 0xc5, 0xef, 0x15, 0xc8, 0x71, 0x6a, 0x75, + 0x78, 0x9d, 0xa1, 0x5d, 0xc8, 0x5a, 0x38, 0x30, 0x7d, 0xdb, 0x63, 0x47, 0x79, 0xa3, 0xc4, 0x49, + 0xec, 0x52, 0x71, 0x0c, 0xb7, 0x1f, 0x1a, 0x7d, 0xac, 0x9b, 0x51, 0x77, 0x67, 0xb4, 0xe5, 0x88, + 0x58, 0x63, 0xbd, 0xd9, 0x81, 0x4c, 0x34, 0x7a, 0x41, 0x21, 0xc9, 0x87, 0xeb, 0xdd, 0xf9, 0x1c, + 0x95, 0xda, 0xda, 0x08, 0xa7, 0xf8, 0x63, 0x12, 0x36, 0x3a, 0xc3, 0xe2, 0xc7, 0x9c, 0x3e, 0x82, + 0xb4, 0x61, 0x85, 0x8e, 0x28, 0xc0, 0x3c, 0x29, 0xb1, 0x3f, 0xc5, 0x8e, 0x7d, 0x41, 0x88, 0xa5, + 0x09, 0x00, 0x86, 0x14, 0x78, 0x84, 0xf4, 0xe4, 0xc8, 0x5e, 0x0b, 0x89, 0x03, 0xa0, 0x26, 0x2c, + 0x0e, 0xb0, 0x65, 0x9b, 0xc6, 0xfc, 0x85, 0x1a, 0x61, 0x45, 0x10, 0x0c, 0xed, 0xd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 0x6a, 0x89, 0xf8, 0xfd, 0x72, 0x1f, 0xbb, 0x7c, 0x20, 0xcb, + 0x82, 0x65, 0x78, 0x76, 0xf0, 0xaa, 0xbf, 0x10, 0x1e, 0x4d, 0x71, 0xbe, 0x4b, 0xdc, 0x7b, 0x22, + 0x90, 0x6b, 0xdc, 0xc5, 0x29, 0x3f, 0x4a, 0xe7, 0xf7, 0x0f, 0x98, 0x6a, 0x77, 0x81, 0x1b, 0x7b, + 0xf0, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1d, 0xe8, 0xc8, 0xa8, 0xae, 0x10, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/genproto/googleapis/container/v1/cluster_service.pb.go b/vendor/google.golang.org/genproto/googleapis/container/v1/cluster_service.pb.go index 7b63f6a..d257978 100644 --- a/vendor/google.golang.org/genproto/googleapis/container/v1/cluster_service.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/container/v1/cluster_service.pb.go @@ -14,12 +14,14 @@ It has these top-level messages: AddonsConfig HttpLoadBalancing HorizontalPodAutoscaling + LegacyAbac Cluster ClusterUpdate Operation CreateClusterRequest GetClusterRequest UpdateClusterRequest + SetMasterAuthRequest DeleteClusterRequest ListClustersRequest ListClustersResponse @@ -40,6 +42,10 @@ It has these top-level messages: RollbackNodePoolUpgradeRequest ListNodePoolsResponse NodePoolAutoscaling + SetLabelsRequest + SetLegacyAbacRequest + StartIPRotationRequest + CompleteIPRotationRequest */ package container @@ -107,7 +113,7 @@ var Cluster_Status_value = map[string]int32{ func (x Cluster_Status) String() string { return proto.EnumName(Cluster_Status_name, int32(x)) } -func (Cluster_Status) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{5, 0} } +func (Cluster_Status) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{6, 0} } // Current status of the operation. type Operation_Status int32 @@ -143,7 +149,7 @@ var Operation_Status_value = map[string]int32{ func (x Operation_Status) String() string { return proto.EnumName(Operation_Status_name, int32(x)) } -func (Operation_Status) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{7, 0} } +func (Operation_Status) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{8, 0} } // Operation type. type Operation_Type int32 @@ -169,19 +175,31 @@ const ( Operation_DELETE_NODE_POOL Operation_Type = 8 // Set node pool management. Operation_SET_NODE_POOL_MANAGEMENT Operation_Type = 9 + // Automatic node pool repair. + Operation_AUTO_REPAIR_NODES Operation_Type = 10 + // Automatic node upgrade. + Operation_AUTO_UPGRADE_NODES Operation_Type = 11 + // Set labels. + Operation_SET_LABELS Operation_Type = 12 + // Set/generate master auth materials + Operation_SET_MASTER_AUTH Operation_Type = 13 ) var Operation_Type_name = map[int32]string{ - 0: "TYPE_UNSPECIFIED", - 1: "CREATE_CLUSTER", - 2: "DELETE_CLUSTER", - 3: "UPGRADE_MASTER", - 4: "UPGRADE_NODES", - 5: "REPAIR_CLUSTER", - 6: "UPDATE_CLUSTER", - 7: "CREATE_NODE_POOL", - 8: "DELETE_NODE_POOL", - 9: "SET_NODE_POOL_MANAGEMENT", + 0: "TYPE_UNSPECIFIED", + 1: "CREATE_CLUSTER", + 2: "DELETE_CLUSTER", + 3: "UPGRADE_MASTER", + 4: "UPGRADE_NODES", + 5: "REPAIR_CLUSTER", + 6: "UPDATE_CLUSTER", + 7: "CREATE_NODE_POOL", + 8: "DELETE_NODE_POOL", + 9: "SET_NODE_POOL_MANAGEMENT", + 10: "AUTO_REPAIR_NODES", + 11: "AUTO_UPGRADE_NODES", + 12: "SET_LABELS", + 13: "SET_MASTER_AUTH", } var Operation_Type_value = map[string]int32{ "TYPE_UNSPECIFIED": 0, @@ -194,12 +212,46 @@ var Operation_Type_value = map[string]int32{ "CREATE_NODE_POOL": 7, "DELETE_NODE_POOL": 8, "SET_NODE_POOL_MANAGEMENT": 9, + "AUTO_REPAIR_NODES": 10, + "AUTO_UPGRADE_NODES": 11, + "SET_LABELS": 12, + "SET_MASTER_AUTH": 13, } func (x Operation_Type) String() string { return proto.EnumName(Operation_Type_name, int32(x)) } -func (Operation_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{7, 1} } +func (Operation_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{8, 1} } + +// operation type - what type of key rotation are we performing +type SetMasterAuthRequest_Action int32 + +const ( + // Operation is unknown and will error out + SetMasterAuthRequest_UNKNOWN SetMasterAuthRequest_Action = 0 + // Set the password to a user generated value. + SetMasterAuthRequest_SET_PASSWORD SetMasterAuthRequest_Action = 1 + // Generate a new password and set it to that. + SetMasterAuthRequest_GENERATE_PASSWORD SetMasterAuthRequest_Action = 2 +) + +var SetMasterAuthRequest_Action_name = map[int32]string{ + 0: "UNKNOWN", + 1: "SET_PASSWORD", + 2: "GENERATE_PASSWORD", +} +var SetMasterAuthRequest_Action_value = map[string]int32{ + "UNKNOWN": 0, + "SET_PASSWORD": 1, + "GENERATE_PASSWORD": 2, +} + +func (x SetMasterAuthRequest_Action) String() string { + return proto.EnumName(SetMasterAuthRequest_Action_name, int32(x)) +} +func (SetMasterAuthRequest_Action) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{12, 0} +} // The current status of the node pool instance. type NodePool_Status int32 @@ -250,7 +302,7 @@ var NodePool_Status_value = map[string]int32{ func (x NodePool_Status) String() string { return proto.EnumName(NodePool_Status_name, int32(x)) } -func (NodePool_Status) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{24, 0} } +func (NodePool_Status) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{26, 0} } // Parameters that describe the nodes in a cluster. type NodeConfig struct { @@ -324,7 +376,7 @@ type NodeConfig struct { Tags []string `protobuf:"bytes,8,rep,name=tags" json:"tags,omitempty"` // Whether the nodes are created as preemptible VM instances. See: // https://cloud.google.com/compute/docs/instances/preemptible for more - // inforamtion about preemptible VM instances. + // information about preemptible VM instances. Preemptible bool `protobuf:"varint,10,opt,name=preemptible" json:"preemptible,omitempty"` } @@ -408,10 +460,13 @@ func (m *NodeConfig) GetPreemptible() bool { // certificates. type MasterAuth struct { // The username to use for HTTP basic authentication to the master endpoint. + // For clusters v1.6.0 and later, you can disable basic authentication by + // providing an empty username. Username string `protobuf:"bytes,1,opt,name=username" json:"username,omitempty"` // The password to use for HTTP basic authentication to the master endpoint. // Because the master endpoint is open to the Internet, you should create a - // strong password. + // strong password. If a password is provided for cluster creation, username + // must be non-empty. Password string `protobuf:"bytes,2,opt,name=password" json:"password,omitempty"` // [Output only] Base64-encoded public certificate that is the root of // trust for the cluster. @@ -538,6 +593,28 @@ func (m *HorizontalPodAutoscaling) GetDisabled() bool { return false } +// Configuration for the legacy Attribute Based Access Control authorization +// mode. +type LegacyAbac struct { + // Whether the ABAC authorizer is enabled for this cluster. When enabled, + // identities in the system, including service accounts, nodes, and + // controllers, will have statically granted permissions beyond those + // provided by the RBAC configuration or IAM. + Enabled bool `protobuf:"varint,1,opt,name=enabled" json:"enabled,omitempty"` +} + +func (m *LegacyAbac) Reset() { *m = LegacyAbac{} } +func (m *LegacyAbac) String() string { return proto.CompactTextString(m) } +func (*LegacyAbac) ProtoMessage() {} +func (*LegacyAbac) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } + +func (m *LegacyAbac) GetEnabled() bool { + if m != nil { + return m.Enabled + } + return false +} + // A Google Container Engine cluster. type Cluster struct { // The name of this cluster. The name must be unique within this project @@ -616,6 +693,13 @@ type Cluster struct { // Alpha enabled clusters are automatically deleted thirty days after // creation. EnableKubernetesAlpha bool `protobuf:"varint,14,opt,name=enable_kubernetes_alpha,json=enableKubernetesAlpha" json:"enable_kubernetes_alpha,omitempty"` + // The resource labels for the cluster to use to annotate any related + // Google Compute Engine resources. + ResourceLabels map[string]string `protobuf:"bytes,15,rep,name=resource_labels,json=resourceLabels" json:"resource_labels,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // The fingerprint of the set of labels for this cluster. + LabelFingerprint string `protobuf:"bytes,16,opt,name=label_fingerprint,json=labelFingerprint" json:"label_fingerprint,omitempty"` + // Configuration for the legacy ABAC authorization mode. + LegacyAbac *LegacyAbac `protobuf:"bytes,18,opt,name=legacy_abac,json=legacyAbac" json:"legacy_abac,omitempty"` // [Output only] Server-defined URL for the resource. SelfLink string `protobuf:"bytes,100,opt,name=self_link,json=selfLink" json:"self_link,omitempty"` // [Output only] The name of the Google Compute Engine @@ -629,9 +713,10 @@ type Cluster struct { // See the `masterAuth` property of this resource for username and // password information. Endpoint string `protobuf:"bytes,102,opt,name=endpoint" json:"endpoint,omitempty"` - // [Output only] The software version of the master endpoint and kubelets used - // in the cluster when it was first created. The version can be upgraded over - // time. + // The initial Kubernetes version for this cluster. Valid versions are those + // found in validMasterVersions returned by getServerConfig. The version can + // be upgraded over time; such upgrades are reflected in + // currentMasterVersion and currentNodeVersion. InitialClusterVersion string `protobuf:"bytes,103,opt,name=initial_cluster_version,json=initialClusterVersion" json:"initial_cluster_version,omitempty"` // [Output only] The current software version of the master endpoint. CurrentMasterVersion string `protobuf:"bytes,104,opt,name=current_master_version,json=currentMasterVersion" json:"current_master_version,omitempty"` @@ -671,7 +756,7 @@ type Cluster struct { func (m *Cluster) Reset() { *m = Cluster{} } func (m *Cluster) String() string { return proto.CompactTextString(m) } func (*Cluster) ProtoMessage() {} -func (*Cluster) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } +func (*Cluster) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } func (m *Cluster) GetName() string { if m != nil { @@ -771,6 +856,27 @@ func (m *Cluster) GetEnableKubernetesAlpha() bool { return false } +func (m *Cluster) GetResourceLabels() map[string]string { + if m != nil { + return m.ResourceLabels + } + return nil +} + +func (m *Cluster) GetLabelFingerprint() string { + if m != nil { + return m.LabelFingerprint + } + return "" +} + +func (m *Cluster) GetLegacyAbac() *LegacyAbac { + if m != nil { + return m.LegacyAbac + } + return nil +} + func (m *Cluster) GetSelfLink() string { if m != nil { return m.SelfLink @@ -915,7 +1021,7 @@ type ClusterUpdate struct { func (m *ClusterUpdate) Reset() { *m = ClusterUpdate{} } func (m *ClusterUpdate) String() string { return proto.CompactTextString(m) } func (*ClusterUpdate) ProtoMessage() {} -func (*ClusterUpdate) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } +func (*ClusterUpdate) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } func (m *ClusterUpdate) GetDesiredNodeVersion() string { if m != nil { @@ -999,7 +1105,7 @@ type Operation struct { func (m *Operation) Reset() { *m = Operation{} } func (m *Operation) String() string { return proto.CompactTextString(m) } func (*Operation) ProtoMessage() {} -func (*Operation) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } +func (*Operation) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } func (m *Operation) GetName() string { if m != nil { @@ -1074,7 +1180,7 @@ type CreateClusterRequest struct { func (m *CreateClusterRequest) Reset() { *m = CreateClusterRequest{} } func (m *CreateClusterRequest) String() string { return proto.CompactTextString(m) } func (*CreateClusterRequest) ProtoMessage() {} -func (*CreateClusterRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } +func (*CreateClusterRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } func (m *CreateClusterRequest) GetProjectId() string { if m != nil { @@ -1113,7 +1219,7 @@ type GetClusterRequest struct { func (m *GetClusterRequest) Reset() { *m = GetClusterRequest{} } func (m *GetClusterRequest) String() string { return proto.CompactTextString(m) } func (*GetClusterRequest) ProtoMessage() {} -func (*GetClusterRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } +func (*GetClusterRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } func (m *GetClusterRequest) GetProjectId() string { if m != nil { @@ -1154,7 +1260,7 @@ type UpdateClusterRequest struct { func (m *UpdateClusterRequest) Reset() { *m = UpdateClusterRequest{} } func (m *UpdateClusterRequest) String() string { return proto.CompactTextString(m) } func (*UpdateClusterRequest) ProtoMessage() {} -func (*UpdateClusterRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } +func (*UpdateClusterRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } func (m *UpdateClusterRequest) GetProjectId() string { if m != nil { @@ -1184,6 +1290,63 @@ func (m *UpdateClusterRequest) GetUpdate() *ClusterUpdate { return nil } +// SetMasterAuthRequest updates the admin password of a cluster. +type SetMasterAuthRequest struct { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId" json:"project_id,omitempty"` + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + Zone string `protobuf:"bytes,2,opt,name=zone" json:"zone,omitempty"` + // The name of the cluster to upgrade. + ClusterId string `protobuf:"bytes,3,opt,name=cluster_id,json=clusterId" json:"cluster_id,omitempty"` + // The exact form of action to be taken on the master auth + Action SetMasterAuthRequest_Action `protobuf:"varint,4,opt,name=action,enum=google.container.v1.SetMasterAuthRequest_Action" json:"action,omitempty"` + // A description of the update. + Update *MasterAuth `protobuf:"bytes,5,opt,name=update" json:"update,omitempty"` +} + +func (m *SetMasterAuthRequest) Reset() { *m = SetMasterAuthRequest{} } +func (m *SetMasterAuthRequest) String() string { return proto.CompactTextString(m) } +func (*SetMasterAuthRequest) ProtoMessage() {} +func (*SetMasterAuthRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } + +func (m *SetMasterAuthRequest) GetProjectId() string { + if m != nil { + return m.ProjectId + } + return "" +} + +func (m *SetMasterAuthRequest) GetZone() string { + if m != nil { + return m.Zone + } + return "" +} + +func (m *SetMasterAuthRequest) GetClusterId() string { + if m != nil { + return m.ClusterId + } + return "" +} + +func (m *SetMasterAuthRequest) GetAction() SetMasterAuthRequest_Action { + if m != nil { + return m.Action + } + return SetMasterAuthRequest_UNKNOWN +} + +func (m *SetMasterAuthRequest) GetUpdate() *MasterAuth { + if m != nil { + return m.Update + } + return nil +} + // DeleteClusterRequest deletes a cluster. type DeleteClusterRequest struct { // The Google Developers Console [project ID or project @@ -1200,7 +1363,7 @@ type DeleteClusterRequest struct { func (m *DeleteClusterRequest) Reset() { *m = DeleteClusterRequest{} } func (m *DeleteClusterRequest) String() string { return proto.CompactTextString(m) } func (*DeleteClusterRequest) ProtoMessage() {} -func (*DeleteClusterRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } +func (*DeleteClusterRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } func (m *DeleteClusterRequest) GetProjectId() string { if m != nil { @@ -1237,7 +1400,7 @@ type ListClustersRequest struct { func (m *ListClustersRequest) Reset() { *m = ListClustersRequest{} } func (m *ListClustersRequest) String() string { return proto.CompactTextString(m) } func (*ListClustersRequest) ProtoMessage() {} -func (*ListClustersRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } +func (*ListClustersRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } func (m *ListClustersRequest) GetProjectId() string { if m != nil { @@ -1266,7 +1429,7 @@ type ListClustersResponse struct { func (m *ListClustersResponse) Reset() { *m = ListClustersResponse{} } func (m *ListClustersResponse) String() string { return proto.CompactTextString(m) } func (*ListClustersResponse) ProtoMessage() {} -func (*ListClustersResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } +func (*ListClustersResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } func (m *ListClustersResponse) GetClusters() []*Cluster { if m != nil { @@ -1298,7 +1461,7 @@ type GetOperationRequest struct { func (m *GetOperationRequest) Reset() { *m = GetOperationRequest{} } func (m *GetOperationRequest) String() string { return proto.CompactTextString(m) } func (*GetOperationRequest) ProtoMessage() {} -func (*GetOperationRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } +func (*GetOperationRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } func (m *GetOperationRequest) GetProjectId() string { if m != nil { @@ -1334,7 +1497,7 @@ type ListOperationsRequest struct { func (m *ListOperationsRequest) Reset() { *m = ListOperationsRequest{} } func (m *ListOperationsRequest) String() string { return proto.CompactTextString(m) } func (*ListOperationsRequest) ProtoMessage() {} -func (*ListOperationsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } +func (*ListOperationsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } func (m *ListOperationsRequest) GetProjectId() string { if m != nil { @@ -1365,7 +1528,7 @@ type CancelOperationRequest struct { func (m *CancelOperationRequest) Reset() { *m = CancelOperationRequest{} } func (m *CancelOperationRequest) String() string { return proto.CompactTextString(m) } func (*CancelOperationRequest) ProtoMessage() {} -func (*CancelOperationRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } +func (*CancelOperationRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} } func (m *CancelOperationRequest) GetProjectId() string { if m != nil { @@ -1400,7 +1563,7 @@ type ListOperationsResponse struct { func (m *ListOperationsResponse) Reset() { *m = ListOperationsResponse{} } func (m *ListOperationsResponse) String() string { return proto.CompactTextString(m) } func (*ListOperationsResponse) ProtoMessage() {} -func (*ListOperationsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } +func (*ListOperationsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} } func (m *ListOperationsResponse) GetOperations() []*Operation { if m != nil { @@ -1429,7 +1592,7 @@ type GetServerConfigRequest struct { func (m *GetServerConfigRequest) Reset() { *m = GetServerConfigRequest{} } func (m *GetServerConfigRequest) String() string { return proto.CompactTextString(m) } func (*GetServerConfigRequest) ProtoMessage() {} -func (*GetServerConfigRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} } +func (*GetServerConfigRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} } func (m *GetServerConfigRequest) GetProjectId() string { if m != nil { @@ -1462,7 +1625,7 @@ type ServerConfig struct { func (m *ServerConfig) Reset() { *m = ServerConfig{} } func (m *ServerConfig) String() string { return proto.CompactTextString(m) } func (*ServerConfig) ProtoMessage() {} -func (*ServerConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} } +func (*ServerConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} } func (m *ServerConfig) GetDefaultClusterVersion() string { if m != nil { @@ -1517,7 +1680,7 @@ type CreateNodePoolRequest struct { func (m *CreateNodePoolRequest) Reset() { *m = CreateNodePoolRequest{} } func (m *CreateNodePoolRequest) String() string { return proto.CompactTextString(m) } func (*CreateNodePoolRequest) ProtoMessage() {} -func (*CreateNodePoolRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} } +func (*CreateNodePoolRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} } func (m *CreateNodePoolRequest) GetProjectId() string { if m != nil { @@ -1565,7 +1728,7 @@ type DeleteNodePoolRequest struct { func (m *DeleteNodePoolRequest) Reset() { *m = DeleteNodePoolRequest{} } func (m *DeleteNodePoolRequest) String() string { return proto.CompactTextString(m) } func (*DeleteNodePoolRequest) ProtoMessage() {} -func (*DeleteNodePoolRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} } +func (*DeleteNodePoolRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} } func (m *DeleteNodePoolRequest) GetProjectId() string { if m != nil { @@ -1611,7 +1774,7 @@ type ListNodePoolsRequest struct { func (m *ListNodePoolsRequest) Reset() { *m = ListNodePoolsRequest{} } func (m *ListNodePoolsRequest) String() string { return proto.CompactTextString(m) } func (*ListNodePoolsRequest) ProtoMessage() {} -func (*ListNodePoolsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} } +func (*ListNodePoolsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} } func (m *ListNodePoolsRequest) GetProjectId() string { if m != nil { @@ -1652,7 +1815,7 @@ type GetNodePoolRequest struct { func (m *GetNodePoolRequest) Reset() { *m = GetNodePoolRequest{} } func (m *GetNodePoolRequest) String() string { return proto.CompactTextString(m) } func (*GetNodePoolRequest) ProtoMessage() {} -func (*GetNodePoolRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} } +func (*GetNodePoolRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} } func (m *GetNodePoolRequest) GetProjectId() string { if m != nil { @@ -1721,7 +1884,7 @@ type NodePool struct { func (m *NodePool) Reset() { *m = NodePool{} } func (m *NodePool) String() string { return proto.CompactTextString(m) } func (*NodePool) ProtoMessage() {} -func (*NodePool) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} } +func (*NodePool) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} } func (m *NodePool) GetName() string { if m != nil { @@ -1796,8 +1959,15 @@ func (m *NodePool) GetManagement() *NodeManagement { // NodeManagement defines the set of node management services turned on for the // node pool. type NodeManagement struct { - // Whether the nodes will be automatically upgraded. + // A flag that specifies whether node auto-upgrade is enabled for the node + // pool. If enabled, node auto-upgrade helps keep the nodes in your node pool + // up to date with the latest release version of Kubernetes. AutoUpgrade bool `protobuf:"varint,1,opt,name=auto_upgrade,json=autoUpgrade" json:"auto_upgrade,omitempty"` + // A flag that specifies whether the node auto-repair is enabled for the node + // pool. If enabled, the nodes in this node pool will be monitored and, if + // they fail health checks too many times, an automatic repair action will be + // triggered. + AutoRepair bool `protobuf:"varint,2,opt,name=auto_repair,json=autoRepair" json:"auto_repair,omitempty"` // Specifies the Auto Upgrade knobs for the node pool. UpgradeOptions *AutoUpgradeOptions `protobuf:"bytes,10,opt,name=upgrade_options,json=upgradeOptions" json:"upgrade_options,omitempty"` } @@ -1805,7 +1975,7 @@ type NodeManagement struct { func (m *NodeManagement) Reset() { *m = NodeManagement{} } func (m *NodeManagement) String() string { return proto.CompactTextString(m) } func (*NodeManagement) ProtoMessage() {} -func (*NodeManagement) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} } +func (*NodeManagement) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} } func (m *NodeManagement) GetAutoUpgrade() bool { if m != nil { @@ -1814,6 +1984,13 @@ func (m *NodeManagement) GetAutoUpgrade() bool { return false } +func (m *NodeManagement) GetAutoRepair() bool { + if m != nil { + return m.AutoRepair + } + return false +} + func (m *NodeManagement) GetUpgradeOptions() *AutoUpgradeOptions { if m != nil { return m.UpgradeOptions @@ -1836,7 +2013,7 @@ type AutoUpgradeOptions struct { func (m *AutoUpgradeOptions) Reset() { *m = AutoUpgradeOptions{} } func (m *AutoUpgradeOptions) String() string { return proto.CompactTextString(m) } func (*AutoUpgradeOptions) ProtoMessage() {} -func (*AutoUpgradeOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} } +func (*AutoUpgradeOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} } func (m *AutoUpgradeOptions) GetAutoUpgradeStartTime() string { if m != nil { @@ -1873,7 +2050,7 @@ type SetNodePoolManagementRequest struct { func (m *SetNodePoolManagementRequest) Reset() { *m = SetNodePoolManagementRequest{} } func (m *SetNodePoolManagementRequest) String() string { return proto.CompactTextString(m) } func (*SetNodePoolManagementRequest) ProtoMessage() {} -func (*SetNodePoolManagementRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} } +func (*SetNodePoolManagementRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} } func (m *SetNodePoolManagementRequest) GetProjectId() string { if m != nil { @@ -1930,7 +2107,7 @@ type RollbackNodePoolUpgradeRequest struct { func (m *RollbackNodePoolUpgradeRequest) Reset() { *m = RollbackNodePoolUpgradeRequest{} } func (m *RollbackNodePoolUpgradeRequest) String() string { return proto.CompactTextString(m) } func (*RollbackNodePoolUpgradeRequest) ProtoMessage() {} -func (*RollbackNodePoolUpgradeRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} } +func (*RollbackNodePoolUpgradeRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} } func (m *RollbackNodePoolUpgradeRequest) GetProjectId() string { if m != nil { @@ -1969,7 +2146,7 @@ type ListNodePoolsResponse struct { func (m *ListNodePoolsResponse) Reset() { *m = ListNodePoolsResponse{} } func (m *ListNodePoolsResponse) String() string { return proto.CompactTextString(m) } func (*ListNodePoolsResponse) ProtoMessage() {} -func (*ListNodePoolsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} } +func (*ListNodePoolsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{31} } func (m *ListNodePoolsResponse) GetNodePools() []*NodePool { if m != nil { @@ -1994,7 +2171,7 @@ type NodePoolAutoscaling struct { func (m *NodePoolAutoscaling) Reset() { *m = NodePoolAutoscaling{} } func (m *NodePoolAutoscaling) String() string { return proto.CompactTextString(m) } func (*NodePoolAutoscaling) ProtoMessage() {} -func (*NodePoolAutoscaling) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} } +func (*NodePoolAutoscaling) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{32} } func (m *NodePoolAutoscaling) GetEnabled() bool { if m != nil { @@ -2017,18 +2194,212 @@ func (m *NodePoolAutoscaling) GetMaxNodeCount() int32 { return 0 } +// SetLabelsRequest sets the Google Cloud Platform labels on a Google Container +// Engine cluster, which will in turn set them for Google Compute Engine +// resources used by that cluster +type SetLabelsRequest struct { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId" json:"project_id,omitempty"` + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + Zone string `protobuf:"bytes,2,opt,name=zone" json:"zone,omitempty"` + // The name of the cluster. + ClusterId string `protobuf:"bytes,3,opt,name=cluster_id,json=clusterId" json:"cluster_id,omitempty"` + // The labels to set for that cluster. + ResourceLabels map[string]string `protobuf:"bytes,4,rep,name=resource_labels,json=resourceLabels" json:"resource_labels,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // The fingerprint of the previous set of labels for this resource, + // used to detect conflicts. The fingerprint is initially generated by + // Container Engine and changes after every request to modify or update + // labels. You must always provide an up-to-date fingerprint hash when + // updating or changing labels. Make a get() request to the + // resource to get the latest fingerprint. + LabelFingerprint string `protobuf:"bytes,5,opt,name=label_fingerprint,json=labelFingerprint" json:"label_fingerprint,omitempty"` +} + +func (m *SetLabelsRequest) Reset() { *m = SetLabelsRequest{} } +func (m *SetLabelsRequest) String() string { return proto.CompactTextString(m) } +func (*SetLabelsRequest) ProtoMessage() {} +func (*SetLabelsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{33} } + +func (m *SetLabelsRequest) GetProjectId() string { + if m != nil { + return m.ProjectId + } + return "" +} + +func (m *SetLabelsRequest) GetZone() string { + if m != nil { + return m.Zone + } + return "" +} + +func (m *SetLabelsRequest) GetClusterId() string { + if m != nil { + return m.ClusterId + } + return "" +} + +func (m *SetLabelsRequest) GetResourceLabels() map[string]string { + if m != nil { + return m.ResourceLabels + } + return nil +} + +func (m *SetLabelsRequest) GetLabelFingerprint() string { + if m != nil { + return m.LabelFingerprint + } + return "" +} + +// SetLegacyAbacRequest enables or disables the ABAC authorization mechanism for +// a cluster. +type SetLegacyAbacRequest struct { + // The Google Developers Console [project ID or project + // number](https://support.google.com/cloud/answer/6158840). + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId" json:"project_id,omitempty"` + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + Zone string `protobuf:"bytes,2,opt,name=zone" json:"zone,omitempty"` + // The name of the cluster to update. + ClusterId string `protobuf:"bytes,3,opt,name=cluster_id,json=clusterId" json:"cluster_id,omitempty"` + // Whether ABAC authorization will be enabled in the cluster. + Enabled bool `protobuf:"varint,4,opt,name=enabled" json:"enabled,omitempty"` +} + +func (m *SetLegacyAbacRequest) Reset() { *m = SetLegacyAbacRequest{} } +func (m *SetLegacyAbacRequest) String() string { return proto.CompactTextString(m) } +func (*SetLegacyAbacRequest) ProtoMessage() {} +func (*SetLegacyAbacRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{34} } + +func (m *SetLegacyAbacRequest) GetProjectId() string { + if m != nil { + return m.ProjectId + } + return "" +} + +func (m *SetLegacyAbacRequest) GetZone() string { + if m != nil { + return m.Zone + } + return "" +} + +func (m *SetLegacyAbacRequest) GetClusterId() string { + if m != nil { + return m.ClusterId + } + return "" +} + +func (m *SetLegacyAbacRequest) GetEnabled() bool { + if m != nil { + return m.Enabled + } + return false +} + +// StartIPRotationRequest creates a new IP for the cluster and then performs +// a node upgrade on each node pool to point to the new IP. +type StartIPRotationRequest struct { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId" json:"project_id,omitempty"` + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + Zone string `protobuf:"bytes,2,opt,name=zone" json:"zone,omitempty"` + // The name of the cluster. + ClusterId string `protobuf:"bytes,3,opt,name=cluster_id,json=clusterId" json:"cluster_id,omitempty"` +} + +func (m *StartIPRotationRequest) Reset() { *m = StartIPRotationRequest{} } +func (m *StartIPRotationRequest) String() string { return proto.CompactTextString(m) } +func (*StartIPRotationRequest) ProtoMessage() {} +func (*StartIPRotationRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{35} } + +func (m *StartIPRotationRequest) GetProjectId() string { + if m != nil { + return m.ProjectId + } + return "" +} + +func (m *StartIPRotationRequest) GetZone() string { + if m != nil { + return m.Zone + } + return "" +} + +func (m *StartIPRotationRequest) GetClusterId() string { + if m != nil { + return m.ClusterId + } + return "" +} + +// CompleteIPRotationRequest moves the cluster master back into single-IP mode. +type CompleteIPRotationRequest struct { + // The Google Developers Console [project ID or project + // number](https://developers.google.com/console/help/new/#projectnumber). + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId" json:"project_id,omitempty"` + // The name of the Google Compute Engine + // [zone](/compute/docs/zones#available) in which the cluster + // resides. + Zone string `protobuf:"bytes,2,opt,name=zone" json:"zone,omitempty"` + // The name of the cluster. + ClusterId string `protobuf:"bytes,3,opt,name=cluster_id,json=clusterId" json:"cluster_id,omitempty"` +} + +func (m *CompleteIPRotationRequest) Reset() { *m = CompleteIPRotationRequest{} } +func (m *CompleteIPRotationRequest) String() string { return proto.CompactTextString(m) } +func (*CompleteIPRotationRequest) ProtoMessage() {} +func (*CompleteIPRotationRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{36} } + +func (m *CompleteIPRotationRequest) GetProjectId() string { + if m != nil { + return m.ProjectId + } + return "" +} + +func (m *CompleteIPRotationRequest) GetZone() string { + if m != nil { + return m.Zone + } + return "" +} + +func (m *CompleteIPRotationRequest) GetClusterId() string { + if m != nil { + return m.ClusterId + } + return "" +} + func init() { proto.RegisterType((*NodeConfig)(nil), "google.container.v1.NodeConfig") proto.RegisterType((*MasterAuth)(nil), "google.container.v1.MasterAuth") proto.RegisterType((*AddonsConfig)(nil), "google.container.v1.AddonsConfig") proto.RegisterType((*HttpLoadBalancing)(nil), "google.container.v1.HttpLoadBalancing") proto.RegisterType((*HorizontalPodAutoscaling)(nil), "google.container.v1.HorizontalPodAutoscaling") + proto.RegisterType((*LegacyAbac)(nil), "google.container.v1.LegacyAbac") proto.RegisterType((*Cluster)(nil), "google.container.v1.Cluster") proto.RegisterType((*ClusterUpdate)(nil), "google.container.v1.ClusterUpdate") proto.RegisterType((*Operation)(nil), "google.container.v1.Operation") proto.RegisterType((*CreateClusterRequest)(nil), "google.container.v1.CreateClusterRequest") proto.RegisterType((*GetClusterRequest)(nil), "google.container.v1.GetClusterRequest") proto.RegisterType((*UpdateClusterRequest)(nil), "google.container.v1.UpdateClusterRequest") + proto.RegisterType((*SetMasterAuthRequest)(nil), "google.container.v1.SetMasterAuthRequest") proto.RegisterType((*DeleteClusterRequest)(nil), "google.container.v1.DeleteClusterRequest") proto.RegisterType((*ListClustersRequest)(nil), "google.container.v1.ListClustersRequest") proto.RegisterType((*ListClustersResponse)(nil), "google.container.v1.ListClustersResponse") @@ -2049,9 +2420,14 @@ func init() { proto.RegisterType((*RollbackNodePoolUpgradeRequest)(nil), "google.container.v1.RollbackNodePoolUpgradeRequest") proto.RegisterType((*ListNodePoolsResponse)(nil), "google.container.v1.ListNodePoolsResponse") proto.RegisterType((*NodePoolAutoscaling)(nil), "google.container.v1.NodePoolAutoscaling") + proto.RegisterType((*SetLabelsRequest)(nil), "google.container.v1.SetLabelsRequest") + proto.RegisterType((*SetLegacyAbacRequest)(nil), "google.container.v1.SetLegacyAbacRequest") + proto.RegisterType((*StartIPRotationRequest)(nil), "google.container.v1.StartIPRotationRequest") + proto.RegisterType((*CompleteIPRotationRequest)(nil), "google.container.v1.CompleteIPRotationRequest") proto.RegisterEnum("google.container.v1.Cluster_Status", Cluster_Status_name, Cluster_Status_value) proto.RegisterEnum("google.container.v1.Operation_Status", Operation_Status_name, Operation_Status_value) proto.RegisterEnum("google.container.v1.Operation_Type", Operation_Type_name, Operation_Type_value) + proto.RegisterEnum("google.container.v1.SetMasterAuthRequest_Action", SetMasterAuthRequest_Action_name, SetMasterAuthRequest_Action_value) proto.RegisterEnum("google.container.v1.NodePool_Status", NodePool_Status_name, NodePool_Status_value) } @@ -2087,6 +2463,10 @@ type ClusterManagerClient interface { CreateCluster(ctx context.Context, in *CreateClusterRequest, opts ...grpc.CallOption) (*Operation, error) // Updates the settings of a specific cluster. UpdateCluster(ctx context.Context, in *UpdateClusterRequest, opts ...grpc.CallOption) (*Operation, error) + // Used to set master auth materials. Currently supports :- + // Changing the admin password of a specific cluster. + // This can be either via password generation or explicitly set the password. + SetMasterAuth(ctx context.Context, in *SetMasterAuthRequest, opts ...grpc.CallOption) (*Operation, error) // Deletes the cluster, including the Kubernetes endpoint and all worker // nodes. // @@ -2118,6 +2498,14 @@ type ClusterManagerClient interface { RollbackNodePoolUpgrade(ctx context.Context, in *RollbackNodePoolUpgradeRequest, opts ...grpc.CallOption) (*Operation, error) // Sets the NodeManagement options for a node pool. SetNodePoolManagement(ctx context.Context, in *SetNodePoolManagementRequest, opts ...grpc.CallOption) (*Operation, error) + // Sets labels on a cluster. + SetLabels(ctx context.Context, in *SetLabelsRequest, opts ...grpc.CallOption) (*Operation, error) + // Enables or disables the ABAC authorization mechanism on a cluster. + SetLegacyAbac(ctx context.Context, in *SetLegacyAbacRequest, opts ...grpc.CallOption) (*Operation, error) + // Start master IP rotation. + StartIPRotation(ctx context.Context, in *StartIPRotationRequest, opts ...grpc.CallOption) (*Operation, error) + // Completes master IP rotation. + CompleteIPRotation(ctx context.Context, in *CompleteIPRotationRequest, opts ...grpc.CallOption) (*Operation, error) } type clusterManagerClient struct { @@ -2164,6 +2552,15 @@ func (c *clusterManagerClient) UpdateCluster(ctx context.Context, in *UpdateClus return out, nil } +func (c *clusterManagerClient) SetMasterAuth(ctx context.Context, in *SetMasterAuthRequest, opts ...grpc.CallOption) (*Operation, error) { + out := new(Operation) + err := grpc.Invoke(ctx, "/google.container.v1.ClusterManager/SetMasterAuth", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *clusterManagerClient) DeleteCluster(ctx context.Context, in *DeleteClusterRequest, opts ...grpc.CallOption) (*Operation, error) { out := new(Operation) err := grpc.Invoke(ctx, "/google.container.v1.ClusterManager/DeleteCluster", in, out, c.cc, opts...) @@ -2263,6 +2660,42 @@ func (c *clusterManagerClient) SetNodePoolManagement(ctx context.Context, in *Se return out, nil } +func (c *clusterManagerClient) SetLabels(ctx context.Context, in *SetLabelsRequest, opts ...grpc.CallOption) (*Operation, error) { + out := new(Operation) + err := grpc.Invoke(ctx, "/google.container.v1.ClusterManager/SetLabels", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *clusterManagerClient) SetLegacyAbac(ctx context.Context, in *SetLegacyAbacRequest, opts ...grpc.CallOption) (*Operation, error) { + out := new(Operation) + err := grpc.Invoke(ctx, "/google.container.v1.ClusterManager/SetLegacyAbac", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *clusterManagerClient) StartIPRotation(ctx context.Context, in *StartIPRotationRequest, opts ...grpc.CallOption) (*Operation, error) { + out := new(Operation) + err := grpc.Invoke(ctx, "/google.container.v1.ClusterManager/StartIPRotation", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *clusterManagerClient) CompleteIPRotation(ctx context.Context, in *CompleteIPRotationRequest, opts ...grpc.CallOption) (*Operation, error) { + out := new(Operation) + err := grpc.Invoke(ctx, "/google.container.v1.ClusterManager/CompleteIPRotation", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // Server API for ClusterManager service type ClusterManagerServer interface { @@ -2287,6 +2720,10 @@ type ClusterManagerServer interface { CreateCluster(context.Context, *CreateClusterRequest) (*Operation, error) // Updates the settings of a specific cluster. UpdateCluster(context.Context, *UpdateClusterRequest) (*Operation, error) + // Used to set master auth materials. Currently supports :- + // Changing the admin password of a specific cluster. + // This can be either via password generation or explicitly set the password. + SetMasterAuth(context.Context, *SetMasterAuthRequest) (*Operation, error) // Deletes the cluster, including the Kubernetes endpoint and all worker // nodes. // @@ -2318,6 +2755,14 @@ type ClusterManagerServer interface { RollbackNodePoolUpgrade(context.Context, *RollbackNodePoolUpgradeRequest) (*Operation, error) // Sets the NodeManagement options for a node pool. SetNodePoolManagement(context.Context, *SetNodePoolManagementRequest) (*Operation, error) + // Sets labels on a cluster. + SetLabels(context.Context, *SetLabelsRequest) (*Operation, error) + // Enables or disables the ABAC authorization mechanism on a cluster. + SetLegacyAbac(context.Context, *SetLegacyAbacRequest) (*Operation, error) + // Start master IP rotation. + StartIPRotation(context.Context, *StartIPRotationRequest) (*Operation, error) + // Completes master IP rotation. + CompleteIPRotation(context.Context, *CompleteIPRotationRequest) (*Operation, error) } func RegisterClusterManagerServer(s *grpc.Server, srv ClusterManagerServer) { @@ -2396,6 +2841,24 @@ func _ClusterManager_UpdateCluster_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _ClusterManager_SetMasterAuth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetMasterAuthRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ClusterManagerServer).SetMasterAuth(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.container.v1.ClusterManager/SetMasterAuth", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ClusterManagerServer).SetMasterAuth(ctx, req.(*SetMasterAuthRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _ClusterManager_DeleteCluster_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(DeleteClusterRequest) if err := dec(in); err != nil { @@ -2594,6 +3057,78 @@ func _ClusterManager_SetNodePoolManagement_Handler(srv interface{}, ctx context. return interceptor(ctx, in, info, handler) } +func _ClusterManager_SetLabels_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetLabelsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ClusterManagerServer).SetLabels(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.container.v1.ClusterManager/SetLabels", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ClusterManagerServer).SetLabels(ctx, req.(*SetLabelsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ClusterManager_SetLegacyAbac_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetLegacyAbacRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ClusterManagerServer).SetLegacyAbac(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.container.v1.ClusterManager/SetLegacyAbac", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ClusterManagerServer).SetLegacyAbac(ctx, req.(*SetLegacyAbacRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ClusterManager_StartIPRotation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StartIPRotationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ClusterManagerServer).StartIPRotation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.container.v1.ClusterManager/StartIPRotation", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ClusterManagerServer).StartIPRotation(ctx, req.(*StartIPRotationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ClusterManager_CompleteIPRotation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CompleteIPRotationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ClusterManagerServer).CompleteIPRotation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.container.v1.ClusterManager/CompleteIPRotation", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ClusterManagerServer).CompleteIPRotation(ctx, req.(*CompleteIPRotationRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _ClusterManager_serviceDesc = grpc.ServiceDesc{ ServiceName: "google.container.v1.ClusterManager", HandlerType: (*ClusterManagerServer)(nil), @@ -2614,6 +3149,10 @@ var _ClusterManager_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateCluster", Handler: _ClusterManager_UpdateCluster_Handler, }, + { + MethodName: "SetMasterAuth", + Handler: _ClusterManager_SetMasterAuth_Handler, + }, { MethodName: "DeleteCluster", Handler: _ClusterManager_DeleteCluster_Handler, @@ -2658,6 +3197,22 @@ var _ClusterManager_serviceDesc = grpc.ServiceDesc{ MethodName: "SetNodePoolManagement", Handler: _ClusterManager_SetNodePoolManagement_Handler, }, + { + MethodName: "SetLabels", + Handler: _ClusterManager_SetLabels_Handler, + }, + { + MethodName: "SetLegacyAbac", + Handler: _ClusterManager_SetLegacyAbac_Handler, + }, + { + MethodName: "StartIPRotation", + Handler: _ClusterManager_StartIPRotation_Handler, + }, + { + MethodName: "CompleteIPRotation", + Handler: _ClusterManager_CompleteIPRotation_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "google/container/v1/cluster_service.proto", @@ -2666,183 +3221,212 @@ var _ClusterManager_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("google/container/v1/cluster_service.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 2838 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0xcb, 0x6f, 0xe3, 0xd6, - 0xd5, 0xff, 0x68, 0xcb, 0xb2, 0x74, 0xf4, 0xb0, 0x7c, 0xfd, 0x18, 0x42, 0x99, 0xc9, 0x38, 0xcc, - 0x63, 0x26, 0xce, 0x17, 0x2b, 0xf3, 0xc8, 0xcb, 0x33, 0x0d, 0xa2, 0x91, 0x15, 0x8f, 0x32, 0x7e, - 0xa8, 0x94, 0x9d, 0xa0, 0x01, 0x5a, 0x82, 0x16, 0xaf, 0x25, 0xc6, 0x14, 0xc9, 0xf0, 0x52, 0x4e, - 0x3c, 0x03, 0x2f, 0x5a, 0x34, 0x40, 0x81, 0x2e, 0x5b, 0x14, 0x5d, 0x14, 0x45, 0x91, 0xa6, 0x9b, - 0x6e, 0xba, 0x29, 0xba, 0xe9, 0xb6, 0x8b, 0xee, 0xb3, 0x28, 0x5a, 0xa0, 0xe8, 0xa6, 0xe8, 0xb6, - 0xff, 0x42, 0x71, 0x1f, 0xa4, 0x48, 0x99, 0xb2, 0xec, 0x78, 0xdc, 0x74, 0x35, 0xba, 0xe7, 0x71, - 0xef, 0xb9, 0xe7, 0xf1, 0xbb, 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x81, 0x04, - 0x89, 0xd3, 0xf2, 0xd8, 0x32, 0xfb, 0x36, 0xb3, 0xfe, 0x91, 0xf2, 0x94, 0xbc, 0x4c, 0x53, 0xf8, - 0x8f, 0x12, 0x14, 0xe3, 0x23, 0xf1, 0x08, 0x8b, 0x13, 0xe7, 0xe6, 0xb1, 0x16, 0x0b, 0x7f, 0x2f, - 0x5f, 0x92, 0xbf, 0xff, 0x2a, 0xc1, 0x95, 0x11, 0x3d, 0x21, 0xba, 0x93, 0x68, 0xda, 0xe9, 0x1d, - 0xe4, 0xd8, 0xfb, 0x98, 0xec, 0x3e, 0x6d, 0xe5, 0x7b, 0x97, 0x72, 0x9f, 0x55, 0x4f, 0x58, 0x47, - 0x23, 0xf3, 0x37, 0x09, 0x16, 0x12, 0x3b, 0x79, 0x74, 0x6b, 0x04, 0x6a, 0x8c, 0xee, 0xfa, 0xc7, - 0xde, 0xcb, 0x66, 0xf7, 0xea, 0x2a, 0xed, 0x4b, 0xb9, 0x57, 0x85, 0x60, 0x7f, 0x60, 0xd3, 0xaa, - 0xb4, 0xfc, 0xc0, 0x86, 0x2b, 0x6d, 0xa7, 0x97, 0x64, 0xd4, 0x83, 0x39, 0xf1, 0x86, 0x8b, 0xbf, - 0x06, 0x36, 0x29, 0x8c, 0x37, 0xa5, 0x8f, 0xee, 0x0b, 0xd9, 0x8e, 0x63, 0xe9, 0x76, 0x67, 0xc5, - 0xf1, 0x3a, 0x95, 0x0e, 0xb6, 0x19, 0xc8, 0x57, 0x38, 0x4b, 0x77, 0x4d, 0x12, 0xfb, 0x6f, 0x6a, - 0xf7, 0xc2, 0xc5, 0x5e, 0x9a, 0x09, 0xde, 0xf9, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb5, 0x59, - 0xbc, 0xdf, 0xce, 0x26, 0x00, 0x00, + // 3298 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x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x21, 0x1d, 0xd7, 0x60, 0x37, 0x85, 0xcb, 0xe8, + 0x17, 0x02, 0xe4, 0x62, 0xd3, 0xa6, 0x21, 0xc0, 0x92, 0x26, 0x52, 0x23, 0x81, 0xad, 0x52, 0x60, + 0xe5, 0xe2, 0x89, 0x6c, 0x47, 0x50, 0x7e, 0x2e, 0x40, 0x2e, 0x36, 0xdf, 0x19, 0x82, 0x32, 0x69, + 0x06, 0x34, 0x12, 0x65, 0x87, 0xa2, 0x6c, 0x48, 0xf7, 0x4e, 0x84, 0xd2, 0x8b, 0x1e, 0x4d, 0x30, + 0xff, 0x5c, 0x80, 0x5c, 0x6c, 0xe6, 0x33, 0x04, 0x73, 0xd2, 0x5c, 0x68, 0x24, 0x66, 0xee, 0x95, + 0x97, 0x4f, 0xe6, 0x95, 0x9f, 0x0a, 0x90, 0x8f, 0x8f, 0x10, 0xd0, 0xe5, 0xa1, 0x71, 0x7a, 0x60, + 0x46, 0x52, 0xbc, 0x72, 0x24, 0x5e, 0x1e, 0xd5, 0x6f, 0x52, 0xc4, 0xd7, 0xd1, 0xd5, 0x23, 0x22, + 0x8e, 0x8c, 0x23, 0x3e, 0x11, 0x20, 0x1b, 0x1d, 0x09, 0x0d, 0x49, 0x3b, 0x09, 0x53, 0xa3, 0x91, + 0x76, 0x5c, 0xa3, 0xa8, 0xee, 0xa0, 0xb7, 0x8f, 0x8d, 0xaa, 0xf4, 0x38, 0x3a, 0x9f, 0x79, 0x82, + 0x3e, 0x13, 0x60, 0x66, 0xdf, 0xf8, 0x07, 0x25, 0x1b, 0x28, 0x79, 0x48, 0x54, 0x5c, 0x0c, 0x98, + 0x83, 0x5f, 0x9e, 0x2d, 0x57, 0x7b, 0x8e, 0xbf, 0x27, 0xc9, 0x14, 0xe2, 0xba, 0xb4, 0x7a, 0x52, + 0x88, 0x37, 0x35, 0x7a, 0x30, 0xf1, 0xcd, 0x9f, 0x09, 0x30, 0xb3, 0x6f, 0x78, 0x33, 0x04, 0x6c, + 0xf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, 0xd0, 0x2f, + 0x00, 0x00, } diff --git a/vendor/google.golang.org/genproto/googleapis/devtools/build/v1/build_events.pb.go b/vendor/google.golang.org/genproto/googleapis/devtools/build/v1/build_events.pb.go new file mode 100644 index 0000000..c0a9e7d --- /dev/null +++ b/vendor/google.golang.org/genproto/googleapis/devtools/build/v1/build_events.pb.go @@ -0,0 +1,873 @@ +// Code generated by protoc-gen-go. +// source: google/devtools/build/v1/build_events.proto +// DO NOT EDIT! + +/* +Package build is a generated protocol buffer package. + +It is generated from these files: + google/devtools/build/v1/build_events.proto + google/devtools/build/v1/build_status.proto + google/devtools/build/v1/publish_build_event.proto + +It has these top-level messages: + BuildEvent + StreamId + BuildStatus + PublishLifecycleEventRequest + PublishBuildToolEventStreamResponse + OrderedBuildEvent +*/ +package build + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "google.golang.org/genproto/googleapis/api/annotations" +import google_protobuf1 "github.com/golang/protobuf/ptypes/any" +import google_protobuf2 "github.com/golang/protobuf/ptypes/timestamp" +import google_protobuf3 "github.com/golang/protobuf/ptypes/wrappers" +import google_rpc "google.golang.org/genproto/googleapis/rpc/status" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +// The type of console output stream. +type ConsoleOutputStream int32 + +const ( + // Unspecified or unknown. + ConsoleOutputStream_UNKNOWN ConsoleOutputStream = 0 + // Normal output stream. + ConsoleOutputStream_STDOUT ConsoleOutputStream = 1 + // Error output stream. + ConsoleOutputStream_STDERR ConsoleOutputStream = 2 +) + +var ConsoleOutputStream_name = map[int32]string{ + 0: "UNKNOWN", + 1: "STDOUT", + 2: "STDERR", +} +var ConsoleOutputStream_value = map[string]int32{ + "UNKNOWN": 0, + "STDOUT": 1, + "STDERR": 2, +} + +func (x ConsoleOutputStream) String() string { + return proto.EnumName(ConsoleOutputStream_name, int32(x)) +} +func (ConsoleOutputStream) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +// How did the event stream finish. +type BuildEvent_BuildComponentStreamFinished_FinishType int32 + +const ( + // Unknown or unspecified; callers should never set this value. + BuildEvent_BuildComponentStreamFinished_FINISH_TYPE_UNSPECIFIED BuildEvent_BuildComponentStreamFinished_FinishType = 0 + // Set by the event publisher to indicate a build event stream is + // finished. + BuildEvent_BuildComponentStreamFinished_FINISHED BuildEvent_BuildComponentStreamFinished_FinishType = 1 + // Set by the WatchBuild RPC server when the publisher of a build event + // stream stops publishing events without publishing a + // BuildComponentStreamFinished event whose type equals FINISHED. + BuildEvent_BuildComponentStreamFinished_EXPIRED BuildEvent_BuildComponentStreamFinished_FinishType = 2 +) + +var BuildEvent_BuildComponentStreamFinished_FinishType_name = map[int32]string{ + 0: "FINISH_TYPE_UNSPECIFIED", + 1: "FINISHED", + 2: "EXPIRED", +} +var BuildEvent_BuildComponentStreamFinished_FinishType_value = map[string]int32{ + "FINISH_TYPE_UNSPECIFIED": 0, + "FINISHED": 1, + "EXPIRED": 2, +} + +func (x BuildEvent_BuildComponentStreamFinished_FinishType) String() string { + return proto.EnumName(BuildEvent_BuildComponentStreamFinished_FinishType_name, int32(x)) +} +func (BuildEvent_BuildComponentStreamFinished_FinishType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{0, 5, 0} +} + +// Which build component generates this event stream. Each build component +// may generate one event stream. +type StreamId_BuildComponent int32 + +const ( + // Unknown or unspecified; callers should never set this value. + StreamId_UNKNOWN_COMPONENT StreamId_BuildComponent = 0 + // A component that coordinates builds. + StreamId_CONTROLLER StreamId_BuildComponent = 1 + // A component that runs executables needed to complete a build. + StreamId_WORKER StreamId_BuildComponent = 2 + // A component that builds something. + StreamId_TOOL StreamId_BuildComponent = 3 + StreamId_DEPRECATED StreamId_BuildComponent = 4 +) + +var StreamId_BuildComponent_name = map[int32]string{ + 0: "UNKNOWN_COMPONENT", + 1: "CONTROLLER", + 2: "WORKER", + 3: "TOOL", + 4: "DEPRECATED", +} +var StreamId_BuildComponent_value = map[string]int32{ + "UNKNOWN_COMPONENT": 0, + "CONTROLLER": 1, + "WORKER": 2, + "TOOL": 3, + "DEPRECATED": 4, +} + +func (x StreamId_BuildComponent) String() string { + return proto.EnumName(StreamId_BuildComponent_name, int32(x)) +} +func (StreamId_BuildComponent) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1, 0} } + +// An event representing some state change that occured in the build. This +// message does not include field for uniquely identifying an event. +type BuildEvent struct { + // The timestamp of this event. + EventTime *google_protobuf2.Timestamp `protobuf:"bytes,1,opt,name=event_time,json=eventTime" json:"event_time,omitempty"` + // ////////////////////////////////////////////////////////////////////////// + // Events that indicate a state change of a build request in the build + // queue. + // + // Types that are valid to be assigned to Event: + // *BuildEvent_InvocationAttemptStarted_ + // *BuildEvent_InvocationAttemptFinished_ + // *BuildEvent_BuildEnqueued_ + // *BuildEvent_BuildFinished_ + // *BuildEvent_ConsoleOutput_ + // *BuildEvent_ComponentStreamFinished + // *BuildEvent_BazelEvent + // *BuildEvent_BuildExecutionEvent + // *BuildEvent_SourceFetchEvent + Event isBuildEvent_Event `protobuf_oneof:"event"` +} + +func (m *BuildEvent) Reset() { *m = BuildEvent{} } +func (m *BuildEvent) String() string { return proto.CompactTextString(m) } +func (*BuildEvent) ProtoMessage() {} +func (*BuildEvent) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +type isBuildEvent_Event interface { + isBuildEvent_Event() +} + +type BuildEvent_InvocationAttemptStarted_ struct { + InvocationAttemptStarted *BuildEvent_InvocationAttemptStarted `protobuf:"bytes,51,opt,name=invocation_attempt_started,json=invocationAttemptStarted,oneof"` +} +type BuildEvent_InvocationAttemptFinished_ struct { + InvocationAttemptFinished *BuildEvent_InvocationAttemptFinished `protobuf:"bytes,52,opt,name=invocation_attempt_finished,json=invocationAttemptFinished,oneof"` +} +type BuildEvent_BuildEnqueued_ struct { + BuildEnqueued *BuildEvent_BuildEnqueued `protobuf:"bytes,53,opt,name=build_enqueued,json=buildEnqueued,oneof"` +} +type BuildEvent_BuildFinished_ struct { + BuildFinished *BuildEvent_BuildFinished `protobuf:"bytes,55,opt,name=build_finished,json=buildFinished,oneof"` +} +type BuildEvent_ConsoleOutput_ struct { + ConsoleOutput *BuildEvent_ConsoleOutput `protobuf:"bytes,56,opt,name=console_output,json=consoleOutput,oneof"` +} +type BuildEvent_ComponentStreamFinished struct { + ComponentStreamFinished *BuildEvent_BuildComponentStreamFinished `protobuf:"bytes,59,opt,name=component_stream_finished,json=componentStreamFinished,oneof"` +} +type BuildEvent_BazelEvent struct { + BazelEvent *google_protobuf1.Any `protobuf:"bytes,60,opt,name=bazel_event,json=bazelEvent,oneof"` +} +type BuildEvent_BuildExecutionEvent struct { + BuildExecutionEvent *google_protobuf1.Any `protobuf:"bytes,61,opt,name=build_execution_event,json=buildExecutionEvent,oneof"` +} +type BuildEvent_SourceFetchEvent struct { + SourceFetchEvent *google_protobuf1.Any `protobuf:"bytes,62,opt,name=source_fetch_event,json=sourceFetchEvent,oneof"` +} + +func (*BuildEvent_InvocationAttemptStarted_) isBuildEvent_Event() {} +func (*BuildEvent_InvocationAttemptFinished_) isBuildEvent_Event() {} +func (*BuildEvent_BuildEnqueued_) isBuildEvent_Event() {} +func (*BuildEvent_BuildFinished_) isBuildEvent_Event() {} +func (*BuildEvent_ConsoleOutput_) isBuildEvent_Event() {} +func (*BuildEvent_ComponentStreamFinished) isBuildEvent_Event() {} +func (*BuildEvent_BazelEvent) isBuildEvent_Event() {} +func (*BuildEvent_BuildExecutionEvent) isBuildEvent_Event() {} +func (*BuildEvent_SourceFetchEvent) isBuildEvent_Event() {} + +func (m *BuildEvent) GetEvent() isBuildEvent_Event { + if m != nil { + return m.Event + } + return nil +} + +func (m *BuildEvent) GetEventTime() *google_protobuf2.Timestamp { + if m != nil { + return m.EventTime + } + return nil +} + +func (m *BuildEvent) GetInvocationAttemptStarted() *BuildEvent_InvocationAttemptStarted { + if x, ok := m.GetEvent().(*BuildEvent_InvocationAttemptStarted_); ok { + return x.InvocationAttemptStarted + } + return nil +} + +func (m *BuildEvent) GetInvocationAttemptFinished() *BuildEvent_InvocationAttemptFinished { + if x, ok := m.GetEvent().(*BuildEvent_InvocationAttemptFinished_); ok { + return x.InvocationAttemptFinished + } + return nil +} + +func (m *BuildEvent) GetBuildEnqueued() *BuildEvent_BuildEnqueued { + if x, ok := m.GetEvent().(*BuildEvent_BuildEnqueued_); ok { + return x.BuildEnqueued + } + return nil +} + +func (m *BuildEvent) GetBuildFinished() *BuildEvent_BuildFinished { + if x, ok := m.GetEvent().(*BuildEvent_BuildFinished_); ok { + return x.BuildFinished + } + return nil +} + +func (m *BuildEvent) GetConsoleOutput() *BuildEvent_ConsoleOutput { + if x, ok := m.GetEvent().(*BuildEvent_ConsoleOutput_); ok { + return x.ConsoleOutput + } + return nil +} + +func (m *BuildEvent) GetComponentStreamFinished() *BuildEvent_BuildComponentStreamFinished { + if x, ok := m.GetEvent().(*BuildEvent_ComponentStreamFinished); ok { + return x.ComponentStreamFinished + } + return nil +} + +func (m *BuildEvent) GetBazelEvent() *google_protobuf1.Any { + if x, ok := m.GetEvent().(*BuildEvent_BazelEvent); ok { + return x.BazelEvent + } + return nil +} + +func (m *BuildEvent) GetBuildExecutionEvent() *google_protobuf1.Any { + if x, ok := m.GetEvent().(*BuildEvent_BuildExecutionEvent); ok { + return x.BuildExecutionEvent + } + return nil +} + +func (m *BuildEvent) GetSourceFetchEvent() *google_protobuf1.Any { + if x, ok := m.GetEvent().(*BuildEvent_SourceFetchEvent); ok { + return x.SourceFetchEvent + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*BuildEvent) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _BuildEvent_OneofMarshaler, _BuildEvent_OneofUnmarshaler, _BuildEvent_OneofSizer, []interface{}{ + (*BuildEvent_InvocationAttemptStarted_)(nil), + (*BuildEvent_InvocationAttemptFinished_)(nil), + (*BuildEvent_BuildEnqueued_)(nil), + (*BuildEvent_BuildFinished_)(nil), + (*BuildEvent_ConsoleOutput_)(nil), + (*BuildEvent_ComponentStreamFinished)(nil), + (*BuildEvent_BazelEvent)(nil), + (*BuildEvent_BuildExecutionEvent)(nil), + (*BuildEvent_SourceFetchEvent)(nil), + } +} + +func _BuildEvent_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*BuildEvent) + // event + switch x := m.Event.(type) { + case *BuildEvent_InvocationAttemptStarted_: + b.EncodeVarint(51<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.InvocationAttemptStarted); err != nil { + return err + } + case *BuildEvent_InvocationAttemptFinished_: + b.EncodeVarint(52<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.InvocationAttemptFinished); err != nil { + return err + } + case *BuildEvent_BuildEnqueued_: + b.EncodeVarint(53<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.BuildEnqueued); err != nil { + return err + } + case *BuildEvent_BuildFinished_: + b.EncodeVarint(55<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.BuildFinished); err != nil { + return err + } + case *BuildEvent_ConsoleOutput_: + b.EncodeVarint(56<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.ConsoleOutput); err != nil { + return err + } + case *BuildEvent_ComponentStreamFinished: + b.EncodeVarint(59<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.ComponentStreamFinished); err != nil { + return err + } + case *BuildEvent_BazelEvent: + b.EncodeVarint(60<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.BazelEvent); err != nil { + return err + } + case *BuildEvent_BuildExecutionEvent: + b.EncodeVarint(61<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.BuildExecutionEvent); err != nil { + return err + } + case *BuildEvent_SourceFetchEvent: + b.EncodeVarint(62<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.SourceFetchEvent); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("BuildEvent.Event has unexpected type %T", x) + } + return nil +} + +func _BuildEvent_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*BuildEvent) + switch tag { + case 51: // event.invocation_attempt_started + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(BuildEvent_InvocationAttemptStarted) + err := b.DecodeMessage(msg) + m.Event = &BuildEvent_InvocationAttemptStarted_{msg} + return true, err + case 52: // event.invocation_attempt_finished + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(BuildEvent_InvocationAttemptFinished) + err := b.DecodeMessage(msg) + m.Event = &BuildEvent_InvocationAttemptFinished_{msg} + return true, err + case 53: // event.build_enqueued + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(BuildEvent_BuildEnqueued) + err := b.DecodeMessage(msg) + m.Event = &BuildEvent_BuildEnqueued_{msg} + return true, err + case 55: // event.build_finished + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(BuildEvent_BuildFinished) + err := b.DecodeMessage(msg) + m.Event = &BuildEvent_BuildFinished_{msg} + return true, err + case 56: // event.console_output + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(BuildEvent_ConsoleOutput) + err := b.DecodeMessage(msg) + m.Event = &BuildEvent_ConsoleOutput_{msg} + return true, err + case 59: // event.component_stream_finished + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(BuildEvent_BuildComponentStreamFinished) + err := b.DecodeMessage(msg) + m.Event = &BuildEvent_ComponentStreamFinished{msg} + return true, err + case 60: // event.bazel_event + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(google_protobuf1.Any) + err := b.DecodeMessage(msg) + m.Event = &BuildEvent_BazelEvent{msg} + return true, err + case 61: // event.build_execution_event + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(google_protobuf1.Any) + err := b.DecodeMessage(msg) + m.Event = &BuildEvent_BuildExecutionEvent{msg} + return true, err + case 62: // event.source_fetch_event + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(google_protobuf1.Any) + err := b.DecodeMessage(msg) + m.Event = &BuildEvent_SourceFetchEvent{msg} + return true, err + default: + return false, nil + } +} + +func _BuildEvent_OneofSizer(msg proto.Message) (n int) { + m := msg.(*BuildEvent) + // event + switch x := m.Event.(type) { + case *BuildEvent_InvocationAttemptStarted_: + s := proto.Size(x.InvocationAttemptStarted) + n += proto.SizeVarint(51<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *BuildEvent_InvocationAttemptFinished_: + s := proto.Size(x.InvocationAttemptFinished) + n += proto.SizeVarint(52<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *BuildEvent_BuildEnqueued_: + s := proto.Size(x.BuildEnqueued) + n += proto.SizeVarint(53<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *BuildEvent_BuildFinished_: + s := proto.Size(x.BuildFinished) + n += proto.SizeVarint(55<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *BuildEvent_ConsoleOutput_: + s := proto.Size(x.ConsoleOutput) + n += proto.SizeVarint(56<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *BuildEvent_ComponentStreamFinished: + s := proto.Size(x.ComponentStreamFinished) + n += proto.SizeVarint(59<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *BuildEvent_BazelEvent: + s := proto.Size(x.BazelEvent) + n += proto.SizeVarint(60<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *BuildEvent_BuildExecutionEvent: + s := proto.Size(x.BuildExecutionEvent) + n += proto.SizeVarint(61<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *BuildEvent_SourceFetchEvent: + s := proto.Size(x.SourceFetchEvent) + n += proto.SizeVarint(62<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// Notification that the build system has attempted to run the build tool. +type BuildEvent_InvocationAttemptStarted struct { + // The number of the invocation attempt, starting at 1 and increasing by 1 + // for each new attempt. Can be used to determine if there is a later + // invocation attempt replacing the current one a client is processing. + AttemptNumber int64 `protobuf:"varint,1,opt,name=attempt_number,json=attemptNumber" json:"attempt_number,omitempty"` +} + +func (m *BuildEvent_InvocationAttemptStarted) Reset() { *m = BuildEvent_InvocationAttemptStarted{} } +func (m *BuildEvent_InvocationAttemptStarted) String() string { return proto.CompactTextString(m) } +func (*BuildEvent_InvocationAttemptStarted) ProtoMessage() {} +func (*BuildEvent_InvocationAttemptStarted) Descriptor() ([]byte, []int) { + return fileDescriptor0, []int{0, 0} +} + +func (m *BuildEvent_InvocationAttemptStarted) GetAttemptNumber() int64 { + if m != nil { + return m.AttemptNumber + } + return 0 +} + +// Notification that an invocation attempt has finished. +type BuildEvent_InvocationAttemptFinished struct { + // The status of the build request. + // If OK, the build request was run, though this does not mean the + // requested build tool succeeded. "exit_code" will be set to the + // exit code of the build tool. + // If not OK, the build request was not successfully executed. + // "exit_code" will not be set. + Status *google_rpc.Status `protobuf:"bytes,1,opt,name=status" json:"status,omitempty"` + // The exit code of the build tool. + ExitCode *google_protobuf3.Int32Value `protobuf:"bytes,2,opt,name=exit_code,json=exitCode" json:"exit_code,omitempty"` + // Final status of the invocation. + InvocationStatus *BuildStatus `protobuf:"bytes,3,opt,name=invocation_status,json=invocationStatus" json:"invocation_status,omitempty"` +} + +func (m *BuildEvent_InvocationAttemptFinished) Reset() { *m = BuildEvent_InvocationAttemptFinished{} } +func (m *BuildEvent_InvocationAttemptFinished) String() string { return proto.CompactTextString(m) } +func (*BuildEvent_InvocationAttemptFinished) ProtoMessage() {} +func (*BuildEvent_InvocationAttemptFinished) Descriptor() ([]byte, []int) { + return fileDescriptor0, []int{0, 1} +} + +func (m *BuildEvent_InvocationAttemptFinished) GetStatus() *google_rpc.Status { + if m != nil { + return m.Status + } + return nil +} + +func (m *BuildEvent_InvocationAttemptFinished) GetExitCode() *google_protobuf3.Int32Value { + if m != nil { + return m.ExitCode + } + return nil +} + +func (m *BuildEvent_InvocationAttemptFinished) GetInvocationStatus() *BuildStatus { + if m != nil { + return m.InvocationStatus + } + return nil +} + +// Notification that the build request is enqueued. It could happen when +// a new build request is inserted into the build queue, or when a +// build request is put back into the build queue due to a previous build +// failure. +type BuildEvent_BuildEnqueued struct { +} + +func (m *BuildEvent_BuildEnqueued) Reset() { *m = BuildEvent_BuildEnqueued{} } +func (m *BuildEvent_BuildEnqueued) String() string { return proto.CompactTextString(m) } +func (*BuildEvent_BuildEnqueued) ProtoMessage() {} +func (*BuildEvent_BuildEnqueued) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 2} } + +// Notification that the build request has finished, and no further +// invocations will occur. Note that this applies to the entire Build. +// Individual invocations trigger InvocationFinished when they finish. +type BuildEvent_BuildFinished struct { + // Final status of the build. + Status *BuildStatus `protobuf:"bytes,1,opt,name=status" json:"status,omitempty"` +} + +func (m *BuildEvent_BuildFinished) Reset() { *m = BuildEvent_BuildFinished{} } +func (m *BuildEvent_BuildFinished) String() string { return proto.CompactTextString(m) } +func (*BuildEvent_BuildFinished) ProtoMessage() {} +func (*BuildEvent_BuildFinished) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 3} } + +func (m *BuildEvent_BuildFinished) GetStatus() *BuildStatus { + if m != nil { + return m.Status + } + return nil +} + +// Textual output written to standard output or standard error. +type BuildEvent_ConsoleOutput struct { + // The output stream type. + Type ConsoleOutputStream `protobuf:"varint,1,opt,name=type,enum=google.devtools.build.v1.ConsoleOutputStream" json:"type,omitempty"` + // The output stream content. + // + // Types that are valid to be assigned to Output: + // *BuildEvent_ConsoleOutput_TextOutput + // *BuildEvent_ConsoleOutput_BinaryOutput + Output isBuildEvent_ConsoleOutput_Output `protobuf_oneof:"output"` +} + +func (m *BuildEvent_ConsoleOutput) Reset() { *m = BuildEvent_ConsoleOutput{} } +func (m *BuildEvent_ConsoleOutput) String() string { return proto.CompactTextString(m) } +func (*BuildEvent_ConsoleOutput) ProtoMessage() {} +func (*BuildEvent_ConsoleOutput) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 4} } + +type isBuildEvent_ConsoleOutput_Output interface { + isBuildEvent_ConsoleOutput_Output() +} + +type BuildEvent_ConsoleOutput_TextOutput struct { + TextOutput string `protobuf:"bytes,2,opt,name=text_output,json=textOutput,oneof"` +} +type BuildEvent_ConsoleOutput_BinaryOutput struct { + BinaryOutput []byte `protobuf:"bytes,3,opt,name=binary_output,json=binaryOutput,proto3,oneof"` +} + +func (*BuildEvent_ConsoleOutput_TextOutput) isBuildEvent_ConsoleOutput_Output() {} +func (*BuildEvent_ConsoleOutput_BinaryOutput) isBuildEvent_ConsoleOutput_Output() {} + +func (m *BuildEvent_ConsoleOutput) GetOutput() isBuildEvent_ConsoleOutput_Output { + if m != nil { + return m.Output + } + return nil +} + +func (m *BuildEvent_ConsoleOutput) GetType() ConsoleOutputStream { + if m != nil { + return m.Type + } + return ConsoleOutputStream_UNKNOWN +} + +func (m *BuildEvent_ConsoleOutput) GetTextOutput() string { + if x, ok := m.GetOutput().(*BuildEvent_ConsoleOutput_TextOutput); ok { + return x.TextOutput + } + return "" +} + +func (m *BuildEvent_ConsoleOutput) GetBinaryOutput() []byte { + if x, ok := m.GetOutput().(*BuildEvent_ConsoleOutput_BinaryOutput); ok { + return x.BinaryOutput + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*BuildEvent_ConsoleOutput) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _BuildEvent_ConsoleOutput_OneofMarshaler, _BuildEvent_ConsoleOutput_OneofUnmarshaler, _BuildEvent_ConsoleOutput_OneofSizer, []interface{}{ + (*BuildEvent_ConsoleOutput_TextOutput)(nil), + (*BuildEvent_ConsoleOutput_BinaryOutput)(nil), + } +} + +func _BuildEvent_ConsoleOutput_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*BuildEvent_ConsoleOutput) + // output + switch x := m.Output.(type) { + case *BuildEvent_ConsoleOutput_TextOutput: + b.EncodeVarint(2<<3 | proto.WireBytes) + b.EncodeStringBytes(x.TextOutput) + case *BuildEvent_ConsoleOutput_BinaryOutput: + b.EncodeVarint(3<<3 | proto.WireBytes) + b.EncodeRawBytes(x.BinaryOutput) + case nil: + default: + return fmt.Errorf("BuildEvent_ConsoleOutput.Output has unexpected type %T", x) + } + return nil +} + +func _BuildEvent_ConsoleOutput_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*BuildEvent_ConsoleOutput) + switch tag { + case 2: // output.text_output + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Output = &BuildEvent_ConsoleOutput_TextOutput{x} + return true, err + case 3: // output.binary_output + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeRawBytes(true) + m.Output = &BuildEvent_ConsoleOutput_BinaryOutput{x} + return true, err + default: + return false, nil + } +} + +func _BuildEvent_ConsoleOutput_OneofSizer(msg proto.Message) (n int) { + m := msg.(*BuildEvent_ConsoleOutput) + // output + switch x := m.Output.(type) { + case *BuildEvent_ConsoleOutput_TextOutput: + n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.TextOutput))) + n += len(x.TextOutput) + case *BuildEvent_ConsoleOutput_BinaryOutput: + n += proto.SizeVarint(3<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.BinaryOutput))) + n += len(x.BinaryOutput) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// Notification of the end of a build event stream published by a build +// component other than CONTROLLER (See StreamId.BuildComponents). +type BuildEvent_BuildComponentStreamFinished struct { + // How the event stream finished. + Type BuildEvent_BuildComponentStreamFinished_FinishType `protobuf:"varint,1,opt,name=type,enum=google.devtools.build.v1.BuildEvent_BuildComponentStreamFinished_FinishType" json:"type,omitempty"` +} + +func (m *BuildEvent_BuildComponentStreamFinished) Reset() { + *m = BuildEvent_BuildComponentStreamFinished{} +} +func (m *BuildEvent_BuildComponentStreamFinished) String() string { return proto.CompactTextString(m) } +func (*BuildEvent_BuildComponentStreamFinished) ProtoMessage() {} +func (*BuildEvent_BuildComponentStreamFinished) Descriptor() ([]byte, []int) { + return fileDescriptor0, []int{0, 5} +} + +func (m *BuildEvent_BuildComponentStreamFinished) GetType() BuildEvent_BuildComponentStreamFinished_FinishType { + if m != nil { + return m.Type + } + return BuildEvent_BuildComponentStreamFinished_FINISH_TYPE_UNSPECIFIED +} + +// Unique identifier for a build event stream. +type StreamId struct { + ProjectNumber int64 `protobuf:"varint,5,opt,name=project_number,json=projectNumber" json:"project_number,omitempty"` + // The id of a Build message. + BuildId string `protobuf:"bytes,1,opt,name=build_id,json=buildId" json:"build_id,omitempty"` + // The unique invocation ID within this build. + // It should be the same as {invocation} (below) during the migration. + InvocationId string `protobuf:"bytes,6,opt,name=invocation_id,json=invocationId" json:"invocation_id,omitempty"` + // The component that emitted this event. + Component StreamId_BuildComponent `protobuf:"varint,3,opt,name=component,enum=google.devtools.build.v1.StreamId_BuildComponent" json:"component,omitempty"` + // The unique invocation ID within this build. + // It should be the same as {invocation_id} below during the migration. + Invocation string `protobuf:"bytes,4,opt,name=invocation" json:"invocation,omitempty"` +} + +func (m *StreamId) Reset() { *m = StreamId{} } +func (m *StreamId) String() string { return proto.CompactTextString(m) } +func (*StreamId) ProtoMessage() {} +func (*StreamId) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *StreamId) GetProjectNumber() int64 { + if m != nil { + return m.ProjectNumber + } + return 0 +} + +func (m *StreamId) GetBuildId() string { + if m != nil { + return m.BuildId + } + return "" +} + +func (m *StreamId) GetInvocationId() string { + if m != nil { + return m.InvocationId + } + return "" +} + +func (m *StreamId) GetComponent() StreamId_BuildComponent { + if m != nil { + return m.Component + } + return StreamId_UNKNOWN_COMPONENT +} + +func (m *StreamId) GetInvocation() string { + if m != nil { + return m.Invocation + } + return "" +} + +func init() { + proto.RegisterType((*BuildEvent)(nil), "google.devtools.build.v1.BuildEvent") + proto.RegisterType((*BuildEvent_InvocationAttemptStarted)(nil), "google.devtools.build.v1.BuildEvent.InvocationAttemptStarted") + proto.RegisterType((*BuildEvent_InvocationAttemptFinished)(nil), "google.devtools.build.v1.BuildEvent.InvocationAttemptFinished") + proto.RegisterType((*BuildEvent_BuildEnqueued)(nil), "google.devtools.build.v1.BuildEvent.BuildEnqueued") + proto.RegisterType((*BuildEvent_BuildFinished)(nil), "google.devtools.build.v1.BuildEvent.BuildFinished") + proto.RegisterType((*BuildEvent_ConsoleOutput)(nil), "google.devtools.build.v1.BuildEvent.ConsoleOutput") + proto.RegisterType((*BuildEvent_BuildComponentStreamFinished)(nil), "google.devtools.build.v1.BuildEvent.BuildComponentStreamFinished") + proto.RegisterType((*StreamId)(nil), "google.devtools.build.v1.StreamId") + proto.RegisterEnum("google.devtools.build.v1.ConsoleOutputStream", ConsoleOutputStream_name, ConsoleOutputStream_value) + proto.RegisterEnum("google.devtools.build.v1.BuildEvent_BuildComponentStreamFinished_FinishType", BuildEvent_BuildComponentStreamFinished_FinishType_name, BuildEvent_BuildComponentStreamFinished_FinishType_value) + proto.RegisterEnum("google.devtools.build.v1.StreamId_BuildComponent", StreamId_BuildComponent_name, StreamId_BuildComponent_value) +} + +func init() { proto.RegisterFile("google/devtools/build/v1/build_events.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 979 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x6d, 0x6f, 0xdb, 0x54, + 0x14, 0x8e, 0xbb, 0xae, 0x4d, 0x4f, 0x9b, 0xcc, 0xbb, 0x63, 0xaa, 0xeb, 0x56, 0x03, 0x8a, 0x2a, + 0xa1, 0x21, 0x1c, 0xb5, 0x05, 0x6d, 0x30, 0x3a, 0x29, 0x4d, 0x5c, 0xc5, 0xac, 0xd8, 0xd1, 0x8d, + 0xcb, 0x78, 0x11, 0x0a, 0x8e, 0x7d, 0x9b, 0x19, 0x25, 0xbe, 0xc6, 0xbe, 0x0e, 0x0d, 0x12, 0x82, + 0xff, 0x82, 0xc4, 0xff, 0xe0, 0x0b, 0xff, 0x80, 0xff, 0xc2, 0x47, 0xe4, 0x7b, 0xaf, 0xf3, 0xd2, + 0x36, 0x5d, 0x07, 0xdf, 0xec, 0x73, 0x9e, 0xf3, 0x3c, 0xe7, 0x9c, 0x3c, 0xc7, 0x0a, 0x7c, 0xd0, + 0xa7, 0xb4, 0x3f, 0x20, 0xb5, 0x80, 0x8c, 0x18, 0xa5, 0x83, 0xb4, 0xd6, 0xcb, 0xc2, 0x41, 0x50, + 0x1b, 0xed, 0x8b, 0x87, 0x2e, 0x19, 0x91, 0x88, 0xa5, 0x46, 0x9c, 0x50, 0x46, 0x91, 0x26, 0xc0, + 0x46, 0x01, 0x36, 0x38, 0xc6, 0x18, 0xed, 0xeb, 0x3b, 0x92, 0xc6, 0x8b, 0xc3, 0x9a, 0x17, 0x45, + 0x94, 0x79, 0x2c, 0xa4, 0x91, 0xac, 0xd3, 0x5f, 0x27, 0x92, 0x32, 0x8f, 0x65, 0x05, 0x78, 0x4b, + 0x82, 0xf9, 0x5b, 0x2f, 0x3b, 0xaf, 0x79, 0xd1, 0x58, 0xa6, 0xde, 0xbe, 0x9c, 0x62, 0xe1, 0x90, + 0xa4, 0xcc, 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x67, 0xae, 0x60, 0xed, 0xb8, 0x4d, 0x13, 0x63, 0x75, + 0xe9, 0x38, 0x85, 0x1d, 0x9f, 0x0e, 0x17, 0x4e, 0x7f, 0x7c, 0x6f, 0x6a, 0x94, 0x76, 0x7e, 0xf8, + 0x6d, 0xe5, 0x9b, 0x23, 0x09, 0xee, 0xd3, 0x81, 0x17, 0xf5, 0x0d, 0x9a, 0xf4, 0x6b, 0x7d, 0x12, + 0xf1, 0xcf, 0x42, 0x4d, 0xa4, 0xbc, 0x38, 0x4c, 0xaf, 0xfe, 0x33, 0x7a, 0xc6, 0x1f, 0xfe, 0x51, + 0x94, 0xde, 0x0a, 0x07, 0x1f, 0xfe, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x78, 0xf8, 0x09, 0x8d, 0xaa, + 0x09, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/genproto/googleapis/devtools/build/v1/build_status.pb.go b/vendor/google.golang.org/genproto/googleapis/devtools/build/v1/build_status.pb.go new file mode 100644 index 0000000..f7500cd --- /dev/null +++ b/vendor/google.golang.org/genproto/googleapis/devtools/build/v1/build_status.pb.go @@ -0,0 +1,121 @@ +// Code generated by protoc-gen-go. +// source: google/devtools/build/v1/build_status.proto +// DO NOT EDIT! + +package build + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "google.golang.org/genproto/googleapis/api/annotations" +import _ "github.com/golang/protobuf/ptypes/any" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// The end result of the Build. +type BuildStatus_Result int32 + +const ( + // Unspecified or unknown. + BuildStatus_UNKNOWN_STATUS BuildStatus_Result = 0 + // Build was successful and tests (if requested) all pass. + BuildStatus_COMMAND_SUCCEEDED BuildStatus_Result = 1 + // Build error and/or test failure. + BuildStatus_COMMAND_FAILED BuildStatus_Result = 2 + // Unable to obtain a result due to input provided by the user. + BuildStatus_USER_ERROR BuildStatus_Result = 3 + // Unable to obtain a result due to a failure within the build system. + BuildStatus_SYSTEM_ERROR BuildStatus_Result = 4 + // Build required too many resources, such as build tool RAM. + BuildStatus_RESOURCE_EXHAUSTED BuildStatus_Result = 5 + // An invocation attempt time exceeded its deadline. + BuildStatus_INVOCATION_DEADLINE_EXCEEDED BuildStatus_Result = 6 + // Build request time exceeded the request_deadline + BuildStatus_REQUEST_DEADLINE_EXCEEDED BuildStatus_Result = 8 + // The build was cancelled by a call to CancelBuild. + BuildStatus_CANCELLED BuildStatus_Result = 7 +) + +var BuildStatus_Result_name = map[int32]string{ + 0: "UNKNOWN_STATUS", + 1: "COMMAND_SUCCEEDED", + 2: "COMMAND_FAILED", + 3: "USER_ERROR", + 4: "SYSTEM_ERROR", + 5: "RESOURCE_EXHAUSTED", + 6: "INVOCATION_DEADLINE_EXCEEDED", + 8: "REQUEST_DEADLINE_EXCEEDED", + 7: "CANCELLED", +} +var BuildStatus_Result_value = map[string]int32{ + "UNKNOWN_STATUS": 0, + "COMMAND_SUCCEEDED": 1, + "COMMAND_FAILED": 2, + "USER_ERROR": 3, + "SYSTEM_ERROR": 4, + "RESOURCE_EXHAUSTED": 5, + "INVOCATION_DEADLINE_EXCEEDED": 6, + "REQUEST_DEADLINE_EXCEEDED": 8, + "CANCELLED": 7, +} + +func (x BuildStatus_Result) String() string { + return proto.EnumName(BuildStatus_Result_name, int32(x)) +} +func (BuildStatus_Result) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{0, 0} } + +// Status used for both invocation attempt and overall build completion. +type BuildStatus struct { + // The end result. + Result BuildStatus_Result `protobuf:"varint,1,opt,name=result,enum=google.devtools.build.v1.BuildStatus_Result" json:"result,omitempty"` +} + +func (m *BuildStatus) Reset() { *m = BuildStatus{} } +func (m *BuildStatus) String() string { return proto.CompactTextString(m) } +func (*BuildStatus) ProtoMessage() {} +func (*BuildStatus) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } + +func (m *BuildStatus) GetResult() BuildStatus_Result { + if m != nil { + return m.Result + } + return BuildStatus_UNKNOWN_STATUS +} + +func init() { + proto.RegisterType((*BuildStatus)(nil), "google.devtools.build.v1.BuildStatus") + proto.RegisterEnum("google.devtools.build.v1.BuildStatus_Result", BuildStatus_Result_name, BuildStatus_Result_value) +} + +func init() { proto.RegisterFile("google/devtools/build/v1/build_status.proto", fileDescriptor1) } + +var fileDescriptor1 = []byte{ + // 370 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0x5f, 0x4b, 0xe3, 0x40, + 0x14, 0xc5, 0x37, 0xdd, 0xdd, 0xec, 0xee, 0xec, 0x6e, 0xc9, 0x0e, 0xac, 0xb4, 0xa5, 0x42, 0xe9, + 0x93, 0xa0, 0x4c, 0xa8, 0x3e, 0x8a, 0x0f, 0x69, 0xe6, 0x8a, 0xc1, 0x76, 0x52, 0x67, 0x12, 0xff, + 0xbd, 0x84, 0xd4, 0xc6, 0x10, 0x88, 0x99, 0xd2, 0x4c, 0x0a, 0x7e, 0x22, 0x3f, 0x8f, 0xdf, 0xc6, + 0x47, 0xc9, 0x9f, 0x42, 0x41, 0xfb, 0x76, 0x73, 0xcf, 0xef, 0xdc, 0x13, 0xce, 0xa0, 0xc3, 0x58, + 0xca, 0x38, 0x8d, 0xcc, 0x45, 0xb4, 0x56, 0x52, 0xa6, 0xb9, 0x39, 0x2f, 0x92, 0x74, 0x61, 0xae, + 0x47, 0xf5, 0x10, 0xe4, 0x2a, 0x54, 0x45, 0x4e, 0x96, 0x2b, 0xa9, 0x24, 0xee, 0xd4, 0x30, 0xd9, + 0xc0, 0xa4, 0x62, 0xc8, 0x7a, 0xd4, 0xeb, 0x37, 0x67, 0xc2, 0x65, 0x62, 0x86, 0x59, 0x26, 0x55, + 0xa8, 0x12, 0x99, 0x35, 0xbe, 0x5e, 0xb7, 0x51, 0xab, 0xaf, 0x79, 0xf1, 0x68, 0x86, 0xd9, 0x73, + 0x2d, 0x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0x0d, 0x1d, 0xcb, 0x34, 0xcc, 0x62, 0x22, 0x57, 0xb1, 0x19, 0x47, + 0x59, 0xd5, 0xbc, 0x59, 0x4b, 0xe1, 0x32, 0xc9, 0x3f, 0x3e, 0xfe, 0x69, 0x35, 0xbc, 0x69, 0xda, + 0x5c, 0xaf, 0xe0, 0x93, 0xf7, 0x00, 0x00, 0x00, 0xff, 0xff, 0xde, 0x3c, 0xd5, 0xd5, 0x28, 0x02, + 0x00, 0x00, +} diff --git a/vendor/google.golang.org/genproto/googleapis/devtools/build/v1/publish_build_event.pb.go b/vendor/google.golang.org/genproto/googleapis/devtools/build/v1/publish_build_event.pb.go new file mode 100644 index 0000000..9ef0196 --- /dev/null +++ b/vendor/google.golang.org/genproto/googleapis/devtools/build/v1/publish_build_event.pb.go @@ -0,0 +1,403 @@ +// Code generated by protoc-gen-go. +// source: google/devtools/build/v1/publish_build_event.proto +// DO NOT EDIT! + +package build + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "google.golang.org/genproto/googleapis/api/annotations" +import _ "google.golang.org/genproto/googleapis/api/serviceconfig" +import _ "github.com/golang/protobuf/ptypes/any" +import google_protobuf4 "github.com/golang/protobuf/ptypes/duration" +import google_protobuf5 "github.com/golang/protobuf/ptypes/empty" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// The service level of the build request. Backends only uses this value when +// the BuildEnqueued event is published to determine what level of service +// this build should receive. +type PublishLifecycleEventRequest_ServiceLevel int32 + +const ( + // Non-interactive builds can tolerate longer event latencies. This is the + // default ServiceLevel if callers do not specify one. + PublishLifecycleEventRequest_NONINTERACTIVE PublishLifecycleEventRequest_ServiceLevel = 0 + // The events of an interactive build should be delivered with low latency. + PublishLifecycleEventRequest_INTERACTIVE PublishLifecycleEventRequest_ServiceLevel = 1 +) + +var PublishLifecycleEventRequest_ServiceLevel_name = map[int32]string{ + 0: "NONINTERACTIVE", + 1: "INTERACTIVE", +} +var PublishLifecycleEventRequest_ServiceLevel_value = map[string]int32{ + "NONINTERACTIVE": 0, + "INTERACTIVE": 1, +} + +func (x PublishLifecycleEventRequest_ServiceLevel) String() string { + return proto.EnumName(PublishLifecycleEventRequest_ServiceLevel_name, int32(x)) +} +func (PublishLifecycleEventRequest_ServiceLevel) EnumDescriptor() ([]byte, []int) { + return fileDescriptor2, []int{0, 0} +} + +// Publishes 'lifecycle events' that update the high-level state of a build: +// - BuildEnqueued: When a build is scheduled. +// - InvocationAttemptStarted: When work for a build starts; there can be +// multiple invocations for a build (e.g. retries). +// - InvocationAttemptCompleted: When work for a build finishes. +// - BuildFinished: When a build is finished. +type PublishLifecycleEventRequest struct { + // The interactivity of this build. + ServiceLevel PublishLifecycleEventRequest_ServiceLevel `protobuf:"varint,1,opt,name=service_level,json=serviceLevel,enum=google.devtools.build.v1.PublishLifecycleEventRequest_ServiceLevel" json:"service_level,omitempty"` + // The lifecycle build event. If this is a build tool event, the RPC will fail + // with INVALID_REQUEST. + BuildEvent *OrderedBuildEvent `protobuf:"bytes,2,opt,name=build_event,json=buildEvent" json:"build_event,omitempty"` + // If the next event for this build or invocation (depending on the event + // type) hasn't been published after this duration from when {build_event} + // is written to BES, consider this stream expired. If this field is not set, + // BES backend will use its own default value. + StreamTimeout *google_protobuf4.Duration `protobuf:"bytes,3,opt,name=stream_timeout,json=streamTimeout" json:"stream_timeout,omitempty"` + // Additional information about a build request. These are define by the event + // publishers, and the Build Event Service does not validate or interpret + // them. They are used while notifying internal systems of new builds and + // invocations if the OrderedBuildEvent.event type is + // BuildEnqueued/InvocationAttemptStarted. + NotificationKeywords []string `protobuf:"bytes,4,rep,name=notification_keywords,json=notificationKeywords" json:"notification_keywords,omitempty"` + // This field identifies which project (if any) the build is associated with. + ProjectId string `protobuf:"bytes,6,opt,name=project_id,json=projectId" json:"project_id,omitempty"` +} + +func (m *PublishLifecycleEventRequest) Reset() { *m = PublishLifecycleEventRequest{} } +func (m *PublishLifecycleEventRequest) String() string { return proto.CompactTextString(m) } +func (*PublishLifecycleEventRequest) ProtoMessage() {} +func (*PublishLifecycleEventRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} } + +func (m *PublishLifecycleEventRequest) GetServiceLevel() PublishLifecycleEventRequest_ServiceLevel { + if m != nil { + return m.ServiceLevel + } + return PublishLifecycleEventRequest_NONINTERACTIVE +} + +func (m *PublishLifecycleEventRequest) GetBuildEvent() *OrderedBuildEvent { + if m != nil { + return m.BuildEvent + } + return nil +} + +func (m *PublishLifecycleEventRequest) GetStreamTimeout() *google_protobuf4.Duration { + if m != nil { + return m.StreamTimeout + } + return nil +} + +func (m *PublishLifecycleEventRequest) GetNotificationKeywords() []string { + if m != nil { + return m.NotificationKeywords + } + return nil +} + +func (m *PublishLifecycleEventRequest) GetProjectId() string { + if m != nil { + return m.ProjectId + } + return "" +} + +// States which event has been committed. Any failure to commit will cause +// RPC errors, hence not recorded by this proto. +type PublishBuildToolEventStreamResponse struct { + // The stream that contains this event. + StreamId *StreamId `protobuf:"bytes,1,opt,name=stream_id,json=streamId" json:"stream_id,omitempty"` + // The sequence number of this event that has been committed. + SequenceNumber int64 `protobuf:"varint,2,opt,name=sequence_number,json=sequenceNumber" json:"sequence_number,omitempty"` +} + +func (m *PublishBuildToolEventStreamResponse) Reset() { *m = PublishBuildToolEventStreamResponse{} } +func (m *PublishBuildToolEventStreamResponse) String() string { return proto.CompactTextString(m) } +func (*PublishBuildToolEventStreamResponse) ProtoMessage() {} +func (*PublishBuildToolEventStreamResponse) Descriptor() ([]byte, []int) { + return fileDescriptor2, []int{1} +} + +func (m *PublishBuildToolEventStreamResponse) GetStreamId() *StreamId { + if m != nil { + return m.StreamId + } + return nil +} + +func (m *PublishBuildToolEventStreamResponse) GetSequenceNumber() int64 { + if m != nil { + return m.SequenceNumber + } + return 0 +} + +// Build event with contextual information about the stream it belongs to and +// its position in that stream. +type OrderedBuildEvent struct { + // Which build event stream this event belongs to. + StreamId *StreamId `protobuf:"bytes,1,opt,name=stream_id,json=streamId" json:"stream_id,omitempty"` + // The position of this event in the stream. The sequence numbers for a build + // event stream should be a sequence of consecutive natural numbers starting + // from one. (1, 2, 3, ...) + SequenceNumber int64 `protobuf:"varint,2,opt,name=sequence_number,json=sequenceNumber" json:"sequence_number,omitempty"` + // The actual event. + Event *BuildEvent `protobuf:"bytes,3,opt,name=event" json:"event,omitempty"` +} + +func (m *OrderedBuildEvent) Reset() { *m = OrderedBuildEvent{} } +func (m *OrderedBuildEvent) String() string { return proto.CompactTextString(m) } +func (*OrderedBuildEvent) ProtoMessage() {} +func (*OrderedBuildEvent) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{2} } + +func (m *OrderedBuildEvent) GetStreamId() *StreamId { + if m != nil { + return m.StreamId + } + return nil +} + +func (m *OrderedBuildEvent) GetSequenceNumber() int64 { + if m != nil { + return m.SequenceNumber + } + return 0 +} + +func (m *OrderedBuildEvent) GetEvent() *BuildEvent { + if m != nil { + return m.Event + } + return nil +} + +func init() { + proto.RegisterType((*PublishLifecycleEventRequest)(nil), "google.devtools.build.v1.PublishLifecycleEventRequest") + proto.RegisterType((*PublishBuildToolEventStreamResponse)(nil), "google.devtools.build.v1.PublishBuildToolEventStreamResponse") + proto.RegisterType((*OrderedBuildEvent)(nil), "google.devtools.build.v1.OrderedBuildEvent") + proto.RegisterEnum("google.devtools.build.v1.PublishLifecycleEventRequest_ServiceLevel", PublishLifecycleEventRequest_ServiceLevel_name, PublishLifecycleEventRequest_ServiceLevel_value) +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for PublishBuildEvent service + +type PublishBuildEventClient interface { + // Publish a build event stating the new state of a build (typically from the + // build queue). If the event is a BuildEnqueued event, also register the new + // build request ID and its build type to BES. + // + // The backend will persist the event and deliver it to registered frontend + // jobs immediately without batching. + // + // The commit status of the request is reported by the RPC's util_status() + // function. The error code is the canoncial error code defined in + // //util/task/codes.proto. + PublishLifecycleEvent(ctx context.Context, in *PublishLifecycleEventRequest, opts ...grpc.CallOption) (*google_protobuf5.Empty, error) + // Publish build tool events belonging to the same stream to a backend job + // using bidirectional streaming. + PublishBuildToolEventStream(ctx context.Context, opts ...grpc.CallOption) (PublishBuildEvent_PublishBuildToolEventStreamClient, error) +} + +type publishBuildEventClient struct { + cc *grpc.ClientConn +} + +func NewPublishBuildEventClient(cc *grpc.ClientConn) PublishBuildEventClient { + return &publishBuildEventClient{cc} +} + +func (c *publishBuildEventClient) PublishLifecycleEvent(ctx context.Context, in *PublishLifecycleEventRequest, opts ...grpc.CallOption) (*google_protobuf5.Empty, error) { + out := new(google_protobuf5.Empty) + err := grpc.Invoke(ctx, "/google.devtools.build.v1.PublishBuildEvent/PublishLifecycleEvent", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *publishBuildEventClient) PublishBuildToolEventStream(ctx context.Context, opts ...grpc.CallOption) (PublishBuildEvent_PublishBuildToolEventStreamClient, error) { + stream, err := grpc.NewClientStream(ctx, &_PublishBuildEvent_serviceDesc.Streams[0], c.cc, "/google.devtools.build.v1.PublishBuildEvent/PublishBuildToolEventStream", opts...) + if err != nil { + return nil, err + } + x := &publishBuildEventPublishBuildToolEventStreamClient{stream} + return x, nil +} + +type PublishBuildEvent_PublishBuildToolEventStreamClient interface { + Send(*OrderedBuildEvent) error + Recv() (*PublishBuildToolEventStreamResponse, error) + grpc.ClientStream +} + +type publishBuildEventPublishBuildToolEventStreamClient struct { + grpc.ClientStream +} + +func (x *publishBuildEventPublishBuildToolEventStreamClient) Send(m *OrderedBuildEvent) error { + return x.ClientStream.SendMsg(m) +} + +func (x *publishBuildEventPublishBuildToolEventStreamClient) Recv() (*PublishBuildToolEventStreamResponse, error) { + m := new(PublishBuildToolEventStreamResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// Server API for PublishBuildEvent service + +type PublishBuildEventServer interface { + // Publish a build event stating the new state of a build (typically from the + // build queue). If the event is a BuildEnqueued event, also register the new + // build request ID and its build type to BES. + // + // The backend will persist the event and deliver it to registered frontend + // jobs immediately without batching. + // + // The commit status of the request is reported by the RPC's util_status() + // function. The error code is the canoncial error code defined in + // //util/task/codes.proto. + PublishLifecycleEvent(context.Context, *PublishLifecycleEventRequest) (*google_protobuf5.Empty, error) + // Publish build tool events belonging to the same stream to a backend job + // using bidirectional streaming. + PublishBuildToolEventStream(PublishBuildEvent_PublishBuildToolEventStreamServer) error +} + +func RegisterPublishBuildEventServer(s *grpc.Server, srv PublishBuildEventServer) { + s.RegisterService(&_PublishBuildEvent_serviceDesc, srv) +} + +func _PublishBuildEvent_PublishLifecycleEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PublishLifecycleEventRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PublishBuildEventServer).PublishLifecycleEvent(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.devtools.build.v1.PublishBuildEvent/PublishLifecycleEvent", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PublishBuildEventServer).PublishLifecycleEvent(ctx, req.(*PublishLifecycleEventRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PublishBuildEvent_PublishBuildToolEventStream_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(PublishBuildEventServer).PublishBuildToolEventStream(&publishBuildEventPublishBuildToolEventStreamServer{stream}) +} + +type PublishBuildEvent_PublishBuildToolEventStreamServer interface { + Send(*PublishBuildToolEventStreamResponse) error + Recv() (*OrderedBuildEvent, error) + grpc.ServerStream +} + +type publishBuildEventPublishBuildToolEventStreamServer struct { + grpc.ServerStream +} + +func (x *publishBuildEventPublishBuildToolEventStreamServer) Send(m *PublishBuildToolEventStreamResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *publishBuildEventPublishBuildToolEventStreamServer) Recv() (*OrderedBuildEvent, error) { + m := new(OrderedBuildEvent) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +var _PublishBuildEvent_serviceDesc = grpc.ServiceDesc{ + ServiceName: "google.devtools.build.v1.PublishBuildEvent", + HandlerType: (*PublishBuildEventServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "PublishLifecycleEvent", + Handler: _PublishBuildEvent_PublishLifecycleEvent_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "PublishBuildToolEventStream", + Handler: _PublishBuildEvent_PublishBuildToolEventStream_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "google/devtools/build/v1/publish_build_event.proto", +} + +func init() { proto.RegisterFile("google/devtools/build/v1/publish_build_event.proto", fileDescriptor2) } + +var fileDescriptor2 = []byte{ + // 619 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0x65, 0x1b, 0xa8, 0xc8, 0xa6, 0x4d, 0xe9, 0x8a, 0x42, 0x9a, 0xb6, 0x28, 0x32, 0x08, 0x22, + 0x2a, 0xd9, 0x34, 0x95, 0x38, 0x14, 0x55, 0x40, 0x4a, 0x0e, 0x11, 0x55, 0x5a, 0xb9, 0x11, 0x07, + 0x2e, 0x96, 0x63, 0x4f, 0xd3, 0xa5, 0xce, 0xae, 0xf1, 0xae, 0x8d, 0x7a, 0xe5, 0x07, 0x7a, 0xe0, + 0x0b, 0xb8, 0xf3, 0x03, 0x7c, 0x07, 0x7c, 0x02, 0x1f, 0xc1, 0x11, 0x79, 0x77, 0x83, 0x4c, 0x8b, + 0x83, 0xe0, 0xc0, 0x6d, 0x77, 0xde,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5, 0x4b, 0xf2, 0xff, 0x3f, 0x7e, 0xb2, 0x83, 0xaf, 0xe9, 0x25, 0xd1, 0x33, + 0xbd, 0x57, 0xce, 0x52, 0xd8, 0x0e, 0x1d, 0xd2, 0xf9, 0x3a, 0x87, 0x97, 0x8b, 0x6a, 0xea, 0xda, + 0xcf, 0x11, 0x5e, 0xf9, 0xed, 0xe2, 0x92, 0xc7, 0xff, 0xb6, 0xe9, 0xcd, 0x5b, 0x97, 0x16, 0xad, + 0x97, 0xbf, 0x3b, 0xeb, 0xfe, 0xfb, 0x2f, 0xdf, 0x3e, 0xcc, 0xb5, 0xac, 0xb5, 0xfc, 0xa5, 0x47, + 0xbf, 0x84, 0x8a, 0x1d, 0xf3, 0xf9, 0xec, 0xa0, 0x87, 0xe4, 0x13, 0xc2, 0x6b, 0x33, 0xa6, 0x4e, + 0xfe, 0xe6, 0x65, 0x34, 0x77, 0xff, 0xd8, 0xc4, 0xac, 0xcd, 0xb2, 0x36, 0x54, 0xcd, 0xb7, 0x2d, + 0x92, 0xd7, 0x0c, 0x17, 0x4b, 0x6d, 0xa3, 0x47, 0xa8, 0x1b, 0xe3, 0xf5, 0x80, 0x4f, 0x4a, 0x69, + 0xba, 0x0b, 0x5d, 0x3f, 0x38, 0x05, 0x16, 0x1e, 0xe6, 0x6a, 0x1c, 0xa2, 0xd7, 0xbb, 0xc6, 0x73, + 0xcc, 0x23, 0x9f, 0x8d, 0x6d, 0x9e, 0x8c, 0x9d, 0x31, 0x30, 0xa5, 0x95, 0xa3, 0x21, 0x3f, 0xa6, + 0xe2, 0xf2, 0xe7, 0xf8, 0x44, 0x1d, 0xbe, 0x23, 0x34, 0x9a, 0x57, 0xce, 0xdb, 0x3f, 0x02, 0x00, + 0x00, 0xff, 0xff, 0xb1, 0xfc, 0x73, 0x01, 0xcb, 0x05, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/genproto/googleapis/devtools/source/v1/source_context.pb.go b/vendor/google.golang.org/genproto/googleapis/devtools/source/v1/source_context.pb.go index 38b77d4..dbfa096 100644 --- a/vendor/google.golang.org/genproto/googleapis/devtools/source/v1/source_context.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/devtools/source/v1/source_context.pb.go @@ -893,53 +893,54 @@ func init() { func init() { proto.RegisterFile("google/devtools/source/v1/source_context.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 758 bytes of a gzipped FileDescriptorProto + // 780 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcb, 0x4e, 0xdb, 0x4c, - 0x14, 0x8e, 0xe3, 0x90, 0xe0, 0x13, 0x02, 0xd1, 0xfc, 0x17, 0x05, 0x28, 0x02, 0x2c, 0x55, 0x45, - 0xa2, 0x72, 0x44, 0x2a, 0x55, 0x2d, 0xad, 0x44, 0x09, 0x4d, 0x9b, 0x08, 0x1a, 0xd0, 0x94, 0x5e, - 0x37, 0x91, 0xb1, 0x47, 0xc6, 0xc5, 0x78, 0xac, 0xb1, 0x13, 0xe0, 0x25, 0xba, 0xee, 0xc3, 0xf5, - 0x11, 0xba, 0xac, 0xd4, 0x6d, 0x35, 0x17, 0x43, 0x12, 0x82, 0x41, 0x6a, 0x57, 0x9e, 0x39, 0xfe, - 0xbe, 0xef, 0x9c, 0x39, 0x97, 0x19, 0xb0, 0x3c, 0x4a, 0xbd, 0x80, 0xd4, 0x5d, 0x32, 0x48, 0x28, - 0x0d, 0xe2, 0x7a, 0x4c, 0xfb, 0xcc, 0x21, 0xf5, 0xc1, 0x86, 0x5a, 0xf5, 0x1c, 0x1a, 0x26, 0xe4, - 0x3c, 0xb1, 0x22, 0x46, 0x13, 0x8a, 0xe6, 0x25, 0xde, 0x4a, 0xf1, 0x96, 0x44, 0x59, 0x83, 0x8d, - 0x85, 0x7b, 0x4a, 0xca, 0x8e, 0xfc, 0xba, 0x1d, 0x86, 0x34, 0xb1, 0x13, 0x9f, 0x86, 0xb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x7d, 0xf4, 0x47, 0x63, 0x38, 0xe1, 0x96, 0x68, 0x0e, 0x60, 0xc9, 0xa1, 0xa7, 0x37, 0x6b, 0x34, - 0xd1, 0x48, 0x2d, 0x0e, 0xf8, 0x7b, 0x78, 0xa0, 0x7d, 0xde, 0x52, 0x04, 0x8f, 0x06, 0x76, 0xe8, - 0x59, 0x94, 0x79, 0x75, 0x8f, 0x84, 0xe2, 0xb5, 0xac, 0xcb, 0x5f, 0x76, 0xe4, 0xc7, 0x13, 0x5e, - 0xe6, 0x67, 0x72, 0x75, 0x54, 0x14, 0xd8, 0x47, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xd7, 0xee, - 0x6b, 0xa8, 0xc4, 0x07, 0x00, 0x00, + 0x14, 0x8e, 0xe3, 0x90, 0xe0, 0x13, 0x02, 0xd1, 0xfc, 0x7f, 0xab, 0x00, 0x45, 0x80, 0xa5, 0xaa, + 0x48, 0x54, 0x8e, 0x92, 0x4a, 0x55, 0x4b, 0x2b, 0x51, 0x02, 0x29, 0x89, 0xa0, 0x01, 0x4d, 0x29, + 0xbd, 0x6c, 0x22, 0x63, 0x8f, 0x8c, 0x8b, 0xf1, 0x58, 0xb6, 0x13, 0xe0, 0x25, 0xba, 0xe6, 0x19, + 0xfa, 0x4c, 0x7d, 0x84, 0x2e, 0x2b, 0x75, 0x5b, 0xcd, 0xc5, 0x90, 0x84, 0x60, 0x90, 0xda, 0x95, + 0x67, 0x8e, 0xbf, 0xef, 0x3b, 0x67, 0xce, 0x65, 0x06, 0x0c, 0x87, 0x52, 0xc7, 0x23, 0x55, 0x9b, + 0xf4, 0x63, 0x4a, 0xbd, 0xa8, 0x1a, 0xd1, 0x5e, 0x68, 0x91, 0x6a, 0xbf, 0x26, 0x57, 0x5d, 0x8b, + 0xfa, 0x31, 0x39, 0x8f, 0x8d, 0x20, 0xa4, 0x31, 0x45, 0xb3, 0x02, 0x6f, 0x24, 0x78, 0x43, 0xa0, + 0x8c, 0x7e, 0x6d, 0xee, 0x91, 0x94, 0x32, 0x03, 0xb7, 0x6a, 0xfa, 0x3e, 0x8d, 0xcd, 0xd8, 0xa5, + 0x7e, 0x24, 0x88, 0xfa, 0x8f, 0x2c, 0x94, 0xde, 0x73, 0xec, 0xa6, 0x10, 0x44, 0x18, 0xc0, 0xf2, + 0x68, 0xcf, 0xee, 0x86, 0x24, 0xa0, 0x15, 0x65, 0x49, 0x59, 0x29, 0xd6, 0x6b, 0xc6, 0xad, 0xfa, + 0xc6, 0x26, 0x03, 0x63, 0x12, 0xd0, 0x21, 0x99, 0x56, 0x06, 0x6b, 0x56, 0xf2, 0x07, 0x99, 0x30, + 0x23, 0x34, 0xcf, 0x68, 0x78, 0x12, 0x05, 0xa6, 0x45, 0x2a, 0x59, 0x2e, 0xfc, 0xfc, 0x2e, 0xe1, + 0x8f, 0x09, 0x61, 0x54, 0x7d, 0xda, 0x1a, 0xfa, 0x8d, 0x5a, 0x90, 0x77, 0x48, 0x18, 0xba, 0x71, + 0x45, 0xe5, 0xca, 0x46, 0x8a, 0xf2, 0x36, 0x07, 0x8e, 0x2a, 0x4a, 0x3e, 0x5a, 0x07, 0xd5, 0x71, + 0xe3, 0x4a, 0x9e, 0xcb, 0xac, 0xa6, 0xc9, 0xdc, 0xd4, 0x60, 0xcc, 0x86, 0x06, 0x05, 0x59, 0x1d, + 0xfd, 0xa7, 0x02, 0x0f, 0x9a, 0xe7, 0x31, 0xf1, 0x6d, 0x62, 0x0f, 0xa7, 0xb9, 0x71, 0x05, 0x92, + 0x39, 0x5e, 0x49, 0xf1, 0x34, 0x44, 0xc5, 0x09, 0x11, 0x1d, 0x40, 0xde, 0x33, 0x8f, 0x88, 0x17, + 0x55, 0xb2, 0x4b, 0xea, 0x4a, 0xb1, 0xfe, 0x3a, 0x45, 0x62, 0x6c, 0x14, 0xc6, 0x2e, 0xa7, 0x37, + 0xfd, 0x38, 0xbc, 0xc0, 0x52, 0x6b, 0xee, 0x25, 0x14, 0x07, 0xcc, 0xa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0xef, 0x24, 0x33, 0xb0, 0x3c, 0xeb, + 0x47, 0x50, 0x1e, 0xed, 0xa3, 0xbf, 0x1a, 0xc3, 0x31, 0xb7, 0x44, 0xe3, 0x52, 0x81, 0x05, 0x8b, + 0x9e, 0xde, 0x2e, 0xd2, 0x40, 0x43, 0xc5, 0xd8, 0x67, 0x0f, 0xe2, 0xbe, 0xf2, 0x65, 0x5d, 0x12, + 0x1c, 0xea, 0x99, 0xbe, 0x63, 0xd0, 0xd0, 0xa9, 0x3a, 0xc4, 0xe7, 0xcf, 0x65, 0x55, 0xfc, 0x32, + 0x03, 0x37, 0x1a, 0xf3, 0x34, 0xbf, 0x12, 0xab, 0xef, 0xd9, 0xc5, 0x6d, 0xa1, 0xc0, 0x8f, 0x68, + 0x6c, 0x91, 0xfe, 0x01, 0x77, 0x2c, 0xbc, 0x19, 0x87, 0xb5, 0xa3, 0x3c, 0x57, 0x7b, 0xf6, 0x27, + 0x00, 0x00, 0xff, 0xff, 0x9e, 0xd0, 0x5c, 0x10, 0xe7, 0x07, 0x00, 0x00, } diff --git a/vendor/google.golang.org/genproto/googleapis/devtools/sourcerepo/v1/sourcerepo.pb.go b/vendor/google.golang.org/genproto/googleapis/devtools/sourcerepo/v1/sourcerepo.pb.go new file mode 100644 index 0000000..08a34d2 --- /dev/null +++ b/vendor/google.golang.org/genproto/googleapis/devtools/sourcerepo/v1/sourcerepo.pb.go @@ -0,0 +1,635 @@ +// Code generated by protoc-gen-go. +// source: google/devtools/sourcerepo/v1/sourcerepo.proto +// DO NOT EDIT! + +/* +Package sourcerepo is a generated protocol buffer package. + +It is generated from these files: + google/devtools/sourcerepo/v1/sourcerepo.proto + +It has these top-level messages: + Repo + MirrorConfig + GetRepoRequest + ListReposRequest + ListReposResponse + CreateRepoRequest + DeleteRepoRequest +*/ +package sourcerepo + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "google.golang.org/genproto/googleapis/api/annotations" +import _ "google.golang.org/genproto/googleapis/api/serviceconfig" +import google_iam_v11 "google.golang.org/genproto/googleapis/iam/v1" +import google_iam_v1 "google.golang.org/genproto/googleapis/iam/v1" +import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +// A repository (or repo) is a Git repository storing versioned source content. +type Repo struct { + // Resource name of the repository, of the form + // `projects//repos/`. + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // The disk usage of the repo, in bytes. + // Only returned by GetRepo. + Size int64 `protobuf:"varint,2,opt,name=size" json:"size,omitempty"` + // URL to clone the repository from Google Cloud Source Repositories. + Url string `protobuf:"bytes,3,opt,name=url" json:"url,omitempty"` + // How this repository mirrors a repository managed by another service. + MirrorConfig *MirrorConfig `protobuf:"bytes,4,opt,name=mirror_config,json=mirrorConfig" json:"mirror_config,omitempty"` +} + +func (m *Repo) Reset() { *m = Repo{} } +func (m *Repo) String() string { return proto.CompactTextString(m) } +func (*Repo) ProtoMessage() {} +func (*Repo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *Repo) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Repo) GetSize() int64 { + if m != nil { + return m.Size + } + return 0 +} + +func (m *Repo) GetUrl() string { + if m != nil { + return m.Url + } + return "" +} + +func (m *Repo) GetMirrorConfig() *MirrorConfig { + if m != nil { + return m.MirrorConfig + } + return nil +} + +// Configuration to automatically mirror a repository from another +// hosting service, for example GitHub or BitBucket. +type MirrorConfig struct { + // URL of the main repository at the other hosting service. + Url string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"` + // ID of the webhook listening to updates to trigger mirroring. + // Removing this webook from the other hosting service will stop + // Google Cloud Source Repositories from receiving notifications, + // and thereby disabling mirroring. + WebhookId string `protobuf:"bytes,2,opt,name=webhook_id,json=webhookId" json:"webhook_id,omitempty"` + // ID of the SSH deploy key at the other hosting service. + // Removing this key from the other service would deauthorize + // Google Cloud Source Repositories from mirroring. + DeployKeyId string `protobuf:"bytes,3,opt,name=deploy_key_id,json=deployKeyId" json:"deploy_key_id,omitempty"` +} + +func (m *MirrorConfig) Reset() { *m = MirrorConfig{} } +func (m *MirrorConfig) String() string { return proto.CompactTextString(m) } +func (*MirrorConfig) ProtoMessage() {} +func (*MirrorConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *MirrorConfig) GetUrl() string { + if m != nil { + return m.Url + } + return "" +} + +func (m *MirrorConfig) GetWebhookId() string { + if m != nil { + return m.WebhookId + } + return "" +} + +func (m *MirrorConfig) GetDeployKeyId() string { + if m != nil { + return m.DeployKeyId + } + return "" +} + +// Request for GetRepo. +type GetRepoRequest struct { + // The name of the requested repository. Values are of the form + // `projects//repos/`. + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` +} + +func (m *GetRepoRequest) Reset() { *m = GetRepoRequest{} } +func (m *GetRepoRequest) String() string { return proto.CompactTextString(m) } +func (*GetRepoRequest) ProtoMessage() {} +func (*GetRepoRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *GetRepoRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +// Request for ListRepos. +type ListReposRequest struct { + // The project ID whose repos should be listed. Values are of the form + // `projects/`. + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // Maximum number of repositories to return; between 1 and 500. + // If not set or zero, defaults to 100 at the server. + PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize" json:"page_size,omitempty"` + // Resume listing repositories where a prior ListReposResponse + // left off. This is an opaque token that must be obtained from + // a recent, prior ListReposResponse's next_page_token field. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken" json:"page_token,omitempty"` +} + +func (m *ListReposRequest) Reset() { *m = ListReposRequest{} } +func (m *ListReposRequest) String() string { return proto.CompactTextString(m) } +func (*ListReposRequest) ProtoMessage() {} +func (*ListReposRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *ListReposRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *ListReposRequest) GetPageSize() int32 { + if m != nil { + return m.PageSize + } + return 0 +} + +func (m *ListReposRequest) GetPageToken() string { + if m != nil { + return m.PageToken + } + return "" +} + +// Response for ListRepos. The size is not set in the returned repositories. +type ListReposResponse struct { + // The listed repos. + Repos []*Repo `protobuf:"bytes,1,rep,name=repos" json:"repos,omitempty"` + // If non-empty, additional repositories exist within the project. These + // can be retrieved by including this value in the next ListReposRequest's + // page_token field. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken" json:"next_page_token,omitempty"` +} + +func (m *ListReposResponse) Reset() { *m = ListReposResponse{} } +func (m *ListReposResponse) String() string { return proto.CompactTextString(m) } +func (*ListReposResponse) ProtoMessage() {} +func (*ListReposResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } + +func (m *ListReposResponse) GetRepos() []*Repo { + if m != nil { + return m.Repos + } + return nil +} + +func (m *ListReposResponse) GetNextPageToken() string { + if m != nil { + return m.NextPageToken + } + return "" +} + +// Request for CreateRepo +type CreateRepoRequest struct { + // The project in which to create the repo. Values are of the form + // `projects/`. + Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` + // The repo to create. Only name should be set; setting other fields + // is an error. The project in the name should match the parent field. + Repo *Repo `protobuf:"bytes,2,opt,name=repo" json:"repo,omitempty"` +} + +func (m *CreateRepoRequest) Reset() { *m = CreateRepoRequest{} } +func (m *CreateRepoRequest) String() string { return proto.CompactTextString(m) } +func (*CreateRepoRequest) ProtoMessage() {} +func (*CreateRepoRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } + +func (m *CreateRepoRequest) GetParent() string { + if m != nil { + return m.Parent + } + return "" +} + +func (m *CreateRepoRequest) GetRepo() *Repo { + if m != nil { + return m.Repo + } + return nil +} + +// Request for DeleteRepo. +type DeleteRepoRequest struct { + // The name of the repo to delete. Values are of the form + // `projects//repos/`. + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` +} + +func (m *DeleteRepoRequest) Reset() { *m = DeleteRepoRequest{} } +func (m *DeleteRepoRequest) String() string { return proto.CompactTextString(m) } +func (*DeleteRepoRequest) ProtoMessage() {} +func (*DeleteRepoRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } + +func (m *DeleteRepoRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func init() { + proto.RegisterType((*Repo)(nil), "google.devtools.sourcerepo.v1.Repo") + proto.RegisterType((*MirrorConfig)(nil), "google.devtools.sourcerepo.v1.MirrorConfig") + proto.RegisterType((*GetRepoRequest)(nil), "google.devtools.sourcerepo.v1.GetRepoRequest") + proto.RegisterType((*ListReposRequest)(nil), "google.devtools.sourcerepo.v1.ListReposRequest") + proto.RegisterType((*ListReposResponse)(nil), "google.devtools.sourcerepo.v1.ListReposResponse") + proto.RegisterType((*CreateRepoRequest)(nil), "google.devtools.sourcerepo.v1.CreateRepoRequest") + proto.RegisterType((*DeleteRepoRequest)(nil), "google.devtools.sourcerepo.v1.DeleteRepoRequest") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for SourceRepo service + +type SourceRepoClient interface { + // Returns all repos belonging to a project. The sizes of the repos are + // not set by ListRepos. To get the size of a repo, use GetRepo. + ListRepos(ctx context.Context, in *ListReposRequest, opts ...grpc.CallOption) (*ListReposResponse, error) + // Returns information about a repo. + GetRepo(ctx context.Context, in *GetRepoRequest, opts ...grpc.CallOption) (*Repo, error) + // Creates a repo in the given project with the given name. + // + // If the named repository already exists, `CreateRepo` returns + // `ALREADY_EXISTS`. + CreateRepo(ctx context.Context, in *CreateRepoRequest, opts ...grpc.CallOption) (*Repo, error) + // Deletes a repo. + DeleteRepo(ctx context.Context, in *DeleteRepoRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + // Sets the access control policy on the specified resource. Replaces any + // existing policy. + SetIamPolicy(ctx context.Context, in *google_iam_v11.SetIamPolicyRequest, opts ...grpc.CallOption) (*google_iam_v1.Policy, error) + // Gets the access control policy for a resource. + // Returns an empty policy if the resource exists and does not have a policy + // set. + GetIamPolicy(ctx context.Context, in *google_iam_v11.GetIamPolicyRequest, opts ...grpc.CallOption) (*google_iam_v1.Policy, error) + // Returns permissions that a caller has on the specified resource. + // If the resource does not exist, this will return an empty set of + // permissions, not a NOT_FOUND error. + TestIamPermissions(ctx context.Context, in *google_iam_v11.TestIamPermissionsRequest, opts ...grpc.CallOption) (*google_iam_v11.TestIamPermissionsResponse, error) +} + +type sourceRepoClient struct { + cc *grpc.ClientConn +} + +func NewSourceRepoClient(cc *grpc.ClientConn) SourceRepoClient { + return &sourceRepoClient{cc} +} + +func (c *sourceRepoClient) ListRepos(ctx context.Context, in *ListReposRequest, opts ...grpc.CallOption) (*ListReposResponse, error) { + out := new(ListReposResponse) + err := grpc.Invoke(ctx, "/google.devtools.sourcerepo.v1.SourceRepo/ListRepos", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sourceRepoClient) GetRepo(ctx context.Context, in *GetRepoRequest, opts ...grpc.CallOption) (*Repo, error) { + out := new(Repo) + err := grpc.Invoke(ctx, "/google.devtools.sourcerepo.v1.SourceRepo/GetRepo", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sourceRepoClient) CreateRepo(ctx context.Context, in *CreateRepoRequest, opts ...grpc.CallOption) (*Repo, error) { + out := new(Repo) + err := grpc.Invoke(ctx, "/google.devtools.sourcerepo.v1.SourceRepo/CreateRepo", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sourceRepoClient) DeleteRepo(ctx context.Context, in *DeleteRepoRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) + err := grpc.Invoke(ctx, "/google.devtools.sourcerepo.v1.SourceRepo/DeleteRepo", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sourceRepoClient) SetIamPolicy(ctx context.Context, in *google_iam_v11.SetIamPolicyRequest, opts ...grpc.CallOption) (*google_iam_v1.Policy, error) { + out := new(google_iam_v1.Policy) + err := grpc.Invoke(ctx, "/google.devtools.sourcerepo.v1.SourceRepo/SetIamPolicy", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sourceRepoClient) GetIamPolicy(ctx context.Context, in *google_iam_v11.GetIamPolicyRequest, opts ...grpc.CallOption) (*google_iam_v1.Policy, error) { + out := new(google_iam_v1.Policy) + err := grpc.Invoke(ctx, "/google.devtools.sourcerepo.v1.SourceRepo/GetIamPolicy", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sourceRepoClient) TestIamPermissions(ctx context.Context, in *google_iam_v11.TestIamPermissionsRequest, opts ...grpc.CallOption) (*google_iam_v11.TestIamPermissionsResponse, error) { + out := new(google_iam_v11.TestIamPermissionsResponse) + err := grpc.Invoke(ctx, "/google.devtools.sourcerepo.v1.SourceRepo/TestIamPermissions", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for SourceRepo service + +type SourceRepoServer interface { + // Returns all repos belonging to a project. The sizes of the repos are + // not set by ListRepos. To get the size of a repo, use GetRepo. + ListRepos(context.Context, *ListReposRequest) (*ListReposResponse, error) + // Returns information about a repo. + GetRepo(context.Context, *GetRepoRequest) (*Repo, error) + // Creates a repo in the given project with the given name. + // + // If the named repository already exists, `CreateRepo` returns + // `ALREADY_EXISTS`. + CreateRepo(context.Context, *CreateRepoRequest) (*Repo, error) + // Deletes a repo. + DeleteRepo(context.Context, *DeleteRepoRequest) (*google_protobuf1.Empty, error) + // Sets the access control policy on the specified resource. Replaces any + // existing policy. + SetIamPolicy(context.Context, *google_iam_v11.SetIamPolicyRequest) (*google_iam_v1.Policy, error) + // Gets the access control policy for a resource. + // Returns an empty policy if the resource exists and does not have a policy + // set. + GetIamPolicy(context.Context, *google_iam_v11.GetIamPolicyRequest) (*google_iam_v1.Policy, error) + // Returns permissions that a caller has on the specified resource. + // If the resource does not exist, this will return an empty set of + // permissions, not a NOT_FOUND error. + TestIamPermissions(context.Context, *google_iam_v11.TestIamPermissionsRequest) (*google_iam_v11.TestIamPermissionsResponse, error) +} + +func RegisterSourceRepoServer(s *grpc.Server, srv SourceRepoServer) { + s.RegisterService(&_SourceRepo_serviceDesc, srv) +} + +func _SourceRepo_ListRepos_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListReposRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SourceRepoServer).ListRepos(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.devtools.sourcerepo.v1.SourceRepo/ListRepos", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SourceRepoServer).ListRepos(ctx, req.(*ListReposRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SourceRepo_GetRepo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRepoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SourceRepoServer).GetRepo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.devtools.sourcerepo.v1.SourceRepo/GetRepo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SourceRepoServer).GetRepo(ctx, req.(*GetRepoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SourceRepo_CreateRepo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateRepoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SourceRepoServer).CreateRepo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.devtools.sourcerepo.v1.SourceRepo/CreateRepo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SourceRepoServer).CreateRepo(ctx, req.(*CreateRepoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SourceRepo_DeleteRepo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRepoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SourceRepoServer).DeleteRepo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.devtools.sourcerepo.v1.SourceRepo/DeleteRepo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SourceRepoServer).DeleteRepo(ctx, req.(*DeleteRepoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SourceRepo_SetIamPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(google_iam_v11.SetIamPolicyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SourceRepoServer).SetIamPolicy(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.devtools.sourcerepo.v1.SourceRepo/SetIamPolicy", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SourceRepoServer).SetIamPolicy(ctx, req.(*google_iam_v11.SetIamPolicyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SourceRepo_GetIamPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(google_iam_v11.GetIamPolicyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SourceRepoServer).GetIamPolicy(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.devtools.sourcerepo.v1.SourceRepo/GetIamPolicy", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SourceRepoServer).GetIamPolicy(ctx, req.(*google_iam_v11.GetIamPolicyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SourceRepo_TestIamPermissions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(google_iam_v11.TestIamPermissionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SourceRepoServer).TestIamPermissions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.devtools.sourcerepo.v1.SourceRepo/TestIamPermissions", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SourceRepoServer).TestIamPermissions(ctx, req.(*google_iam_v11.TestIamPermissionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _SourceRepo_serviceDesc = grpc.ServiceDesc{ + ServiceName: "google.devtools.sourcerepo.v1.SourceRepo", + HandlerType: (*SourceRepoServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListRepos", + Handler: _SourceRepo_ListRepos_Handler, + }, + { + MethodName: "GetRepo", + Handler: _SourceRepo_GetRepo_Handler, + }, + { + MethodName: "CreateRepo", + Handler: _SourceRepo_CreateRepo_Handler, + }, + { + MethodName: "DeleteRepo", + Handler: _SourceRepo_DeleteRepo_Handler, + }, + { + MethodName: "SetIamPolicy", + Handler: _SourceRepo_SetIamPolicy_Handler, + }, + { + MethodName: "GetIamPolicy", + Handler: _SourceRepo_GetIamPolicy_Handler, + }, + { + MethodName: "TestIamPermissions", + Handler: _SourceRepo_TestIamPermissions_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "google/devtools/sourcerepo/v1/sourcerepo.proto", +} + +func init() { proto.RegisterFile("google/devtools/sourcerepo/v1/sourcerepo.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 748 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0xd1, 0x4e, 0x13, 0x4d, + 0x14, 0xce, 0xd0, 0x02, 0x7f, 0x0f, 0xe5, 0x07, 0x26, 0x81, 0x34, 0xc5, 0x92, 0xba, 0x28, 0xd6, + 0x12, 0x77, 0x05, 0x35, 0xc4, 0x1a, 0x13, 0x03, 0x9a, 0x86, 0xa8, 0x49, 0x53, 0xb8, 0xf2, 0xa6, + 0xd9, 0xb6, 0x87, 0x65, 0xa5, 0xbb, 0xb3, 0xee, 0x4c, 0xab, 0xd5, 0xa0, 0x09, 0x09, 0xf7, 0x46, + 0x1e, 0xc3, 0xc7, 0xf1, 0x15, 0x7c, 0x08, 0x2f, 0xcd, 0xcc, 0xee, 0xd2, 0x2d, 0xad, 0xed, 0xde, + 0xcd, 0x9c, 0xf3, 0x9d, 0xf3, 0x7d, 0xf3, 0xcd, 0xd9, 0x59, 0xd0, 0x2d, 0xc6, 0xac, 0x0e, 0x1a, + 0x6d, 0xec, 0x09, 0xc6, 0x3a, 0xdc, 0xe0, 0xac, 0xeb, 0xb7, 0xd0, 0x47, 0x8f, 0x19, 0xbd, 0x9d, + 0xd8, 0x4e, 0xf7, 0x7c, 0x26, 0x18, 0x2d, 0x04, 0x78, 0x3d, 0xc2, 0xeb, 0x31, 0x44, 0x6f, 0x27, + 0x7f, 0x2b, 0x6c, 0x67, 0x7a, 0xb6, 0x61, 0xba, 0x2e, 0x13, 0xa6, 0xb0, 0x99, 0xcb, 0x83, 0xe2, + 0xfc, 0x6a, 0x3c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b, 0x83, 0xc7, 0xa1, 0x26, 0x27, 0xa4, 0x46, 0xde, 0x55, + 0xc3, 0x0a, 0x8b, 0x75, 0x4c, 0xd7, 0xd2, 0x99, 0x6f, 0x19, 0x16, 0xba, 0x6a, 0x7e, 0x8c, 0x20, + 0x65, 0x7a, 0x36, 0xff, 0xc7, 0x9f, 0xfb, 0xd9, 0x60, 0xd7, 0x9c, 0x53, 0x35, 0x8f, 0xfe, 0x06, + 0x00, 0x00, 0xff, 0xff, 0x30, 0x80, 0x85, 0x9e, 0xec, 0x07, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/genproto/googleapis/logging/v2/log_entry.pb.go b/vendor/google.golang.org/genproto/googleapis/logging/v2/log_entry.pb.go index 0a16bd2..d81b52c 100644 --- a/vendor/google.golang.org/genproto/googleapis/logging/v2/log_entry.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/logging/v2/log_entry.pb.go @@ -18,6 +18,7 @@ It has these top-level messages: DeleteLogRequest WriteLogEntriesRequest WriteLogEntriesResponse + WriteLogEntriesPartialErrors ListLogEntriesRequest ListLogEntriesResponse ListMonitoredResourceDescriptorsRequest @@ -102,6 +103,8 @@ type LogEntry struct { // time stamps are more than a couple of hours in the future. Log entries // with time stamps in the past are accepted. Timestamp *google_protobuf4.Timestamp `protobuf:"bytes,9,opt,name=timestamp" json:"timestamp,omitempty"` + // Output only. The time the log entry was received by Stackdriver Logging. + ReceiveTimestamp *google_protobuf4.Timestamp `protobuf:"bytes,24,opt,name=receive_timestamp,json=receiveTimestamp" json:"receive_timestamp,omitempty"` // Optional. The severity of the log entry. The default value is // `LogSeverity.DEFAULT`. Severity google_logging_type1.LogSeverity `protobuf:"varint,10,opt,name=severity,enum=google.logging.type.LogSeverity" json:"severity,omitempty"` @@ -203,6 +206,13 @@ func (m *LogEntry) GetTimestamp() *google_protobuf4.Timestamp { return nil } +func (m *LogEntry) GetReceiveTimestamp() *google_protobuf4.Timestamp { + if m != nil { + return m.ReceiveTimestamp + } + return nil +} + func (m *LogEntry) GetSeverity() google_logging_type1.LogSeverity { if m != nil { return m.Severity @@ -443,48 +453,49 @@ func init() { func init() { proto.RegisterFile("google/logging/v2/log_entry.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 679 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x94, 0xd1, 0x6e, 0xd3, 0x3c, - 0x14, 0xc7, 0x97, 0x76, 0x5f, 0x97, 0xba, 0xdd, 0xf6, 0xcd, 0x1a, 0x5b, 0x56, 0x86, 0x28, 0x1b, - 0x82, 0x72, 0x93, 0x4a, 0xe5, 0x66, 0x63, 0x93, 0x10, 0x9d, 0x10, 0x43, 0x2a, 0x30, 0x79, 0x88, - 0x0b, 0x84, 0x54, 0x79, 0x89, 0x9b, 0x19, 0x52, 0x3b, 0x38, 0x4e, 0x45, 0xaf, 0x78, 0x04, 0xde, - 0x83, 0x27, 0xe4, 0x12, 0xf9, 0xd8, 0xe9, 0x4a, 0x3b, 0xed, 0xee, 0x9c, 0xfa, 0xf7, 0x3f, 0xff, - 0xe3, 0xe3, 0x93, 0xa2, 0x47, 0x89, 0x94, 0x49, 0xca, 0xba, 0xa9, 0x4c, 0x12, 0x2e, 0x92, 0xee, - 0xa4, 0x67, 0xc2, 0x21, 0x13, 0x5a, 0x4d, 0xc3, 0x4c, 0x49, 0x2d, 0xf1, 0x96, 0x45, 0x42, 0x87, - 0x84, 0x93, 0x5e, 0x6b, 0xdf, 0xa9, 0x68, 0xc6, 0xbb, 0x54, 0x08, 0xa9, 0xa9, 0xe6, 0x52, 0xe4, - 0x56, 0xd0, 0x3a, 0x9c, 0x3b, 0x1d, 0x4b, 0xc1, 0xb5, 0x54, 0x2c, 0x1e, 0x2a, 0x96, 0xcb, 0x42, - 0x45, 0xcc, 0x41, 0x4f, 0x16, 0x8c, 0xf5, 0x34, 0x63, 0xdd, 0x6b, 0xad, 0xb3, 0xa1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0x73, 0xcb, 0x73, 0xc0, 0xd1, 0xd6, 0xd2, 0x7d, - 0xf0, 0x06, 0xaa, 0xf0, 0xd8, 0x95, 0xaa, 0xf0, 0x18, 0xb7, 0x90, 0x9f, 0x29, 0x19, 0x17, 0x11, - 0x53, 0xae, 0xd8, 0x2c, 0x37, 0x2e, 0x23, 0xae, 0x72, 0x0d, 0xbb, 0xea, 0x13, 0x9b, 0x60, 0x8c, - 0x56, 0x53, 0x9a, 0x6b, 0x78, 0x68, 0x9f, 0x40, 0x7c, 0xf0, 0x05, 0xed, 0xdc, 0x7e, 0x35, 0x43, - 0x8f, 0x78, 0xca, 0x9c, 0x23, 0xc4, 0x50, 0x81, 0x0b, 0xdb, 0x7c, 0x95, 0x40, 0x6c, 0xfa, 0x18, - 0x15, 0x22, 0x82, 0xf9, 0x55, 0x6d, 0x1f, 0x65, 0xde, 0xff, 0x89, 0xee, 0x45, 0x72, 0xbc, 0x3c, - 0xce, 0xfe, 0x7a, 0x69, 0x7a, 0x01, 0x5f, 0x9a, 0xf7, 0xf9, 0xc8, 0x31, 0x89, 0x4c, 0xa9, 0x48, - 0x42, 0xa9, 0x92, 0x6e, 0xc2, 0x04, 0xec, 0x7e, 0xd7, 0x1e, 0xd1, 0x8c, 0xe7, 0x73, 0x7f, 0xa3, - 0x27, 0x2e, 0xfc, 0xe3, 0x79, 0xbf, 0x2b, 0xbb, 0x6f, 0xac, 0xfa, 0x2c, 0x95, 0x45, 0x6c, 0xde, - 0x0a, 0x7c, 0x3e, 0xf5, 0xae, 0x6a, 0x50, 0xe1, 0xf9, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x34, - 0x32, 0x8a, 0x87, 0x87, 0x05, 0x00, 0x00, + // 699 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0x5f, 0x6f, 0xdb, 0x36, + 0x10, 0x8f, 0xec, 0xcc, 0x91, 0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 0x66, 0x0c, 0xfc, 0x1b, 0xaa, 0x73, 0x91, 0x33, 0xa5, 0x87, 0x3c, 0x0e, 0xd6, 0xe1, 0xde, 0x7c, + 0xfb, 0xe1, 0x79, 0x8c, 0x2f, 0x51, 0x73, 0x71, 0xf1, 0x82, 0x0d, 0x28, 0xef, 0x61, 0xf9, 0x6b, + 0xad, 0x33, 0x62, 0x71, 0xa4, 0x71, 0x3f, 0x4f, 0xf0, 0x13, 0x54, 0x4b, 0xe9, 0x1d, 0x4b, 0xf3, + 0xa0, 0xd1, 0xae, 0x76, 0x1a, 0xbd, 0x7f, 0xc2, 0x95, 0x67, 0x13, 0x96, 0x5b, 0x14, 0x0e, 0x00, + 0x09, 0x31, 0x71, 0x34, 0xdc, 0x47, 0x75, 0x99, 0x31, 0x05, 0x2f, 0x29, 0xd8, 0x86, 0x12, 0xfe, + 0x7a, 0x44, 0xe3, 0x55, 0x89, 0x25, 0x73, 0x1a, 0xde, 0x43, 0xbf, 0x68, 0x45, 0x23, 0x16, 0xec, + 0x43, 0x8b, 0x36, 0xc1, 0x04, 0x6d, 0xdb, 0x3d, 0x1b, 0xa6, 0x32, 0xb2, 0xfa, 0x07, 0xa0, 0xff, + 0xef, 0x23, 0xfa, 0xb7, 0xc0, 0x18, 0x38, 0x02, 0xd9, 0xca, 0x7f, 0xc8, 0x5b, 0x67, 0xa8, 0xb1, + 0xd0, 0x04, 0xde, 0x41, 0xd5, 0x0f, 0x6c, 0x1a, 0x78, 0x60, 0x6b, 0x42, 0x53, 0xca, 0x84, 0xa6, + 0x05, 0x83, 0x55, 0xae, 0x13, 0x9b, 0xfc, 0x5f, 0x39, 0xf5, 0xfa, 0x75, 0xb4, 0xe1, 0xb6, 0xf0, + 0x98, 0xa3, 0xdd, 0x95, 0x7e, 0xf0, 0x16, 0xaa, 0xf0, 0xd8, 0x49, 0x55, 0x78, 0x8c, 0x5b, 0xc8, + 0xcf, 0x94, 0x8c, 0x8b, 0x88, 0x29, 0x27, 0x36, 0xcb, 0x8d, 0xcb, 0x88, 0xab, 0x5c, 0xc3, 0xd2, + 0xfb, 0xc4, 0x26, 0x18, 0xa3, 0xf5, 0x94, 0xe6, 0x1a, 0x2e, 0xda, 0x27, 0x10, 0x1f, 0xbf, 0x43, + 0xfb, 0x0f, 0xb7, 0x66, 0xd0, 0x23, 0x9e, 0x32, 0xe7, 0x08, 0x31, 0x28, 0x70, 0x61, 0x8b, 0xaf, + 0x12, 0x88, 0x4d, 0x1d, 0xa3, 0x42, 0x44, 0x30, 0xbf, 0xaa, 0xad, 0xa3, 0xcc, 0xfb, 0x9f, 0xd1, + 0xaf, 0x91, 0x1c, 0xaf, 0x8e, 0xb3, 0xbf, 0x59, 0x9a, 0xde, 0xc0, 0x93, 0xf5, 0xde, 0x9e, 0x3a, + 0x4c, 0x22, 0x53, 0x2a, 0x92, 0x50, 0xaa, 0xa4, 0x9b, 0x30, 0x01, 0x4f, 0xa0, 0x6b, 0x8f, 0x68, + 0xc6, 0xf3, 0x85, 0xff, 0xf1, 0xb9, 0x0b, 0xbf, 0x79, 0xde, 0x97, 0xca, 0xc1, 0x95, 0x65, 0x5f, + 0xa6, 0xb2, 0x88, 0xcd, 0x5d, 0x81, 0xcf, 0x9b, 0xde, 0x5d, 0x0d, 0x14, 0xfe, 0xfb, 0x1e, 0x00, + 0x00, 0xff, 0xff, 0xa9, 0x61, 0x44, 0xa8, 0xd0, 0x05, 0x00, 0x00, } diff --git a/vendor/google.golang.org/genproto/googleapis/logging/v2/logging.pb.go b/vendor/google.golang.org/genproto/googleapis/logging/v2/logging.pb.go index 9859c5b..06eeb23 100644 --- a/vendor/google.golang.org/genproto/googleapis/logging/v2/logging.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/logging/v2/logging.pb.go @@ -12,7 +12,7 @@ import google_api3 "google.golang.org/genproto/googleapis/api/monitoredres" import _ "github.com/golang/protobuf/ptypes/duration" import google_protobuf5 "github.com/golang/protobuf/ptypes/empty" import _ "github.com/golang/protobuf/ptypes/timestamp" -import _ "google.golang.org/genproto/googleapis/rpc/status" +import google_rpc "google.golang.org/genproto/googleapis/rpc/status" import ( context "golang.org/x/net/context" @@ -157,6 +157,29 @@ func (m *WriteLogEntriesResponse) String() string { return proto.Comp func (*WriteLogEntriesResponse) ProtoMessage() {} func (*WriteLogEntriesResponse) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} } +// Error details for WriteLogEntries with partial success. +type WriteLogEntriesPartialErrors struct { + // When `WriteLogEntriesRequest.partial_success` is true, records the error + // status for entries that were not written due to a permanent error, keyed + // by the entry's zero-based index in `WriteLogEntriesRequest.entries`. + // + // Failed requests for which no entries are written will not include + // per-entry errors. + LogEntryErrors map[int32]*google_rpc.Status `protobuf:"bytes,1,rep,name=log_entry_errors,json=logEntryErrors" json:"log_entry_errors,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` +} + +func (m *WriteLogEntriesPartialErrors) Reset() { *m = WriteLogEntriesPartialErrors{} } +func (m *WriteLogEntriesPartialErrors) String() string { return proto.CompactTextString(m) } +func (*WriteLogEntriesPartialErrors) ProtoMessage() {} +func (*WriteLogEntriesPartialErrors) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{3} } + +func (m *WriteLogEntriesPartialErrors) GetLogEntryErrors() map[int32]*google_rpc.Status { + if m != nil { + return m.LogEntryErrors + } + return nil +} + // The parameters to `ListLogEntries`. type ListLogEntriesRequest struct { // Deprecated. Use `resource_names` instead. One or more project identifiers @@ -204,7 +227,7 @@ type ListLogEntriesRequest struct { func (m *ListLogEntriesRequest) Reset() { *m = ListLogEntriesRequest{} } func (m *ListLogEntriesRequest) String() string { return proto.CompactTextString(m) } func (*ListLogEntriesRequest) ProtoMessage() {} -func (*ListLogEntriesRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{3} } +func (*ListLogEntriesRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{4} } func (m *ListLogEntriesRequest) GetProjectIds() []string { if m != nil { @@ -268,7 +291,7 @@ type ListLogEntriesResponse struct { func (m *ListLogEntriesResponse) Reset() { *m = ListLogEntriesResponse{} } func (m *ListLogEntriesResponse) String() string { return proto.CompactTextString(m) } func (*ListLogEntriesResponse) ProtoMessage() {} -func (*ListLogEntriesResponse) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{4} } +func (*ListLogEntriesResponse) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{5} } func (m *ListLogEntriesResponse) GetEntries() []*LogEntry { if m != nil { @@ -303,7 +326,7 @@ func (m *ListMonitoredResourceDescriptorsRequest) Reset() { func (m *ListMonitoredResourceDescriptorsRequest) String() string { return proto.CompactTextString(m) } func (*ListMonitoredResourceDescriptorsRequest) ProtoMessage() {} func (*ListMonitoredResourceDescriptorsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor1, []int{5} + return fileDescriptor1, []int{6} } func (m *ListMonitoredResourceDescriptorsRequest) GetPageSize() int32 { @@ -336,7 +359,7 @@ func (m *ListMonitoredResourceDescriptorsResponse) Reset() { func (m *ListMonitoredResourceDescriptorsResponse) String() string { return proto.CompactTextString(m) } func (*ListMonitoredResourceDescriptorsResponse) ProtoMessage() {} func (*ListMonitoredResourceDescriptorsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor1, []int{6} + return fileDescriptor1, []int{7} } func (m *ListMonitoredResourceDescriptorsResponse) GetResourceDescriptors() []*google_api3.MonitoredResourceDescriptor { @@ -376,7 +399,7 @@ type ListLogsRequest struct { func (m *ListLogsRequest) Reset() { *m = ListLogsRequest{} } func (m *ListLogsRequest) String() string { return proto.CompactTextString(m) } func (*ListLogsRequest) ProtoMessage() {} -func (*ListLogsRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{7} } +func (*ListLogsRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{8} } func (m *ListLogsRequest) GetParent() string { if m != nil { @@ -414,7 +437,7 @@ type ListLogsResponse struct { func (m *ListLogsResponse) Reset() { *m = ListLogsResponse{} } func (m *ListLogsResponse) String() string { return proto.CompactTextString(m) } func (*ListLogsResponse) ProtoMessage() {} -func (*ListLogsResponse) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{8} } +func (*ListLogsResponse) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{9} } func (m *ListLogsResponse) GetLogNames() []string { if m != nil { @@ -434,6 +457,7 @@ func init() { proto.RegisterType((*DeleteLogRequest)(nil), "google.logging.v2.DeleteLogRequest") proto.RegisterType((*WriteLogEntriesRequest)(nil), "google.logging.v2.WriteLogEntriesRequest") proto.RegisterType((*WriteLogEntriesResponse)(nil), "google.logging.v2.WriteLogEntriesResponse") + proto.RegisterType((*WriteLogEntriesPartialErrors)(nil), "google.logging.v2.WriteLogEntriesPartialErrors") proto.RegisterType((*ListLogEntriesRequest)(nil), "google.logging.v2.ListLogEntriesRequest") proto.RegisterType((*ListLogEntriesResponse)(nil), "google.logging.v2.ListLogEntriesResponse") proto.RegisterType((*ListMonitoredResourceDescriptorsRequest)(nil), "google.logging.v2.ListMonitoredResourceDescriptorsRequest") @@ -673,62 +697,66 @@ var _LoggingServiceV2_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("google/logging/v2/logging.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 912 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xd7, 0xd8, 0x4d, 0x6a, 0xbf, 0xd0, 0xc4, 0x1d, 0x1a, 0xc7, 0xb5, 0xd3, 0xc6, 0x6c, 0x28, - 0xd9, 0x5a, 0xea, 0xae, 0x30, 0xaa, 0xd4, 0xa6, 0xe2, 0x12, 0x5a, 0x21, 0xa4, 0x14, 0x45, 0x1b, - 0xd4, 0x4a, 0xbd, 0x58, 0x6b, 0xfb, 0x75, 0x35, 0x74, 0xbd, 0xb3, 0xcc, 0x8c, 0x1d, 0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 0xa1, 0xee, 0xd0, 0xa6, 0xa6, 0x3e, 0x58, 0x46, 0x71, 0x0c, - 0xa5, 0xbc, 0x79, 0xa9, 0xf3, 0x7e, 0x6d, 0x26, 0xb4, 0xf6, 0x97, 0x62, 0x6c, 0xf8, 0x4f, 0x4d, - 0xf8, 0xdb, 0x74, 0x57, 0x87, 0x7f, 0x93, 0x8d, 0xd8, 0x54, 0x4b, 0xbd, 0x35, 0x3d, 0x75, 0xf4, - 0x13, 0x6c, 0xf7, 0xf8, 0x60, 0xde, 0xdf, 0xd1, 0x47, 0xb6, 0xe9, 0x4f, 0x74, 0xbf, 0x9e, 0x90, - 0x17, 0x0f, 0x2c, 0x24, 0xe2, 0x71, 0x98, 0x44, 0x1e, 0x17, 0x91, 0x1f, 0x61, 0x62, 0xba, 0xd9, - 0xcf, 0xae, 0xc2, 0x94, 0xc9, 0xa9, 0xff, 0x21, 0x8f, 0xec, 0xe7, 0xbf, 0x84, 0xfc, 0x5a, 0xd8, - 0xf9, 0x3a, 0x7b, 0xfd, 0x55, 0xcc, 0x87, 0x7d, 0xcf, 0xba, 0xf6, 0x9e, 0xb5, 0xbb, 0xeb, 0xc6, - 0xc3, 0x17, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x9a, 0x9f, 0x7c, 0xe8, 0x3f, 0x09, 0x00, 0x00, + // 975 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcd, 0x6e, 0xdb, 0x46, + 0x10, 0x06, 0xa5, 0xd8, 0x91, 0x46, 0x8d, 0xad, 0x6c, 0x62, 0x59, 0x91, 0x9c, 0x58, 0xa5, 0x9b, + 0x5a, 0x11, 0x10, 0x12, 0x55, 0x11, 0x20, 0x71, 0xd0, 0x8b, 0x13, 0xa3, 0x28, 0xe0, 0x14, 0x06, + 0xdd, 0x26, 0x40, 0x2e, 0x02, 0x25, 0x4d, 0x88, 0x6d, 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c4, 0xaa, 0x91, 0x26, 0x0a, 0x00, 0x00, } diff --git a/vendor/google.golang.org/genproto/googleapis/logging/v2/logging_config.pb.go b/vendor/google.golang.org/genproto/googleapis/logging/v2/logging_config.pb.go index 3c1b1d6..f96a1a5 100644 --- a/vendor/google.golang.org/genproto/googleapis/logging/v2/logging_config.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/logging/v2/logging_config.pb.go @@ -103,6 +103,20 @@ type LogSink struct { // Consult the destination service's documentation to determine the // appropriate IAM roles to assign to the identity. WriterIdentity string `protobuf:"bytes,8,opt,name=writer_identity,json=writerIdentity" json:"writer_identity,omitempty"` + // Optional. This field applies only to sinks owned by organizations and + // folders. If the field is false, the default, only the logs owned by the + // sink's parent resource are available for export. If the field is true, then + // logs from all the projects, folders, and billing accounts contained in the + // sink's parent resource are also available for export. Whether a particular + // log entry from the children is exported depends on the sink's filter + // expression. For example, if this field is true, then the filter + // `resource.type=gce_instance` would export all Compute Engine VM instance + // log entries from all projects in the sink's parent. To only export entries + // from certain child projects, filter on the project part of the log name: + // + // logName:("projects/test-project1/" OR "projects/test-project2/") AND + // resource.type=gce_instance + IncludeChildren bool `protobuf:"varint,9,opt,name=include_children,json=includeChildren" json:"include_children,omitempty"` // Optional. The time at which this sink will begin exporting log entries. // Log entries are exported only if their timestamp is not earlier than the // start time. The default value of this field is the time the sink is @@ -156,6 +170,13 @@ func (m *LogSink) GetWriterIdentity() string { return "" } +func (m *LogSink) GetIncludeChildren() bool { + if m != nil { + return m.IncludeChildren + } + return false +} + func (m *LogSink) GetStartTime() *google_protobuf4.Timestamp { if m != nil { return m.StartTime @@ -658,55 +679,57 @@ var _ConfigServiceV2_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("google/logging/v2/logging_config.proto", fileDescriptor2) } var fileDescriptor2 = []byte{ - // 787 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55,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78, 0xda, 0x38, - 0x1e, 0x91, 0x2e, 0xee, 0x38, 0xe8, 0x1e, 0x8a, 0x8f, 0x82, 0x40, 0xef, 0xce, 0xa3, 0x3a, 0x23, - 0x4b, 0x63, 0x67, 0x71, 0x92, 0xd2, 0x94, 0xb9, 0xfb, 0xeb, 0x9f, 0x7f, 0xfd, 0x96, 0xdb, 0x46, - 0xaf, 0xc4, 0xab, 0x77, 0xa7, 0x36, 0xf6, 0x65, 0x14, 0xb3, 0x1f, 0x70, 0x97, 0x27, 0x76, 0xed, - 0xde, 0x56, 0x42, 0xe2, 0xb0, 0x9a, 0x0a, 0x04, 0xbd, 0x33, 0xe7, 0xde, 0x69, 0xf1, 0x18, 0x0b, - 0x46, 0x69, 0xd6, 0x24, 0xe0, 0x0e, 0x32, 0x25, 0xe0, 0xe3, 0x10, 0x26, 0x30, 0x15, 0xa4, 0x5d, - 0xbb, 0x47, 0x77, 0x00, 0x4f, 0x32, 0x43, 0xf3, 0x1a, 0xca, 0xa8, 0x70, 0x21, 0xf6, 0xfb, 0x12, - 0x7b, 0xd7, 0x5c, 0xdc, 0xec, 0xe7, 0x6a, 0xdb, 0x3f, 0x6b, 0x00, 0x4f, 0x82, 0x9a, 0x8b, 0x9e, - 0xd1, 0xdb, 0x42, 0xf4, 0x7d, 0x89, 0x5e, 0x33, 0x9e, 0xd1, 0x79, 0x4a, 0x61, 0x04, 0xf0, 0x24, - 0x9d, 0xb9, 0x0c, 0x32, 0xca, 0x32, 0x36, 0x33, 0xef, 0x60, 0x43, 0xfc, 0x74, 0xc6, 0x73, 0xaf, - 0x3d, 0x03, 0xfd, 0xe0, 0x17, 0x0d, 0x5e, 0x76, 0x59, 0x98, 0xc5, 0x3b, 0x40, 0x27, 0xea, 0xac, - 0xe4, 0xd9, 0x12, 0x10, 0x2d, 0xed, 0xbb, 0x4f, 0xd3, 0xc4, 0x80, 0x0d, 0x7c, 0x1a, 0x58, 0x2c, - 0x0e, 0xec, 0x00, 0x53, 0x49, 0xc0, 0x56, 0x21, 0x3f, 0x22, 0xc9, 0xc4, 0xff, 0xf5, 0x8b, 0xf4, - 0xf8, 0x47, 0xee, 0xcd, 0x63, 0x55, 0x5a, 0x1f, 0xb0, 0x61, 0xcf, 0x4a, 0x6f, 0xb7, 0x3a, 0xce, - 0x65, 0x5e, 0x96, 0x7f, 0xf4, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x9e, 0xa5, 0xee, 0x9d, - 0x07, 0x00, 0x00, + // 818 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0xff, 0x6e, 0xdb, 0x54, + 0x14, 0xc6, 0xe9, 0xaf, 0xe4, 0x54, 0x6b, 0x93, 0x0b, 0x2b, 0x56, 0xca, 0x58, 0x30, 0xdb, 0x08, + 0x41, 0xd8, 0x25, 0x80, 0xc4, 0x0f, 0x21, 0xc4, 0xb2, 0x76, 0xaa, 0x54, 0xba, 0xca, 0xe9, 0x82, + 0x84, 0x90, 0x2c, 0x2f, 0x3e, 0x31, 0x97, 0xd9, 0xf7, 0x7a, 0xf6, 0x75, 0x60, 0x9b, 0x2a, 0x01, + 0x6f, 0x80, 0x90, 0x78, 0x08, 0x9e, 0x81, 0xb7, 0xe0, 0x15, 0x78, 0x0e, 0x84, 0xee, 0x8f, 0xac, + 0x69, 0x1d, 0x42, 0xff, 0xe2, 0xaf, 0xdc, 0xfb, 0x9d, 0x73, 0xee, 0xf7, 0x9d, 0x73, 0x3e, 0x39, + 0x70, 0x27, 0xe6, 0x3c, 0x4e, 0xd0, 0x4b, 0x78, 0x1c, 0x53, 0x16, 0x7b, 0xd3, 0xfe, 0xec, 0x18, + 0x8c, 0x39, 0x9b, 0xd0, 0xd8, 0xcd, 0x72, 0x2e, 0x38, 0x69, 0xe9, 0x3c, 0xd7, 0x04, 0xdd, 0x69, + 0xbf, 0xfd, 0x9a, 0x29, 0x0d, 0x33,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17, 0x2e, 0xe5, 0x7e, 0x47, 0x71, 0xdf, + 0x76, 0x96, 0x37, 0xfb, 0x89, 0xde, 0xf6, 0x8f, 0x16, 0xc0, 0xb9, 0xa1, 0x16, 0xb2, 0x57, 0xfc, + 0xb6, 0x94, 0x7d, 0x4f, 0xb1, 0xf7, 0xda, 0x57, 0xe8, 0xdc, 0x48, 0x98, 0x02, 0x9c, 0x5b, 0x67, + 0xa1, 0x82, 0x8a, 0xb3, 0xda, 0x3b, 0x95, 0xef, 0xe0, 0xbe, 0xfc, 0x7f, 0x9a, 0xcd, 0xbd, 0x77, + 0x05, 0xf6, 0xbb, 0x3f, 0x59, 0x70, 0x7d, 0xcc, 0xd3, 0x2a, 0xdf, 0x5d, 0x72, 0xa4, 0xcf, 0xda, + 0x9e, 0x27, 0x92, 0xe2, 0xc4, 0xfa, 0xfa, 0x23, 0x93, 0x18, 0xf3, 0x24, 0x64, 0xb1, 0xcb, 0xf3, + 0xd8, 0x8b, 0x91, 0x29, 0x01, 0x9e, 0x0e, 0x85, 0x19, 0x2d, 0xe6, 0xfe, 0x8a, 0x3f, 0x35, 0xc7, + 0xdf, 0x6b, 0xaf, 0xde, 0xd7, 0xa5, 0x83, 0x84, 0x97, 0x91, 0x6b, 0x5e, 0x77, 0x47, 0xfd, 0x47, + 0xeb, 0xaa, 0xfc, 0xfd, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xda, 0xa4, 0xe3, 0x1e, 0xc8, 0x07, + 0x00, 0x00, } diff --git a/vendor/google.golang.org/genproto/googleapis/privacy/dlp/v2beta1/dlp.pb.go b/vendor/google.golang.org/genproto/googleapis/privacy/dlp/v2beta1/dlp.pb.go index 23f8ca0..2fce8ad 100644 --- a/vendor/google.golang.org/genproto/googleapis/privacy/dlp/v2beta1/dlp.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/privacy/dlp/v2beta1/dlp.pb.go @@ -22,6 +22,7 @@ It has these top-level messages: InspectContentRequest InspectContentResponse CreateInspectOperationRequest + OutputStorageConfig InfoTypeStatistics InspectOperationMetadata InspectOperationResult @@ -41,6 +42,7 @@ It has these top-level messages: Projection DatastoreOptions CloudStorageOptions + CloudStoragePath StorageConfig CloudStorageKey DatastoreKey @@ -651,6 +653,19 @@ type CreateInspectOperationRequest struct { InspectConfig *InspectConfig `protobuf:"bytes,1,opt,name=inspect_config,json=inspectConfig" json:"inspect_config,omitempty"` // Specification of the data set to process. StorageConfig *StorageConfig `protobuf:"bytes,2,opt,name=storage_config,json=storageConfig" json:"storage_config,omitempty"` + // Optional location to store findings. The bucket must already exist and + // the Google APIs service account for DLP must have write permission to + // write to the given bucket. + // Results will be split over multiple csv files with each file name matching + // the pattern "[operation_id] + [count].csv". + // The operation_id will match the identifier for the Operation, + // and the [count] is a counter used for tracking the number of files written. + // The CSV file(s) contain the following columns regardless of storage type + // scanned: id, info_type, likelihood, byte size of finding, quote, time_stamp + // For cloud storage the next two columns are: file_path, start_offset + // For datastore the next two columns are: project_id, namespace_id, path, + // column_name, offset. + OutputConfig *OutputStorageConfig `protobuf:"bytes,3,opt,name=output_config,json=outputConfig" json:"output_config,omitempty"` } func (m *CreateInspectOperationRequest) Reset() { *m = CreateInspectOperationRequest{} } @@ -672,6 +687,104 @@ func (m *CreateInspectOperationRequest) GetStorageConfig() *StorageConfig { return nil } +func (m *CreateInspectOperationRequest) GetOutputConfig() *OutputStorageConfig { + if m != nil { + return m.OutputConfig + } + return nil +} + +// Cloud repository for storing output. +type OutputStorageConfig struct { + // Types that are valid to be assigned to Type: + // *OutputStorageConfig_StoragePath + Type isOutputStorageConfig_Type `protobuf_oneof:"type"` +} + +func (m *OutputStorageConfig) Reset() { *m = OutputStorageConfig{} } +func (m *OutputStorageConfig) String() string { return proto.CompactTextString(m) } +func (*OutputStorageConfig) ProtoMessage() {} +func (*OutputStorageConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } + +type isOutputStorageConfig_Type interface { + isOutputStorageConfig_Type() +} + +type OutputStorageConfig_StoragePath struct { + StoragePath *CloudStoragePath `protobuf:"bytes,2,opt,name=storage_path,json=storagePath,oneof"` +} + +func (*OutputStorageConfig_StoragePath) isOutputStorageConfig_Type() {} + +func (m *OutputStorageConfig) GetType() isOutputStorageConfig_Type { + if m != nil { + return m.Type + } + return nil +} + +func (m *OutputStorageConfig) GetStoragePath() *CloudStoragePath { + if x, ok := m.GetType().(*OutputStorageConfig_StoragePath); ok { + return x.StoragePath + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*OutputStorageConfig) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _OutputStorageConfig_OneofMarshaler, _OutputStorageConfig_OneofUnmarshaler, _OutputStorageConfig_OneofSizer, []interface{}{ + (*OutputStorageConfig_StoragePath)(nil), + } +} + +func _OutputStorageConfig_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*OutputStorageConfig) + // type + switch x := m.Type.(type) { + case *OutputStorageConfig_StoragePath: + b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.StoragePath); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("OutputStorageConfig.Type has unexpected type %T", x) + } + return nil +} + +func _OutputStorageConfig_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*OutputStorageConfig) + switch tag { + case 2: // type.storage_path + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(CloudStoragePath) + err := b.DecodeMessage(msg) + m.Type = &OutputStorageConfig_StoragePath{msg} + return true, err + default: + return false, nil + } +} + +func _OutputStorageConfig_OneofSizer(msg proto.Message) (n int) { + m := msg.(*OutputStorageConfig) + // type + switch x := m.Type.(type) { + case *OutputStorageConfig_StoragePath: + s := proto.Size(x.StoragePath) + n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + // Stats regarding a specific InfoType. type InfoTypeStatistics struct { // The type of finding this stat is for. @@ -683,7 +796,7 @@ type InfoTypeStatistics struct { func (m *InfoTypeStatistics) Reset() { *m = InfoTypeStatistics{} } func (m *InfoTypeStatistics) String() string { return proto.CompactTextString(m) } func (*InfoTypeStatistics) ProtoMessage() {} -func (*InfoTypeStatistics) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } +func (*InfoTypeStatistics) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } func (m *InfoTypeStatistics) GetInfoType() *InfoType { if m != nil { @@ -708,12 +821,18 @@ type InspectOperationMetadata struct { InfoTypeStats []*InfoTypeStatistics `protobuf:"bytes,2,rep,name=info_type_stats,json=infoTypeStats" json:"info_type_stats,omitempty"` // The time which this request was started. CreateTime *google_protobuf3.Timestamp `protobuf:"bytes,3,opt,name=create_time,json=createTime" json:"create_time,omitempty"` + // The inspect config used to create the Operation. + RequestInspectConfig *InspectConfig `protobuf:"bytes,5,opt,name=request_inspect_config,json=requestInspectConfig" json:"request_inspect_config,omitempty"` + // The storage config used to create the Operation. + RequestStorageConfig *StorageConfig `protobuf:"bytes,6,opt,name=request_storage_config,json=requestStorageConfig" json:"request_storage_config,omitempty"` + // Optional location to store findings. + RequestOutputConfig *OutputStorageConfig `protobuf:"bytes,7,opt,name=request_output_config,json=requestOutputConfig" json:"request_output_config,omitempty"` } func (m *InspectOperationMetadata) Reset() { *m = InspectOperationMetadata{} } func (m *InspectOperationMetadata) String() string { return proto.CompactTextString(m) } func (*InspectOperationMetadata) ProtoMessage() {} -func (*InspectOperationMetadata) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } +func (*InspectOperationMetadata) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } func (m *InspectOperationMetadata) GetProcessedBytes() int64 { if m != nil { @@ -743,6 +862,27 @@ func (m *InspectOperationMetadata) GetCreateTime() *google_protobuf3.Timestamp { return nil } +func (m *InspectOperationMetadata) GetRequestInspectConfig() *InspectConfig { + if m != nil { + return m.RequestInspectConfig + } + return nil +} + +func (m *InspectOperationMetadata) GetRequestStorageConfig() *StorageConfig { + if m != nil { + return m.RequestStorageConfig + } + return nil +} + +func (m *InspectOperationMetadata) GetRequestOutputConfig() *OutputStorageConfig { + if m != nil { + return m.RequestOutputConfig + } + return nil +} + // The operational data. type InspectOperationResult struct { // The server-assigned name, which is only unique within the same service that @@ -754,7 +894,7 @@ type InspectOperationResult struct { func (m *InspectOperationResult) Reset() { *m = InspectOperationResult{} } func (m *InspectOperationResult) String() string { return proto.CompactTextString(m) } func (*InspectOperationResult) ProtoMessage() {} -func (*InspectOperationResult) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } +func (*InspectOperationResult) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } func (m *InspectOperationResult) GetName() string { if m != nil { @@ -781,7 +921,7 @@ type ListInspectFindingsRequest struct { func (m *ListInspectFindingsRequest) Reset() { *m = ListInspectFindingsRequest{} } func (m *ListInspectFindingsRequest) String() string { return proto.CompactTextString(m) } func (*ListInspectFindingsRequest) ProtoMessage() {} -func (*ListInspectFindingsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } +func (*ListInspectFindingsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } func (m *ListInspectFindingsRequest) GetName() string { if m != nil { @@ -816,7 +956,7 @@ type ListInspectFindingsResponse struct { func (m *ListInspectFindingsResponse) Reset() { *m = ListInspectFindingsResponse{} } func (m *ListInspectFindingsResponse) String() string { return proto.CompactTextString(m) } func (*ListInspectFindingsResponse) ProtoMessage() {} -func (*ListInspectFindingsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } +func (*ListInspectFindingsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } func (m *ListInspectFindingsResponse) GetResult() *InspectResult { if m != nil { @@ -845,7 +985,7 @@ type InfoTypeDescription struct { func (m *InfoTypeDescription) Reset() { *m = InfoTypeDescription{} } func (m *InfoTypeDescription) String() string { return proto.CompactTextString(m) } func (*InfoTypeDescription) ProtoMessage() {} -func (*InfoTypeDescription) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } +func (*InfoTypeDescription) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} } func (m *InfoTypeDescription) GetName() string { if m != nil { @@ -882,7 +1022,7 @@ type ListInfoTypesRequest struct { func (m *ListInfoTypesRequest) Reset() { *m = ListInfoTypesRequest{} } func (m *ListInfoTypesRequest) String() string { return proto.CompactTextString(m) } func (*ListInfoTypesRequest) ProtoMessage() {} -func (*ListInfoTypesRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} } +func (*ListInfoTypesRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} } func (m *ListInfoTypesRequest) GetCategory() string { if m != nil { @@ -907,7 +1047,7 @@ type ListInfoTypesResponse struct { func (m *ListInfoTypesResponse) Reset() { *m = ListInfoTypesResponse{} } func (m *ListInfoTypesResponse) String() string { return proto.CompactTextString(m) } func (*ListInfoTypesResponse) ProtoMessage() {} -func (*ListInfoTypesResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} } +func (*ListInfoTypesResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} } func (m *ListInfoTypesResponse) GetInfoTypes() []*InfoTypeDescription { if m != nil { @@ -927,7 +1067,7 @@ type CategoryDescription struct { func (m *CategoryDescription) Reset() { *m = CategoryDescription{} } func (m *CategoryDescription) String() string { return proto.CompactTextString(m) } func (*CategoryDescription) ProtoMessage() {} -func (*CategoryDescription) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} } +func (*CategoryDescription) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} } func (m *CategoryDescription) GetName() string { if m != nil { @@ -955,7 +1095,7 @@ type ListRootCategoriesRequest struct { func (m *ListRootCategoriesRequest) Reset() { *m = ListRootCategoriesRequest{} } func (m *ListRootCategoriesRequest) String() string { return proto.CompactTextString(m) } func (*ListRootCategoriesRequest) ProtoMessage() {} -func (*ListRootCategoriesRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} } +func (*ListRootCategoriesRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} } func (m *ListRootCategoriesRequest) GetLanguageCode() string { if m != nil { @@ -973,7 +1113,7 @@ type ListRootCategoriesResponse struct { func (m *ListRootCategoriesResponse) Reset() { *m = ListRootCategoriesResponse{} } func (m *ListRootCategoriesResponse) String() string { return proto.CompactTextString(m) } func (*ListRootCategoriesResponse) ProtoMessage() {} -func (*ListRootCategoriesResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} } +func (*ListRootCategoriesResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} } func (m *ListRootCategoriesResponse) GetCategories() []*CategoryDescription { if m != nil { @@ -996,6 +1136,7 @@ func init() { proto.RegisterType((*InspectContentRequest)(nil), "google.privacy.dlp.v2beta1.InspectContentRequest") proto.RegisterType((*InspectContentResponse)(nil), "google.privacy.dlp.v2beta1.InspectContentResponse") proto.RegisterType((*CreateInspectOperationRequest)(nil), "google.privacy.dlp.v2beta1.CreateInspectOperationRequest") + proto.RegisterType((*OutputStorageConfig)(nil), "google.privacy.dlp.v2beta1.OutputStorageConfig") proto.RegisterType((*InfoTypeStatistics)(nil), "google.privacy.dlp.v2beta1.InfoTypeStatistics") proto.RegisterType((*InspectOperationMetadata)(nil), "google.privacy.dlp.v2beta1.InspectOperationMetadata") proto.RegisterType((*InspectOperationResult)(nil), "google.privacy.dlp.v2beta1.InspectOperationResult") @@ -1266,109 +1407,115 @@ var _DlpService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("google/privacy/dlp/v2beta1/dlp.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 1651 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00,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0x9d, 0xf5, 0x3c, 0x36, 0x58, 0x00, 0x71, - 0x45, 0x28, 0xc9, 0x25, 0xfa, 0x21, 0xcc, 0x3b, 0xcc, 0x25, 0x21, 0xa3, 0x01, 0xd7, 0x66, 0x0a, - 0x77, 0x35, 0x53, 0x4f, 0x35, 0x13, 0x5b, 0x55, 0xda, 0xb7, 0x3d, 0x62, 0x9d, 0xb2, 0x2b, 0x22, - 0x6e, 0x84, 0xa8, 0x9c, 0x6f, 0xe5, 0xa6, 0x49, 0xc0, 0xd3, 0x08, 0x81, 0xd4, 0xde, 0x11, 0xca, - 0x68, 0x17, 0x20, 0x22, 0x0e, 0x8b, 0x5c, 0xeb, 0x82, 0x0c, 0x75, 0x9c, 0xbf, 0x99, 0x4b, 0x49, - 0xa2, 0x3f, 0x26, 0x43, 0x5c, 0x89, 0x92, 0x25, 0xfa, 0x50, 0x14, 0x32, 0xf1, 0x5d, 0x8b, 0xba, - 0x8d, 0x92, 0xb4, 0x71, 0x4b, 0x21, 0x13, 0xdf, 0xed, 0xb9, 0xf8, 0xfe, 0x99, 0x5a, 0x98, 0x6d, - 0x28, 0x29, 0xd7, 0x96, 0xa0, 0x14, 0x73, 0x3b, 0xe2, 0x32, 0xc6, 0x45, 0xac, 0x36, 0x68, 0x01, - 0x8a, 0x24, 0x50, 0x75, 0x5d, 0xc4, 0x62, 0x69, 0x3a, 0x50, 0x1b, 0xf3, 0x49, 0x40, 0x38, 0x0b, - 0xa5, 0x5a, 0x09, 0x8b, 0xa5, 0xb8, 0xbc, 0x3e, 0x39, 0xe3, 0x52, 0xab, 0x84, 0xe5, 0x5a, 0x98, - 0xff, 0x92, 0xba, 0xfc, 0x5c, 0x77, 0x11, 0xb5, 0x41, 0x2b, 0x30, 0x7b, 0x4e, 0xa8, 0x77, 0xce, - 0xa5, 0xff, 0x25, 0xac, 0x77, 0xe6, 0x2f, 0x8a, 0xb0, 0x84, 0x89, 0x6b, 0xcb, 0xfe, 0x28, 0x9a, - 0x02, 0x26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x8d, - 0x13, 0x00, 0x00, + // 1759 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xdd, 0x6f, 0xdb, 0xd6, + 0x15, 0x0f, 0x25, 0xcb, 0x96, 0x8e, 0x3e, 0x9c, 0x5e, 0x7f, 0x54, 0x55, 0x9a, 0xd5, 0x61, 0xba, + 0xd4, 0x33, 0x32, 0xa9, 0xd1, 0xb0, 0x0c, 0x6b, 0x91, 0x2e, 0xb5, 0xec, 0x20, 0x5a, 0xdd, 0x58, + 0xbd, 0x76, 0x53, 0x74, 0xd8, 0x40, 0xd0, 0xe4, 0x35, 0x7d, 0x11, 0x8a, 0x97, 0x25, 0xaf, 0x52, + 0xab, 0x45, 0x30, 0x60, 0x2f, 0xdb, 0xe3, 0x80, 0xbd, 0x6c, 0xc3, 0xf6, 0xb6, 0x87, 0x0d, 0xd8, + 0xdb, 0xde, 0xf6, 0x6f, 0xec, 0x5f, 0xd8, 0xd3, 0xfe, 0x80, 0x3d, 0x0f, 0xf7, 0x83, 0x14, 0xa5, + 0x28, 0xb4, 0xe5, 0x6d, 0x40, 0xdf, 0xee, 0xc7, 0x39, 0x87, 0xbf, 0xf3, 0xf5, 0xe3, 0x21, 0xe1, + 0x6d, 0x8f, 0x31, 0xcf, 0x27, 0x9d, 0x30, 0xa2, 0xcf, 0x6d, 0x67, 0xdc, 0x71, 0xfd, 0xb0, 0xf3, + 0xbc, 0x7b, 0x42, 0xb8, 0x7d, 0x4f, 0xac, 0xdb, 0x61, 0xc4, 0x38, 0x43, 0x2d, 0x25, 0xd5, 0xd6, + 0x52, 0x6d, 0x71, 0xa3, 0xa5, 0x5a, 0x6f, 0x6a, 0x0b, 0x76, 0x48, 0x3b, 0x76, 0x10, 0x30, 0x6e, + 0x73, 0xca, 0x82, 0x58, 0x69, 0xb6, 0x6e, 0xeb, 0x5b, 0x9f, 0x05, 0x5e, 0x34, 0x0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x6c, 0xa2, 0x87, 0x00, 0x27, + 0x63, 0x4e, 0xac, 0xc8, 0x0e, 0x3c, 0x15, 0xb1, 0x6a, 0xf7, 0x56, 0x1e, 0x1a, 0x2c, 0x04, 0x71, + 0x45, 0x28, 0xc9, 0x25, 0xfa, 0x31, 0xac, 0x3a, 0xcc, 0x25, 0x21, 0xa3, 0x01, 0xd7, 0x66, 0x0a, + 0x97, 0x35, 0xd3, 0x48, 0x35, 0x13, 0x5b, 0x55, 0x3a, 0xb4, 0x3d, 0x62, 0x9d, 0xb0, 0x73, 0x22, + 0x3a, 0x42, 0x54, 0xce, 0x77, 0x72, 0xd3, 0x24, 0xc4, 0xd3, 0x08, 0x81, 0xd4, 0xde, 0x15, 0xca, + 0x68, 0x0f, 0x20, 0x22, 0x0e, 0x8b, 0x5c, 0xeb, 0x19, 0x19, 0xeb, 0x38, 0x7f, 0x3b, 0x17, 0x92, + 0x94, 0xfe, 0x88, 0x8c, 0x71, 0x25, 0x4a, 0x96, 0xe8, 0x03, 0x51, 0xc8, 0xc4, 0x77, 0x2d, 0xea, + 0x36, 0x4b, 0xd2, 0xc6, 0x05, 0x85, 0x4c, 0x7c, 0xb7, 0xef, 0xe2, 0x95, 0x53, 0xb5, 0x30, 0x3b, + 0x50, 0x52, 0xae, 0xad, 0x43, 0x29, 0xe6, 0x76, 0xc4, 0x65, 0x8c, 0x8b, 0x58, 0x6d, 0xd0, 0x75, + 0x28, 0x92, 0x40, 0xd5, 0x75, 0x11, 0x8b, 0xa5, 0xe9, 0x40, 0x7d, 0xca, 0x27, 0x21, 0xc2, 0x59, + 0x28, 0xd5, 0x4a, 0x58, 0x2c, 0x45, 0xf3, 0xfa, 0xe4, 0x94, 0x4b, 0xad, 0x12, 0x96, 0x6b, 0x61, + 0xfe, 0x4b, 0xea, 0xf2, 0x33, 0xcd, 0x22, 0x6a, 0x83, 0x36, 0x61, 0xf9, 0x8c, 0x50, 0xef, 0x8c, + 0x4b, 0xff, 0x4b, 0x58, 0xef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 0xa4, 0xcf, 0x63, 0xc1, 0xfc, 0xa4, 0xcf, 0xa5, 0x37, 0xf3, 0xbe, 0x84, 0xfa, + 0x2e, 0x6a, 0xa7, 0x50, 0xa3, 0x29, 0x26, 0xe8, 0x7c, 0x9d, 0xf0, 0xe8, 0x83, 0x9d, 0x17, 0x9d, + 0xc9, 0x8f, 0xb3, 0x3f, 0x19, 0x80, 0x5e, 0xe6, 0x0d, 0xf4, 0xfd, 0x8b, 0x10, 0xcc, 0x65, 0xaa, + 0xd6, 0xfd, 0x45, 0xd5, 0x34, 0xfa, 0xb7, 0x24, 0xfa, 0x37, 0xd0, 0xeb, 0xaf, 0x40, 0xbf, 0xfb, + 0x0c, 0xbe, 0xe5, 0xb0, 0x61, 0x8e, 0xf5, 0xdd, 0xf2, 0x9e, 0x1f, 0x0e, 0xc4, 0x88, 0x35, 0x30, + 0x7e, 0xf2, 0x40, 0xcb, 0x79, 0x4c, 0x50, 0x64, 0x9b, 0x45, 0x5e, 0xc7, 0x23, 0x81, 0x1c, 0xc0, + 0x3a, 0xea, 0xca, 0x0e, 0x69, 0x3c, 0xef, 0x77, 0xe6, 0xfb, 0xae, 0x1f, 0x9e, 0x2c, 0x4b, 0xc9, + 0xef, 0xfd, 0x27, 0x00, 0x00, 0xff, 0xff, 0x5c, 0x0a, 0xe5, 0x73, 0x7c, 0x15, 0x00, 0x00, } diff --git a/vendor/google.golang.org/genproto/googleapis/privacy/dlp/v2beta1/storage.pb.go b/vendor/google.golang.org/genproto/googleapis/privacy/dlp/v2beta1/storage.pb.go index d73ffe0..dc6c894 100644 --- a/vendor/google.golang.org/genproto/googleapis/privacy/dlp/v2beta1/storage.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/privacy/dlp/v2beta1/storage.pb.go @@ -212,6 +212,24 @@ func (m *CloudStorageOptions_FileSet) GetUrl() string { return "" } +// A location in Cloud Storage. +type CloudStoragePath struct { + // The url, in the format of gs://bucket/. + Path string `protobuf:"bytes,1,opt,name=path" json:"path,omitempty"` +} + +func (m *CloudStoragePath) Reset() { *m = CloudStoragePath{} } +func (m *CloudStoragePath) String() string { return proto.CompactTextString(m) } +func (*CloudStoragePath) ProtoMessage() {} +func (*CloudStoragePath) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{8} } + +func (m *CloudStoragePath) GetPath() string { + if m != nil { + return m.Path + } + return "" +} + // Shared message indicating Cloud storage type. type StorageConfig struct { // Types that are valid to be assigned to Type: @@ -223,7 +241,7 @@ type StorageConfig struct { func (m *StorageConfig) Reset() { *m = StorageConfig{} } func (m *StorageConfig) String() string { return proto.CompactTextString(m) } func (*StorageConfig) ProtoMessage() {} -func (*StorageConfig) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{8} } +func (*StorageConfig) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{9} } type isStorageConfig_Type interface { isStorageConfig_Type() @@ -345,7 +363,7 @@ type CloudStorageKey struct { func (m *CloudStorageKey) Reset() { *m = CloudStorageKey{} } func (m *CloudStorageKey) String() string { return proto.CompactTextString(m) } func (*CloudStorageKey) ProtoMessage() {} -func (*CloudStorageKey) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{9} } +func (*CloudStorageKey) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{10} } func (m *CloudStorageKey) GetFilePath() string { if m != nil { @@ -370,7 +388,7 @@ type DatastoreKey struct { func (m *DatastoreKey) Reset() { *m = DatastoreKey{} } func (m *DatastoreKey) String() string { return proto.CompactTextString(m) } func (*DatastoreKey) ProtoMessage() {} -func (*DatastoreKey) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{10} } +func (*DatastoreKey) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{11} } func (m *DatastoreKey) GetEntityKey() *Key { if m != nil { @@ -403,7 +421,7 @@ type Key struct { func (m *Key) Reset() { *m = Key{} } func (m *Key) String() string { return proto.CompactTextString(m) } func (*Key) ProtoMessage() {} -func (*Key) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{11} } +func (*Key) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{12} } func (m *Key) GetPartitionId() *PartitionId { if m != nil { @@ -440,7 +458,7 @@ type Key_PathElement struct { func (m *Key_PathElement) Reset() { *m = Key_PathElement{} } func (m *Key_PathElement) String() string { return proto.CompactTextString(m) } func (*Key_PathElement) ProtoMessage() {} -func (*Key_PathElement) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{11, 0} } +func (*Key_PathElement) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{12, 0} } type isKey_PathElement_IdType interface { isKey_PathElement_IdType() @@ -560,7 +578,7 @@ type RecordKey struct { func (m *RecordKey) Reset() { *m = RecordKey{} } func (m *RecordKey) String() string { return proto.CompactTextString(m) } func (*RecordKey) ProtoMessage() {} -func (*RecordKey) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{12} } +func (*RecordKey) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{13} } type isRecordKey_Type interface { isRecordKey_Type() @@ -681,6 +699,7 @@ func init() { proto.RegisterType((*DatastoreOptions)(nil), "google.privacy.dlp.v2beta1.DatastoreOptions") proto.RegisterType((*CloudStorageOptions)(nil), "google.privacy.dlp.v2beta1.CloudStorageOptions") proto.RegisterType((*CloudStorageOptions_FileSet)(nil), "google.privacy.dlp.v2beta1.CloudStorageOptions.FileSet") + proto.RegisterType((*CloudStoragePath)(nil), "google.privacy.dlp.v2beta1.CloudStoragePath") proto.RegisterType((*StorageConfig)(nil), "google.privacy.dlp.v2beta1.StorageConfig") proto.RegisterType((*CloudStorageKey)(nil), "google.privacy.dlp.v2beta1.CloudStorageKey") proto.RegisterType((*DatastoreKey)(nil), "google.privacy.dlp.v2beta1.DatastoreKey") @@ -692,51 +711,52 @@ func init() { func init() { proto.RegisterFile("google/privacy/dlp/v2beta1/storage.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 729 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x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 0x37, 0xed, 0x55, 0x8d, - 0x3f, 0x8f, 0x5f, 0xb9, 0x4d, 0xa0, 0x5b, 0x3f, 0x4f, 0xe9, 0x94, 0x72, 0x85, 0x4c, 0x62, 0xfb, - 0x5a, 0x2f, 0xa0, 0x79, 0x50, 0xef, 0x00, 0xf3, 0x6a, 0xec, 0xb2, 0x30, 0x2f, 0xa1, 0x05, 0x55, - 0xbb, 0x8c, 0x6a, 0xfd, 0x0a, 0xaa, 0x32, 0xe2, 0x7d, 0x68, 0x37, 0x85, 0x1e, 0x65, 0xa3, 0x5f, - 0x29, 0x77, 0x45, 0xaf, 0x01, 0x6b, 0x8c, 0x44, 0x66, 0x1a, 0x7f, 0x3a, 0xd0, 0x40, 0x34, 0x16, - 0x19, 0xd1, 0x0d, 0xff, 0x0c, 0x5b, 0x8f, 0xad, 0xb0, 0xd0, 0xef, 0xf8, 0xad, 0x36, 0x18, 0xd2, - 0xa2, 0x5f, 0x41, 0x9b, 0xf1, 0x93, 0x19, 0x8f, 0x60, 0x63, 0x61, 0x61, 0x4d, 0x5b, 0xda, 0xb7, - 0xf3, 0x26, 0xfb, 0x96, 0x9c, 0x4d, 0xb2, 0xf4, 0x7b, 0xe6, 0xa7, 0xde, 0x14, 0xf6, 0x62, 0x31, - 0x5d, 0x41, 0xd3, 0x83, 0xb3, 0x54, 0xda, 0x9b, 0x8c, 0x9d, 0x5f, 0xbe, 0xb3, 0xc8, 0x44, 0xa4, - 0x98, 0x27, 0x81, 0xc8, 0x92, 0x30, 0xa1, 0xdc, 0x7c, 0x30, 0xc2, 0xf2, 0x2f, 0x2c, 0x59, 0xfe, - 0xd2, 0x77, 0xe9, 0x5b, 0x92, 0xca, 0x9b, 0x77, 0x06, 0xf9, 0xf5, 0xbf, 0x01, 0x00, 0x00, 0xff, - 0xff, 0xc5, 0x05, 0xbf, 0x79, 0xc0, 0x06, 0x00, 0x00, + // 740 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xdd, 0x6e, 0xf3, 0x44, + 0x10, 0x8d, 0x93, 0xa8, 0x6d, 0xc6, 0x29, 0x4d, 0x5d, 0x90, 0xaa, 0x14, 0xfa, 0x63, 0xa1, 0x36, + 0x6a, 0xc1, 0x16, 0xe1, 0x82, 0x0b, 0x44, 0x91, 0xd2, 0x1f, 0x25, 0x44, 0x6a, 0x82, 0x5b, 0x09, + 0x01, 0x17, 0xd6, 0xd6, 0xbb, 0x71, 0x97, 0x3a, 0xbb, 0x2b, 0x7b, 0x5b, 0xe1, 0x17, 0xe0, 0xb5, + 0x78, 0x10, 0xee, 0x11, 0x8f, 0x81, 0x76, 0xbd, 0x49, 0xdc, 0x1f, 0xd2, 0x22, 0x7d, 0x77, 0x9b, + 0xc9, 0x99, 0x33, 0x3b, 0x73, 0xce, 0xac, 0xa1, 0x13, 0x73, 0x1e, 0x27, 0xc4, 0x17, 0x29, 0x7d, + 0x44, 0x51, 0xee, 0xe3, 0x44, 0xf8, 0x8f, 0xdd, 0x5b, 0x22, 0xd1, 0x57, 0x7e, 0x26, 0x79, 0x8a, + 0x62, 0xe2, 0x89, 0x94, 0x4b, 0xee, 0xb4, 0x0b, 0xa4, 0x67, 0x90, 0x1e, 0x4e, 0x84, 0x67, 0x90, + 0xed, 0x4f, 0x0d, 0x0b, 0x12, 0xd4, 0x47, 0x8c, 0x71, 0x89, 0x24, 0xe5, 0x2c, 0x2b, 0x32, 0xdd, + 0x5d, 0x58, 0x1b, 0xb0, 0x09, 0xbf, 0xc9, 0x05, 0x71, 0x1c, 0xa8, 0x33, 0x34, 0x25, 0xdb, 0xd6, + 0xbe, 0xd5, 0x69, 0x04, 0xfa, 0xec, 0x1e, 0xc3, 0xea, 0x25, 0x25, 0x09, 0x1e, 0x60, 0x67, 0x0f, + 0xec, 0x88, 0x27, 0x0f, 0x53, 0x16, 0x96, 0x50, 0x50, 0x84, 0xae, 0x14, 0x76, 0x04, 0xf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0xc0, 0xda, 0x84, 0x26, 0x24, 0xcc, 0x88, 0x34, 0x7d, 0x7e, + 0xb3, 0x8c, 0xfd, 0x15, 0x0a, 0xef, 0x92, 0x26, 0xe4, 0x9a, 0xc8, 0x60, 0x75, 0x52, 0x1c, 0xda, + 0x3b, 0xca, 0x79, 0xfa, 0xe8, 0xb4, 0xa0, 0xf6, 0x90, 0x26, 0x46, 0x74, 0x75, 0x74, 0x0f, 0xa1, + 0x55, 0x26, 0x19, 0x23, 0x79, 0xa7, 0x24, 0x17, 0x48, 0xde, 0xcd, 0xbc, 0xa1, 0xce, 0xee, 0x5f, + 0x16, 0xac, 0x1b, 0xcc, 0x19, 0x67, 0x13, 0x1a, 0x3b, 0xbf, 0xc2, 0x26, 0x9e, 0x49, 0x15, 0xf2, + 0xa2, 0xb8, 0x99, 0xeb, 0x17, 0xcb, 0xee, 0xfc, 0x5c, 0xdf, 0x7e, 0x25, 0x68, 0xe1, 0xe7, 0x9a, + 0x13, 0xf8, 0x24, 0x52, 0xd7, 0x0a, 0xcd, 0x7a, 0xce, 0x0b, 0xd4, 0x74, 0x01, 0xff, 0x7f, 0x0e, + 0xa5, 0x5f, 0x09, 0xb6, 0xa2, 0x97, 0xe1, 0xde, 0x0a, 0xd4, 0x65, 0x2e, 0x88, 0xfb, 0x23, 0x6c, + 0x94, 0xb3, 0x86, 0x24, 0x77, 0x76, 0xa0, 0xa1, 0x95, 0x28, 0x4d, 0x42, 0x4b, 0xa3, 0x27, 0x74, + 0x00, 0xcd, 0x4c, 0xa2, 0x54, 0x86, 0x7c, 0x32, 0x51, 0x52, 0xa9, 0xb6, 0x6b, 0x81, 0xad, 0x63, + 0x23, 0x1d, 0x72, 0xaf, 0xa0, 0x39, 0xef, 0x54, 0xf1, 0x9d, 0x02, 0x10, 0x26, 0xa9, 0xcc, 0xc3, + 0x7b, 0x32, 0xdb, 0x93, 0xbd, 0xa5, 0xfe, 0x23, 0x79, 0xd0, 0x28, 0x52, 0x86, 0x24, 0x77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x00, 0x00, } diff --git a/vendor/google.golang.org/genproto/googleapis/pubsub/v1/pubsub.pb.go b/vendor/google.golang.org/genproto/googleapis/pubsub/v1/pubsub.pb.go index 0d81dd1..7256608 100644 --- a/vendor/google.golang.org/genproto/googleapis/pubsub/v1/pubsub.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/pubsub/v1/pubsub.pb.go @@ -994,7 +994,7 @@ type Snapshot struct { // old. If a snapshot is created from this subscription, the snapshot -- which // will always capture this 3-day-old backlog as long as the snapshot // exists -- will expire in 4 days. - ExpirationTime *google_protobuf4.Timestamp `protobuf:"bytes,3,opt,name=expiration_time,json=expirationTime" json:"expiration_time,omitempty"` + ExpireTime *google_protobuf4.Timestamp `protobuf:"bytes,3,opt,name=expire_time,json=expireTime" json:"expire_time,omitempty"` } func (m *Snapshot) Reset() { *m = Snapshot{} } @@ -1016,9 +1016,9 @@ func (m *Snapshot) GetTopic() string { return "" } -func (m *Snapshot) GetExpirationTime() *google_protobuf4.Timestamp { +func (m *Snapshot) GetExpireTime() *google_protobuf4.Timestamp { if m != nil { - return m.ExpirationTime + return m.ExpireTime } return nil } @@ -2209,122 +2209,122 @@ var _Publisher_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("google/pubsub/v1/pubsub.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 1868 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0xcb, 0x73, 0x23, 0x47, - 0x19, 0xcf, 0x48, 0x7e, 0xc8, 0x9f, 0x64, 0x7b, 0xb7, 0xb1, 0x77, 0xb5, 0xb3, 0x2f, 0x7b, 0x76, - 0xb1, 0x15, 0x65, 0x57, 0xf2, 0x2a, 0x95, 0x90, 0x78, 0x71, 0x52, 0x7e, 0x2c, 0x1b, 0x53, 0x59, - 0x62, 0xc6, 0x0b, 0x54, 0x71, 0x40, 0x35, 0xd2, 0xb4, 0xe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x03, 0xbf, 0x8a, 0x30, + 0x09, 0xa9, 0x70, 0x48, 0x7f, 0x8b, 0x0b, 0xf8, 0x0f, 0xbd, 0x03, 0x97, 0x8e, 0x38, 0xec, 0x44, + 0x39, 0xf4, 0x04, 0x4a, 0x42, 0xb7, 0xd8, 0x78, 0x77, 0xa6, 0x18, 0xcf, 0x18, 0x1e, 0xd0, 0x9b, + 0xb0, 0x36, 0x04, 0x21, 0xbe, 0xe7, 0x12, 0x8c, 0xee, 0x80, 0x3a, 0xb2, 0x1e, 0xa9, 0x28, 0x9b, + 0xc5, 0xea, 0x8a, 0x01, 0x43, 0xf3, 0x11, 0xdd, 0x86, 0x2b, 0x1f, 0xdb, 0x84, 0xab, 0x40, 0x62, + 0x6e, 0x15, 0x58, 0xf6, 0x03, 0xef, 0x53, 0xdc, 0x09, 0x05, 0xbb, 0xf8, 0x27, 0xba, 0x01, 0x2b, + 0x3e, 0xbd, 0x8c, 0xd8, 0x9f, 0x71, 0x73, 0x2c, 0x1a, 0x25, 0xba, 0x70, 0x6c, 0x7f, 0x86, 0xa9, + 0xab, 0xd8, 0x66, 0xe8, 0xf5, 0xb0, 0x1b, 0xbb, 0x8a, 0xae, 0xbc, 0xa4, 0x0b, 0xba, 0x03, 0x28, + 0x09, 0x25, 0x18, 0x36, 0x60, 0x89, 0xa9, 0xce, 0xc9, 0xa9, 0xcd, 0x6b, 0x59, 0x7d, 0xb9, 0x7d, + 0x85, 0x18, 0xba, 0x0f, 0x6b, 0x2e, 0x3e, 0x0f, 0x5b, 0x09, 0x28, 0xee, 0x97, 0x55, 0xba, 0x7c, + 0x34, 0x84, 0x7b, 0x05, 0xb7, 0x86, 0x70, 0xc7, 0x51, 0x9b, 0x74, 0x02, 0xdb, 0x67, 0xc9, 0x36, + 0xd9, 0x03, 0xdf, 0x44, 0x43, 0x17, 0x6e, 0xe7, 0x41, 0x0a, 0x6d, 0xef, 0xc1, 0x2a, 0x49, 0x6e, + 0x08, 0x8f, 0xa4, 0x17, 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a6, 0x6f, 0x93, 0xd1, 0x3f, 0xa9, + 0x9e, 0xf0, 0xaf, 0xff, 0x29, 0xca, 0xdf, 0x0b, 0x57, 0x9f, 0xf3, 0xb3, 0xfb, 0x7d, 0x2f, 0xb2, + 0x68, 0x4c, 0x1f, 0x47, 0xed, 0xfa, 0x8f, 0x1f, 0xb5, 0x97, 0xd8, 0xf1, 0xb7, 0xff, 0x1f, 0x00, + 0x00, 0xff, 0xff, 0x93, 0x6b, 0x90, 0xee, 0xe2, 0x1a, 0x00, 0x00, } diff --git a/vendor/google.golang.org/genproto/googleapis/watcher/v1/watch.pb.go b/vendor/google.golang.org/genproto/googleapis/watcher/v1/watch.pb.go new file mode 100644 index 0000000..25ed420 --- /dev/null +++ b/vendor/google.golang.org/genproto/googleapis/watcher/v1/watch.pb.go @@ -0,0 +1,376 @@ +// Code generated by protoc-gen-go. +// source: google/watcher/v1/watch.proto +// DO NOT EDIT! + +/* +Package watcher is a generated protocol buffer package. + +It is generated from these files: + google/watcher/v1/watch.proto + +It has these top-level messages: + Request + ChangeBatch + Change +*/ +package watcher + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "google.golang.org/genproto/googleapis/api/annotations" +import google_protobuf1 "github.com/golang/protobuf/ptypes/any" +import _ "github.com/golang/protobuf/ptypes/empty" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +// A reported value can be in one of the following states: +type Change_State int32 + +const ( + // The element exists and its full value is included in data. + Change_EXISTS Change_State = 0 + // The element does not exist. + Change_DOES_NOT_EXIST Change_State = 1 + // Element may or may not exist. Used only for initial state delivery when + // the client is not interested in fetching the initial state. See the + // "Initial State" section above. + Change_INITIAL_STATE_SKIPPED Change_State = 2 + // The element may exist, but some error has occurred. More information is + // available in the data field - the value is a serialized Status + // proto (from [google.rpc.Status][]) + Change_ERROR Change_State = 3 +) + +var Change_State_name = map[int32]string{ + 0: "EXISTS", + 1: "DOES_NOT_EXIST", + 2: "INITIAL_STATE_SKIPPED", + 3: "ERROR", +} +var Change_State_value = map[string]int32{ + "EXISTS": 0, + "DOES_NOT_EXIST": 1, + "INITIAL_STATE_SKIPPED": 2, + "ERROR": 3, +} + +func (x Change_State) String() string { + return proto.EnumName(Change_State_name, int32(x)) +} +func (Change_State) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} } + +// The message used by the client to register interest in an entity. +type Request struct { + // The `target` value **must** be a valid URL path pointing to an entity + // to watch. Note that the service name **must** be + // removed from the target field (e.g., the target field must say + // "/foo/bar", not "myservice.googleapis.com/foo/bar"). A client is + // also allowed to pass system-specific parameters in the URL that + // are only obeyed by some implementations. Some parameters will be + // implementation-specific. However, some have predefined meaning + // and are listed here: + // + // * recursive = true|false [default=false] + // If set to true, indicates that the client wants to watch all elements + // of entities in the subtree rooted at the entity's name in `target`. For + // descendants that are not the immediate children of the target, the + // `Change.element` will contain slashes. + // + // Note that some namespaces and entities will not support recursive + // watching. When watching such an entity, a client must not set recursive + // to true. Otherwise, it will receive an `UNIMPLEMENTED` error. + // + // Normal URL encoding must be used inside `target`. For example, if a query + // parameter name or value, or the non-query parameter portion of `target` + // contains a special character, it must be %-encoded. We recommend that + // clients and servers use their runtime's URL library to produce and consume + // target values. + Target string `protobuf:"bytes,1,opt,name=target" json:"target,omitempty"` + // The `resume_marker` specifies how much of the existing underlying state is + // delivered to the client when the watch request is received by the + // system. The client can set this marker in one of the following ways to get + // different semantics: + // + // * Parameter is not specified or has the value "". + // Semantics: Fetch initial state. + // The client wants the entity's initial state to be delivered. See the + // description in "Initial State". + // + // * Parameter is set to the string "now" (UTF-8 encoding). + // Semantics: Fetch new changes only. + // The client just wants to get the changes received by the system after + // the watch point. The system may deliver changes from before the watch + // point as well. + // + // * Parameter is set to a value received in an earlier + // `Change.resume_marker` field while watching the same entity. + // Semantics: Resume from a specific point. + // The client wants to receive the changes from a specific point; this + // value must correspond to a value received in the `Change.resume_marker` + // field. The system may deliver changes from before the `resume_marker` + // as well. If the system cannot resume the stream from this point (e.g., + // if it is too far behind in the stream), it can raise the + // `FAILED_PRECONDITION` error. + // + // An implementation MUST support an unspecified parameter and the + // empty string "" marker (initial state fetching) and the "now" marker. + // It need not support resuming from a specific point. + ResumeMarker []byte `protobuf:"bytes,2,opt,name=resume_marker,json=resumeMarker,proto3" json:"resume_marker,omitempty"` +} + +func (m *Request) Reset() { *m = Request{} } +func (m *Request) String() string { return proto.CompactTextString(m) } +func (*Request) ProtoMessage() {} +func (*Request) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *Request) GetTarget() string { + if m != nil { + return m.Target + } + return "" +} + +func (m *Request) GetResumeMarker() []byte { + if m != nil { + return m.ResumeMarker + } + return nil +} + +// A batch of Change messages. +type ChangeBatch struct { + // A list of Change messages. + Changes []*Change `protobuf:"bytes,1,rep,name=changes" json:"changes,omitempty"` +} + +func (m *ChangeBatch) Reset() { *m = ChangeBatch{} } +func (m *ChangeBatch) String() string { return proto.CompactTextString(m) } +func (*ChangeBatch) ProtoMessage() {} +func (*ChangeBatch) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *ChangeBatch) GetChanges() []*Change { + if m != nil { + return m.Changes + } + return nil +} + +// A Change indicates the most recent state of an element. +type Change struct { + // Name of the element, interpreted relative to the entity's actual + // name. "" refers to the entity itself. The element name is a valid + // UTF-8 string. + Element string `protobuf:"bytes,1,opt,name=element" json:"element,omitempty"` + // The state of the `element`. + State Change_State `protobuf:"varint,2,opt,name=state,enum=google.watcher.v1.Change_State" json:"state,omitempty"` + // The actual change data. This field is present only when `state() == EXISTS` + // or `state() == ERROR`. Please see [google.protobuf.Any][google.protobuf.Any] about how to use + // the Any type. + Data *google_protobuf1.Any `protobuf:"bytes,6,opt,name=data" json:"data,omitempty"` + // If present, provides a compact representation of all the messages that have + // been received by the caller for the given entity, e.g., it could be a + // sequence number or a multi-part timestamp/version vector. This marker can + // be provided in the Request message, allowing the caller to resume the stream + // watching at a specific point without fetching the initial state. + ResumeMarker []byte `protobuf:"bytes,4,opt,name=resume_marker,json=resumeMarker,proto3" json:"resume_marker,omitempty"` + // If true, this Change is followed by more Changes that are in the same group + // as this Change. + Continued bool `protobuf:"varint,5,opt,name=continued" json:"continued,omitempty"` +} + +func (m *Change) Reset() { *m = Change{} } +func (m *Change) String() string { return proto.CompactTextString(m) } +func (*Change) ProtoMessage() {} +func (*Change) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *Change) GetElement() string { + if m != nil { + return m.Element + } + return "" +} + +func (m *Change) GetState() Change_State { + if m != nil { + return m.State + } + return Change_EXISTS +} + +func (m *Change) GetData() *google_protobuf1.Any { + if m != nil { + return m.Data + } + return nil +} + +func (m *Change) GetResumeMarker() []byte { + if m != nil { + return m.ResumeMarker + } + return nil +} + +func (m *Change) GetContinued() bool { + if m != nil { + return m.Continued + } + return false +} + +func init() { + proto.RegisterType((*Request)(nil), "google.watcher.v1.Request") + proto.RegisterType((*ChangeBatch)(nil), "google.watcher.v1.ChangeBatch") + proto.RegisterType((*Change)(nil), "google.watcher.v1.Change") + proto.RegisterEnum("google.watcher.v1.Change_State", Change_State_name, Change_State_value) +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for Watcher service + +type WatcherClient interface { + // Start a streaming RPC to get watch information from the server. + Watch(ctx context.Context, in *Request, opts ...grpc.CallOption) (Watcher_WatchClient, error) +} + +type watcherClient struct { + cc *grpc.ClientConn +} + +func NewWatcherClient(cc *grpc.ClientConn) WatcherClient { + return &watcherClient{cc} +} + +func (c *watcherClient) Watch(ctx context.Context, in *Request, opts ...grpc.CallOption) (Watcher_WatchClient, error) { + stream, err := grpc.NewClientStream(ctx, &_Watcher_serviceDesc.Streams[0], c.cc, "/google.watcher.v1.Watcher/Watch", opts...) + if err != nil { + return nil, err + } + x := &watcherWatchClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Watcher_WatchClient interface { + Recv() (*ChangeBatch, error) + grpc.ClientStream +} + +type watcherWatchClient struct { + grpc.ClientStream +} + +func (x *watcherWatchClient) Recv() (*ChangeBatch, error) { + m := new(ChangeBatch) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// Server API for Watcher service + +type WatcherServer interface { + // Start a streaming RPC to get watch information from the server. + Watch(*Request, Watcher_WatchServer) error +} + +func RegisterWatcherServer(s *grpc.Server, srv WatcherServer) { + s.RegisterService(&_Watcher_serviceDesc, srv) +} + +func _Watcher_Watch_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(Request) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(WatcherServer).Watch(m, &watcherWatchServer{stream}) +} + +type Watcher_WatchServer interface { + Send(*ChangeBatch) error + grpc.ServerStream +} + +type watcherWatchServer struct { + grpc.ServerStream +} + +func (x *watcherWatchServer) Send(m *ChangeBatch) error { + return x.ServerStream.SendMsg(m) +} + +var _Watcher_serviceDesc = grpc.ServiceDesc{ + ServiceName: "google.watcher.v1.Watcher", + HandlerType: (*WatcherServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "Watch", + Handler: _Watcher_Watch_Handler, + ServerStreams: true, + }, + }, + Metadata: "google/watcher/v1/watch.proto", +} + +func init() { proto.RegisterFile("google/watcher/v1/watch.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 445 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b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x5b, 0x7c, + 0xdb, 0x8f, 0x1c, 0x3c, 0xd9, 0xba, 0x13, 0xfd, 0x39, 0xc1, 0xc1, 0xb7, 0x9f, 0xbf, 0xbe, 0xb7, + 0xba, 0xb8, 0xf3, 0xe7, 0xea, 0x9e, 0xa3, 0xf1, 0xdb, 0x31, 0xe8, 0xce, 0xd3, 0xf5, 0x46, 0xa6, + 0xe8, 0xe3, 0x4b, 0xdb, 0x83, 0xcb, 0x05, 0x15, 0x3c, 0x92, 0x25, 0x8f, 0x39, 0x13, 0x7a, 0x5f, + 0xb1, 0xa1, 0xe8, 0x6a, 0x5e, 0xfd, 0x73, 0xbf, 0xaf, 0x6c, 0x78, 0xe1, 0x6a, 0xd1, 0xf1, 0xef, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x4f, 0x60, 0xe9, 0x84, 0xe3, 0x02, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/grpc/.travis.yml b/vendor/google.golang.org/grpc/.travis.yml index 6ec5732..0c1a96c 100644 --- a/vendor/google.golang.org/grpc/.travis.yml +++ b/vendor/google.golang.org/grpc/.travis.yml @@ -4,7 +4,6 @@ go: - 1.5.4 - 1.6.3 - 1.7 - - 1.8 go_import_path: google.golang.org/grpc @@ -15,6 +14,6 @@ before_install: script: - '! gofmt -s -d -l . 2>&1 | read' - '! goimports -l . | read' - - 'if [[ $TRAVIS_GO_VERSION != 1.5* ]]; then ! golint ./... | grep -vE "(_mock|_string|\.pb)\.go:"; fi' + - 'if [[ $TRAVIS_GO_VERSION != 1.5* ]]; then ! golint ./... | grep -vE "(_string|\.pb)\.go:"; fi' - '! go tool vet -all . 2>&1 | grep -vE "constant [0-9]+ not a string in call to Errorf" | grep -vF .pb.go:' # https://github.com/golang/protobuf/issues/214 - make test testrace diff --git a/vendor/google.golang.org/grpc/Documentation/gomock-example.md b/vendor/google.golang.org/grpc/Documentation/gomock-example.md deleted file mode 100644 index 9f7e023..0000000 --- a/vendor/google.golang.org/grpc/Documentation/gomock-example.md +++ /dev/null @@ -1,121 +0,0 @@ -# Mocking Service for gRPC - -[Example code](https://github.com/grpc/grpc-go/tree/master/examples/helloworld/mock) - -## Why? - -To test client-side logic without the overhead of connecting to a real server. Mocking enables users to write light-weight unit tests to check functionalities on client-side without invoking RPC calls to a server. - -## Idea: Mock the client stub that connects to the server. - -We use Gomock to mock the client interface (in the generated code) and programmatically set its methods to expect and return pre-determined values. This enables users to write tests around the client logic and use this mocked stub while making RPC calls. - -## How to use Gomock? - -Documentation on Gomock can be found [here](https://github.com/golang/mock). -A quick reading of the documentation should enable users to follow the code below. - -Consider a gRPC service based on following proto file: - -```proto -//helloworld.proto - -package helloworld; - -message HelloRequest { - string name = 1; -} - -message HelloReply { - string name = 1; -} - -service Greeter { - rpc SayHello (HelloRequest) returns (HelloReply) {} -} -``` - -The generated file helloworld.pb.go will have a client interface for each service defined in the proto file. This interface will have methods corresponding to each rpc inside that service. - -```Go -type GreeterClient interface { - SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) -} -``` - -The generated code also contains a struct that implements this interface. - -```Go -type greeterClient struct { - cc *grpc.ClientConn -} -func (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error){ - // ... - // gRPC specific code here - // ... -} -``` - -Along with this the generated code has a method to create an instance of this struct. -```Go -func NewGreeterClient(cc *grpc.ClientConn) GreeterClient -``` - -The user code uses this function to create an instance of the struct greeterClient which then can be used to make rpc calls to the server. -We will mock this interface GreeterClient and use an instance of that mock to make rpc calls. These calls instead of going to server will return pre-determined values. - -To create a mock we’ll use [mockgen](https://github.com/golang/mock#running-mockgen). -From the directory ``` examples/helloworld/mock/ ``` run ``` mockgen google.golang.org/grpc/examples/helloworld/helloworld GreeterClient > mock_helloworld/hw_mock.go ``` - -Notice that in the above command we specify GreeterClient as the interface to be mocked. - -The user test code can import the package generated by mockgen along with library package gomock to write unit tests around client-side logic. -```Go -import "github.com/golang/mock/gomock" -import hwmock "google.golang.org/grpc/examples/helloworld/mock/mock_helloworld" -``` - -An instance of the mocked interface can be created as: -```Go -mockGreeterClient := hwmock.NewMockGreeterClient(ctrl) -``` -This mocked object can be programmed to expect calls to its methods and return pre-determined values. For instance, we can program mockGreeterClient to expect a call to its method SayHello and return a HelloReply with message “Mocked RPC”. - -```Go -mockGreeterClient.EXPECT().SayHello( - gomock.Any(), // expect any value for first parameter - gomock.Any(), // expect any value for second parameter -).Return(&helloworld.HelloReply{Message: “Mocked RPC”}, nil) -``` - -gomock.Any() indicates that the parameter can have any value or type. We can indicate specific values for built-in types with gomock.Eq(). -However, if the test code needs to specify the parameter to have a proto message type, we can replace gomock.Any() with an instance of a struct that implements gomock.Matcher interface. - -```Go -type rpcMsg struct { - msg proto.Message -} - -func (r *rpcMsg) Matches(msg interface{}) bool { - m, ok := msg.(proto.Message) - if !ok { - return false - } - return proto.Equal(m, r.msg) -} - -func (r *rpcMsg) String() string { - return fmt.Sprintf("is %s", r.msg) -} - -... - -req := &helloworld.HelloRequest{Name: "unit_test"} -mockGreeterClient.EXPECT().SayHello( - gomock.Any(), - &rpcMsg{msg: req}, -).Return(&helloworld.HelloReply{Message: "Mocked Interface"}, nil) -``` - - - diff --git a/vendor/google.golang.org/grpc/Documentation/grpc-auth-support.md b/vendor/google.golang.org/grpc/Documentation/grpc-auth-support.md index 248d272..5312b57 100644 --- a/vendor/google.golang.org/grpc/Documentation/grpc-auth-support.md +++ b/vendor/google.golang.org/grpc/Documentation/grpc-auth-support.md @@ -26,7 +26,7 @@ server.Serve(lis) ## Google Compute Engine (GCE) ```Go -conn, err := grpc.Dial(serverAddr, grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, "")), grpc.WithPerRPCCredentials(oauth.NewComputeEngine())) +conn, err := grpc.Dial(serverAddr, grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, ""), grpc.WithPerRPCCredentials(oauth.NewComputeEngine()))) ``` ## JWT @@ -36,6 +36,6 @@ jwtCreds, err := oauth.NewServiceAccountFromFile(*serviceAccountKeyFile, *oauthS if err != nil { log.Fatalf("Failed to create JWT credentials: %v", err) } -conn, err := grpc.Dial(serverAddr, grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, "")), grpc.WithPerRPCCredentials(jwtCreds)) +conn, err := grpc.Dial(serverAddr, grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, ""), grpc.WithPerRPCCredentials(jwtCreds))) ``` diff --git a/vendor/google.golang.org/grpc/Documentation/server-reflection-tutorial.md b/vendor/google.golang.org/grpc/Documentation/server-reflection-tutorial.md deleted file mode 100644 index ca8e30c..0000000 --- a/vendor/google.golang.org/grpc/Documentation/server-reflection-tutorial.md +++ /dev/null @@ -1,152 +0,0 @@ -# gRPC Server Reflection Tutorial - -gRPC Server Reflection provides information about publicly-accessible gRPC -services on a server, and assists clients at runtime to construct RPC -requests and responses without precompiled service information. It is used by -gRPC CLI, which can be used to introspect server protos and send/receive test -RPCs. - -## Enable Server Reflection - -gRPC-go Server Reflection is implemented in package [reflection](https://github.com/grpc/grpc-go/tree/master/reflection). To enable server reflection, you need to import this package and register reflection service on your gRPC server. - -For example, to enable server reflection in `example/helloworld`, we need to make the following changes: - -```diff ---- a/examples/helloworld/greeter_server/main.go -+++ b/examples/helloworld/greeter_server/main.go -@@ -40,6 +40,7 @@ import ( - "golang.org/x/net/context" - "google.golang.org/grpc" - pb "google.golang.org/grpc/examples/helloworld/helloworld" -+ "google.golang.org/grpc/reflection" - ) - - const ( -@@ -61,6 +62,8 @@ func main() { - } - s := grpc.NewServer() - pb.RegisterGreeterServer(s, &server{}) -+ // Register reflection service on gRPC server. -+ reflection.Register(s) - if err := s.Serve(lis); err != nil { - log.Fatalf("failed to serve: %v", err) - } -``` - -We have made this change in `example/helloworld`, and we will use it as an example to show the use of gRPC server reflection and gRPC CLI in this tutorial. - -## gRPC CLI - -After enabling Server Reflection in a server application, you can use gRPC CLI to check its services. -gRPC CLI is only available in c++. Instructions on how to use gRPC CLI can be found at [command_line_tool.md](https://github.com/grpc/grpc/blob/master/doc/command_line_tool.md). - -To build gRPC CLI: - -```sh -git clone https://github.com/grpc/grpc -cd grpc -make grpc_cli -cd bins/opt # grpc_cli is in directory bins/opt/ -``` - -## Use gRPC CLI to check services - -First, start the helloworld server in grpc-go directory: - -```sh -$ cd -$ go run examples/helloworld/greeter_server/main.go -``` - -Open a new terminal and make sure you are in the directory where grpc_cli lives: - -```sh -$ cd /bins/opt -``` - -### List services - -`grpc_cli ls` command lists services and methods exposed at a given port: - -- List all the services exposed at a given port - - ```sh - $ ./grpc_cli ls localhost:50051 - ``` - - output: - ```sh - helloworld.Greeter - grpc.reflection.v1alpha.ServerReflection - ``` - -- List one service with details - - `grpc_cli ls` command inspects a service given its full name (in the format of - \.\). It can print information with a long listing format - when `-l` flag is set. This flag can be used to get more details about a - service. - - ```sh - $ ./grpc_cli ls localhost:50051 helloworld.Greeter -l - ``` - - output: - ```sh - filename: helloworld.proto - package: helloworld; - service Greeter { - rpc SayHello(helloworld.HelloRequest) returns (helloworld.HelloReply) {} - } - - ``` - -### List methods - -- List one method with details - - `grpc_cli ls` command also inspects a method given its full name (in the - format of \.\.\). - - ```sh - $ ./grpc_cli ls localhost:50051 helloworld.Greeter.SayHello -l - ``` - - output: - ```sh - rpc SayHello(helloworld.HelloRequest) returns (helloworld.HelloReply) {} - ``` - -### Inspect message types - -We can use`grpc_cli type` command to inspect request/response types given the -full name of the type (in the format of \.\). - -- Get information about the request type - - ```sh - $ ./grpc_cli type localhost:50051 helloworld.HelloRequest - ``` - - output: - ```sh - message HelloRequest { - optional string name = 1[json_name = "name"]; - } - ``` - -### Call a remote method - -We can send RPCs to a server and get responses using `grpc_cli call` command. - -- Call a unary method - - ```sh - $ ./grpc_cli call localhost:50051 SayHello "name: 'gRPC CLI'" - ``` - - output: - ```sh - message: "Hello gRPC CLI" - ``` diff --git a/vendor/google.golang.org/grpc/README.md b/vendor/google.golang.org/grpc/README.md index 39120c2..110a8cf 100644 --- a/vendor/google.golang.org/grpc/README.md +++ b/vendor/google.golang.org/grpc/README.md @@ -18,22 +18,6 @@ Prerequisites This requires Go 1.5 or later. -A note on the version used: significant performance improvements in benchmarks -of grpc-go have been seen by upgrading the go version from 1.5 to the latest -1.7.1. - -From https://golang.org/doc/install, one way to install the latest version of go is: -``` -$ GO_VERSION=1.7.1 -$ OS=linux -$ ARCH=amd64 -$ curl -O https://storage.googleapis.com/golang/go${GO_VERSION}.${OS}-${ARCH}.tar.gz -$ sudo tar -C /usr/local -xzf go$GO_VERSION.$OS-$ARCH.tar.gz -$ # Put go on the PATH, keep the usual installation dir -$ sudo ln -s /usr/local/go/bin/go /usr/bin/go -$ rm go$GO_VERSION.$OS-$ARCH.tar.gz -``` - Constraints ----------- 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. @@ -46,12 +30,3 @@ Status ------ GA -FAQ ---- - -#### Compiling error, undefined: grpc.SupportPackageIsVersion - -Please update proto package, gRPC package and rebuild the proto files: - - `go get -u github.com/golang/protobuf/{proto,protoc-gen-go}` - - `go get -u google.golang.org/grpc` - - `protoc --go_out=plugins=grpc:. *.proto` diff --git a/vendor/google.golang.org/grpc/benchmark/benchmark.go b/vendor/google.golang.org/grpc/benchmark/benchmark.go index fc3304a..d114327 100644 --- a/vendor/google.golang.org/grpc/benchmark/benchmark.go +++ b/vendor/google.golang.org/grpc/benchmark/benchmark.go @@ -47,8 +47,7 @@ import ( "google.golang.org/grpc/grpclog" ) -// Allows reuse of the same testpb.Payload object. -func setPayload(p *testpb.Payload, t testpb.PayloadType, size int) { +func newPayload(t testpb.PayloadType, size int) *testpb.Payload { if size < 0 { grpclog.Fatalf("Requested a response with invalid length %d", size) } @@ -60,15 +59,10 @@ func setPayload(p *testpb.Payload, t testpb.PayloadType, size int) { default: grpclog.Fatalf("Unsupported payload type: %d", t) } - p.Type = t - p.Body = body - return -} - -func newPayload(t testpb.PayloadType, size int) *testpb.Payload { - p := new(testpb.Payload) - setPayload(p, t, size) - return p + return &testpb.Payload{ + Type: t, + Body: body, + } } type testServer struct { @@ -81,13 +75,8 @@ func (s *testServer) UnaryCall(ctx context.Context, in *testpb.SimpleRequest) (* } func (s *testServer) StreamingCall(stream testpb.BenchmarkService_StreamingCallServer) error { - response := &testpb.SimpleResponse{ - Payload: new(testpb.Payload), - } - in := new(testpb.SimpleRequest) for { - // use ServerStream directly to reuse the same testpb.SimpleRequest object - err := stream.(grpc.ServerStream).RecvMsg(in) + in, err := stream.Recv() if err == io.EOF { // read done. return nil @@ -95,8 +84,9 @@ func (s *testServer) StreamingCall(stream testpb.BenchmarkService_StreamingCallS if err != nil { return err } - setPayload(response.Payload, in.ResponseType, int(in.ResponseSize)) - if err := stream.Send(response); err != nil { + if err := stream.Send(&testpb.SimpleResponse{ + Payload: newPayload(in.ResponseType, int(in.ResponseSize)), + }); err != nil { return err } } diff --git a/vendor/google.golang.org/grpc/call.go b/vendor/google.golang.org/grpc/call.go index c1588c6..772c817 100644 --- a/vendor/google.golang.org/grpc/call.go +++ b/vendor/google.golang.org/grpc/call.go @@ -36,13 +36,12 @@ package grpc import ( "bytes" "io" + "math" "time" "golang.org/x/net/context" "golang.org/x/net/trace" "google.golang.org/grpc/codes" - "google.golang.org/grpc/peer" - "google.golang.org/grpc/stats" "google.golang.org/grpc/transport" ) @@ -50,8 +49,7 @@ import ( // On error, it returns the error and indicates whether the call should be retried. // // TODO(zhaoq): Check whether the received message sequence is valid. -// TODO ctx is used for stats collection and processing. It is the context passed from the application. -func recvResponse(ctx context.Context, dopts dialOptions, t transport.ClientTransport, c *callInfo, stream *transport.Stream, reply interface{}) (err error) { +func recvResponse(dopts dialOptions, t transport.ClientTransport, c *callInfo, stream *transport.Stream, reply interface{}) (err error) { // Try to acquire header metadata from the server if there is any. defer func() { if err != nil { @@ -65,34 +63,20 @@ func recvResponse(ctx context.Context, dopts dialOptions, t transport.ClientTran return } p := &parser{r: stream} - var inPayload *stats.InPayload - if dopts.copts.StatsHandler != nil { - inPayload = &stats.InPayload{ - Client: true, - } - } for { - if err = recv(p, dopts.codec, stream, dopts.dc, reply, dopts.maxMsgSize, inPayload); err != nil { + if err = recv(p, dopts.codec, stream, dopts.dc, reply, math.MaxInt32); err != nil { if err == io.EOF { break } return } } - if inPayload != nil && err == io.EOF && stream.StatusCode() == codes.OK { - // TODO in the current implementation, inTrailer may be handled before inPayload in some cases. - // Fix the order if necessary. - dopts.copts.StatsHandler.HandleRPC(ctx, inPayload) - } c.trailerMD = stream.Trailer() - if peer, ok := peer.FromContext(stream.Context()); ok { - c.peer = peer - } return nil } // sendRequest writes out various information of an RPC such as Context and Message. -func sendRequest(ctx context.Context, dopts dialOptions, compressor Compressor, callHdr *transport.CallHdr, t transport.ClientTransport, args interface{}, opts *transport.Options) (_ *transport.Stream, err error) { +func sendRequest(ctx context.Context, codec Codec, compressor Compressor, callHdr *transport.CallHdr, t transport.ClientTransport, args interface{}, opts *transport.Options) (_ *transport.Stream, err error) { stream, err := t.NewStream(ctx, callHdr) if err != nil { return nil, err @@ -105,27 +89,15 @@ func sendRequest(ctx context.Context, dopts dialOptions, compressor Compressor, } } }() - var ( - cbuf *bytes.Buffer - outPayload *stats.OutPayload - ) + var cbuf *bytes.Buffer if compressor != nil { cbuf = new(bytes.Buffer) } - if dopts.copts.StatsHandler != nil { - outPayload = &stats.OutPayload{ - Client: true, - } - } - outBuf, err := encode(dopts.codec, args, compressor, cbuf, outPayload) + outBuf, err := encode(codec, args, compressor, cbuf) if err != nil { return nil, Errorf(codes.Internal, "grpc: %v", err) } err = t.Write(stream, outBuf, opts) - if err == nil && outPayload != nil { - outPayload.SentTime = time.Now() - dopts.copts.StatsHandler.HandleRPC(ctx, outPayload) - } // t.NewStream(...) could lead to an early rejection of the RPC (e.g., the service/method // does not exist.) so that t.Write could get io.EOF from wait(...). Leave the following // recvResponse to get the final status. @@ -146,16 +118,8 @@ func Invoke(ctx context.Context, method string, args, reply interface{}, cc *Cli return invoke(ctx, method, args, reply, cc, opts...) } -func invoke(ctx context.Context, method string, args, reply interface{}, cc *ClientConn, opts ...CallOption) (e error) { +func invoke(ctx context.Context, method string, args, reply interface{}, cc *ClientConn, opts ...CallOption) (err error) { c := defaultCallInfo - if mc, ok := cc.getMethodConfig(method); ok { - c.failFast = !mc.WaitForReady - if mc.Timeout > 0 { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, mc.Timeout) - defer cancel() - } - } for _, o := range opts { if err := o.before(&c); err != nil { return toRPCErr(err) @@ -176,32 +140,12 @@ func invoke(ctx context.Context, method string, args, reply interface{}, cc *Cli c.traceInfo.tr.LazyLog(&c.traceInfo.firstLine, false) // TODO(dsymonds): Arrange for c.traceInfo.firstLine.remoteAddr to be set. defer func() { - if e != nil { - c.traceInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{e}}, true) + if err != nil { + c.traceInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) c.traceInfo.tr.SetError() } }() } - sh := cc.dopts.copts.StatsHandler - if sh != nil { - ctx = sh.TagRPC(ctx, &stats.RPCTagInfo{FullMethodName: method}) - begin := &stats.Begin{ - Client: true, - BeginTime: time.Now(), - FailFast: c.failFast, - } - sh.HandleRPC(ctx, begin) - } - defer func() { - if sh != nil { - end := &stats.End{ - Client: true, - EndTime: time.Now(), - Error: e, - } - sh.HandleRPC(ctx, end) - } - }() topts := &transport.Options{ Last: true, Delay: false, @@ -223,7 +167,6 @@ func invoke(ctx context.Context, method string, args, reply interface{}, cc *Cli if cc.dopts.cp != nil { callHdr.SendCompress = cc.dopts.cp.Type() } - gopts := BalancerGetOptions{ BlockingWait: !c.failFast, } @@ -245,7 +188,7 @@ func invoke(ctx context.Context, method string, args, reply interface{}, cc *Cli if c.traceInfo.tr != nil { c.traceInfo.tr.LazyLog(&payload{sent: true, msg: args}, true) } - stream, err = sendRequest(ctx, cc.dopts, cc.dopts.cp, callHdr, t, args, topts) + stream, err = sendRequest(ctx, cc.dopts.codec, cc.dopts.cp, callHdr, t, args, topts) if err != nil { if put != nil { put() @@ -262,7 +205,7 @@ func invoke(ctx context.Context, method string, args, reply interface{}, cc *Cli } return toRPCErr(err) } - err = recvResponse(ctx, cc.dopts, t, &c, stream, reply) + err = recvResponse(cc.dopts, t, &c, stream, reply) if err != nil { if put != nil { put() diff --git a/vendor/google.golang.org/grpc/call_test.go b/vendor/google.golang.org/grpc/call_test.go index 3c2165e..64976d7 100644 --- a/vendor/google.golang.org/grpc/call_test.go +++ b/vendor/google.golang.org/grpc/call_test.go @@ -118,7 +118,7 @@ func (h *testStreamHandler) handleStream(t *testing.T, s *transport.Stream) { } } // send a response back to end the stream. - reply, err := encode(testCodec{}, &expectedResponse, nil, nil, nil) + reply, err := encode(testCodec{}, &expectedResponse, nil, nil) if err != nil { t.Errorf("Failed to encode the response: %v", err) return @@ -164,10 +164,7 @@ func (s *server) start(t *testing.T, port int, maxStreams uint32) { if err != nil { return } - config := &transport.ServerConfig{ - MaxStreams: maxStreams, - } - st, err := transport.NewServerTransport("http2", conn, config) + st, err := transport.NewServerTransport("http2", conn, maxStreams, nil) if err != nil { continue } @@ -185,8 +182,6 @@ func (s *server) start(t *testing.T, port int, maxStreams uint32) { } go st.HandleStreams(func(s *transport.Stream) { go h.handleStream(t, s) - }, func(ctx context.Context, method string) context.Context { - return ctx }) } } diff --git a/vendor/google.golang.org/grpc/clientconn.go b/vendor/google.golang.org/grpc/clientconn.go index 1ba592c..6167472 100644 --- a/vendor/google.golang.org/grpc/clientconn.go +++ b/vendor/google.golang.org/grpc/clientconn.go @@ -36,7 +36,6 @@ package grpc import ( "errors" "fmt" - "math" "net" "strings" "sync" @@ -46,8 +45,6 @@ import ( "golang.org/x/net/trace" "google.golang.org/grpc/credentials" "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/keepalive" - "google.golang.org/grpc/stats" "google.golang.org/grpc/transport" ) @@ -57,8 +54,6 @@ var ( ErrClientConnClosing = errors.New("grpc: the client connection is closing") // ErrClientConnTimeout indicates that the ClientConn cannot establish the // underlying connections within the specified timeout. - // DEPRECATED: Please use context.DeadlineExceeded instead. This error will be - // removed in Q1 2017. ErrClientConnTimeout = errors.New("grpc: timed out when dialing") // errNoTransportSecurity indicates that there is no transport security @@ -88,33 +83,22 @@ var ( // dialOptions configure a Dial call. dialOptions are set by the DialOption // values passed to Dial. type dialOptions struct { - unaryInt UnaryClientInterceptor - streamInt StreamClientInterceptor - codec Codec - cp Compressor - dc Decompressor - bs backoffStrategy - balancer Balancer - block bool - insecure bool - timeout time.Duration - scChan <-chan ServiceConfig - copts transport.ConnectOptions - maxMsgSize int + unaryInt UnaryClientInterceptor + streamInt StreamClientInterceptor + codec Codec + cp Compressor + dc Decompressor + bs backoffStrategy + balancer Balancer + block bool + insecure bool + timeout time.Duration + copts transport.ConnectOptions } -const defaultClientMaxMsgSize = math.MaxInt32 - // DialOption configures how we set up the connection. type DialOption func(*dialOptions) -// WithMaxMsgSize returns a DialOption which sets the maximum message size the client can receive. -func WithMaxMsgSize(s int) DialOption { - return func(o *dialOptions) { - o.maxMsgSize = s - } -} - // WithCodec returns a DialOption which sets a codec for message marshaling and unmarshaling. func WithCodec(c Codec) DialOption { return func(o *dialOptions) { @@ -145,13 +129,6 @@ func WithBalancer(b Balancer) DialOption { } } -// WithServiceConfig returns a DialOption which has a channel to read the service configuration. -func WithServiceConfig(c <-chan ServiceConfig) DialOption { - return func(o *dialOptions) { - o.scChan = c - } -} - // WithBackoffMaxDelay configures the dialer to use the provided maximum delay // when backing off after failed connection attempts. func WithBackoffMaxDelay(md time.Duration) DialOption { @@ -222,8 +199,6 @@ func WithTimeout(d time.Duration) DialOption { } // WithDialer returns a DialOption that specifies a function to use for dialing network addresses. -// If FailOnNonTempDialError() is set to true, and an error is returned by f, gRPC checks the error's -// Temporary() method to decide if it should try to reconnect to the network address. func WithDialer(f func(string, time.Duration) (net.Conn, error)) DialOption { return func(o *dialOptions) { o.copts.Dialer = func(ctx context.Context, addr string) (net.Conn, error) { @@ -235,25 +210,6 @@ func WithDialer(f func(string, time.Duration) (net.Conn, error)) DialOption { } } -// WithStatsHandler returns a DialOption that specifies the stats handler -// for all the RPCs and underlying network connections in this ClientConn. -func WithStatsHandler(h stats.Handler) DialOption { - return func(o *dialOptions) { - o.copts.StatsHandler = h - } -} - -// FailOnNonTempDialError returns a DialOption that specified if gRPC fails on non-temporary dial errors. -// If f is true, and dialer returns a non-temporary error, gRPC will fail the connection to the network -// address and won't try to reconnect. -// The default value of FailOnNonTempDialError is false. -// This is an EXPERIMENTAL API. -func FailOnNonTempDialError(f bool) DialOption { - return func(o *dialOptions) { - o.copts.FailOnNonTempDialError = f - } -} - // WithUserAgent returns a DialOption that specifies a user agent string for all the RPCs. func WithUserAgent(s string) DialOption { return func(o *dialOptions) { @@ -261,13 +217,6 @@ func WithUserAgent(s string) DialOption { } } -// WithKeepaliveParams returns a DialOption that specifies keepalive paramaters for the client transport. -func WithKeepaliveParams(kp keepalive.ClientParameters) DialOption { - return func(o *dialOptions) { - o.copts.KeepaliveParams = kp - } -} - // WithUnaryInterceptor returns a DialOption that specifies the interceptor for unary RPCs. func WithUnaryInterceptor(f UnaryClientInterceptor) DialOption { return func(o *dialOptions) { @@ -282,15 +231,6 @@ func WithStreamInterceptor(f StreamClientInterceptor) DialOption { } } -// WithAuthority returns a DialOption that specifies the value to be used as -// the :authority pseudo-header. This value only works with WithInsecure and -// has no effect if TransportCredentials are present. -func WithAuthority(a string) DialOption { - return func(o *dialOptions) { - o.copts.Authority = a - } -} - // Dial creates a client connection to the given target. func Dial(target string, opts ...DialOption) (*ClientConn, error) { return DialContext(context.Background(), target, opts...) @@ -307,16 +247,6 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * conns: make(map[Address]*addrConn), } cc.ctx, cc.cancel = context.WithCancel(context.Background()) - cc.dopts.maxMsgSize = defaultClientMaxMsgSize - for _, opt := range opts { - opt(&cc.dopts) - } - if cc.dopts.timeout > 0 { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, cc.dopts.timeout) - defer cancel() - } - defer func() { select { case <-ctx.Done(): @@ -329,17 +259,10 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * } }() - if cc.dopts.scChan != nil { - // Wait for the initial service config. - select { - case sc, ok := <-cc.dopts.scChan: - if ok { - cc.sc = sc - } - case <-ctx.Done(): - return nil, ctx.Err() - } + for _, opt := range opts { + opt(&cc.dopts) } + // Set defaults. if cc.dopts.codec == nil { cc.dopts.codec = protoCodec{} @@ -350,8 +273,6 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * creds := cc.dopts.copts.TransportCredentials if creds != nil && creds.Info().ServerName != "" { cc.authority = creds.Info().ServerName - } else if cc.dopts.insecure && cc.dopts.copts.Authority != "" { - cc.authority = cc.dopts.copts.Authority } else { colonPos := strings.LastIndex(target, ":") if colonPos == -1 { @@ -363,9 +284,6 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * waitC := make(chan error, 1) go func() { var addrs []Address - if cc.dopts.balancer == nil && cc.sc.LB != nil { - cc.dopts.balancer = cc.sc.LB - } if cc.dopts.balancer == nil { // Connect to target directly if balancer is nil. addrs = append(addrs, Address{Addr: target}) @@ -401,6 +319,10 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * } close(waitC) }() + var timeoutCh <-chan time.Time + if cc.dopts.timeout > 0 { + timeoutCh = time.After(cc.dopts.timeout) + } select { case <-ctx.Done(): return nil, ctx.Err() @@ -408,17 +330,14 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * if err != nil { return nil, err } + case <-timeoutCh: + return nil, ErrClientConnTimeout } - // If balancer is nil or balancer.Notify() is nil, ok will be false here. // The lbWatcher goroutine will not be created. if ok { go cc.lbWatcher() } - - if cc.dopts.scChan != nil { - go cc.scWatcher() - } return cc, nil } @@ -465,7 +384,6 @@ type ClientConn struct { dopts dialOptions mu sync.RWMutex - sc ServiceConfig conns map[Address]*addrConn } @@ -504,24 +422,6 @@ func (cc *ClientConn) lbWatcher() { } } -func (cc *ClientConn) scWatcher() { - for { - select { - case sc, ok := <-cc.dopts.scChan: - if !ok { - return - } - cc.mu.Lock() - // TODO: load balance policy runtime change is ignored. - // We may revist this decision in the future. - cc.sc = sc - cc.mu.Unlock() - case <-cc.ctx.Done(): - return - } - } -} - // resetAddrConn creates an addrConn for addr and adds it to cc.conns. // If there is an old addrConn for addr, it will be torn down, using tearDownErr as the reason. // If tearDownErr is nil, errConnDrain will be used instead. @@ -609,14 +509,6 @@ func (cc *ClientConn) resetAddrConn(addr Address, skipWait bool, tearDownErr err return nil } -// TODO: Avoid the locking here. -func (cc *ClientConn) getMethodConfig(method string) (m MethodConfig, ok bool) { - cc.mu.RLock() - defer cc.mu.RUnlock() - m, ok = cc.sc.Methods[method] - return -} - func (cc *ClientConn) getTransport(ctx context.Context, opts BalancerGetOptions) (transport.ClientTransport, func(), error) { var ( ac *addrConn @@ -797,8 +689,6 @@ func (ac *addrConn) resetTransport(closeTransport bool) error { Metadata: ac.addr.Metadata, } newTransport, err := transport.NewClientTransport(ctx, sinfo, ac.dopts.copts) - // Don't call cancel in success path due to a race in Go 1.6: - // https://github.com/golang/go/issues/15078. if err != nil { cancel() diff --git a/vendor/google.golang.org/grpc/clientconn_test.go b/vendor/google.golang.org/grpc/clientconn_test.go index 93e78a5..179be25 100644 --- a/vendor/google.golang.org/grpc/clientconn_test.go +++ b/vendor/google.golang.org/grpc/clientconn_test.go @@ -34,13 +34,13 @@ package grpc import ( - "net" "testing" "time" "golang.org/x/net/context" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/oauth" ) const tlsDir = "testdata/" @@ -50,8 +50,8 @@ func TestDialTimeout(t *testing.T) { if err == nil { conn.Close() } - if err != context.DeadlineExceeded { - t.Fatalf("Dial(_, _) = %v, %v, want %v", conn, err, context.DeadlineExceeded) + if err != ErrClientConnTimeout { + t.Fatalf("Dial(_, _) = %v, %v, want %v", conn, err, ErrClientConnTimeout) } } @@ -64,8 +64,8 @@ func TestTLSDialTimeout(t *testing.T) { if err == nil { conn.Close() } - if err != context.DeadlineExceeded { - t.Fatalf("Dial(_, _) = %v, %v, want %v", conn, err, context.DeadlineExceeded) + if err != ErrClientConnTimeout { + t.Fatalf("Dial(_, _) = %v, %v, want %v", conn, err, ErrClientConnTimeout) } } @@ -85,34 +85,6 @@ func TestTLSServerNameOverwrite(t *testing.T) { } } -func TestWithAuthority(t *testing.T) { - overwriteServerName := "over.write.server.name" - conn, err := Dial("Non-Existent.Server:80", WithInsecure(), WithAuthority(overwriteServerName)) - if err != nil { - t.Fatalf("Dial(_, _) = _, %v, want _, ", err) - } - conn.Close() - if conn.authority != overwriteServerName { - t.Fatalf("%v.authority = %v, want %v", conn, conn.authority, overwriteServerName) - } -} - -func TestWithAuthorityAndTLS(t *testing.T) { - overwriteServerName := "over.write.server.name" - creds, err := credentials.NewClientTLSFromFile(tlsDir+"ca.pem", overwriteServerName) - if err != nil { - t.Fatalf("Failed to create credentials %v", err) - } - conn, err := Dial("Non-Existent.Server:80", WithTransportCredentials(creds), WithAuthority("no.effect.authority")) - if err != nil { - t.Fatalf("Dial(_, _) = _, %v, want _, ", err) - } - conn.Close() - if conn.authority != overwriteServerName { - t.Fatalf("%v.authority = %v, want %v", conn, conn.authority, overwriteServerName) - } -} - func TestDialContextCancel(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) cancel() @@ -158,17 +130,6 @@ func TestDialWithBlockingBalancer(t *testing.T) { <-dialDone } -// securePerRPCCredentials always requires transport security. -type securePerRPCCredentials struct{} - -func (c securePerRPCCredentials) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) { - return nil, nil -} - -func (c securePerRPCCredentials) RequireTransportSecurity() bool { - return true -} - func TestCredentialsMisuse(t *testing.T) { tlsCreds, err := credentials.NewClientTLSFromFile(tlsDir+"ca.pem", "x.test.youtube.com") if err != nil { @@ -178,8 +139,12 @@ func TestCredentialsMisuse(t *testing.T) { if _, err := Dial("Non-Existent.Server:80", WithTransportCredentials(tlsCreds), WithBlock(), WithInsecure()); err != errCredentialsConflict { t.Fatalf("Dial(_, _) = _, %v, want _, %v", err, errCredentialsConflict) } + rpcCreds, err := oauth.NewJWTAccessFromKey(nil) + if err != nil { + t.Fatalf("Failed to create credentials %v", err) + } // security info on insecure connection - if _, err := Dial("Non-Existent.Server:80", WithPerRPCCredentials(securePerRPCCredentials{}), WithBlock(), WithInsecure()); err != errTransportCredentialsMissing { + if _, err := Dial("Non-Existent.Server:80", WithPerRPCCredentials(rpcCreds), WithBlock(), WithInsecure()); err != errTransportCredentialsMissing { t.Fatalf("Dial(_, _) = _, %v, want _, %v", err, errTransportCredentialsMissing) } } @@ -223,33 +188,3 @@ func testBackoffConfigSet(t *testing.T, expected *BackoffConfig, opts ...DialOpt } conn.Close() } - -type testErr struct { - temp bool -} - -func (e *testErr) Error() string { - return "test error" -} - -func (e *testErr) Temporary() bool { - return e.temp -} - -var nonTemporaryError = &testErr{false} - -func nonTemporaryErrorDialer(addr string, timeout time.Duration) (net.Conn, error) { - return nil, nonTemporaryError -} - -func TestDialWithBlockErrorOnNonTemporaryErrorDialer(t *testing.T) { - ctx, _ := context.WithTimeout(context.Background(), 100*time.Millisecond) - if _, err := DialContext(ctx, "", WithInsecure(), WithDialer(nonTemporaryErrorDialer), WithBlock(), FailOnNonTempDialError(true)); err != nonTemporaryError { - t.Fatalf("Dial(%q) = %v, want %v", "", err, nonTemporaryError) - } - - // Without FailOnNonTempDialError, gRPC will retry to connect, and dial should exit with time out error. - if _, err := DialContext(ctx, "", WithInsecure(), WithDialer(nonTemporaryErrorDialer), WithBlock()); err != context.DeadlineExceeded { - t.Fatalf("Dial(%q) = %v, want %v", "", err, context.DeadlineExceeded) - } -} diff --git a/vendor/google.golang.org/grpc/codegen.sh b/vendor/google.golang.org/grpc/codegen.sh index 4cdc6ba..b009488 100755 --- a/vendor/google.golang.org/grpc/codegen.sh +++ b/vendor/google.golang.org/grpc/codegen.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/bash # This script serves as an example to demonstrate how to generate the gRPC-Go # interface and the related messages from .proto file. diff --git a/vendor/google.golang.org/grpc/coverage.sh b/vendor/google.golang.org/grpc/coverage.sh index b85f918..1202353 100755 --- a/vendor/google.golang.org/grpc/coverage.sh +++ b/vendor/google.golang.org/grpc/coverage.sh @@ -1,5 +1,4 @@ -#!/usr/bin/env bash - +#!/bin/bash set -e diff --git a/vendor/google.golang.org/grpc/credentials/credentials.go b/vendor/google.golang.org/grpc/credentials/credentials.go index 4d45c3e..5555ef0 100644 --- a/vendor/google.golang.org/grpc/credentials/credentials.go +++ b/vendor/google.golang.org/grpc/credentials/credentials.go @@ -165,7 +165,9 @@ func (c *tlsCreds) ClientHandshake(ctx context.Context, addr string, rawConn net case <-ctx.Done(): return nil, nil, ctx.Err() } - return conn, TLSInfo{conn.ConnectionState()}, nil + // TODO(zhaoq): Omit the auth info for client now. It is more for + // information than anything else. + return conn, nil, nil } func (c *tlsCreds) ServerHandshake(rawConn net.Conn) (net.Conn, AuthInfo, error) { diff --git a/vendor/google.golang.org/grpc/credentials/credentials_test.go b/vendor/google.golang.org/grpc/credentials/credentials_test.go index 1609374..caf35b2 100644 --- a/vendor/google.golang.org/grpc/credentials/credentials_test.go +++ b/vendor/google.golang.org/grpc/credentials/credentials_test.go @@ -34,11 +34,7 @@ package credentials import ( - "crypto/tls" - "net" "testing" - - "golang.org/x/net/context" ) func TestTLSOverrideServerName(t *testing.T) { @@ -62,161 +58,4 @@ func TestTLSClone(t *testing.T) { if c.Info().ServerName != expectedServerName { t.Fatalf("Change in clone should not affect the original, c.Info().ServerName = %v, want %v", c.Info().ServerName, expectedServerName) } - -} - -const tlsDir = "../test/testdata/" - -type serverHandshake func(net.Conn) (AuthInfo, error) - -func TestClientHandshakeReturnsAuthInfo(t *testing.T) { - done := make(chan AuthInfo, 1) - lis := launchServer(t, tlsServerHandshake, done) - defer lis.Close() - lisAddr := lis.Addr().String() - clientAuthInfo := clientHandle(t, gRPCClientHandshake, lisAddr) - // wait until server sends serverAuthInfo or fails. - serverAuthInfo, ok := <-done - if !ok { - t.Fatalf("Error at server-side") - } - if !compare(clientAuthInfo, serverAuthInfo) { - t.Fatalf("c.ClientHandshake(_, %v, _) = %v, want %v.", lisAddr, clientAuthInfo, serverAuthInfo) - } -} - -func TestServerHandshakeReturnsAuthInfo(t *testing.T) { - done := make(chan AuthInfo, 1) - lis := launchServer(t, gRPCServerHandshake, done) - defer lis.Close() - clientAuthInfo := clientHandle(t, tlsClientHandshake, lis.Addr().String()) - // wait until server sends serverAuthInfo or fails. - serverAuthInfo, ok := <-done - if !ok { - t.Fatalf("Error at server-side") - } - if !compare(clientAuthInfo, serverAuthInfo) { - t.Fatalf("ServerHandshake(_) = %v, want %v.", serverAuthInfo, clientAuthInfo) - } -} - -func TestServerAndClientHandshake(t *testing.T) { - done := make(chan AuthInfo, 1) - lis := launchServer(t, gRPCServerHandshake, done) - defer lis.Close() - clientAuthInfo := clientHandle(t, gRPCClientHandshake, lis.Addr().String()) - // wait until server sends serverAuthInfo or fails. - serverAuthInfo, ok := <-done - if !ok { - t.Fatalf("Error at server-side") - } - if !compare(clientAuthInfo, serverAuthInfo) { - t.Fatalf("AuthInfo returned by server: %v and client: %v aren't same", serverAuthInfo, clientAuthInfo) - } -} - -func compare(a1, a2 AuthInfo) bool { - if a1.AuthType() != a2.AuthType() { - return false - } - switch a1.AuthType() { - case "tls": - state1 := a1.(TLSInfo).State - state2 := a2.(TLSInfo).State - if state1.Version == state2.Version && - state1.HandshakeComplete == state2.HandshakeComplete && - state1.CipherSuite == state2.CipherSuite && - state1.NegotiatedProtocol == state2.NegotiatedProtocol { - return true - } - return false - default: - return false - } -} - -func launchServer(t *testing.T, hs serverHandshake, done chan AuthInfo) net.Listener { - lis, err := net.Listen("tcp", "localhost:0") - if err != nil { - t.Fatalf("Failed to listen: %v", err) - } - go serverHandle(t, hs, done, lis) - return lis -} - -// Is run in a seperate goroutine. -func serverHandle(t *testing.T, hs serverHandshake, done chan AuthInfo, lis net.Listener) { - serverRawConn, err := lis.Accept() - if err != nil { - t.Errorf("Server failed to accept connection: %v", err) - close(done) - return - } - serverAuthInfo, err := hs(serverRawConn) - if err != nil { - t.Errorf("Server failed while handshake. Error: %v", err) - serverRawConn.Close() - close(done) - return - } - done <- serverAuthInfo -} - -func clientHandle(t *testing.T, hs func(net.Conn, string) (AuthInfo, error), lisAddr string) AuthInfo { - conn, err := net.Dial("tcp", lisAddr) - if err != nil { - t.Fatalf("Client failed to connect to %s. Error: %v", lisAddr, err) - } - defer conn.Close() - clientAuthInfo, err := hs(conn, lisAddr) - if err != nil { - t.Fatalf("Error on client while handshake. Error: %v", err) - } - return clientAuthInfo -} - -// Server handshake implementation in gRPC. -func gRPCServerHandshake(conn net.Conn) (AuthInfo, error) { - serverTLS, err := NewServerTLSFromFile(tlsDir+"server1.pem", tlsDir+"server1.key") - if err != nil { - return nil, err - } - _, serverAuthInfo, err := serverTLS.ServerHandshake(conn) - if err != nil { - return nil, err - } - return serverAuthInfo, nil -} - -// Client handshake implementation in gRPC. -func gRPCClientHandshake(conn net.Conn, lisAddr string) (AuthInfo, error) { - clientTLS := NewTLS(&tls.Config{InsecureSkipVerify: true}) - _, authInfo, err := clientTLS.ClientHandshake(context.Background(), lisAddr, conn) - if err != nil { - return nil, err - } - return authInfo, nil -} - -func tlsServerHandshake(conn net.Conn) (AuthInfo, error) { - cert, err := tls.LoadX509KeyPair(tlsDir+"server1.pem", tlsDir+"server1.key") - if err != nil { - return nil, err - } - serverTLSConfig := &tls.Config{Certificates: []tls.Certificate{cert}} - serverConn := tls.Server(conn, serverTLSConfig) - err = serverConn.Handshake() - if err != nil { - return nil, err - } - return TLSInfo{State: serverConn.ConnectionState()}, nil -} - -func tlsClientHandshake(conn net.Conn, _ string) (AuthInfo, error) { - clientTLSConfig := &tls.Config{InsecureSkipVerify: true} - clientConn := tls.Client(conn, clientTLSConfig) - if err := clientConn.Handshake(); err != nil { - return nil, err - } - return TLSInfo{State: clientConn.ConnectionState()}, nil } diff --git a/vendor/google.golang.org/grpc/credentials/credentials_util_go17.go b/vendor/google.golang.org/grpc/credentials/credentials_util_go17.go index 7597b09..9647b9e 100644 --- a/vendor/google.golang.org/grpc/credentials/credentials_util_go17.go +++ b/vendor/google.golang.org/grpc/credentials/credentials_util_go17.go @@ -1,5 +1,4 @@ // +build go1.7 -// +build !go1.8 /* * @@ -45,6 +44,8 @@ import ( // contains a mutex and must not be copied. // // If cfg is nil, a new zero tls.Config is returned. +// +// TODO replace this function with official clone function. func cloneTLSConfig(cfg *tls.Config) *tls.Config { if cfg == nil { return &tls.Config{} diff --git a/vendor/google.golang.org/grpc/credentials/credentials_util_go18.go b/vendor/google.golang.org/grpc/credentials/credentials_util_go18.go deleted file mode 100644 index 0ecf342..0000000 --- a/vendor/google.golang.org/grpc/credentials/credentials_util_go18.go +++ /dev/null @@ -1,53 +0,0 @@ -// +build go1.8 - -/* - * - * Copyright 2017, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -package credentials - -import ( - "crypto/tls" -) - -// cloneTLSConfig returns a shallow clone of the exported -// fields of cfg, ignoring the unexported sync.Once, which -// contains a mutex and must not be copied. -// -// If cfg is nil, a new zero tls.Config is returned. -func cloneTLSConfig(cfg *tls.Config) *tls.Config { - if cfg == nil { - return &tls.Config{} - } - - return cfg.Clone() -} diff --git a/vendor/google.golang.org/grpc/credentials/credentials_util_pre_go17.go b/vendor/google.golang.org/grpc/credentials/credentials_util_pre_go17.go index cfd40df..09b8d12 100644 --- a/vendor/google.golang.org/grpc/credentials/credentials_util_pre_go17.go +++ b/vendor/google.golang.org/grpc/credentials/credentials_util_pre_go17.go @@ -44,6 +44,8 @@ import ( // contains a mutex and must not be copied. // // If cfg is nil, a new zero tls.Config is returned. +// +// TODO replace this function with official clone function. func cloneTLSConfig(cfg *tls.Config) *tls.Config { if cfg == nil { return &tls.Config{} diff --git a/vendor/google.golang.org/grpc/examples/gotutorial.md b/vendor/google.golang.org/grpc/examples/gotutorial.md index 6770b52..25c0a2d 100644 --- a/vendor/google.golang.org/grpc/examples/gotutorial.md +++ b/vendor/google.golang.org/grpc/examples/gotutorial.md @@ -33,7 +33,7 @@ You also should have the relevant tools installed to generate the server and cli ## Defining the service -Our first step (as you'll know from the [quick start](http://www.grpc.io/docs/#quick-start)) is to define the gRPC *service* and the method *request* and *response* types using [protocol buffers](https://developers.google.com/protocol-buffers/docs/overview). You can see the complete .proto file in [examples/route_guide/routeguide/route_guide.proto](https://github.com/grpc/grpc-go/tree/master/examples/route_guide/routeguide/route_guide.proto). +Our first step (as you'll know from the [quick start](http://www.grpc.io/docs/#quick-start)) is to define the gRPC *service* and the method *request* and *response* types using [protocol buffers] (https://developers.google.com/protocol-buffers/docs/overview). You can see the complete .proto file in [examples/route_guide/routeguide/route_guide.proto](https://github.com/grpc/grpc-go/tree/master/examples/route_guide/routeguide/route_guide.proto). To define a service, you specify a named `service` in your .proto file: diff --git a/vendor/google.golang.org/grpc/examples/helloworld/greeter_server/main.go b/vendor/google.golang.org/grpc/examples/helloworld/greeter_server/main.go index 162cf90..d572b22 100644 --- a/vendor/google.golang.org/grpc/examples/helloworld/greeter_server/main.go +++ b/vendor/google.golang.org/grpc/examples/helloworld/greeter_server/main.go @@ -40,7 +40,6 @@ import ( "golang.org/x/net/context" "google.golang.org/grpc" pb "google.golang.org/grpc/examples/helloworld/helloworld" - "google.golang.org/grpc/reflection" ) const ( @@ -62,8 +61,6 @@ func main() { } s := grpc.NewServer() pb.RegisterGreeterServer(s, &server{}) - // Register reflection service on gRPC server. - reflection.Register(s) if err := s.Serve(lis); err != nil { log.Fatalf("failed to serve: %v", err) } diff --git a/vendor/google.golang.org/grpc/examples/helloworld/mock/hw_test.go b/vendor/google.golang.org/grpc/examples/helloworld/mock/hw_test.go deleted file mode 100644 index b63fec7..0000000 --- a/vendor/google.golang.org/grpc/examples/helloworld/mock/hw_test.go +++ /dev/null @@ -1,49 +0,0 @@ -package mock_test - -import ( - "fmt" - "testing" - - "github.com/golang/mock/gomock" - "github.com/golang/protobuf/proto" - "golang.org/x/net/context" - helloworld "google.golang.org/grpc/examples/helloworld/helloworld" - hwmock "google.golang.org/grpc/examples/helloworld/mock/mock_helloworld" -) - -// rpcMsg implements the gomock.Matcher interface -type rpcMsg struct { - msg proto.Message -} - -func (r *rpcMsg) Matches(msg interface{}) bool { - m, ok := msg.(proto.Message) - if !ok { - return false - } - return proto.Equal(m, r.msg) -} - -func (r *rpcMsg) String() string { - return fmt.Sprintf("is %s", r.msg) -} - -func TestSayHello(t *testing.T) { - ctrl := gomock.NewController(t) - defer ctrl.Finish() - mockGreeterClient := hwmock.NewMockGreeterClient(ctrl) - req := &helloworld.HelloRequest{Name: "unit_test"} - mockGreeterClient.EXPECT().SayHello( - gomock.Any(), - &rpcMsg{msg: req}, - ).Return(&helloworld.HelloReply{Message: "Mocked Interface"}, nil) - testSayHello(t, mockGreeterClient) -} - -func testSayHello(t *testing.T, client helloworld.GreeterClient) { - r, err := client.SayHello(context.Background(), &helloworld.HelloRequest{Name: "unit_test"}) - if err != nil || r.Message != "Mocked Interface" { - t.Errorf("mocking failed") - } - t.Log("Reply : ", r.Message) -} diff --git a/vendor/google.golang.org/grpc/examples/helloworld/mock/mock_helloworld/hw_mock.go b/vendor/google.golang.org/grpc/examples/helloworld/mock/mock_helloworld/hw_mock.go deleted file mode 100644 index 14957ed..0000000 --- a/vendor/google.golang.org/grpc/examples/helloworld/mock/mock_helloworld/hw_mock.go +++ /dev/null @@ -1,48 +0,0 @@ -// Automatically generated by MockGen. DO NOT EDIT! -// Source: google.golang.org/grpc/examples/helloworld/helloworld (interfaces: GreeterClient) - -package mock_helloworld - -import ( - gomock "github.com/golang/mock/gomock" - context "golang.org/x/net/context" - grpc "google.golang.org/grpc" - helloworld "google.golang.org/grpc/examples/helloworld/helloworld" -) - -// Mock of GreeterClient interface -type MockGreeterClient struct { - ctrl *gomock.Controller - recorder *_MockGreeterClientRecorder -} - -// Recorder for MockGreeterClient (not exported) -type _MockGreeterClientRecorder struct { - mock *MockGreeterClient -} - -func NewMockGreeterClient(ctrl *gomock.Controller) *MockGreeterClient { - mock := &MockGreeterClient{ctrl: ctrl} - mock.recorder = &_MockGreeterClientRecorder{mock} - return mock -} - -func (_m *MockGreeterClient) EXPECT() *_MockGreeterClientRecorder { - return _m.recorder -} - -func (_m *MockGreeterClient) SayHello(_param0 context.Context, _param1 *helloworld.HelloRequest, _param2 ...grpc.CallOption) (*helloworld.HelloReply, error) { - _s := []interface{}{_param0, _param1} - for _, _x := range _param2 { - _s = append(_s, _x) - } - ret := _m.ctrl.Call(_m, "SayHello", _s...) - ret0, _ := ret[0].(*helloworld.HelloReply) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -func (_mr *_MockGreeterClientRecorder) SayHello(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - _s := append([]interface{}{arg0, arg1}, arg2...) - return _mr.mock.ctrl.RecordCall(_mr.mock, "SayHello", _s...) -} diff --git a/vendor/google.golang.org/grpc/grpclb/grpclb.go b/vendor/google.golang.org/grpc/grpclb/grpclb.go index d9a1a8b..996d27a 100644 --- a/vendor/google.golang.org/grpc/grpclb/grpclb.go +++ b/vendor/google.golang.org/grpc/grpclb/grpclb.go @@ -40,7 +40,6 @@ import ( "errors" "fmt" "sync" - "time" "golang.org/x/net/context" "google.golang.org/grpc" @@ -94,17 +93,16 @@ type addrInfo struct { } type balancer struct { - r naming.Resolver - mu sync.Mutex - seq int // a sequence number to make sure addrCh does not get stale addresses. - w naming.Watcher - addrCh chan []grpc.Address - rbs []remoteBalancerInfo - addrs []*addrInfo - next int - waitCh chan struct{} - done bool - expTimer *time.Timer + r naming.Resolver + mu sync.Mutex + seq int // a sequence number to make sure addrCh does not get stale addresses. + w naming.Watcher + addrCh chan []grpc.Address + rbs []remoteBalancerInfo + addrs []*addrInfo + next int + waitCh chan struct{} + done bool } func (b *balancer) watchAddrUpdates(w naming.Watcher, ch chan remoteBalancerInfo) error { @@ -182,39 +180,14 @@ func (b *balancer) watchAddrUpdates(w naming.Watcher, ch chan remoteBalancerInfo return nil } -func (b *balancer) serverListExpire(seq int) { - b.mu.Lock() - defer b.mu.Unlock() - // TODO: gRPC interanls do not clear the connections when the server list is stale. - // This means RPCs will keep using the existing server list until b receives new - // server list even though the list is expired. Revisit this behavior later. - if b.done || seq < b.seq { - return - } - b.next = 0 - b.addrs = nil - // Ask grpc internals to close all the corresponding connections. - b.addrCh <- nil -} - -func convertDuration(d *lbpb.Duration) time.Duration { - if d == nil { - return 0 - } - return time.Duration(d.Seconds)*time.Second + time.Duration(d.Nanos)*time.Nanosecond -} - func (b *balancer) processServerList(l *lbpb.ServerList, seq int) { - if l == nil { - return - } servers := l.GetServers() - expiration := convertDuration(l.GetExpirationInterval()) var ( sl []*addrInfo addrs []grpc.Address ) for _, s := range servers { + // TODO: Support ExpirationInterval md := metadata.Pairs("lb-token", s.LoadBalanceToken) addr := grpc.Address{ Addr: fmt.Sprintf("%s:%d", s.IpAddress, s.Port), @@ -236,20 +209,11 @@ func (b *balancer) processServerList(l *lbpb.ServerList, seq int) { b.next = 0 b.addrs = sl b.addrCh <- addrs - if b.expTimer != nil { - b.expTimer.Stop() - b.expTimer = nil - } - if expiration > 0 { - b.expTimer = time.AfterFunc(expiration, func() { - b.serverListExpire(seq) - }) - } } return } -func (b *balancer) callRemoteBalancer(lbc lbpb.LoadBalancerClient, seq int) (retry bool) { +func (b *balancer) callRemoteBalancer(lbc lbpb.LoadBalancerClient) (retry bool) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() stream, err := lbc.BalanceLoad(ctx, grpc.FailFast(false)) @@ -262,6 +226,8 @@ func (b *balancer) callRemoteBalancer(lbc lbpb.LoadBalancerClient, seq int) (ret b.mu.Unlock() return } + b.seq++ + seq := b.seq b.mu.Unlock() initReq := &lbpb.LoadBalanceRequest{ LoadBalanceRequestType: &lbpb.LoadBalanceRequest_InitialRequest{ @@ -294,14 +260,6 @@ func (b *balancer) callRemoteBalancer(lbc lbpb.LoadBalancerClient, seq int) (ret if err != nil { break } - b.mu.Lock() - if b.done || seq < b.seq { - b.mu.Unlock() - return - } - b.seq++ // tick when receiving a new list of servers. - seq = b.seq - b.mu.Unlock() if serverList := reply.GetServerList(); serverList != nil { b.processServerList(serverList, seq) } @@ -368,15 +326,10 @@ func (b *balancer) Start(target string, config grpc.BalancerConfig) error { grpclog.Printf("Failed to setup a connection to the remote balancer %v: %v", rb.addr, err) return } - b.mu.Lock() - b.seq++ // tick when getting a new balancer address - seq := b.seq - b.next = 0 - b.mu.Unlock() go func(cc *grpc.ClientConn) { lbc := lbpb.NewLoadBalancerClient(cc) for { - if retry := b.callRemoteBalancer(lbc, seq); !retry { + if retry := b.callRemoteBalancer(lbc); !retry { cc.Close() return } @@ -544,9 +497,6 @@ func (b *balancer) Close() error { b.mu.Lock() defer b.mu.Unlock() b.done = true - if b.expTimer != nil { - b.expTimer.Stop() - } if b.waitCh != nil { close(b.waitCh) } diff --git a/vendor/google.golang.org/grpc/grpclb/grpclb_test.go b/vendor/google.golang.org/grpc/grpclb/grpclb_test.go index f034b6b..3215bea 100644 --- a/vendor/google.golang.org/grpc/grpclb/grpclb_test.go +++ b/vendor/google.golang.org/grpc/grpclb/grpclb_test.go @@ -162,16 +162,14 @@ func (c *serverNameCheckCreds) OverrideServerName(s string) error { } type remoteBalancer struct { - sls []*lbpb.ServerList - intervals []time.Duration - done chan struct{} + servers *lbpb.ServerList + done chan struct{} } -func newRemoteBalancer(sls []*lbpb.ServerList, intervals []time.Duration) *remoteBalancer { +func newRemoteBalancer(servers *lbpb.ServerList) *remoteBalancer { return &remoteBalancer{ - sls: sls, - intervals: intervals, - done: make(chan struct{}), + servers: servers, + done: make(chan struct{}), } } @@ -188,16 +186,13 @@ func (b *remoteBalancer) BalanceLoad(stream lbpb.LoadBalancer_BalanceLoadServer) if err := stream.Send(resp); err != nil { return err } - for k, v := range b.sls { - time.Sleep(b.intervals[k]) - resp = &lbpb.LoadBalanceResponse{ - LoadBalanceResponseType: &lbpb.LoadBalanceResponse_ServerList{ - ServerList: v, - }, - } - if err := stream.Send(resp); err != nil { - return err - } + resp = &lbpb.LoadBalanceResponse{ + LoadBalanceResponseType: &lbpb.LoadBalanceResponse_ServerList{ + ServerList: b.servers, + }, + } + if err := stream.Send(resp); err != nil { + return err } <-b.done return nil @@ -273,9 +268,7 @@ func TestGRPCLB(t *testing.T) { sl := &lbpb.ServerList{ Servers: bes, } - sls := []*lbpb.ServerList{sl} - intervals := []time.Duration{0} - ls := newRemoteBalancer(sls, intervals) + ls := newRemoteBalancer(sl) lbpb.RegisterLoadBalancerServer(lb, ls) go func() { lb.Serve(lbLis) @@ -350,9 +343,7 @@ func TestDropRequest(t *testing.T) { sl := &lbpb.ServerList{ Servers: bes, } - sls := []*lbpb.ServerList{sl} - intervals := []time.Duration{0} - ls := newRemoteBalancer(sls, intervals) + ls := newRemoteBalancer(sl) lbpb.RegisterLoadBalancerServer(lb, ls) go func() { lb.Serve(lbLis) @@ -422,9 +413,7 @@ func TestDropRequestFailedNonFailFast(t *testing.T) { sl := &lbpb.ServerList{ Servers: bes, } - sls := []*lbpb.ServerList{sl} - intervals := []time.Duration{0} - ls := newRemoteBalancer(sls, intervals) + ls := newRemoteBalancer(sl) lbpb.RegisterLoadBalancerServer(lb, ls) go func() { lb.Serve(lbLis) @@ -450,86 +439,3 @@ func TestDropRequestFailedNonFailFast(t *testing.T) { } cc.Close() } - -func TestServerExpiration(t *testing.T) { - // Start a backend. - beLis, err := net.Listen("tcp", "localhost:0") - if err != nil { - t.Fatalf("Failed to listen %v", err) - } - beAddr := strings.Split(beLis.Addr().String(), ":") - bePort, err := strconv.Atoi(beAddr[1]) - backends := startBackends(t, besn, beLis) - defer stopBackends(backends) - - // Start a load balancer. - lbLis, err := net.Listen("tcp", "localhost:0") - if err != nil { - t.Fatalf("Failed to create the listener for the load balancer %v", err) - } - lbCreds := &serverNameCheckCreds{ - sn: lbsn, - } - lb := grpc.NewServer(grpc.Creds(lbCreds)) - if err != nil { - t.Fatalf("Failed to generate the port number %v", err) - } - be := &lbpb.Server{ - IpAddress: []byte(beAddr[0]), - Port: int32(bePort), - LoadBalanceToken: lbToken, - } - var bes []*lbpb.Server - bes = append(bes, be) - exp := &lbpb.Duration{ - Seconds: 0, - Nanos: 100000000, // 100ms - } - var sls []*lbpb.ServerList - sl := &lbpb.ServerList{ - Servers: bes, - ExpirationInterval: exp, - } - sls = append(sls, sl) - sl = &lbpb.ServerList{ - Servers: bes, - } - sls = append(sls, sl) - var intervals []time.Duration - intervals = append(intervals, 0) - intervals = append(intervals, 500*time.Millisecond) - ls := newRemoteBalancer(sls, intervals) - lbpb.RegisterLoadBalancerServer(lb, ls) - go func() { - lb.Serve(lbLis) - }() - defer func() { - ls.stop() - lb.Stop() - }() - creds := serverNameCheckCreds{ - expected: besn, - } - ctx, _ := context.WithTimeout(context.Background(), 10*time.Second) - cc, err := grpc.DialContext(ctx, besn, grpc.WithBalancer(Balancer(&testNameResolver{ - addr: lbLis.Addr().String(), - })), grpc.WithBlock(), grpc.WithTransportCredentials(&creds)) - if err != nil { - t.Fatalf("Failed to dial to the backend %v", err) - } - helloC := hwpb.NewGreeterClient(cc) - if _, err := helloC.SayHello(context.Background(), &hwpb.HelloRequest{Name: "grpc"}); err != nil { - t.Fatalf("%v.SayHello(_, _) = _, %v, want _, ", helloC, err) - } - // Sleep and wake up when the first server list gets expired. - time.Sleep(150 * time.Millisecond) - if _, err := helloC.SayHello(context.Background(), &hwpb.HelloRequest{Name: "grpc"}); grpc.Code(err) != codes.Unavailable { - t.Fatalf("%v.SayHello(_, _) = _, %v, want _, %s", helloC, err, codes.Unavailable) - } - // A non-failfast rpc should be succeeded after the second server list is received from - // the remote load balancer. - if _, err := helloC.SayHello(context.Background(), &hwpb.HelloRequest{Name: "grpc"}, grpc.FailFast(false)); err != nil { - t.Fatalf("%v.SayHello(_, _) = _, %v, want _, ", helloC, err) - } - cc.Close() -} diff --git a/vendor/google.golang.org/grpc/grpclog/glogger/glogger.go b/vendor/google.golang.org/grpc/grpclog/glogger/glogger.go index 43b886c..53e3c53 100644 --- a/vendor/google.golang.org/grpc/grpclog/glogger/glogger.go +++ b/vendor/google.golang.org/grpc/grpclog/glogger/glogger.go @@ -37,8 +37,6 @@ Package glogger defines glog-based logging for grpc. package glogger import ( - "fmt" - "github.com/golang/glog" "google.golang.org/grpc/grpclog" ) @@ -50,25 +48,25 @@ func init() { type glogger struct{} func (g *glogger) Fatal(args ...interface{}) { - glog.FatalDepth(2, args...) + glog.Fatal(args...) } func (g *glogger) Fatalf(format string, args ...interface{}) { - glog.FatalDepth(2, fmt.Sprintf(format, args...)) + glog.Fatalf(format, args...) } func (g *glogger) Fatalln(args ...interface{}) { - glog.FatalDepth(2, fmt.Sprintln(args...)) + glog.Fatalln(args...) } func (g *glogger) Print(args ...interface{}) { - glog.InfoDepth(2, args...) + glog.Info(args...) } func (g *glogger) Printf(format string, args ...interface{}) { - glog.InfoDepth(2, fmt.Sprintf(format, args...)) + glog.Infof(format, args...) } func (g *glogger) Println(args ...interface{}) { - glog.InfoDepth(2, fmt.Sprintln(args...)) + glog.Infoln(args...) } diff --git a/vendor/google.golang.org/grpc/interop/client/client.go b/vendor/google.golang.org/grpc/interop/client/client.go index 38bad3f..7ae864e 100644 --- a/vendor/google.golang.org/grpc/interop/client/client.go +++ b/vendor/google.golang.org/grpc/interop/client/client.go @@ -52,7 +52,7 @@ var ( serviceAccountKeyFile = flag.String("service_account_key_file", "", "Path to service account json key file") oauthScope = flag.String("oauth_scope", "", "The scope for OAuth2 tokens") defaultServiceAccount = flag.String("default_service_account", "", "Email of GCE default service account") - serverHost = flag.String("server_host", "localhost", "The server host name") + serverHost = flag.String("server_host", "127.0.0.1", "The server host name") serverPort = flag.Int("server_port", 10000, "The server port number") tlsServerName = flag.String("server_host_override", "", "The server name use to verify the hostname returned by TLS handshake if it is not empty. Otherwise, --server_host is used.") testCase = flag.String("test_case", "large_unary", @@ -71,10 +71,7 @@ var ( oauth2_auth_token: large_unary with oauth2 token auth; cancel_after_begin: cancellation after metadata has been sent but before payloads are sent; cancel_after_first_response: cancellation after receiving 1st message from the server; - status_code_and_message: status code propagated back to client; - custom_metadata: server will echo custom metadata; - unimplemented_method: client attempts to call unimplemented method; - unimplemented_service: client attempts to call unimplemented service.`) + status_code_and_message: status code propagated back to client.`) // The test CA root cert file testCAFile = "testdata/ca.pem" @@ -187,15 +184,6 @@ func main() { case "status_code_and_message": interop.DoStatusCodeAndMessage(tc) grpclog.Println("StatusCodeAndMessage done") - case "custom_metadata": - interop.DoCustomMetadata(tc) - grpclog.Println("CustomMetadata done") - case "unimplemented_method": - interop.DoUnimplementedMethod(conn) - grpclog.Println("UnimplementedMethod done") - case "unimplemented_service": - interop.DoUnimplementedService(testpb.NewUnimplementedServiceClient(conn)) - grpclog.Println("UnimplementedService done") default: grpclog.Fatal("Unsupported test case: ", *testCase) } diff --git a/vendor/google.golang.org/grpc/interop/grpc_testing/test.pb.go b/vendor/google.golang.org/grpc/interop/grpc_testing/test.pb.go index 76ae564..68b97c1 100755 --- a/vendor/google.golang.org/grpc/interop/grpc_testing/test.pb.go +++ b/vendor/google.golang.org/grpc/interop/grpc_testing/test.pb.go @@ -792,115 +792,48 @@ var _TestService_serviceDesc = grpc.ServiceDesc{ Metadata: "test.proto", } -// Client API for UnimplementedService service - -type UnimplementedServiceClient interface { - // A call that no server should implement - UnimplementedCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) -} - -type unimplementedServiceClient struct { - cc *grpc.ClientConn -} - -func NewUnimplementedServiceClient(cc *grpc.ClientConn) UnimplementedServiceClient { - return &unimplementedServiceClient{cc} -} - -func (c *unimplementedServiceClient) UnimplementedCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := grpc.Invoke(ctx, "/grpc.testing.UnimplementedService/UnimplementedCall", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Server API for UnimplementedService service - -type UnimplementedServiceServer interface { - // A call that no server should implement - UnimplementedCall(context.Context, *Empty) (*Empty, error) -} - -func RegisterUnimplementedServiceServer(s *grpc.Server, srv UnimplementedServiceServer) { - s.RegisterService(&_UnimplementedService_serviceDesc, srv) -} - -func _UnimplementedService_UnimplementedCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(UnimplementedServiceServer).UnimplementedCall(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/grpc.testing.UnimplementedService/UnimplementedCall", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UnimplementedServiceServer).UnimplementedCall(ctx, req.(*Empty)) - } - return interceptor(ctx, in, info, handler) -} - -var _UnimplementedService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.testing.UnimplementedService", - HandlerType: (*UnimplementedServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "UnimplementedCall", - Handler: _UnimplementedService_UnimplementedCall_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: fileDescriptor0, -} - func init() { proto.RegisterFile("test.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 649 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x54, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0xc5, 0x69, 0x42, 0xda, 0x49, 0x6a, 0xc2, 0x94, 0x0a, 0x37, 0x45, 0x22, 0x32, 0x07, 0x0c, - 0x12, 0x01, 0x45, 0x82, 0x03, 0x12, 0xa0, 0xd2, 0xa6, 0xa2, 0x52, 0xdb, 0x14, 0xbb, 0x39, 0x47, - 0x4b, 0x32, 0x75, 0x2d, 0xf9, 0x0b, 0x7b, 0x5d, 0x91, 0x1e, 0xf8, 0x33, 0xfc, 0x08, 0x0e, 0xfc, - 0x39, 0xb4, 0x6b, 0x3b, 0x71, 0xd2, 0x54, 0x34, 0x7c, 0xdd, 0x76, 0xdf, 0xbe, 0xf9, 0x78, 0x33, - 0xcf, 0x06, 0xe0, 0x14, 0xf3, 0x76, 0x18, 0x05, 0x3c, 0xc0, 0xba, 0x1d, 0x85, 0xc3, 0xb6, 0x00, - 0x1c, 0xdf, 0xd6, 0xab, 0x50, 0xe9, 0x7a, 0x21, 0x1f, 0xeb, 0x87, 0x50, 0x3d, 0x61, 0x63, 0x37, - 0x60, 0x23, 0x7c, 0x06, 0x65, 0x3e, 0x0e, 0x49, 0x53, 0x5a, 0x8a, 0xa1, 0x76, 0xb6, 0xda, 0xc5, - 0x80, 0x76, 0x46, 0x3a, 0x1d, 0x87, 0x64, 0x4a, 0x1a, 0x22, 0x94, 0x3f, 0x05, 0xa3, 0xb1, 0x56, - 0x6a, 0x29, 0x46, 0xdd, 0x94, 0x67, 0xfd, 0x35, 0x40, 0x77, 0x78, 0x1e, 0x58, 0x9c, 0xf1, 0x24, - 0x16, 0x8c, 0x61, 0x30, 0x4a, 0x13, 0x56, 0x4c, 0x79, 0x46, 0x0d, 0xaa, 0x1e, 0xc5, 0x31, 0xb3, - 0x49, 0x06, 0xae, 0x99, 0xf9, 0x55, 0xff, 0x5e, 0x82, 0x75, 0xcb, 0xf1, 0x42, 0x97, 0x4c, 0xfa, - 0x9c, 0x50, 0xcc, 0xf1, 0x2d, 0xac, 0x47, 0x14, 0x87, 0x81, 0x1f, 0xd3, 0xe0, 0x66, 0x9d, 0xd5, - 0x73, 0xbe, 0xb8, 0xe1, 0xa3, 0x42, 0x7c, 0xec, 0x5c, 0xa6, 0x15, 0x2b, 0x53, 0x92, 0xe5, 0x5c, - 0x12, 0x3e, 0x87, 0x6a, 0x98, 0x66, 0xd0, 0x56, 0x5a, 0x8a, 0x51, 0xeb, 0x6c, 0x2e, 0x4c, 0x6f, - 0xe6, 0x2c, 0x91, 0xf5, 0xcc, 0x71, 0xdd, 0x41, 0x12, 0x53, 0xe4, 0x33, 0x8f, 0xb4, 0x72, 0x4b, - 0x31, 0x56, 0xcd, 0xba, 0x00, 0xfb, 0x19, 0x86, 0x06, 0x34, 0x24, 0x29, 0x60, 0x09, 0x3f, 0x1f, - 0xc4, 0xc3, 0x20, 0x24, 0xad, 0x22, 0x79, 0xaa, 0xc0, 0x7b, 0x02, 0xb6, 0x04, 0x8a, 0x3b, 0x70,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625 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x54, 0x4d, 0x6f, 0xd3, 0x4c, + 0x10, 0x7e, 0x9d, 0x8f, 0x37, 0xcd, 0x24, 0x35, 0xd1, 0x46, 0x15, 0xae, 0x8b, 0x44, 0x65, 0x0e, + 0x18, 0x24, 0x02, 0x8a, 0x04, 0x07, 0x0e, 0xa0, 0xd0, 0xa6, 0xa2, 0x52, 0x9b, 0x04, 0x3b, 0x39, + 0x47, 0x4b, 0xb2, 0x75, 0x2d, 0x39, 0xb6, 0xb1, 0xd7, 0x88, 0x70, 0xe0, 0xcf, 0xf0, 0x23, 0x38, + 0xf0, 0xe7, 0xd8, 0x5d, 0x7f, 0xc4, 0x49, 0x5c, 0x91, 0xf2, 0x75, 0xdb, 0x7d, 0xf6, 0x99, 0x67, + 0xe6, 0x99, 0x19, 0x1b, 0x80, 0x92, 0x90, 0x76, 0xfc, 0xc0, 0xa3, 0x1e, 0x6a, 0x5a, 0x81, 0x3f, + 0xeb, 0x70, 0xc0, 0x76, 0x2d, 0xad, 0x06, 0xd5, 0xfe, 0xc2, 0xa7, 0x4b, 0xed, 0x02, 0x6a, 0x23, + 0xbc, 0x74, 0x3c, 0x3c, 0x47, 0x4f, 0xa0, 0x42, 0x97, 0x3e, 0x51, 0xa4, 0x63, 0x49, 0x97, 0xbb, + 0x87, 0x9d, 0x7c, 0x40, 0x27, 0x21, 0x8d, 0x19, 0xc1, 0x10, 0x34, 0x84, 0xa0, 0xf2, 0xde, 0x9b, + 0x2f, 0x95, 0x12, 0xa3, 0x37, 0x0d, 0x71, 0xd6, 0x5e, 0x02, 0xf4, 0x67, 0xd7, 0x9e, 0x49, 0x31, + 0x8d, 0x42, 0xce, 0x98, 0x79, 0xf3, 0x58, 0xb0, 0x6a, 0x88, 0x33, 0x52, 0xa0, 0xb6, 0x20, 0x61, + 0x88, 0x2d, 0x22, 0x02, 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 0x4b, 0xbd, 0x57, 0xfc, 0x98, 0x34, 0xc0, 0x81, 0x76, 0x41, 0x7f, 0x90, 0xbe, 0x11, 0x74, 0xe3, + 0x9e, 0xa9, 0x8f, 0x76, 0x60, 0xc6, 0xb9, 0x9e, 0x49, 0xc8, 0x06, 0xb4, 0xfd, 0x51, 0xa1, 0x87, + 0x37, 0x48, 0x6c, 0x7e, 0xc4, 0xaa, 0xfe, 0x73, 0x62, 0x9c, 0x4a, 0xe7, 0xa9, 0xe4, 0xb3, 0xc8, + 0x71, 0x4e, 0x23, 0xe6, 0xf6, 0xd3, 0x5f, 0xf3, 0xa4, 0x4b, 0xc2, 0x95, 0xfc, 0x16, 0x3b, 0x57, + 0xff, 0x20, 0xd5, 0x8f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbb, 0x7f, 0x47, 0xd6, 0x4b, 0x07, 0x00, + 0x00, } diff --git a/vendor/google.golang.org/grpc/interop/grpc_testing/test.proto b/vendor/google.golang.org/grpc/interop/grpc_testing/test.proto index cc2bb74..d4ce2c1 100644 --- a/vendor/google.golang.org/grpc/interop/grpc_testing/test.proto +++ b/vendor/google.golang.org/grpc/interop/grpc_testing/test.proto @@ -151,10 +151,3 @@ service TestService { rpc HalfDuplexCall(stream StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse); } - -// A simple service NOT implemented at servers so clients can test for -// that case. -service UnimplementedService { - // A call that no server should implement - rpc UnimplementedCall(grpc.testing.Empty) returns (grpc.testing.Empty); -} diff --git a/vendor/google.golang.org/grpc/interop/http2/negative_http2_client.go b/vendor/google.golang.org/grpc/interop/http2/negative_http2_client.go deleted file mode 100644 index 9c09ad7..0000000 --- a/vendor/google.golang.org/grpc/interop/http2/negative_http2_client.go +++ /dev/null @@ -1,174 +0,0 @@ -/* - * - * Copyright 2016, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * Client used to test http2 error edge cases like GOAWAYs and RST_STREAMs - * - * Documentation: - * https://github.com/grpc/grpc/blob/master/doc/negative-http2-interop-test-descriptions.md - */ - -package main - -import ( - "flag" - "net" - "strconv" - "sync" - "time" - - "github.com/golang/protobuf/proto" - "golang.org/x/net/context" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/interop" - testpb "google.golang.org/grpc/interop/grpc_testing" -) - -var ( - serverHost = flag.String("server_host", "127.0.0.1", "The server host name") - serverPort = flag.Int("server_port", 8080, "The server port number") - testCase = flag.String("test_case", "goaway", - `Configure different test cases. Valid options are: - goaway : client sends two requests, the server will send a goaway in between; - rst_after_header : server will send rst_stream after it sends headers; - rst_during_data : server will send rst_stream while sending data; - rst_after_data : server will send rst_stream after sending data; - ping : server will send pings between each http2 frame; - max_streams : server will ensure that the max_concurrent_streams limit is upheld;`) - largeReqSize = 271828 - largeRespSize = 314159 -) - -func largeSimpleRequest() *testpb.SimpleRequest { - pl := interop.ClientNewPayload(testpb.PayloadType_COMPRESSABLE, largeReqSize) - return &testpb.SimpleRequest{ - ResponseType: testpb.PayloadType_COMPRESSABLE.Enum(), - ResponseSize: proto.Int32(int32(largeRespSize)), - Payload: pl, - } -} - -// sends two unary calls. The server asserts that the calls use different connections. -func goaway(tc testpb.TestServiceClient) { - interop.DoLargeUnaryCall(tc) - // sleep to ensure that the client has time to recv the GOAWAY. - // TODO(ncteisen): make this less hacky. - time.Sleep(1 * time.Second) - interop.DoLargeUnaryCall(tc) -} - -func rstAfterHeader(tc testpb.TestServiceClient) { - req := largeSimpleRequest() - reply, err := tc.UnaryCall(context.Background(), req) - if reply != nil { - grpclog.Fatalf("Client received reply despite server sending rst stream after header") - } - if grpc.Code(err) != codes.Internal { - grpclog.Fatalf("%v.UnaryCall() = _, %v, want _, %v", tc, grpc.Code(err), codes.Internal) - } -} - -func rstDuringData(tc testpb.TestServiceClient) { - req := largeSimpleRequest() - reply, err := tc.UnaryCall(context.Background(), req) - if reply != nil { - grpclog.Fatalf("Client received reply despite server sending rst stream during data") - } - if grpc.Code(err) != codes.Unknown { - grpclog.Fatalf("%v.UnaryCall() = _, %v, want _, %v", tc, grpc.Code(err), codes.Unknown) - } -} - -func rstAfterData(tc testpb.TestServiceClient) { - req := largeSimpleRequest() - reply, err := tc.UnaryCall(context.Background(), req) - if reply != nil { - grpclog.Fatalf("Client received reply despite server sending rst stream after data") - } - if grpc.Code(err) != codes.Internal { - grpclog.Fatalf("%v.UnaryCall() = _, %v, want _, %v", tc, grpc.Code(err), codes.Internal) - } -} - -func ping(tc testpb.TestServiceClient) { - // The server will assert that every ping it sends was ACK-ed by the client. - interop.DoLargeUnaryCall(tc) -} - -func maxStreams(tc testpb.TestServiceClient) { - interop.DoLargeUnaryCall(tc) - var wg sync.WaitGroup - for i := 0; i < 15; i++ { - wg.Add(1) - go func() { - defer wg.Done() - interop.DoLargeUnaryCall(tc) - }() - } - wg.Wait() -} - -func main() { - flag.Parse() - serverAddr := net.JoinHostPort(*serverHost, strconv.Itoa(*serverPort)) - var opts []grpc.DialOption - opts = append(opts, grpc.WithInsecure()) - conn, err := grpc.Dial(serverAddr, opts...) - if err != nil { - grpclog.Fatalf("Fail to dial: %v", err) - } - defer conn.Close() - tc := testpb.NewTestServiceClient(conn) - switch *testCase { - case "goaway": - goaway(tc) - grpclog.Println("goaway done") - case "rst_after_header": - rstAfterHeader(tc) - grpclog.Println("rst_after_header done") - case "rst_during_data": - rstDuringData(tc) - grpclog.Println("rst_during_data done") - case "rst_after_data": - rstAfterData(tc) - grpclog.Println("rst_after_data done") - case "ping": - ping(tc) - grpclog.Println("ping done") - case "max_streams": - maxStreams(tc) - grpclog.Println("max_streams done") - default: - grpclog.Fatal("Unsupported test case: ", *testCase) - } -} diff --git a/vendor/google.golang.org/grpc/interop/test_utils.go b/vendor/google.golang.org/grpc/interop/test_utils.go index e4e427c..908dd8d 100644 --- a/vendor/google.golang.org/grpc/interop/test_utils.go +++ b/vendor/google.golang.org/grpc/interop/test_utils.go @@ -52,16 +52,13 @@ import ( ) var ( - reqSizes = []int{27182, 8, 1828, 45904} - respSizes = []int{31415, 9, 2653, 58979} - largeReqSize = 271828 - largeRespSize = 314159 - initialMetadataKey = "x-grpc-test-echo-initial" - trailingMetadataKey = "x-grpc-test-echo-trailing-bin" + reqSizes = []int{27182, 8, 1828, 45904} + respSizes = []int{31415, 9, 2653, 58979} + largeReqSize = 271828 + largeRespSize = 314159 ) -// ClientNewPayload returns a payload of the given type and size. -func ClientNewPayload(t testpb.PayloadType, size int) *testpb.Payload { +func clientNewPayload(t testpb.PayloadType, size int) *testpb.Payload { if size < 0 { grpclog.Fatalf("Requested a response with invalid length %d", size) } @@ -80,8 +77,8 @@ func ClientNewPayload(t testpb.PayloadType, size int) *testpb.Payload { } // DoEmptyUnaryCall performs a unary RPC with empty request and response messages. -func DoEmptyUnaryCall(tc testpb.TestServiceClient, args ...grpc.CallOption) { - reply, err := tc.EmptyCall(context.Background(), &testpb.Empty{}, args...) +func DoEmptyUnaryCall(tc testpb.TestServiceClient) { + reply, err := tc.EmptyCall(context.Background(), &testpb.Empty{}) if err != nil { grpclog.Fatal("/TestService/EmptyCall RPC failed: ", err) } @@ -91,14 +88,14 @@ func DoEmptyUnaryCall(tc testpb.TestServiceClient, args ...grpc.CallOption) { } // DoLargeUnaryCall performs a unary RPC with large payload in the request and response. -func DoLargeUnaryCall(tc testpb.TestServiceClient, args ...grpc.CallOption) { - pl := ClientNewPayload(testpb.PayloadType_COMPRESSABLE, largeReqSize) +func DoLargeUnaryCall(tc testpb.TestServiceClient) { + pl := clientNewPayload(testpb.PayloadType_COMPRESSABLE, largeReqSize) req := &testpb.SimpleRequest{ ResponseType: testpb.PayloadType_COMPRESSABLE.Enum(), ResponseSize: proto.Int32(int32(largeRespSize)), Payload: pl, } - reply, err := tc.UnaryCall(context.Background(), req, args...) + reply, err := tc.UnaryCall(context.Background(), req) if err != nil { grpclog.Fatal("/TestService/UnaryCall RPC failed: ", err) } @@ -110,21 +107,23 @@ func DoLargeUnaryCall(tc testpb.TestServiceClient, args ...grpc.CallOption) { } // DoClientStreaming performs a client streaming RPC. -func DoClientStreaming(tc testpb.TestServiceClient, args ...grpc.CallOption) { - stream, err := tc.StreamingInputCall(context.Background(), args...) +func DoClientStreaming(tc testpb.TestServiceClient) { + stream, err := tc.StreamingInputCall(context.Background()) if err != nil { grpclog.Fatalf("%v.StreamingInputCall(_) = _, %v", tc, err) } var sum int for _, s := range reqSizes { - pl := ClientNewPayload(testpb.PayloadType_COMPRESSABLE, s) + pl := clientNewPayload(testpb.PayloadType_COMPRESSABLE, s) req := &testpb.StreamingInputCallRequest{ Payload: pl, } if err := stream.Send(req); err != nil { - grpclog.Fatalf("%v has error %v while sending %v", stream, err, req) + grpclog.Fatalf("%v.Send(%v) = %v", stream, req, err) } sum += s + grpclog.Printf("Sent a request of size %d, aggregated size %d", s, sum) + } reply, err := stream.CloseAndRecv() if err != nil { @@ -136,7 +135,7 @@ func DoClientStreaming(tc testpb.TestServiceClient, args ...grpc.CallOption) { } // DoServerStreaming performs a server streaming RPC. -func DoServerStreaming(tc testpb.TestServiceClient, args ...grpc.CallOption) { +func DoServerStreaming(tc testpb.TestServiceClient) { respParam := make([]*testpb.ResponseParameters, len(respSizes)) for i, s := range respSizes { respParam[i] = &testpb.ResponseParameters{ @@ -147,7 +146,7 @@ func DoServerStreaming(tc testpb.TestServiceClient, args ...grpc.CallOption) { ResponseType: testpb.PayloadType_COMPRESSABLE.Enum(), ResponseParameters: respParam, } - stream, err := tc.StreamingOutputCall(context.Background(), req, args...) + stream, err := tc.StreamingOutputCall(context.Background(), req) if err != nil { grpclog.Fatalf("%v.StreamingOutputCall(_) = _, %v", tc, err) } @@ -172,7 +171,7 @@ func DoServerStreaming(tc testpb.TestServiceClient, args ...grpc.CallOption) { respCnt++ } if rpcStatus != io.EOF { - grpclog.Fatalf("Failed to finish the server streaming rpc: %v", rpcStatus) + grpclog.Fatalf("Failed to finish the server streaming rpc: %v", err) } if respCnt != len(respSizes) { grpclog.Fatalf("Got %d reply, want %d", len(respSizes), respCnt) @@ -180,8 +179,8 @@ func DoServerStreaming(tc testpb.TestServiceClient, args ...grpc.CallOption) { } // DoPingPong performs ping-pong style bi-directional streaming RPC. -func DoPingPong(tc testpb.TestServiceClient, args ...grpc.CallOption) { - stream, err := tc.FullDuplexCall(context.Background(), args...) +func DoPingPong(tc testpb.TestServiceClient) { + stream, err := tc.FullDuplexCall(context.Background()) if err != nil { grpclog.Fatalf("%v.FullDuplexCall(_) = _, %v", tc, err) } @@ -192,14 +191,14 @@ func DoPingPong(tc testpb.TestServiceClient, args ...grpc.CallOption) { Size: proto.Int32(int32(respSizes[index])), }, } - pl := ClientNewPayload(testpb.PayloadType_COMPRESSABLE, reqSizes[index]) + pl := clientNewPayload(testpb.PayloadType_COMPRESSABLE, reqSizes[index]) req := &testpb.StreamingOutputCallRequest{ ResponseType: testpb.PayloadType_COMPRESSABLE.Enum(), ResponseParameters: respParam, Payload: pl, } if err := stream.Send(req); err != nil { - grpclog.Fatalf("%v has error %v while sending %v", stream, err, req) + grpclog.Fatalf("%v.Send(%v) = %v", stream, req, err) } reply, err := stream.Recv() if err != nil { @@ -224,8 +223,8 @@ func DoPingPong(tc testpb.TestServiceClient, args ...grpc.CallOption) { } // DoEmptyStream sets up a bi-directional streaming with zero message. -func DoEmptyStream(tc testpb.TestServiceClient, args ...grpc.CallOption) { - stream, err := tc.FullDuplexCall(context.Background(), args...) +func DoEmptyStream(tc testpb.TestServiceClient) { + stream, err := tc.FullDuplexCall(context.Background()) if err != nil { grpclog.Fatalf("%v.FullDuplexCall(_) = _, %v", tc, err) } @@ -238,25 +237,22 @@ func DoEmptyStream(tc testpb.TestServiceClient, args ...grpc.CallOption) { } // DoTimeoutOnSleepingServer performs an RPC on a sleep server which causes RPC timeout. -func DoTimeoutOnSleepingServer(tc testpb.TestServiceClient, args ...grpc.CallOption) { - ctx, cancel := context.WithTimeout(context.Background(), 1*time.Millisecond) - defer cancel() - stream, err := tc.FullDuplexCall(ctx, args...) +func DoTimeoutOnSleepingServer(tc testpb.TestServiceClient) { + ctx, _ := context.WithTimeout(context.Background(), 1*time.Millisecond) + stream, err := tc.FullDuplexCall(ctx) if err != nil { if grpc.Code(err) == codes.DeadlineExceeded { return } grpclog.Fatalf("%v.FullDuplexCall(_) = _, %v", tc, err) } - pl := ClientNewPayload(testpb.PayloadType_COMPRESSABLE, 27182) + pl := clientNewPayload(testpb.PayloadType_COMPRESSABLE, 27182) req := &testpb.StreamingOutputCallRequest{ ResponseType: testpb.PayloadType_COMPRESSABLE.Enum(), Payload: pl, } if err := stream.Send(req); err != nil { - if grpc.Code(err) != codes.DeadlineExceeded { - grpclog.Fatalf("%v.Send(_) = %v", stream, err) - } + grpclog.Fatalf("%v.Send(%v) = %v", stream, req, err) } if _, err := stream.Recv(); grpc.Code(err) != codes.DeadlineExceeded { grpclog.Fatalf("%v.Recv() = _, %v, want error code %d", stream, err, codes.DeadlineExceeded) @@ -265,7 +261,7 @@ func DoTimeoutOnSleepingServer(tc testpb.TestServiceClient, args ...grpc.CallOpt // DoComputeEngineCreds performs a unary RPC with compute engine auth. func DoComputeEngineCreds(tc testpb.TestServiceClient, serviceAccount, oauthScope string) { - pl := ClientNewPayload(testpb.PayloadType_COMPRESSABLE, largeReqSize) + pl := clientNewPayload(testpb.PayloadType_COMPRESSABLE, largeReqSize) req := &testpb.SimpleRequest{ ResponseType: testpb.PayloadType_COMPRESSABLE.Enum(), ResponseSize: proto.Int32(int32(largeRespSize)), @@ -297,7 +293,7 @@ func getServiceAccountJSONKey(keyFile string) []byte { // DoServiceAccountCreds performs a unary RPC with service account auth. func DoServiceAccountCreds(tc testpb.TestServiceClient, serviceAccountKeyFile, oauthScope string) { - pl := ClientNewPayload(testpb.PayloadType_COMPRESSABLE, largeReqSize) + pl := clientNewPayload(testpb.PayloadType_COMPRESSABLE, largeReqSize) req := &testpb.SimpleRequest{ ResponseType: testpb.PayloadType_COMPRESSABLE.Enum(), ResponseSize: proto.Int32(int32(largeRespSize)), @@ -322,7 +318,7 @@ func DoServiceAccountCreds(tc testpb.TestServiceClient, serviceAccountKeyFile, o // DoJWTTokenCreds performs a unary RPC with JWT token auth. func DoJWTTokenCreds(tc testpb.TestServiceClient, serviceAccountKeyFile string) { - pl := ClientNewPayload(testpb.PayloadType_COMPRESSABLE, largeReqSize) + pl := clientNewPayload(testpb.PayloadType_COMPRESSABLE, largeReqSize) req := &testpb.SimpleRequest{ ResponseType: testpb.PayloadType_COMPRESSABLE.Enum(), ResponseSize: proto.Int32(int32(largeRespSize)), @@ -356,7 +352,7 @@ func GetToken(serviceAccountKeyFile string, oauthScope string) *oauth2.Token { // DoOauth2TokenCreds performs a unary RPC with OAUTH2 token auth. func DoOauth2TokenCreds(tc testpb.TestServiceClient, serviceAccountKeyFile, oauthScope string) { - pl := ClientNewPayload(testpb.PayloadType_COMPRESSABLE, largeReqSize) + pl := clientNewPayload(testpb.PayloadType_COMPRESSABLE, largeReqSize) req := &testpb.SimpleRequest{ ResponseType: testpb.PayloadType_COMPRESSABLE.Enum(), ResponseSize: proto.Int32(int32(largeRespSize)), @@ -382,7 +378,7 @@ func DoOauth2TokenCreds(tc testpb.TestServiceClient, serviceAccountKeyFile, oaut // DoPerRPCCreds performs a unary RPC with per RPC OAUTH2 token. func DoPerRPCCreds(tc testpb.TestServiceClient, serviceAccountKeyFile, oauthScope string) { jsonKey := getServiceAccountJSONKey(serviceAccountKeyFile) - pl := ClientNewPayload(testpb.PayloadType_COMPRESSABLE, largeReqSize) + pl := clientNewPayload(testpb.PayloadType_COMPRESSABLE, largeReqSize) req := &testpb.SimpleRequest{ ResponseType: testpb.PayloadType_COMPRESSABLE.Enum(), ResponseSize: proto.Int32(int32(largeRespSize)), @@ -415,9 +411,9 @@ var ( ) // DoCancelAfterBegin cancels the RPC after metadata has been sent but before payloads are sent. -func DoCancelAfterBegin(tc testpb.TestServiceClient, args ...grpc.CallOption) { +func DoCancelAfterBegin(tc testpb.TestServiceClient) { ctx, cancel := context.WithCancel(metadata.NewContext(context.Background(), testMetadata)) - stream, err := tc.StreamingInputCall(ctx, args...) + stream, err := tc.StreamingInputCall(ctx) if err != nil { grpclog.Fatalf("%v.StreamingInputCall(_) = _, %v", tc, err) } @@ -429,9 +425,9 @@ func DoCancelAfterBegin(tc testpb.TestServiceClient, args ...grpc.CallOption) { } // DoCancelAfterFirstResponse cancels the RPC after receiving the first message from the server. -func DoCancelAfterFirstResponse(tc testpb.TestServiceClient, args ...grpc.CallOption) { +func DoCancelAfterFirstResponse(tc testpb.TestServiceClient) { ctx, cancel := context.WithCancel(context.Background()) - stream, err := tc.FullDuplexCall(ctx, args...) + stream, err := tc.FullDuplexCall(ctx) if err != nil { grpclog.Fatalf("%v.FullDuplexCall(_) = _, %v", tc, err) } @@ -440,14 +436,14 @@ func DoCancelAfterFirstResponse(tc testpb.TestServiceClient, args ...grpc.CallOp Size: proto.Int32(31415), }, } - pl := ClientNewPayload(testpb.PayloadType_COMPRESSABLE, 27182) + pl := clientNewPayload(testpb.PayloadType_COMPRESSABLE, 27182) req := &testpb.StreamingOutputCallRequest{ ResponseType: testpb.PayloadType_COMPRESSABLE.Enum(), ResponseParameters: respParam, Payload: pl, } if err := stream.Send(req); err != nil { - grpclog.Fatalf("%v has error %v while sending %v", stream, err, req) + grpclog.Fatalf("%v.Send(%v) = %v", stream, req, err) } if _, err := stream.Recv(); err != nil { grpclog.Fatalf("%v.Recv() = %v", stream, err) @@ -458,94 +454,8 @@ func DoCancelAfterFirstResponse(tc testpb.TestServiceClient, args ...grpc.CallOp } } -var ( - initialMetadataValue = "test_initial_metadata_value" - trailingMetadataValue = "\x0a\x0b\x0a\x0b\x0a\x0b" - customMetadata = metadata.Pairs( - initialMetadataKey, initialMetadataValue, - trailingMetadataKey, trailingMetadataValue, - ) -) - -func validateMetadata(header, trailer metadata.MD) { - if len(header[initialMetadataKey]) != 1 { - grpclog.Fatalf("Expected exactly one header from server. Received %d", len(header[initialMetadataKey])) - } - if header[initialMetadataKey][0] != initialMetadataValue { - grpclog.Fatalf("Got header %s; want %s", header[initialMetadataKey][0], initialMetadataValue) - } - if len(trailer[trailingMetadataKey]) != 1 { - grpclog.Fatalf("Expected exactly one trailer from server. Received %d", len(trailer[trailingMetadataKey])) - } - if trailer[trailingMetadataKey][0] != trailingMetadataValue { - grpclog.Fatalf("Got trailer %s; want %s", trailer[trailingMetadataKey][0], trailingMetadataValue) - } -} - -// DoCustomMetadata checks that metadata is echoed back to the client. -func DoCustomMetadata(tc testpb.TestServiceClient, args ...grpc.CallOption) { - // Testing with UnaryCall. - pl := ClientNewPayload(testpb.PayloadType_COMPRESSABLE, 1) - req := &testpb.SimpleRequest{ - ResponseType: testpb.PayloadType_COMPRESSABLE.Enum(), - ResponseSize: proto.Int32(int32(1)), - Payload: pl, - } - ctx := metadata.NewContext(context.Background(), customMetadata) - var header, trailer metadata.MD - args = append(args, grpc.Header(&header), grpc.Trailer(&trailer)) - reply, err := tc.UnaryCall( - ctx, - req, - args..., - ) - if err != nil { - grpclog.Fatal("/TestService/UnaryCall RPC failed: ", err) - } - t := reply.GetPayload().GetType() - s := len(reply.GetPayload().GetBody()) - if t != testpb.PayloadType_COMPRESSABLE || s != 1 { - grpclog.Fatalf("Got the reply with type %d len %d; want %d, %d", t, s, testpb.PayloadType_COMPRESSABLE, 1) - } - validateMetadata(header, trailer) - - // Testing with FullDuplex. - stream, err := tc.FullDuplexCall(ctx, args...) - if err != nil { - grpclog.Fatalf("%v.FullDuplexCall(_) = _, %v, want ", tc, err) - } - respParam := []*testpb.ResponseParameters{ - { - Size: proto.Int32(1), - }, - } - streamReq := &testpb.StreamingOutputCallRequest{ - ResponseType: testpb.PayloadType_COMPRESSABLE.Enum(), - ResponseParameters: respParam, - Payload: pl, - } - if err := stream.Send(streamReq); err != nil { - grpclog.Fatalf("%v has error %v while sending %v", stream, err, streamReq) - } - streamHeader, err := stream.Header() - if err != nil { - grpclog.Fatalf("%v.Header() = %v", stream, err) - } - if _, err := stream.Recv(); err != nil { - grpclog.Fatalf("%v.Recv() = %v", stream, err) - } - if err := stream.CloseSend(); err != nil { - grpclog.Fatalf("%v.CloseSend() = %v, want ", stream, err) - } - if _, err := stream.Recv(); err != io.EOF { - grpclog.Fatalf("%v failed to complete the custom metadata test: %v", stream, err) - } - streamTrailer := stream.Trailer() - validateMetadata(streamHeader, streamTrailer) -} - // DoStatusCodeAndMessage checks that the status code is propagated back to the client. -func DoStatusCodeAndMessage(tc testpb.TestServiceClient, args ...grpc.CallOption) { +func DoStatusCodeAndMessage(tc testpb.TestServiceClient) { var code int32 = 2 msg := "test status message" expectedErr := grpc.Errorf(codes.Code(code), msg) @@ -557,11 +467,11 @@ func DoStatusCodeAndMessage(tc testpb.TestServiceClient, args ...grpc.CallOption req := &testpb.SimpleRequest{ ResponseStatus: respStatus, } - if _, err := tc.UnaryCall(context.Background(), req, args...); err == nil || err.Error() != expectedErr.Error() { + if _, err := tc.UnaryCall(context.Background(), req); err == nil || err.Error() != expectedErr.Error() { grpclog.Fatalf("%v.UnaryCall(_, %v) = _, %v, want _, %v", tc, req, err, expectedErr) } // Test FullDuplexCall. - stream, err := tc.FullDuplexCall(context.Background(), args...) + stream, err := tc.FullDuplexCall(context.Background()) if err != nil { grpclog.Fatalf("%v.FullDuplexCall(_) = _, %v, want ", tc, err) } @@ -569,7 +479,7 @@ func DoStatusCodeAndMessage(tc testpb.TestServiceClient, args ...grpc.CallOption ResponseStatus: respStatus, } if err := stream.Send(streamReq); err != nil { - grpclog.Fatalf("%v has error %v while sending %v, want ", stream, err, streamReq) + grpclog.Fatalf("%v.Send(%v) = %v, want ", stream, streamReq, err) } if err := stream.CloseSend(); err != nil { grpclog.Fatalf("%v.CloseSend() = %v, want ", stream, err) @@ -579,22 +489,6 @@ func DoStatusCodeAndMessage(tc testpb.TestServiceClient, args ...grpc.CallOption } } -// DoUnimplementedService attempts to call a method from an unimplemented service. -func DoUnimplementedService(tc testpb.UnimplementedServiceClient) { - _, err := tc.UnimplementedCall(context.Background(), &testpb.Empty{}) - if grpc.Code(err) != codes.Unimplemented { - grpclog.Fatalf("%v.UnimplementedCall() = _, %v, want _, %v", tc, grpc.Code(err), codes.Unimplemented) - } -} - -// DoUnimplementedMethod attempts to call an unimplemented method. -func DoUnimplementedMethod(cc *grpc.ClientConn) { - var req, reply proto.Message - if err := grpc.Invoke(context.Background(), "/grpc.testing.TestService/UnimplementedCall", req, reply, cc); err == nil || grpc.Code(err) != codes.Unimplemented { - grpclog.Fatalf("grpc.Invoke(_, _, _, _, _) = %v, want error code %s", err, codes.Unimplemented) - } -} - type testServer struct { } @@ -627,16 +521,6 @@ func serverNewPayload(t testpb.PayloadType, size int32) (*testpb.Payload, error) func (s *testServer) UnaryCall(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { status := in.GetResponseStatus() - if md, ok := metadata.FromContext(ctx); ok { - if initialMetadata, ok := md[initialMetadataKey]; ok { - header := metadata.Pairs(initialMetadataKey, initialMetadata[0]) - grpc.SendHeader(ctx, header) - } - if trailingMetadata, ok := md[trailingMetadataKey]; ok { - trailer := metadata.Pairs(trailingMetadataKey, trailingMetadata[0]) - grpc.SetTrailer(ctx, trailer) - } - } if status != nil && *status.Code != 0 { return nil, grpc.Errorf(codes.Code(*status.Code), *status.Message) } @@ -686,16 +570,6 @@ func (s *testServer) StreamingInputCall(stream testpb.TestService_StreamingInput } func (s *testServer) FullDuplexCall(stream testpb.TestService_FullDuplexCallServer) error { - if md, ok := metadata.FromContext(stream.Context()); ok { - if initialMetadata, ok := md[initialMetadataKey]; ok { - header := metadata.Pairs(initialMetadataKey, initialMetadata[0]) - stream.SendHeader(header) - } - if trailingMetadata, ok := md[trailingMetadataKey]; ok { - trailer := metadata.Pairs(trailingMetadataKey, trailingMetadata[0]) - stream.SetTrailer(trailer) - } - } for { in, err := stream.Recv() if err == io.EOF { diff --git a/vendor/google.golang.org/grpc/keepalive/keepalive.go b/vendor/google.golang.org/grpc/keepalive/keepalive.go deleted file mode 100644 index 20672e4..0000000 --- a/vendor/google.golang.org/grpc/keepalive/keepalive.go +++ /dev/null @@ -1,52 +0,0 @@ -/* - * - * Copyright 2017, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// Package keepalive defines configurable parameters for point-to-point healthcheck. -package keepalive - -import ( - "time" -) - -// ClientParameters is used to set keepalive parameters on the client-side. -// These configure how the client will actively probe to notice when a connection broken -// and to cause activity so intermediaries are aware the connection is still in use. -type ClientParameters struct { - // After a duration of this time if the client doesn't see any activity it pings the server to see if the transport is still alive. - Time time.Duration // The current default value is infinity. - // After having pinged for keepalive check, the client waits for a duration of Timeout and if no activity is seen even after that - // the connection is closed. - Timeout time.Duration // The current default value is 20 seconds. - // If true, client runs keepalive checks even with no active RPCs. - PermitWithoutStream bool -} diff --git a/vendor/google.golang.org/grpc/metadata/metadata.go b/vendor/google.golang.org/grpc/metadata/metadata.go index 7332395..3c0ca7a 100644 --- a/vendor/google.golang.org/grpc/metadata/metadata.go +++ b/vendor/google.golang.org/grpc/metadata/metadata.go @@ -32,7 +32,6 @@ */ // Package metadata define the structure of the metadata supported by gRPC library. -// Please refer to http://www.grpc.io/docs/guides/wire.html for more information about custom-metadata. package metadata // import "google.golang.org/grpc/metadata" import ( @@ -83,7 +82,6 @@ func DecodeKeyValue(k, v string) (string, string, error) { type MD map[string][]string // New creates a MD from given key-value map. -// Keys are automatically converted to lowercase. And for keys having "-bin" as suffix, their values will be applied Base64 encoding. func New(m map[string]string) MD { md := MD{} for k, v := range m { @@ -95,7 +93,6 @@ func New(m map[string]string) MD { // Pairs returns an MD formed by the mapping of key, value ... // Pairs panics if len(kv) is odd. -// Keys are automatically converted to lowercase. And for keys having "-bin" as suffix, their values will be appplied Base64 encoding. func Pairs(kv ...string) MD { if len(kv)%2 == 1 { panic(fmt.Sprintf("metadata: Pairs got the odd number of input pairs for metadata: %d", len(kv))) @@ -144,8 +141,6 @@ func NewContext(ctx context.Context, md MD) context.Context { } // FromContext returns the MD in ctx if it exists. -// The returned md should be immutable, writing to it may cause races. -// Modification should be made to the copies of the returned md. func FromContext(ctx context.Context) (md MD, ok bool) { md, ok = ctx.Value(mdKey{}).(MD) return diff --git a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2.pb.go index 0b503d6..ac49de4 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2.pb.go @@ -2,22 +2,6 @@ // source: proto2.proto // DO NOT EDIT! -/* -Package grpc_testing is a generated protocol buffer package. - -It is generated from these files: - proto2.proto - proto2_ext.proto - proto2_ext2.proto - test.proto - -It has these top-level messages: - ToBeExtended - Extension - AnotherExtension - SearchResponse - SearchRequest -*/ package grpc_testing import proto "github.com/golang/protobuf/proto" @@ -29,32 +13,26 @@ var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type ToBeExtended struct { +type ToBeExtened struct { Foo *int32 `protobuf:"varint,1,req,name=foo" json:"foo,omitempty"` proto.XXX_InternalExtensions `json:"-"` XXX_unrecognized []byte `json:"-"` } -func (m *ToBeExtended) Reset() { *m = ToBeExtended{} } -func (m *ToBeExtended) String() string { return proto.CompactTextString(m) } -func (*ToBeExtended) ProtoMessage() {} -func (*ToBeExtended) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (m *ToBeExtened) Reset() { *m = ToBeExtened{} } +func (m *ToBeExtened) String() string { return proto.CompactTextString(m) } +func (*ToBeExtened) ProtoMessage() {} +func (*ToBeExtened) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } -var extRange_ToBeExtended = []proto.ExtensionRange{ - {10, 30}, +var extRange_ToBeExtened = []proto.ExtensionRange{ + {10, 20}, } -func (*ToBeExtended) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_ToBeExtended +func (*ToBeExtened) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_ToBeExtened } -func (m *ToBeExtended) GetFoo() int32 { +func (m *ToBeExtened) GetFoo() int32 { if m != nil && m.Foo != nil { return *m.Foo } @@ -62,17 +40,17 @@ func (m *ToBeExtended) GetFoo() int32 { } func init() { - proto.RegisterType((*ToBeExtended)(nil), "grpc.testing.ToBeExtended") + proto.RegisterType((*ToBeExtened)(nil), "grpc.testing.ToBeExtened") } -func init() { proto.RegisterFile("proto2.proto", fileDescriptor0) } +func init() { proto.RegisterFile("proto2.proto", fileDescriptor1) } -var fileDescriptor0 = []byte{ - // 86 bytes of a gzipped FileDescriptorProto +var fileDescriptor1 = []byte{ + // 85 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x28, 0xca, 0x2f, 0xc9, 0x37, 0xd2, 0x03, 0x53, 0x42, 0x3c, 0xe9, 0x45, 0x05, 0xc9, 0x7a, 0x25, 0xa9, 0xc5, 0x25, - 0x99, 0x79, 0xe9, 0x4a, 0x6a, 0x5c, 0x3c, 0x21, 0xf9, 0x4e, 0xa9, 0xae, 0x15, 0x25, 0xa9, 0x79, - 0x29, 0xa9, 0x29, 0x42, 0x02, 0x5c, 0xcc, 0x69, 0xf9, 0xf9, 0x12, 0x8c, 0x0a, 0x4c, 0x1a, 0xac, - 0x41, 0x20, 0xa6, 0x16, 0x0b, 0x07, 0x97, 0x80, 0x3c, 0x20, 0x00, 0x00, 0xff, 0xff, 0x74, 0x86, - 0x9c, 0x08, 0x44, 0x00, 0x00, 0x00, + 0x99, 0x79, 0xe9, 0x4a, 0xaa, 0x5c, 0xdc, 0x21, 0xf9, 0x4e, 0xa9, 0xae, 0x15, 0x25, 0xa9, 0x79, + 0xa9, 0x29, 0x42, 0x02, 0x5c, 0xcc, 0x69, 0xf9, 0xf9, 0x12, 0x8c, 0x0a, 0x4c, 0x1a, 0xac, 0x41, + 0x20, 0xa6, 0x16, 0x0b, 0x07, 0x97, 0x80, 0x28, 0x20, 0x00, 0x00, 0xff, 0xff, 0xc9, 0xed, 0xbc, + 0xc2, 0x43, 0x00, 0x00, 0x00, } diff --git a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2.proto b/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2.proto index 6b120f3..f79adc4 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2.proto +++ b/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2.proto @@ -2,7 +2,7 @@ syntax = "proto2"; package grpc.testing; -message ToBeExtended { +message ToBeExtened { required int32 foo = 1; - extensions 10 to 30; + extensions 10 to 20; } diff --git a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext.pb.go index dbd0942..0120ca9 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext.pb.go @@ -2,6 +2,20 @@ // source: proto2_ext.proto // DO NOT EDIT! +/* +Package grpc_testing is a generated protocol buffer package. + +It is generated from these files: + proto2_ext.proto + proto2.proto + test.proto + +It has these top-level messages: + Extension + ToBeExtened + SearchResponse + SearchRequest +*/ package grpc_testing import proto "github.com/golang/protobuf/proto" @@ -13,71 +27,62 @@ var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + type Extension struct { - Whatzit *int32 `protobuf:"varint,1,opt,name=whatzit" json:"whatzit,omitempty"` + Baz *int32 `protobuf:"varint,1,opt,name=baz" json:"baz,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Extension) Reset() { *m = Extension{} } func (m *Extension) String() string { return proto.CompactTextString(m) } func (*Extension) ProtoMessage() {} -func (*Extension) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } +func (*Extension) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } -func (m *Extension) GetWhatzit() int32 { - if m != nil && m.Whatzit != nil { - return *m.Whatzit +func (m *Extension) GetBaz() int32 { + if m != nil && m.Baz != nil { + return *m.Baz } return 0 } -var E_Foo = &proto.ExtensionDesc{ - ExtendedType: (*ToBeExtended)(nil), +var E_Bar = &proto.ExtensionDesc{ + ExtendedType: (*ToBeExtened)(nil), ExtensionType: (*int32)(nil), Field: 13, - Name: "grpc.testing.foo", - Tag: "varint,13,opt,name=foo", - Filename: "proto2_ext.proto", -} - -var E_Bar = &proto.ExtensionDesc{ - ExtendedType: (*ToBeExtended)(nil), - ExtensionType: (*Extension)(nil), - Field: 17, Name: "grpc.testing.bar", - Tag: "bytes,17,opt,name=bar", - Filename: "proto2_ext.proto", + Tag: "varint,13,opt,name=bar", } var E_Baz = &proto.ExtensionDesc{ - ExtendedType: (*ToBeExtended)(nil), - ExtensionType: (*SearchRequest)(nil), - Field: 19, + ExtendedType: (*ToBeExtened)(nil), + ExtensionType: (*Extension)(nil), + Field: 17, Name: "grpc.testing.baz", - Tag: "bytes,19,opt,name=baz", - Filename: "proto2_ext.proto", + Tag: "bytes,17,opt,name=baz", } func init() { proto.RegisterType((*Extension)(nil), "grpc.testing.Extension") - proto.RegisterExtension(E_Foo) proto.RegisterExtension(E_Bar) proto.RegisterExtension(E_Baz) } -func init() { proto.RegisterFile("proto2_ext.proto", fileDescriptor1) } +func init() { proto.RegisterFile("proto2_ext.proto", fileDescriptor0) } -var fileDescriptor1 = []byte{ - // 179 bytes of a gzipped FileDescriptorProto +var fileDescriptor0 = []byte{ + // 130 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x12, 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x37, 0x8a, 0x4f, 0xad, 0x28, 0xd1, 0x03, 0x33, 0x85, 0x78, 0xd2, 0x8b, 0x0a, 0x92, 0xf5, - 0x4a, 0x52, 0x8b, 0x4b, 0x32, 0xf3, 0xd2, 0xa5, 0x78, 0x20, 0xf2, 0x10, 0x39, 0x29, 0x2e, 0x90, - 0x30, 0x84, 0xad, 0xa4, 0xca, 0xc5, 0xe9, 0x5a, 0x51, 0x92, 0x9a, 0x57, 0x9c, 0x99, 0x9f, 0x27, - 0x24, 0xc1, 0xc5, 0x5e, 0x9e, 0x91, 0x58, 0x52, 0x95, 0x59, 0x22, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, - 0x1a, 0x04, 0xe3, 0x5a, 0xe9, 0x70, 0x31, 0xa7, 0xe5, 0xe7, 0x0b, 0x49, 0xe9, 0x21, 0x1b, 0xab, - 0x17, 0x92, 0xef, 0x94, 0x0a, 0xd6, 0x9d, 0x92, 0x9a, 0x22, 0xc1, 0x0b, 0xd6, 0x01, 0x52, 0x66, - 0xe5, 0xca, 0xc5, 0x9c, 0x94, 0x58, 0x84, 0x57, 0xb5, 0xa0, 0x02, 0xa3, 0x06, 0xb7, 0x91, 0x38, - 0xaa, 0x0a, 0xb8, 0x4b, 0x82, 0x40, 0xfa, 0xad, 0x3c, 0x41, 0xc6, 0x54, 0xe1, 0x35, 0x46, 0x18, - 0x6c, 0x8c, 0x34, 0xaa, 0x8a, 0xe0, 0xd4, 0xc4, 0xa2, 0xe4, 0x8c, 0xa0, 0xd4, 0xc2, 0xd2, 0xd4, - 0xe2, 0x12, 0x90, 0x51, 0x55, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x71, 0x6b, 0x94, 0x9f, 0x21, - 0x01, 0x00, 0x00, + 0x4a, 0x52, 0x8b, 0x4b, 0x32, 0xf3, 0xd2, 0xa5, 0x78, 0x20, 0xf2, 0x10, 0x39, 0x25, 0x59, 0x2e, + 0x4e, 0xd7, 0x8a, 0x92, 0xd4, 0xbc, 0xe2, 0xcc, 0xfc, 0x3c, 0x21, 0x01, 0x2e, 0xe6, 0xa4, 0xc4, + 0x2a, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xd6, 0x20, 0x10, 0xd3, 0x4a, 0x1b, 0x24, 0x52, 0x24, 0x24, + 0xa9, 0x87, 0x6c, 0x84, 0x5e, 0x48, 0xbe, 0x53, 0x2a, 0x58, 0x57, 0x6a, 0x8a, 0x04, 0x2f, 0x4c, + 0x71, 0x91, 0x95, 0x0b, 0x58, 0x3b, 0x3e, 0xc5, 0x82, 0x40, 0xc5, 0xdc, 0x46, 0xe2, 0xa8, 0x0a, + 0xe0, 0xf6, 0x83, 0xad, 0x04, 0x04, 0x00, 0x00, 0xff, 0xff, 0x59, 0xfa, 0x16, 0xbc, 0xc0, 0x00, + 0x00, 0x00, } diff --git a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext.proto b/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext.proto index b669141..c2dd737 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext.proto +++ b/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext.proto @@ -3,14 +3,11 @@ syntax = "proto2"; package grpc.testing; import "proto2.proto"; -import "test.proto"; - -extend ToBeExtended { - optional int32 foo = 13; - optional Extension bar = 17; - optional SearchRequest baz = 19; +extend ToBeExtened { + optional int32 bar = 13; + optional Extension baz = 17; } message Extension { - optional int32 whatzit = 1; + optional int32 baz = 1; } diff --git a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext2.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext2.pb.go deleted file mode 100644 index 0aaec7c..0000000 --- a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext2.pb.go +++ /dev/null @@ -1,72 +0,0 @@ -// Code generated by protoc-gen-go. -// source: proto2_ext2.proto -// DO NOT EDIT! - -package grpc_testing - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -type AnotherExtension struct { - Whatchamacallit *int32 `protobuf:"varint,1,opt,name=whatchamacallit" json:"whatchamacallit,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *AnotherExtension) Reset() { *m = AnotherExtension{} } -func (m *AnotherExtension) String() string { return proto.CompactTextString(m) } -func (*AnotherExtension) ProtoMessage() {} -func (*AnotherExtension) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} } - -func (m *AnotherExtension) GetWhatchamacallit() int32 { - if m != nil && m.Whatchamacallit != nil { - return *m.Whatchamacallit - } - return 0 -} - -var E_Frob = &proto.ExtensionDesc{ - ExtendedType: (*ToBeExtended)(nil), - ExtensionType: (*string)(nil), - Field: 23, - Name: "grpc.testing.frob", - Tag: "bytes,23,opt,name=frob", - Filename: "proto2_ext2.proto", -} - -var E_Nitz = &proto.ExtensionDesc{ - ExtendedType: (*ToBeExtended)(nil), - ExtensionType: (*AnotherExtension)(nil), - Field: 29, - Name: "grpc.testing.nitz", - Tag: "bytes,29,opt,name=nitz", - Filename: "proto2_ext2.proto", -} - -func init() { - proto.RegisterType((*AnotherExtension)(nil), "grpc.testing.AnotherExtension") - proto.RegisterExtension(E_Frob) - proto.RegisterExtension(E_Nitz) -} - -func init() { proto.RegisterFile("proto2_ext2.proto", fileDescriptor2) } - -var fileDescriptor2 = []byte{ - // 165 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x12, 0x2c, 0x28, 0xca, 0x2f, - 0xc9, 0x37, 0x8a, 0x4f, 0xad, 0x28, 0x31, 0xd2, 0x03, 0xb3, 0x85, 0x78, 0xd2, 0x8b, 0x0a, 0x92, - 0xf5, 0x4a, 0x52, 0x8b, 0x4b, 0x32, 0xf3, 0xd2, 0xa5, 0x78, 0x20, 0x0a, 0x20, 0x72, 0x4a, 0x36, - 0x5c, 0x02, 0x8e, 0x79, 0xf9, 0x25, 0x19, 0xa9, 0x45, 0xae, 0x15, 0x25, 0xa9, 0x79, 0xc5, 0x99, - 0xf9, 0x79, 0x42, 0x1a, 0x5c, 0xfc, 0xe5, 0x19, 0x89, 0x25, 0xc9, 0x19, 0x89, 0xb9, 0x89, 0xc9, - 0x89, 0x39, 0x39, 0x99, 0x25, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xac, 0x41, 0xe8, 0xc2, 0x56, 0x7a, - 0x5c, 0x2c, 0x69, 0x45, 0xf9, 0x49, 0x42, 0x52, 0x7a, 0xc8, 0x56, 0xe8, 0x85, 0xe4, 0x3b, 0xa5, - 0x82, 0x8d, 0x4b, 0x49, 0x4d, 0x91, 0x10, 0x57, 0x60, 0xd4, 0xe0, 0x0c, 0x02, 0xab, 0xb3, 0xf2, - 0xe3, 0x62, 0xc9, 0xcb, 0x2c, 0xa9, 0xc2, 0xab, 0x5e, 0x56, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x0e, - 0x55, 0x05, 0xba, 0x1b, 0x83, 0xc0, 0xe6, 0x00, 0x02, 0x00, 0x00, 0xff, 0xff, 0xf0, 0x7e, 0x0d, - 0x26, 0xed, 0x00, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext2.proto b/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext2.proto deleted file mode 100644 index 16fa69e..0000000 --- a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext2.proto +++ /dev/null @@ -1,14 +0,0 @@ -syntax = "proto2"; - -package grpc.testing; - -import "proto2.proto"; - -extend ToBeExtended { - optional string frob = 23; - optional AnotherExtension nitz = 29; -} - -message AnotherExtension { - optional int32 whatchamacallit = 1; -} diff --git a/vendor/google.golang.org/grpc/reflection/grpc_testing/test.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_testing/test.pb.go index 27d71fc..607dfd3 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_testing/test.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_testing/test.pb.go @@ -25,7 +25,7 @@ type SearchResponse struct { func (m *SearchResponse) Reset() { *m = SearchResponse{} } func (m *SearchResponse) String() string { return proto.CompactTextString(m) } func (*SearchResponse) ProtoMessage() {} -func (*SearchResponse) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{0} } +func (*SearchResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} } func (m *SearchResponse) GetResults() []*SearchResponse_Result { if m != nil { @@ -43,28 +43,7 @@ type SearchResponse_Result struct { func (m *SearchResponse_Result) Reset() { *m = SearchResponse_Result{} } func (m *SearchResponse_Result) String() string { return proto.CompactTextString(m) } func (*SearchResponse_Result) ProtoMessage() {} -func (*SearchResponse_Result) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{0, 0} } - -func (m *SearchResponse_Result) GetUrl() string { - if m != nil { - return m.Url - } - return "" -} - -func (m *SearchResponse_Result) GetTitle() string { - if m != nil { - return m.Title - } - return "" -} - -func (m *SearchResponse_Result) GetSnippets() []string { - if m != nil { - return m.Snippets - } - return nil -} +func (*SearchResponse_Result) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0, 0} } type SearchRequest struct { Query string `protobuf:"bytes,1,opt,name=query" json:"query,omitempty"` @@ -73,14 +52,7 @@ type SearchRequest struct { func (m *SearchRequest) Reset() { *m = SearchRequest{} } func (m *SearchRequest) String() string { return proto.CompactTextString(m) } func (*SearchRequest) ProtoMessage() {} -func (*SearchRequest) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{1} } - -func (m *SearchRequest) GetQuery() string { - if m != nil { - return m.Query - } - return "" -} +func (*SearchRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{1} } func init() { proto.RegisterType((*SearchResponse)(nil), "grpc.testing.SearchResponse") @@ -226,23 +198,23 @@ var _SearchService_serviceDesc = grpc.ServiceDesc{ Metadata: "test.proto", } -func init() { proto.RegisterFile("test.proto", fileDescriptor3) } +func init() { proto.RegisterFile("test.proto", fileDescriptor2) } -var fileDescriptor3 = []byte{ - // 231 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x91, 0xbd, 0x4a, 0xc5, 0x40, - 0x10, 0x85, 0x59, 0x83, 0xd1, 0x3b, 0xfe, 0x32, 0x58, 0x84, 0x68, 0x11, 0xae, 0x08, 0xa9, 0x16, - 0xb9, 0xd6, 0x56, 0xb6, 0x16, 0xb2, 0x79, 0x82, 0x6b, 0x18, 0xe2, 0x42, 0x4c, 0x36, 0x33, 0x13, - 0xc1, 0x87, 0xb1, 0xf5, 0x39, 0x25, 0x59, 0x23, 0x0a, 0x62, 0x63, 0xb7, 0xe7, 0xe3, 0xcc, 0xb7, - 0xbb, 0x0c, 0x80, 0x92, 0xa8, 0x0d, 0xdc, 0x6b, 0x8f, 0x87, 0x0d, 0x87, 0xda, 0x4e, 0xc0, 0x77, - 0xcd, 0xfa, 0xcd, 0xc0, 0x71, 0x45, 0x5b, 0xae, 0x9f, 0x1c, 0x49, 0xe8, 0x3b, 0x21, 0xbc, 0x85, - 0x3d, 0x26, 0x19, 0x5b, 0x95, 0xcc, 0x14, 0x49, 0x79, 0xb0, 0xb9, 0xb4, 0xdf, 0x47, 0xec, 0xcf, - 0xba, 0x75, 0x73, 0xd7, 0x2d, 0x33, 0xf9, 0x3d, 0xa4, 0x11, 0xe1, 0x29, 0x24, 0x23, 0xb7, 0x99, - 0x29, 0x4c, 0xb9, 0x72, 0xd3, 0x11, 0xcf, 0x60, 0x57, 0xbd, 0xb6, 0x94, 0xed, 0xcc, 0x2c, 0x06, - 0xcc, 0x61, 0x5f, 0x3a, 0x1f, 0x02, 0xa9, 0x64, 0x49, 0x91, 0x94, 0x2b, 0xf7, 0x95, 0xd7, 0x57, - 0x70, 0xb4, 0xdc, 0x37, 0x8c, 0x24, 0x3a, 0x29, 0x86, 0x91, 0xf8, 0xf5, 0x53, 0x1b, 0xc3, 0xe6, - 0xdd, 0x2c, 0xbd, 0x8a, 0xf8, 0xc5, 0xd7, 0x84, 0x77, 0x90, 0x46, 0x80, 0xe7, 0xbf, 0x3f, 0x7f, - 0xd6, 0xe5, 0x17, 0x7f, 0xfd, 0x0d, 0x1f, 0xe0, 0xa4, 0x52, 0xa6, 0xed, 0xb3, 0xef, 0x9a, 0x7f, - 0xdb, 0x4a, 0x73, 0x6d, 0x1e, 0xd3, 0x79, 0x09, 0x37, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x20, - 0xd6, 0x09, 0xb8, 0x92, 0x01, 0x00, 0x00, +var fileDescriptor2 = []byte{ + // 227 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0x49, 0x2d, 0x2e, + 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x49, 0x2f, 0x2a, 0x48, 0xd6, 0x03, 0x09, 0x64, + 0xe6, 0xa5, 0x2b, 0xcd, 0x65, 0xe4, 0xe2, 0x0b, 0x4e, 0x4d, 0x2c, 0x4a, 0xce, 0x08, 0x4a, 0x2d, + 0x2e, 0xc8, 0xcf, 0x2b, 0x4e, 0x15, 0xb2, 0xe5, 0x62, 0x2f, 0x4a, 0x2d, 0x2e, 0xcd, 0x29, 0x29, + 0x96, 0x60, 0x54, 0x60, 0xd6, 0xe0, 0x36, 0x52, 0xd6, 0x43, 0xd6, 0xa2, 0x87, 0xaa, 0x5c, 0x2f, + 0x08, 0xac, 0x36, 0x08, 0xa6, 0x47, 0xca, 0x87, 0x8b, 0x0d, 0x22, 0x24, 0x24, 0xc0, 0xc5, 0x5c, + 0x5a, 0x94, 0x03, 0x34, 0x84, 0x51, 0x83, 0x33, 0x08, 0xc4, 0x14, 0x12, 0xe1, 0x62, 0x2d, 0xc9, + 0x2c, 0xc9, 0x49, 0x95, 0x60, 0x02, 0x8b, 0x41, 0x38, 0x42, 0x52, 0x5c, 0x1c, 0xc5, 0x79, 0x99, + 0x05, 0x05, 0xa9, 0x40, 0x1b, 0x99, 0x81, 0x36, 0x72, 0x06, 0xc1, 0xf9, 0x4a, 0xaa, 0x5c, 0xbc, + 0x30, 0xfb, 0x0a, 0x4b, 0x81, 0x0e, 0x00, 0x19, 0x01, 0x64, 0x14, 0x55, 0x42, 0x8d, 0x85, 0x70, + 0x8c, 0x96, 0x31, 0xc2, 0xd4, 0x05, 0xa7, 0x16, 0x95, 0x65, 0x26, 0xa7, 0x0a, 0x39, 0x73, 0xb1, + 0x41, 0x04, 0x84, 0xa4, 0xb1, 0x3b, 0x1f, 0x6c, 0x9c, 0x94, 0x0c, 0x3e, 0xbf, 0x09, 0x05, 0x70, + 0xf1, 0x07, 0x97, 0x14, 0xa5, 0x26, 0xe6, 0x02, 0xe5, 0x28, 0x36, 0x4d, 0x83, 0xd1, 0x80, 0x31, + 0x89, 0x0d, 0x1c, 0x09, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x20, 0xd6, 0x09, 0xb8, 0x92, + 0x01, 0x00, 0x00, } diff --git a/vendor/google.golang.org/grpc/reflection/serverreflection.go b/vendor/google.golang.org/grpc/reflection/serverreflection.go index f28304d..4b3fcf5 100644 --- a/vendor/google.golang.org/grpc/reflection/serverreflection.go +++ b/vendor/google.golang.org/grpc/reflection/serverreflection.go @@ -119,11 +119,11 @@ func (s *serverReflectionServer) decodeFileDesc(enc []byte) (*dpb.FileDescriptor func decompress(b []byte) ([]byte, error) { r, err := gzip.NewReader(bytes.NewReader(b)) if err != nil { - return nil, fmt.Errorf("bad gzipped descriptor: %v", err) + return nil, fmt.Errorf("bad gzipped descriptor: %v\n", err) } out, err := ioutil.ReadAll(r) if err != nil { - return nil, fmt.Errorf("bad gzipped descriptor: %v", err) + return nil, fmt.Errorf("bad gzipped descriptor: %v\n", err) } return out, nil } @@ -156,7 +156,9 @@ func (s *serverReflectionServer) fileDescContainingExtension(st reflect.Type, ex return nil, fmt.Errorf("failed to find registered extension for extension number %v", ext) } - return s.decodeFileDesc(proto.FileDescriptor(extDesc.Filename)) + extT := reflect.TypeOf(extDesc.ExtensionType).Elem() + + return s.fileDescForType(extT) } func (s *serverReflectionServer) allExtensionNumbersForType(st reflect.Type) ([]int32, error) { diff --git a/vendor/google.golang.org/grpc/reflection/serverreflection_test.go b/vendor/google.golang.org/grpc/reflection/serverreflection_test.go index daef8ff..1759e66 100644 --- a/vendor/google.golang.org/grpc/reflection/serverreflection_test.go +++ b/vendor/google.golang.org/grpc/reflection/serverreflection_test.go @@ -51,15 +51,13 @@ import ( var ( s = &serverReflectionServer{} // fileDescriptor of each test proto file. - fdTest *dpb.FileDescriptorProto - fdProto2 *dpb.FileDescriptorProto - fdProto2Ext *dpb.FileDescriptorProto - fdProto2Ext2 *dpb.FileDescriptorProto + fdTest *dpb.FileDescriptorProto + fdProto2 *dpb.FileDescriptorProto + fdProto2Ext *dpb.FileDescriptorProto // fileDescriptor marshalled. - fdTestByte []byte - fdProto2Byte []byte - fdProto2ExtByte []byte - fdProto2Ext2Byte []byte + fdTestByte []byte + fdProto2Byte []byte + fdProto2ExtByte []byte ) func loadFileDesc(filename string) (*dpb.FileDescriptorProto, []byte) { @@ -82,7 +80,6 @@ func init() { fdTest, fdTestByte = loadFileDesc("test.proto") fdProto2, fdProto2Byte = loadFileDesc("proto2.proto") fdProto2Ext, fdProto2ExtByte = loadFileDesc("proto2_ext.proto") - fdProto2Ext2, fdProto2Ext2Byte = loadFileDesc("proto2_ext2.proto") } func TestFileDescForType(t *testing.T) { @@ -91,7 +88,7 @@ func TestFileDescForType(t *testing.T) { wantFd *dpb.FileDescriptorProto }{ {reflect.TypeOf(pb.SearchResponse_Result{}), fdTest}, - {reflect.TypeOf(pb.ToBeExtended{}), fdProto2}, + {reflect.TypeOf(pb.ToBeExtened{}), fdProto2}, } { fd, err := s.fileDescForType(test.st) if err != nil || !reflect.DeepEqual(fd, test.wantFd) { @@ -131,11 +128,7 @@ func TestFileDescContainingExtension(t *testing.T) { extNum int32 want *dpb.FileDescriptorProto }{ - {reflect.TypeOf(pb.ToBeExtended{}), 13, fdProto2Ext}, - {reflect.TypeOf(pb.ToBeExtended{}), 17, fdProto2Ext}, - {reflect.TypeOf(pb.ToBeExtended{}), 19, fdProto2Ext}, - {reflect.TypeOf(pb.ToBeExtended{}), 23, fdProto2Ext2}, - {reflect.TypeOf(pb.ToBeExtended{}), 29, fdProto2Ext2}, + {reflect.TypeOf(pb.ToBeExtened{}), 17, fdProto2Ext}, } { fd, err := s.fileDescContainingExtension(test.st, test.extNum) if err != nil || !reflect.DeepEqual(fd, test.want) { @@ -156,7 +149,7 @@ func TestAllExtensionNumbersForType(t *testing.T) { st reflect.Type want []int32 }{ - {reflect.TypeOf(pb.ToBeExtended{}), []int32{13, 17, 19, 23, 29}}, + {reflect.TypeOf(pb.ToBeExtened{}), []int32{13, 17}}, } { r, err := s.allExtensionNumbersForType(test.st) sort.Sort(intArray(r)) @@ -285,7 +278,7 @@ func testFileContainingSymbol(t *testing.T, stream rpb.ServerReflection_ServerRe {"grpc.testing.SearchService.Search", fdTestByte}, {"grpc.testing.SearchService.StreamingSearch", fdTestByte}, {"grpc.testing.SearchResponse", fdTestByte}, - {"grpc.testing.ToBeExtended", fdProto2Byte}, + {"grpc.testing.ToBeExtened", fdProto2Byte}, } { if err := stream.Send(&rpb.ServerReflectionRequest{ MessageRequest: &rpb.ServerReflectionRequest_FileContainingSymbol{ @@ -316,7 +309,7 @@ func testFileContainingSymbolError(t *testing.T, stream rpb.ServerReflection_Ser "grpc.testing.SerchService", "grpc.testing.SearchService.SearchE", "grpc.tesing.SearchResponse", - "gpc.testing.ToBeExtended", + "gpc.testing.ToBeExtened", } { if err := stream.Send(&rpb.ServerReflectionRequest{ MessageRequest: &rpb.ServerReflectionRequest_FileContainingSymbol{ @@ -345,11 +338,7 @@ func testFileContainingExtension(t *testing.T, stream rpb.ServerReflection_Serve extNum int32 want []byte }{ - {"grpc.testing.ToBeExtended", 13, fdProto2ExtByte}, - {"grpc.testing.ToBeExtended", 17, fdProto2ExtByte}, - {"grpc.testing.ToBeExtended", 19, fdProto2ExtByte}, - {"grpc.testing.ToBeExtended", 23, fdProto2Ext2Byte}, - {"grpc.testing.ToBeExtended", 29, fdProto2Ext2Byte}, + {"grpc.testing.ToBeExtened", 17, fdProto2ExtByte}, } { if err := stream.Send(&rpb.ServerReflectionRequest{ MessageRequest: &rpb.ServerReflectionRequest_FileContainingExtension{ @@ -383,8 +372,8 @@ func testFileContainingExtensionError(t *testing.T, stream rpb.ServerReflection_ typeName string extNum int32 }{ - {"grpc.testing.ToBExtended", 17}, - {"grpc.testing.ToBeExtended", 15}, + {"grpc.testing.ToBExtened", 17}, + {"grpc.testing.ToBeExtened", 15}, } { if err := stream.Send(&rpb.ServerReflectionRequest{ MessageRequest: &rpb.ServerReflectionRequest_FileContainingExtension{ @@ -415,7 +404,7 @@ func testAllExtensionNumbersOfType(t *testing.T, stream rpb.ServerReflection_Ser typeName string want []int32 }{ - {"grpc.testing.ToBeExtended", []int32{13, 17, 19, 23, 29}}, + {"grpc.testing.ToBeExtened", []int32{13, 17}}, } { if err := stream.Send(&rpb.ServerReflectionRequest{ MessageRequest: &rpb.ServerReflectionRequest_AllExtensionNumbersOfType{ @@ -446,7 +435,7 @@ func testAllExtensionNumbersOfType(t *testing.T, stream rpb.ServerReflection_Ser func testAllExtensionNumbersOfTypeError(t *testing.T, stream rpb.ServerReflection_ServerReflectionInfoClient) { for _, test := range []string{ - "grpc.testing.ToBeExtendedE", + "grpc.testing.ToBeExtenedE", } { if err := stream.Send(&rpb.ServerReflectionRequest{ MessageRequest: &rpb.ServerReflectionRequest_AllExtensionNumbersOfType{ diff --git a/vendor/google.golang.org/grpc/rpc_util.go b/vendor/google.golang.org/grpc/rpc_util.go index 73c3a96..a25eaa8 100644 --- a/vendor/google.golang.org/grpc/rpc_util.go +++ b/vendor/google.golang.org/grpc/rpc_util.go @@ -42,14 +42,11 @@ import ( "io/ioutil" "math" "os" - "time" "github.com/golang/protobuf/proto" "golang.org/x/net/context" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" - "google.golang.org/grpc/peer" - "google.golang.org/grpc/stats" "google.golang.org/grpc/transport" ) @@ -141,7 +138,6 @@ type callInfo struct { failFast bool headerMD metadata.MD trailerMD metadata.MD - peer *peer.Peer traceInfo traceInfo // in trace.go } @@ -185,20 +181,12 @@ func Trailer(md *metadata.MD) CallOption { }) } -// Peer returns a CallOption that retrieves peer information for a -// unary RPC. -func Peer(peer *peer.Peer) CallOption { - return afterCall(func(c *callInfo) { - *peer = *c.peer - }) -} - // FailFast configures the action to take when an RPC is attempted on broken // connections or unreachable servers. If failfast is true, the RPC will fail // immediately. Otherwise, the RPC client will block the call until a // connection is available (or the call is canceled or times out) and will retry // the call if it fails due to a transient error. Please refer to -// https://github.com/grpc/grpc/blob/master/doc/fail_fast.md. Note: failFast is default to true. +// https://github.com/grpc/grpc/blob/master/doc/fail_fast.md func FailFast(failFast bool) CallOption { return beforeCall(func(c *callInfo) error { c.failFast = failFast @@ -267,11 +255,9 @@ func (p *parser) recvMsg(maxMsgSize int) (pf payloadFormat, msg []byte, err erro // encode serializes msg and prepends the message header. If msg is nil, it // generates the message header of 0 message length. -func encode(c Codec, msg interface{}, cp Compressor, cbuf *bytes.Buffer, outPayload *stats.OutPayload) ([]byte, error) { - var ( - b []byte - length uint - ) +func encode(c Codec, msg interface{}, cp Compressor, cbuf *bytes.Buffer) ([]byte, error) { + var b []byte + var length uint if msg != nil { var err error // TODO(zhaoq): optimize to reduce memory alloc and copying. @@ -279,12 +265,6 @@ func encode(c Codec, msg interface{}, cp Compressor, cbuf *bytes.Buffer, outPayl if err != nil { return nil, err } - if outPayload != nil { - outPayload.Payload = msg - // TODO truncate large payload. - outPayload.Data = b - outPayload.Length = len(b) - } if cp != nil { if err := cp.Do(cbuf, b); err != nil { return nil, err @@ -315,10 +295,6 @@ func encode(c Codec, msg interface{}, cp Compressor, cbuf *bytes.Buffer, outPayl // Copy encoded msg to buf copy(buf[5:], b) - if outPayload != nil { - outPayload.WireLength = len(buf) - } - return buf, nil } @@ -335,14 +311,11 @@ func checkRecvPayload(pf payloadFormat, recvCompress string, dc Decompressor) er return nil } -func recv(p *parser, c Codec, s *transport.Stream, dc Decompressor, m interface{}, maxMsgSize int, inPayload *stats.InPayload) error { +func recv(p *parser, c Codec, s *transport.Stream, dc Decompressor, m interface{}, maxMsgSize int) error { pf, d, err := p.recvMsg(maxMsgSize) if err != nil { return err } - if inPayload != nil { - inPayload.WireLength = len(d) - } if err := checkRecvPayload(pf, s.RecvCompress(), dc); err != nil { return err } @@ -360,13 +333,6 @@ func recv(p *parser, c Codec, s *transport.Stream, dc Decompressor, m interface{ if err := c.Unmarshal(d, m); err != nil { return Errorf(codes.Internal, "grpc: failed to unmarshal the received message %v", err) } - if inPayload != nil { - inPayload.RecvTime = time.Now() - inPayload.Payload = m - // TODO truncate large payload. - inPayload.Data = d - inPayload.Length = len(d) - } return nil } @@ -377,7 +343,7 @@ type rpcError struct { } func (e *rpcError) Error() string { - return fmt.Sprintf("rpc error: code = %s desc = %s", e.code, e.desc) + return fmt.Sprintf("rpc error: code = %d desc = %s", e.code, e.desc) } // Code returns the error code for err if it was produced by the rpc system. @@ -482,44 +448,6 @@ func convertCode(err error) codes.Code { return codes.Unknown } -// MethodConfig defines the configuration recommended by the service providers for a -// particular method. -// This is EXPERIMENTAL and subject to change. -type MethodConfig struct { - // WaitForReady indicates whether RPCs sent to this method should wait until - // the connection is ready by default (!failfast). The value specified via the - // gRPC client API will override the value set here. - WaitForReady bool - // Timeout is the default timeout for RPCs sent to this method. The actual - // deadline used will be the minimum of the value specified here and the value - // set by the application via the gRPC client API. If either one is not set, - // then the other will be used. If neither is set, then the RPC has no deadline. - Timeout time.Duration - // MaxReqSize is the maximum allowed payload size for an individual request in a - // stream (client->server) in bytes. The size which is measured is the serialized - // payload after per-message compression (but before stream compression) in bytes. - // The actual value used is the minumum of the value specified here and the value set - // by the application via the gRPC client API. If either one is not set, then the other - // will be used. If neither is set, then the built-in default is used. - // TODO: support this. - MaxReqSize uint32 - // MaxRespSize is the maximum allowed payload size for an individual response in a - // stream (server->client) in bytes. - // TODO: support this. - MaxRespSize uint32 -} - -// ServiceConfig is provided by the service provider and contains parameters for how -// clients that connect to the service should behave. -// This is EXPERIMENTAL and subject to change. -type ServiceConfig struct { - // LB is the load balancer the service providers recommends. The balancer specified - // via grpc.WithBalancer will override this. - LB Balancer - // Methods contains a map for the methods in this service. - Methods map[string]MethodConfig -} - // SupportPackageIsVersion4 is referenced from generated protocol buffer files // to assert that that code is compatible with this version of the grpc package. // diff --git a/vendor/google.golang.org/grpc/rpc_util_test.go b/vendor/google.golang.org/grpc/rpc_util_test.go index 375e42b..0ba2d44 100644 --- a/vendor/google.golang.org/grpc/rpc_util_test.go +++ b/vendor/google.golang.org/grpc/rpc_util_test.go @@ -114,7 +114,7 @@ func TestEncode(t *testing.T) { }{ {nil, nil, []byte{0, 0, 0, 0, 0}, nil}, } { - b, err := encode(protoCodec{}, test.msg, nil, nil, nil) + b, err := encode(protoCodec{}, test.msg, nil, nil) if err != test.err || !bytes.Equal(b, test.b) { t.Fatalf("encode(_, _, %v, _) = %v, %v\nwant %v, %v", test.cp, b, err, test.b, test.err) } @@ -199,12 +199,12 @@ func TestErrorsWithSameParameters(t *testing.T) { // bytes. func bmEncode(b *testing.B, mSize int) { msg := &perfpb.Buffer{Body: make([]byte, mSize)} - encoded, _ := encode(protoCodec{}, msg, nil, nil, nil) + encoded, _ := encode(protoCodec{}, msg, nil, nil) encodedSz := int64(len(encoded)) b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { - encode(protoCodec{}, msg, nil, nil, nil) + encode(protoCodec{}, msg, nil, nil) } b.SetBytes(encodedSz) } diff --git a/vendor/google.golang.org/grpc/server.go b/vendor/google.golang.org/grpc/server.go index 157f35e..e0bb187 100644 --- a/vendor/google.golang.org/grpc/server.go +++ b/vendor/google.golang.org/grpc/server.go @@ -54,8 +54,6 @@ import ( "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal" "google.golang.org/grpc/metadata" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/tap" "google.golang.org/grpc/transport" ) @@ -112,11 +110,8 @@ type options struct { maxMsgSize int unaryInt UnaryServerInterceptor streamInt StreamServerInterceptor - inTapHandle tap.ServerInHandle - statsHandler stats.Handler maxConcurrentStreams uint32 useHandlerImpl bool // use http.Handler-based server - unknownStreamDesc *StreamDesc } var defaultMaxMsgSize = 1024 * 1024 * 4 // use 4MB as the default message size limit @@ -191,42 +186,6 @@ func StreamInterceptor(i StreamServerInterceptor) ServerOption { } } -// InTapHandle returns a ServerOption that sets the tap handle for all the server -// transport to be created. Only one can be installed. -func InTapHandle(h tap.ServerInHandle) ServerOption { - return func(o *options) { - if o.inTapHandle != nil { - panic("The tap handle has been set.") - } - o.inTapHandle = h - } -} - -// StatsHandler returns a ServerOption that sets the stats handler for the server. -func StatsHandler(h stats.Handler) ServerOption { - return func(o *options) { - o.statsHandler = h - } -} - -// UnknownServiceHandler returns a ServerOption that allows for adding a custom -// unknown service handler. The provided method is a bidi-streaming RPC service -// handler that will be invoked instead of returning the the "unimplemented" gRPC -// error whenever a request is received for an unregistered service or method. -// The handling function has full access to the Context of the request and the -// stream, and the invocation passes through interceptors. -func UnknownServiceHandler(streamHandler StreamHandler) ServerOption { - return func(o *options) { - o.unknownStreamDesc = &StreamDesc{ - StreamName: "unknown_service_handler", - Handler: streamHandler, - // We need to assume that the users of the streamHandler will want to use both. - ClientStreams: true, - ServerStreams: true, - } - } -} - // NewServer creates a gRPC server which has no service registered and has not // started to accept requests yet. func NewServer(opt ...ServerOption) *Server { @@ -370,7 +329,6 @@ func (s *Server) useTransportAuthenticator(rawConn net.Conn) (net.Conn, credenti // read gRPC requests and then call the registered handlers to reply to them. // Serve returns when lis.Accept fails with fatal errors. lis will be closed when // this method returns. -// Serve always returns non-nil error. func (s *Server) Serve(lis net.Listener) error { s.mu.Lock() s.printf("serving") @@ -454,23 +412,17 @@ func (s *Server) handleRawConn(rawConn net.Conn) { if s.opts.useHandlerImpl { s.serveUsingHandler(conn) } else { - s.serveHTTP2Transport(conn, authInfo) + s.serveNewHTTP2Transport(conn, authInfo) } } -// serveHTTP2Transport sets up a http/2 transport (using the +// serveNewHTTP2Transport sets up a new http/2 transport (using the // gRPC http2 server transport in transport/http2_server.go) and // serves streams on it. // This is run in its own goroutine (it does network I/O in // transport.NewServerTransport). -func (s *Server) serveHTTP2Transport(c net.Conn, authInfo credentials.AuthInfo) { - config := &transport.ServerConfig{ - MaxStreams: s.opts.maxConcurrentStreams, - AuthInfo: authInfo, - InTapHandle: s.opts.inTapHandle, - StatsHandler: s.opts.statsHandler, - } - st, err := transport.NewServerTransport("http2", c, config) +func (s *Server) serveNewHTTP2Transport(c net.Conn, authInfo credentials.AuthInfo) { + st, err := transport.NewServerTransport("http2", c, s.opts.maxConcurrentStreams, authInfo) if err != nil { s.mu.Lock() s.errorf("NewServerTransport(%q) failed: %v", c.RemoteAddr(), err) @@ -496,12 +448,6 @@ func (s *Server) serveStreams(st transport.ServerTransport) { defer wg.Done() s.handleStream(st, stream, s.traceInfo(st, stream)) }() - }, func(ctx context.Context, method string) context.Context { - if !EnableTracing { - return ctx - } - tr := trace.New("grpc.Recv."+methodFamily(method), method) - return trace.NewContext(ctx, tr) }) wg.Wait() } @@ -551,17 +497,15 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { // traceInfo returns a traceInfo and associates it with stream, if tracing is enabled. // If tracing is not enabled, it returns nil. func (s *Server) traceInfo(st transport.ServerTransport, stream *transport.Stream) (trInfo *traceInfo) { - tr, ok := trace.FromContext(stream.Context()) - if !ok { + if !EnableTracing { return nil } - trInfo = &traceInfo{ - tr: tr, + tr: trace.New("grpc.Recv."+methodFamily(stream.Method()), stream.Method()), } trInfo.firstLine.client = false trInfo.firstLine.remoteAddr = st.RemoteAddr() - + stream.TraceContext(trInfo.tr) if dl, ok := stream.Context().Deadline(); ok { trInfo.firstLine.deadline = dl.Sub(time.Now()) } @@ -588,17 +532,11 @@ func (s *Server) removeConn(c io.Closer) { } func (s *Server) sendResponse(t transport.ServerTransport, stream *transport.Stream, msg interface{}, cp Compressor, opts *transport.Options) error { - var ( - cbuf *bytes.Buffer - outPayload *stats.OutPayload - ) + var cbuf *bytes.Buffer if cp != nil { cbuf = new(bytes.Buffer) } - if s.opts.statsHandler != nil { - outPayload = &stats.OutPayload{} - } - p, err := encode(s.opts.codec, msg, cp, cbuf, outPayload) + p, err := encode(s.opts.codec, msg, cp, cbuf) if err != nil { // This typically indicates a fatal issue (e.g., memory // corruption or hardware faults) the application program @@ -609,33 +547,10 @@ func (s *Server) sendResponse(t transport.ServerTransport, stream *transport.Str // the optimal option. grpclog.Fatalf("grpc: Server failed to encode response %v", err) } - err = t.Write(stream, p, opts) - if err == nil && outPayload != nil { - outPayload.SentTime = time.Now() - s.opts.statsHandler.HandleRPC(stream.Context(), outPayload) - } - return err + return t.Write(stream, p, opts) } func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.Stream, srv *service, md *MethodDesc, trInfo *traceInfo) (err error) { - sh := s.opts.statsHandler - if sh != nil { - begin := &stats.Begin{ - BeginTime: time.Now(), - } - sh.HandleRPC(stream.Context(), begin) - } - defer func() { - if sh != nil { - end := &stats.End{ - EndTime: time.Now(), - } - if err != nil && err != io.EOF { - end.Error = toRPCErr(err) - } - sh.HandleRPC(stream.Context(), end) - } - }() if trInfo != nil { defer trInfo.tr.Finish() trInfo.firstLine.client = false @@ -664,14 +579,14 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. if err != nil { switch err := err.(type) { case *rpcError: - if e := t.WriteStatus(stream, err.code, err.desc); e != nil { - grpclog.Printf("grpc: Server.processUnaryRPC failed to write status %v", e) + if err := t.WriteStatus(stream, err.code, err.desc); err != nil { + grpclog.Printf("grpc: Server.processUnaryRPC failed to write status %v", err) } case transport.ConnectionError: // Nothing to do here. case transport.StreamError: - if e := t.WriteStatus(stream, err.Code, err.Desc); e != nil { - grpclog.Printf("grpc: Server.processUnaryRPC failed to write status %v", e) + if err := t.WriteStatus(stream, err.Code, err.Desc); err != nil { + grpclog.Printf("grpc: Server.processUnaryRPC failed to write status %v", err) } default: panic(fmt.Sprintf("grpc: Unexpected error (%T) from recvMsg: %v", err, err)) @@ -682,29 +597,20 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. if err := checkRecvPayload(pf, stream.RecvCompress(), s.opts.dc); err != nil { switch err := err.(type) { case *rpcError: - if e := t.WriteStatus(stream, err.code, err.desc); e != nil { - grpclog.Printf("grpc: Server.processUnaryRPC failed to write status %v", e) + if err := t.WriteStatus(stream, err.code, err.desc); err != nil { + grpclog.Printf("grpc: Server.processUnaryRPC failed to write status %v", err) } - return err default: - if e := t.WriteStatus(stream, codes.Internal, err.Error()); e != nil { - grpclog.Printf("grpc: Server.processUnaryRPC failed to write status %v", e) + if err := t.WriteStatus(stream, codes.Internal, err.Error()); err != nil { + grpclog.Printf("grpc: Server.processUnaryRPC failed to write status %v", err) } - // TODO checkRecvPayload always return RPC error. Add a return here if necessary. - } - } - var inPayload *stats.InPayload - if sh != nil { - inPayload = &stats.InPayload{ - RecvTime: time.Now(), + } + return err } statusCode := codes.OK statusDesc := "" df := func(v interface{}) error { - if inPayload != nil { - inPayload.WireLength = len(req) - } if pf == compressionMade { var err error req, err = s.opts.dc.Do(bytes.NewReader(req)) @@ -712,7 +618,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. if err := t.WriteStatus(stream, codes.Internal, err.Error()); err != nil { grpclog.Printf("grpc: Server.processUnaryRPC failed to write status %v", err) } - return Errorf(codes.Internal, err.Error()) + return err } } if len(req) > s.opts.maxMsgSize { @@ -724,12 +630,6 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. if err := s.opts.codec.Unmarshal(req, v); err != nil { return err } - if inPayload != nil { - inPayload.Payload = v - inPayload.Data = req - inPayload.Length = len(req) - sh.HandleRPC(stream.Context(), inPayload) - } if trInfo != nil { trInfo.tr.LazyLog(&payload{sent: false, msg: v}, true) } @@ -750,8 +650,9 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. } if err := t.WriteStatus(stream, statusCode, statusDesc); err != nil { grpclog.Printf("grpc: Server.processUnaryRPC failed to write status: %v", err) + return err } - return Errorf(statusCode, statusDesc) + return nil } if trInfo != nil { trInfo.tr.LazyLog(stringer("OK"), false) @@ -776,46 +677,23 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. if trInfo != nil { trInfo.tr.LazyLog(&payload{sent: true, msg: reply}, true) } - errWrite := t.WriteStatus(stream, statusCode, statusDesc) - if statusCode != codes.OK { - return Errorf(statusCode, statusDesc) - } - return errWrite + return t.WriteStatus(stream, statusCode, statusDesc) } } func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transport.Stream, srv *service, sd *StreamDesc, trInfo *traceInfo) (err error) { - sh := s.opts.statsHandler - if sh != nil { - begin := &stats.Begin{ - BeginTime: time.Now(), - } - sh.HandleRPC(stream.Context(), begin) - } - defer func() { - if sh != nil { - end := &stats.End{ - EndTime: time.Now(), - } - if err != nil && err != io.EOF { - end.Error = toRPCErr(err) - } - sh.HandleRPC(stream.Context(), end) - } - }() if s.opts.cp != nil { stream.SetSendCompress(s.opts.cp.Type()) } ss := &serverStream{ - t: t, - s: stream, - p: &parser{r: stream}, - codec: s.opts.codec, - cp: s.opts.cp, - dc: s.opts.dc, - maxMsgSize: s.opts.maxMsgSize, - trInfo: trInfo, - statsHandler: sh, + t: t, + s: stream, + p: &parser{r: stream}, + codec: s.opts.codec, + cp: s.opts.cp, + dc: s.opts.dc, + maxMsgSize: s.opts.maxMsgSize, + trInfo: trInfo, } if ss.cp != nil { ss.cbuf = new(bytes.Buffer) @@ -834,19 +712,15 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp }() } var appErr error - var server interface{} - if srv != nil { - server = srv.server - } if s.opts.streamInt == nil { - appErr = sd.Handler(server, ss) + appErr = sd.Handler(srv.server, ss) } else { info := &StreamServerInfo{ FullMethod: stream.Method(), IsClientStream: sd.ClientStreams, IsServerStream: sd.ServerStreams, } - appErr = s.opts.streamInt(server, ss, info, sd.Handler) + appErr = s.opts.streamInt(srv.server, ss, info, sd.Handler) } if appErr != nil { if err, ok := appErr.(*rpcError); ok { @@ -870,11 +744,7 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp } ss.mu.Unlock() } - errWrite := t.WriteStatus(ss.s, ss.statusCode, ss.statusDesc) - if ss.statusCode != codes.OK { - return Errorf(ss.statusCode, ss.statusDesc) - } - return errWrite + return t.WriteStatus(ss.s, ss.statusCode, ss.statusDesc) } @@ -889,8 +759,7 @@ func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Str trInfo.tr.LazyLog(&fmtStringer{"Malformed method name %q", []interface{}{sm}}, true) trInfo.tr.SetError() } - errDesc := fmt.Sprintf("malformed method name: %q", stream.Method()) - if err := t.WriteStatus(stream, codes.InvalidArgument, errDesc); err != nil { + if err := t.WriteStatus(stream, codes.InvalidArgument, fmt.Sprintf("malformed method name: %q", stream.Method())); err != nil { if trInfo != nil { trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) trInfo.tr.SetError() @@ -906,16 +775,11 @@ func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Str method := sm[pos+1:] srv, ok := s.m[service] if !ok { - if unknownDesc := s.opts.unknownStreamDesc; unknownDesc != nil { - s.processStreamingRPC(t, stream, nil, unknownDesc, trInfo) - return - } if trInfo != nil { trInfo.tr.LazyLog(&fmtStringer{"Unknown service %v", []interface{}{service}}, true) trInfo.tr.SetError() } - errDesc := fmt.Sprintf("unknown service %v", service) - if err := t.WriteStatus(stream, codes.Unimplemented, errDesc); err != nil { + if err := t.WriteStatus(stream, codes.Unimplemented, fmt.Sprintf("unknown service %v", service)); err != nil { if trInfo != nil { trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) trInfo.tr.SetError() @@ -940,12 +804,7 @@ func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Str trInfo.tr.LazyLog(&fmtStringer{"Unknown method %v", []interface{}{method}}, true) trInfo.tr.SetError() } - if unknownDesc := s.opts.unknownStreamDesc; unknownDesc != nil { - s.processStreamingRPC(t, stream, nil, unknownDesc, trInfo) - return - } - errDesc := fmt.Sprintf("unknown method %v", method) - if err := t.WriteStatus(stream, codes.Unimplemented, errDesc); err != nil { + if err := t.WriteStatus(stream, codes.Unimplemented, fmt.Sprintf("unknown method %v", method)); err != nil { if trInfo != nil { trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) trInfo.tr.SetError() diff --git a/vendor/google.golang.org/grpc/server_test.go b/vendor/google.golang.org/grpc/server_test.go index 53968cc..2383880 100644 --- a/vendor/google.golang.org/grpc/server_test.go +++ b/vendor/google.golang.org/grpc/server_test.go @@ -60,7 +60,7 @@ func TestStopBeforeServe(t *testing.T) { // server.Serve is responsible for closing the listener, even if the // server was already stopped. err = lis.Close() - if got, want := ErrorDesc(err), "use of closed"; !strings.Contains(got, want) { + if got, want := ErrorDesc(err), "use of closed network connection"; !strings.Contains(got, want) { t.Errorf("Close() error = %q, want %q", got, want) } } diff --git a/vendor/google.golang.org/grpc/stats/grpc_testing/test.pb.go b/vendor/google.golang.org/grpc/stats/grpc_testing/test.pb.go deleted file mode 100644 index b24dcd8..0000000 --- a/vendor/google.golang.org/grpc/stats/grpc_testing/test.pb.go +++ /dev/null @@ -1,225 +0,0 @@ -// Code generated by protoc-gen-go. -// source: test.proto -// DO NOT EDIT! - -/* -Package grpc_testing is a generated protocol buffer package. - -It is generated from these files: - test.proto - -It has these top-level messages: - SimpleRequest - SimpleResponse -*/ -package grpc_testing - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -import ( - context "golang.org/x/net/context" - grpc "google.golang.org/grpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -// Unary request. -type SimpleRequest struct { - Id int32 `protobuf:"varint,2,opt,name=id" json:"id,omitempty"` -} - -func (m *SimpleRequest) Reset() { *m = SimpleRequest{} } -func (m *SimpleRequest) String() string { return proto.CompactTextString(m) } -func (*SimpleRequest) ProtoMessage() {} -func (*SimpleRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - -// Unary response, as configured by the request. -type SimpleResponse struct { - Id int32 `protobuf:"varint,3,opt,name=id" json:"id,omitempty"` -} - -func (m *SimpleResponse) Reset() { *m = SimpleResponse{} } -func (m *SimpleResponse) String() string { return proto.CompactTextString(m) } -func (*SimpleResponse) ProtoMessage() {} -func (*SimpleResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } - -func init() { - proto.RegisterType((*SimpleRequest)(nil), "grpc.testing.SimpleRequest") - proto.RegisterType((*SimpleResponse)(nil), "grpc.testing.SimpleResponse") -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// Client API for TestService service - -type TestServiceClient interface { - // One request followed by one response. - // The server returns the client id as-is. - UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) - // A sequence of requests with each request served by the server immediately. - // As one request could lead to multiple responses, this interface - // demonstrates the idea of full duplexing. - FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_FullDuplexCallClient, error) -} - -type testServiceClient struct { - cc *grpc.ClientConn -} - -func NewTestServiceClient(cc *grpc.ClientConn) TestServiceClient { - return &testServiceClient{cc} -} - -func (c *testServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) { - out := new(SimpleResponse) - err := grpc.Invoke(ctx, "/grpc.testing.TestService/UnaryCall", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *testServiceClient) FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_FullDuplexCallClient, error) { - stream, err := grpc.NewClientStream(ctx, &_TestService_serviceDesc.Streams[0], c.cc, "/grpc.testing.TestService/FullDuplexCall", opts...) - if err != nil { - return nil, err - } - x := &testServiceFullDuplexCallClient{stream} - return x, nil -} - -type TestService_FullDuplexCallClient interface { - Send(*SimpleRequest) error - Recv() (*SimpleResponse, error) - grpc.ClientStream -} - -type testServiceFullDuplexCallClient struct { - grpc.ClientStream -} - -func (x *testServiceFullDuplexCallClient) Send(m *SimpleRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *testServiceFullDuplexCallClient) Recv() (*SimpleResponse, error) { - m := new(SimpleResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// Server API for TestService service - -type TestServiceServer interface { - // One request followed by one response. - // The server returns the client id as-is. - UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error) - // A sequence of requests with each request served by the server immediately. - // As one request could lead to multiple responses, this interface - // demonstrates the idea of full duplexing. - FullDuplexCall(TestService_FullDuplexCallServer) error -} - -func RegisterTestServiceServer(s *grpc.Server, srv TestServiceServer) { - s.RegisterService(&_TestService_serviceDesc, srv) -} - -func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SimpleRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TestServiceServer).UnaryCall(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/grpc.testing.TestService/UnaryCall", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TestServiceServer).UnaryCall(ctx, req.(*SimpleRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _TestService_FullDuplexCall_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(TestServiceServer).FullDuplexCall(&testServiceFullDuplexCallServer{stream}) -} - -type TestService_FullDuplexCallServer interface { - Send(*SimpleResponse) error - Recv() (*SimpleRequest, error) - grpc.ServerStream -} - -type testServiceFullDuplexCallServer struct { - grpc.ServerStream -} - -func (x *testServiceFullDuplexCallServer) Send(m *SimpleResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *testServiceFullDuplexCallServer) Recv() (*SimpleRequest, error) { - m := new(SimpleRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -var _TestService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.testing.TestService", - HandlerType: (*TestServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "UnaryCall", - Handler: _TestService_UnaryCall_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "FullDuplexCall", - Handler: _TestService_FullDuplexCall_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "test.proto", -} - -func init() { proto.RegisterFile("test.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 167 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0x49, 0x2d, 0x2e, - 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x49, 0x2f, 0x2a, 0x48, 0xd6, 0x03, 0x09, 0x64, - 0xe6, 0xa5, 0x2b, 0xc9, 0x73, 0xf1, 0x06, 0x67, 0xe6, 0x16, 0xe4, 0xa4, 0x06, 0xa5, 0x16, 0x96, - 0xa6, 0x16, 0x97, 0x08, 0xf1, 0x71, 0x31, 0x65, 0xa6, 0x48, 0x30, 0x29, 0x30, 0x6a, 0xb0, 0x06, - 0x31, 0x65, 0xa6, 0x28, 0x29, 0x70, 0xf1, 0xc1, 0x14, 0x14, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x42, - 0x55, 0x30, 0xc3, 0x54, 0x18, 0x2d, 0x63, 0xe4, 0xe2, 0x0e, 0x49, 0x2d, 0x2e, 0x09, 0x4e, 0x2d, - 0x2a, 0xcb, 0x4c, 0x4e, 0x15, 0x72, 0xe3, 0xe2, 0x0c, 0xcd, 0x4b, 0x2c, 0xaa, 0x74, 0x4e, 0xcc, - 0xc9, 0x11, 0x92, 0xd6, 0x43, 0xb6, 0x4e, 0x0f, 0xc5, 0x2e, 0x29, 0x19, 0xec, 0x92, 0x50, 0x7b, - 0xfc, 0xb9, 0xf8, 0xdc, 0x4a, 0x73, 0x72, 0x5c, 0x4a, 0x0b, 0x72, 0x52, 0x2b, 0x28, 0x34, 0x4c, - 0x83, 0xd1, 0x80, 0x31, 0x89, 0x0d, 0x1c, 0x00, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8d, - 0x82, 0x5b, 0xdd, 0x0e, 0x01, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/stats/grpc_testing/test.proto b/vendor/google.golang.org/grpc/stats/grpc_testing/test.proto deleted file mode 100644 index 54e6f74..0000000 --- a/vendor/google.golang.org/grpc/stats/grpc_testing/test.proto +++ /dev/null @@ -1,23 +0,0 @@ -syntax = "proto3"; - -package grpc.testing; - -message SimpleRequest { - int32 id = 2; -} - -message SimpleResponse { - int32 id = 3; -} - -// A simple test service. -service TestService { - // One request followed by one response. - // The server returns the client id as-is. - rpc UnaryCall(SimpleRequest) returns (SimpleResponse); - - // A sequence of requests with each request served by the server immediately. - // As one request could lead to multiple responses, this interface - // demonstrates the idea of full duplexing. - rpc FullDuplexCall(stream SimpleRequest) returns (stream SimpleResponse); -} diff --git a/vendor/google.golang.org/grpc/stats/handlers.go b/vendor/google.golang.org/grpc/stats/handlers.go deleted file mode 100644 index 26e1a8e..0000000 --- a/vendor/google.golang.org/grpc/stats/handlers.go +++ /dev/null @@ -1,76 +0,0 @@ -/* - * - * Copyright 2016, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -package stats - -import ( - "net" - - "golang.org/x/net/context" -) - -// ConnTagInfo defines the relevant information needed by connection context tagger. -type ConnTagInfo struct { - // RemoteAddr is the remote address of the corresponding connection. - RemoteAddr net.Addr - // LocalAddr is the local address of the corresponding connection. - LocalAddr net.Addr - // TODO add QOS related fields. -} - -// RPCTagInfo defines the relevant information needed by RPC context tagger. -type RPCTagInfo struct { - // FullMethodName is the RPC method in the format of /package.service/method. - FullMethodName string -} - -// Handler defines the interface for the related stats handling (e.g., RPCs, connections). -type Handler interface { - // TagRPC can attach some information to the given context. - // The returned context is used in the rest lifetime of the RPC. - TagRPC(context.Context, *RPCTagInfo) context.Context - // HandleRPC processes the RPC stats. - HandleRPC(context.Context, RPCStats) - - // TagConn can attach some information to the given context. - // The returned context will be used for stats handling. - // For conn stats handling, the context used in HandleConn for this - // connection will be derived from the context returned. - // For RPC stats handling, - // - On server side, the context used in HandleRPC for all RPCs on this - // connection will be derived from the context returned. - // - On client side, the context is not derived from the context returned. - TagConn(context.Context, *ConnTagInfo) context.Context - // HandleConn processes the Conn stats. - HandleConn(context.Context, ConnStats) -} diff --git a/vendor/google.golang.org/grpc/stats/stats.go b/vendor/google.golang.org/grpc/stats/stats.go deleted file mode 100644 index a82448a..0000000 --- a/vendor/google.golang.org/grpc/stats/stats.go +++ /dev/null @@ -1,223 +0,0 @@ -/* - * - * Copyright 2016, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// Package stats is for collecting and reporting various network and RPC stats. -// This package is for monitoring purpose only. All fields are read-only. -// All APIs are experimental. -package stats // import "google.golang.org/grpc/stats" - -import ( - "net" - "time" -) - -// RPCStats contains stats information about RPCs. -type RPCStats interface { - isRPCStats() - // IsClient returns true if this RPCStats is from client side. - IsClient() bool -} - -// Begin contains stats when an RPC begins. -// FailFast are only valid if Client is true. -type Begin struct { - // Client is true if this Begin is from client side. - Client bool - // BeginTime is the time when the RPC begins. - BeginTime time.Time - // FailFast indicates if this RPC is failfast. - FailFast bool -} - -// IsClient indicates if this is from client side. -func (s *Begin) IsClient() bool { return s.Client } - -func (s *Begin) isRPCStats() {} - -// InPayload contains the information for an incoming payload. -type InPayload struct { - // Client is true if this InPayload is from client side. - Client bool - // Payload is the payload with original type. - Payload interface{} - // Data is the serialized message payload. - Data []byte - // Length is the length of uncompressed data. - Length int - // WireLength is the length of data on wire (compressed, signed, encrypted). - WireLength int - // RecvTime is the time when the payload is received. - RecvTime time.Time -} - -// IsClient indicates if this is from client side. -func (s *InPayload) IsClient() bool { return s.Client } - -func (s *InPayload) isRPCStats() {} - -// InHeader contains stats when a header is received. -// FullMethod, addresses and Compression are only valid if Client is false. -type InHeader struct { - // Client is true if this InHeader is from client side. - Client bool - // WireLength is the wire length of header. - WireLength int - - // FullMethod is the full RPC method string, i.e., /package.service/method. - FullMethod string - // RemoteAddr is the remote address of the corresponding connection. - RemoteAddr net.Addr - // LocalAddr is the local address of the corresponding connection. - LocalAddr net.Addr - // Compression is the compression algorithm used for the RPC. - Compression string -} - -// IsClient indicates if this is from client side. -func (s *InHeader) IsClient() bool { return s.Client } - -func (s *InHeader) isRPCStats() {} - -// InTrailer contains stats when a trailer is received. -type InTrailer struct { - // Client is true if this InTrailer is from client side. - Client bool - // WireLength is the wire length of trailer. - WireLength int -} - -// IsClient indicates if this is from client side. -func (s *InTrailer) IsClient() bool { return s.Client } - -func (s *InTrailer) isRPCStats() {} - -// OutPayload contains the information for an outgoing payload. -type OutPayload struct { - // Client is true if this OutPayload is from client side. - Client bool - // Payload is the payload with original type. - Payload interface{} - // Data is the serialized message payload. - Data []byte - // Length is the length of uncompressed data. - Length int - // WireLength is the length of data on wire (compressed, signed, encrypted). - WireLength int - // SentTime is the time when the payload is sent. - SentTime time.Time -} - -// IsClient indicates if this is from client side. -func (s *OutPayload) IsClient() bool { return s.Client } - -func (s *OutPayload) isRPCStats() {} - -// OutHeader contains stats when a header is sent. -// FullMethod, addresses and Compression are only valid if Client is true. -type OutHeader struct { - // Client is true if this OutHeader is from client side. - Client bool - // WireLength is the wire length of header. - WireLength int - - // FullMethod is the full RPC method string, i.e., /package.service/method. - FullMethod string - // RemoteAddr is the remote address of the corresponding connection. - RemoteAddr net.Addr - // LocalAddr is the local address of the corresponding connection. - LocalAddr net.Addr - // Compression is the compression algorithm used for the RPC. - Compression string -} - -// IsClient indicates if this is from client side. -func (s *OutHeader) IsClient() bool { return s.Client } - -func (s *OutHeader) isRPCStats() {} - -// OutTrailer contains stats when a trailer is sent. -type OutTrailer struct { - // Client is true if this OutTrailer is from client side. - Client bool - // WireLength is the wire length of trailer. - WireLength int -} - -// IsClient indicates if this is from client side. -func (s *OutTrailer) IsClient() bool { return s.Client } - -func (s *OutTrailer) isRPCStats() {} - -// End contains stats when an RPC ends. -type End struct { - // Client is true if this End is from client side. - Client bool - // EndTime is the time when the RPC ends. - EndTime time.Time - // Error is the error just happened. Its type is gRPC error. - Error error -} - -// IsClient indicates if this is from client side. -func (s *End) IsClient() bool { return s.Client } - -func (s *End) isRPCStats() {} - -// ConnStats contains stats information about connections. -type ConnStats interface { - isConnStats() - // IsClient returns true if this ConnStats is from client side. - IsClient() bool -} - -// ConnBegin contains the stats of a connection when it is established. -type ConnBegin struct { - // Client is true if this ConnBegin is from client side. - Client bool -} - -// IsClient indicates if this is from client side. -func (s *ConnBegin) IsClient() bool { return s.Client } - -func (s *ConnBegin) isConnStats() {} - -// ConnEnd contains the stats of a connection when it ends. -type ConnEnd struct { - // Client is true if this ConnEnd is from client side. - Client bool -} - -// IsClient indicates if this is from client side. -func (s *ConnEnd) IsClient() bool { return s.Client } - -func (s *ConnEnd) isConnStats() {} diff --git a/vendor/google.golang.org/grpc/stats/stats_test.go b/vendor/google.golang.org/grpc/stats/stats_test.go deleted file mode 100644 index 3e5424b..0000000 --- a/vendor/google.golang.org/grpc/stats/stats_test.go +++ /dev/null @@ -1,981 +0,0 @@ -/* - * - * Copyright 2016, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -package stats_test - -import ( - "fmt" - "io" - "net" - "reflect" - "sync" - "testing" - "time" - - "github.com/golang/protobuf/proto" - "golang.org/x/net/context" - "google.golang.org/grpc" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/stats" - testpb "google.golang.org/grpc/stats/grpc_testing" -) - -func init() { - grpc.EnableTracing = false -} - -type connCtxKey struct{} -type rpcCtxKey struct{} - -var ( - // For headers: - testMetadata = metadata.MD{ - "key1": []string{"value1"}, - "key2": []string{"value2"}, - } - // For trailers: - testTrailerMetadata = metadata.MD{ - "tkey1": []string{"trailerValue1"}, - "tkey2": []string{"trailerValue2"}, - } - // The id for which the service handler should return error. - errorID int32 = 32202 -) - -type testServer struct{} - -func (s *testServer) UnaryCall(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { - md, ok := metadata.FromContext(ctx) - if ok { - if err := grpc.SendHeader(ctx, md); err != nil { - return nil, grpc.Errorf(grpc.Code(err), "grpc.SendHeader(_, %v) = %v, want ", md, err) - } - if err := grpc.SetTrailer(ctx, testTrailerMetadata); err != nil { - return nil, grpc.Errorf(grpc.Code(err), "grpc.SetTrailer(_, %v) = %v, want ", testTrailerMetadata, err) - } - } - - if in.Id == errorID { - return nil, fmt.Errorf("got error id: %v", in.Id) - } - - return &testpb.SimpleResponse{Id: in.Id}, nil -} - -func (s *testServer) FullDuplexCall(stream testpb.TestService_FullDuplexCallServer) error { - md, ok := metadata.FromContext(stream.Context()) - if ok { - if err := stream.SendHeader(md); err != nil { - return grpc.Errorf(grpc.Code(err), "%v.SendHeader(%v) = %v, want %v", stream, md, err, nil) - } - stream.SetTrailer(testTrailerMetadata) - } - for { - in, err := stream.Recv() - if err == io.EOF { - // read done. - return nil - } - if err != nil { - return err - } - - if in.Id == errorID { - return fmt.Errorf("got error id: %v", in.Id) - } - - if err := stream.Send(&testpb.SimpleResponse{Id: in.Id}); err != nil { - return err - } - } -} - -// test is an end-to-end test. It should be created with the newTest -// func, modified as needed, and then started with its startServer method. -// It should be cleaned up with the tearDown method. -type test struct { - t *testing.T - compress string - clientStatsHandler stats.Handler - serverStatsHandler stats.Handler - - testServer testpb.TestServiceServer // nil means none - // srv and srvAddr are set once startServer is called. - srv *grpc.Server - srvAddr string - - cc *grpc.ClientConn // nil until requested via clientConn -} - -func (te *test) tearDown() { - if te.cc != nil { - te.cc.Close() - te.cc = nil - } - te.srv.Stop() -} - -type testConfig struct { - compress string -} - -// newTest returns a new test using the provided testing.T and -// environment. It is returned with default values. Tests should -// modify it before calling its startServer and clientConn methods. -func newTest(t *testing.T, tc *testConfig, ch stats.Handler, sh stats.Handler) *test { - te := &test{ - t: t, - compress: tc.compress, - clientStatsHandler: ch, - serverStatsHandler: sh, - } - return te -} - -// startServer starts a gRPC server listening. Callers should defer a -// call to te.tearDown to clean up. -func (te *test) startServer(ts testpb.TestServiceServer) { - te.testServer = ts - lis, err := net.Listen("tcp", "localhost:0") - if err != nil { - te.t.Fatalf("Failed to listen: %v", err) - } - var opts []grpc.ServerOption - if te.compress == "gzip" { - opts = append(opts, - grpc.RPCCompressor(grpc.NewGZIPCompressor()), - grpc.RPCDecompressor(grpc.NewGZIPDecompressor()), - ) - } - if te.serverStatsHandler != nil { - opts = append(opts, grpc.StatsHandler(te.serverStatsHandler)) - } - s := grpc.NewServer(opts...) - te.srv = s - if te.testServer != nil { - testpb.RegisterTestServiceServer(s, te.testServer) - } - _, port, err := net.SplitHostPort(lis.Addr().String()) - if err != nil { - te.t.Fatalf("Failed to parse listener address: %v", err) - } - addr := "127.0.0.1:" + port - - go s.Serve(lis) - te.srvAddr = addr -} - -func (te *test) clientConn() *grpc.ClientConn { - if te.cc != nil { - return te.cc - } - opts := []grpc.DialOption{grpc.WithInsecure(), grpc.WithBlock()} - if te.compress == "gzip" { - opts = append(opts, - grpc.WithCompressor(grpc.NewGZIPCompressor()), - grpc.WithDecompressor(grpc.NewGZIPDecompressor()), - ) - } - if te.clientStatsHandler != nil { - opts = append(opts, grpc.WithStatsHandler(te.clientStatsHandler)) - } - - var err error - te.cc, err = grpc.Dial(te.srvAddr, opts...) - if err != nil { - te.t.Fatalf("Dial(%q) = %v", te.srvAddr, err) - } - return te.cc -} - -type rpcConfig struct { - count int // Number of requests and responses for streaming RPCs. - success bool // Whether the RPC should succeed or return error. - failfast bool - streaming bool // Whether the rpc should be a streaming RPC. -} - -func (te *test) doUnaryCall(c *rpcConfig) (*testpb.SimpleRequest, *testpb.SimpleResponse, error) { - var ( - resp *testpb.SimpleResponse - req *testpb.SimpleRequest - err error - ) - tc := testpb.NewTestServiceClient(te.clientConn()) - if c.success { - req = &testpb.SimpleRequest{Id: errorID + 1} - } else { - req = &testpb.SimpleRequest{Id: errorID} - } - ctx := metadata.NewContext(context.Background(), testMetadata) - - resp, err = tc.UnaryCall(ctx, req, grpc.FailFast(c.failfast)) - return req, resp, err -} - -func (te *test) doFullDuplexCallRoundtrip(c *rpcConfig) ([]*testpb.SimpleRequest, []*testpb.SimpleResponse, error) { - var ( - reqs []*testpb.SimpleRequest - resps []*testpb.SimpleResponse - err error - ) - tc := testpb.NewTestServiceClient(te.clientConn()) - stream, err := tc.FullDuplexCall(metadata.NewContext(context.Background(), testMetadata), grpc.FailFast(c.failfast)) - if err != nil { - return reqs, resps, err - } - var startID int32 - if !c.success { - startID = errorID - } - for i := 0; i < c.count; i++ { - req := &testpb.SimpleRequest{ - Id: int32(i) + startID, - } - reqs = append(reqs, req) - if err = stream.Send(req); err != nil { - return reqs, resps, err - } - var resp *testpb.SimpleResponse - if resp, err = stream.Recv(); err != nil { - return reqs, resps, err - } - resps = append(resps, resp) - } - if err = stream.CloseSend(); err != nil && err != io.EOF { - return reqs, resps, err - } - if _, err = stream.Recv(); err != io.EOF { - return reqs, resps, err - } - - return reqs, resps, nil -} - -type expectedData struct { - method string - serverAddr string - compression string - reqIdx int - requests []*testpb.SimpleRequest - respIdx int - responses []*testpb.SimpleResponse - err error - failfast bool -} - -type gotData struct { - ctx context.Context - client bool - s interface{} // This could be RPCStats or ConnStats. -} - -const ( - begin int = iota - end - inPayload - inHeader - inTrailer - outPayload - outHeader - outTrailer - connbegin - connend -) - -func checkBegin(t *testing.T, d *gotData, e *expectedData) { - var ( - ok bool - st *stats.Begin - ) - if st, ok = d.s.(*stats.Begin); !ok { - t.Fatalf("got %T, want Begin", d.s) - } - if d.ctx == nil { - t.Fatalf("d.ctx = nil, want ") - } - if st.BeginTime.IsZero() { - t.Fatalf("st.BeginTime = %v, want ", st.BeginTime) - } - if d.client { - if st.FailFast != e.failfast { - t.Fatalf("st.FailFast = %v, want %v", st.FailFast, e.failfast) - } - } -} - -func checkInHeader(t *testing.T, d *gotData, e *expectedData) { - var ( - ok bool - st *stats.InHeader - ) - if st, ok = d.s.(*stats.InHeader); !ok { - t.Fatalf("got %T, want InHeader", d.s) - } - if d.ctx == nil { - t.Fatalf("d.ctx = nil, want ") - } - // TODO check real length, not just > 0. - if st.WireLength <= 0 { - t.Fatalf("st.Lenght = 0, want > 0") - } - if !d.client { - if st.FullMethod != e.method { - t.Fatalf("st.FullMethod = %s, want %v", st.FullMethod, e.method) - } - if st.LocalAddr.String() != e.serverAddr { - t.Fatalf("st.LocalAddr = %v, want %v", st.LocalAddr, e.serverAddr) - } - if st.Compression != e.compression { - t.Fatalf("st.Compression = %v, want %v", st.Compression, e.compression) - } - - if connInfo, ok := d.ctx.Value(connCtxKey{}).(*stats.ConnTagInfo); ok { - if connInfo.RemoteAddr != st.RemoteAddr { - t.Fatalf("connInfo.RemoteAddr = %v, want %v", connInfo.RemoteAddr, st.RemoteAddr) - } - if connInfo.LocalAddr != st.LocalAddr { - t.Fatalf("connInfo.LocalAddr = %v, want %v", connInfo.LocalAddr, st.LocalAddr) - } - } else { - t.Fatalf("got context %v, want one with connCtxKey", d.ctx) - } - if rpcInfo, ok := d.ctx.Value(rpcCtxKey{}).(*stats.RPCTagInfo); ok { - if rpcInfo.FullMethodName != st.FullMethod { - t.Fatalf("rpcInfo.FullMethod = %s, want %v", rpcInfo.FullMethodName, st.FullMethod) - } - } else { - t.Fatalf("got context %v, want one with rpcCtxKey", d.ctx) - } - } -} - -func checkInPayload(t *testing.T, d *gotData, e *expectedData) { - var ( - ok bool - st *stats.InPayload - ) - if st, ok = d.s.(*stats.InPayload); !ok { - t.Fatalf("got %T, want InPayload", d.s) - } - if d.ctx == nil { - t.Fatalf("d.ctx = nil, want ") - } - if d.client { - b, err := proto.Marshal(e.responses[e.respIdx]) - if err != nil { - t.Fatalf("failed to marshal message: %v", err) - } - if reflect.TypeOf(st.Payload) != reflect.TypeOf(e.responses[e.respIdx]) { - t.Fatalf("st.Payload = %T, want %T", st.Payload, e.responses[e.respIdx]) - } - e.respIdx++ - if string(st.Data) != string(b) { - t.Fatalf("st.Data = %v, want %v", st.Data, b) - } - if st.Length != len(b) { - t.Fatalf("st.Lenght = %v, want %v", st.Length, len(b)) - } - } else { - b, err := proto.Marshal(e.requests[e.reqIdx]) - if err != nil { - t.Fatalf("failed to marshal message: %v", err) - } - if reflect.TypeOf(st.Payload) != reflect.TypeOf(e.requests[e.reqIdx]) { - t.Fatalf("st.Payload = %T, want %T", st.Payload, e.requests[e.reqIdx]) - } - e.reqIdx++ - if string(st.Data) != string(b) { - t.Fatalf("st.Data = %v, want %v", st.Data, b) - } - if st.Length != len(b) { - t.Fatalf("st.Lenght = %v, want %v", st.Length, len(b)) - } - } - // TODO check WireLength and ReceivedTime. - if st.RecvTime.IsZero() { - t.Fatalf("st.ReceivedTime = %v, want ", st.RecvTime) - } -} - -func checkInTrailer(t *testing.T, d *gotData, e *expectedData) { - var ( - ok bool - st *stats.InTrailer - ) - if st, ok = d.s.(*stats.InTrailer); !ok { - t.Fatalf("got %T, want InTrailer", d.s) - } - if d.ctx == nil { - t.Fatalf("d.ctx = nil, want ") - } - // TODO check real length, not just > 0. - if st.WireLength <= 0 { - t.Fatalf("st.Lenght = 0, want > 0") - } -} - -func checkOutHeader(t *testing.T, d *gotData, e *expectedData) { - var ( - ok bool - st *stats.OutHeader - ) - if st, ok = d.s.(*stats.OutHeader); !ok { - t.Fatalf("got %T, want OutHeader", d.s) - } - if d.ctx == nil { - t.Fatalf("d.ctx = nil, want ") - } - // TODO check real length, not just > 0. - if st.WireLength <= 0 { - t.Fatalf("st.Lenght = 0, want > 0") - } - if d.client { - if st.FullMethod != e.method { - t.Fatalf("st.FullMethod = %s, want %v", st.FullMethod, e.method) - } - if st.RemoteAddr.String() != e.serverAddr { - t.Fatalf("st.RemoteAddr = %v, want %v", st.RemoteAddr, e.serverAddr) - } - if st.Compression != e.compression { - t.Fatalf("st.Compression = %v, want %v", st.Compression, e.compression) - } - - if rpcInfo, ok := d.ctx.Value(rpcCtxKey{}).(*stats.RPCTagInfo); ok { - if rpcInfo.FullMethodName != st.FullMethod { - t.Fatalf("rpcInfo.FullMethod = %s, want %v", rpcInfo.FullMethodName, st.FullMethod) - } - } else { - t.Fatalf("got context %v, want one with rpcCtxKey", d.ctx) - } - } -} - -func checkOutPayload(t *testing.T, d *gotData, e *expectedData) { - var ( - ok bool - st *stats.OutPayload - ) - if st, ok = d.s.(*stats.OutPayload); !ok { - t.Fatalf("got %T, want OutPayload", d.s) - } - if d.ctx == nil { - t.Fatalf("d.ctx = nil, want ") - } - if d.client { - b, err := proto.Marshal(e.requests[e.reqIdx]) - if err != nil { - t.Fatalf("failed to marshal message: %v", err) - } - if reflect.TypeOf(st.Payload) != reflect.TypeOf(e.requests[e.reqIdx]) { - t.Fatalf("st.Payload = %T, want %T", st.Payload, e.requests[e.reqIdx]) - } - e.reqIdx++ - if string(st.Data) != string(b) { - t.Fatalf("st.Data = %v, want %v", st.Data, b) - } - if st.Length != len(b) { - t.Fatalf("st.Lenght = %v, want %v", st.Length, len(b)) - } - } else { - b, err := proto.Marshal(e.responses[e.respIdx]) - if err != nil { - t.Fatalf("failed to marshal message: %v", err) - } - if reflect.TypeOf(st.Payload) != reflect.TypeOf(e.responses[e.respIdx]) { - t.Fatalf("st.Payload = %T, want %T", st.Payload, e.responses[e.respIdx]) - } - e.respIdx++ - if string(st.Data) != string(b) { - t.Fatalf("st.Data = %v, want %v", st.Data, b) - } - if st.Length != len(b) { - t.Fatalf("st.Lenght = %v, want %v", st.Length, len(b)) - } - } - // TODO check WireLength and ReceivedTime. - if st.SentTime.IsZero() { - t.Fatalf("st.SentTime = %v, want ", st.SentTime) - } -} - -func checkOutTrailer(t *testing.T, d *gotData, e *expectedData) { - var ( - ok bool - st *stats.OutTrailer - ) - if st, ok = d.s.(*stats.OutTrailer); !ok { - t.Fatalf("got %T, want OutTrailer", d.s) - } - if d.ctx == nil { - t.Fatalf("d.ctx = nil, want ") - } - if st.Client { - t.Fatalf("st IsClient = true, want false") - } - // TODO check real length, not just > 0. - if st.WireLength <= 0 { - t.Fatalf("st.Lenght = 0, want > 0") - } -} - -func checkEnd(t *testing.T, d *gotData, e *expectedData) { - var ( - ok bool - st *stats.End - ) - if st, ok = d.s.(*stats.End); !ok { - t.Fatalf("got %T, want End", d.s) - } - if d.ctx == nil { - t.Fatalf("d.ctx = nil, want ") - } - if st.EndTime.IsZero() { - t.Fatalf("st.EndTime = %v, want ", st.EndTime) - } - if grpc.Code(st.Error) != grpc.Code(e.err) || grpc.ErrorDesc(st.Error) != grpc.ErrorDesc(e.err) { - t.Fatalf("st.Error = %v, want %v", st.Error, e.err) - } -} - -func checkConnBegin(t *testing.T, d *gotData, e *expectedData) { - var ( - ok bool - st *stats.ConnBegin - ) - if st, ok = d.s.(*stats.ConnBegin); !ok { - t.Fatalf("got %T, want ConnBegin", d.s) - } - if d.ctx == nil { - t.Fatalf("d.ctx = nil, want ") - } - st.IsClient() // TODO remove this. -} - -func checkConnEnd(t *testing.T, d *gotData, e *expectedData) { - var ( - ok bool - st *stats.ConnEnd - ) - if st, ok = d.s.(*stats.ConnEnd); !ok { - t.Fatalf("got %T, want ConnEnd", d.s) - } - if d.ctx == nil { - t.Fatalf("d.ctx = nil, want ") - } - st.IsClient() // TODO remove this. -} - -type statshandler struct { - mu sync.Mutex - gotRPC []*gotData - gotConn []*gotData -} - -func (h *statshandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context { - return context.WithValue(ctx, connCtxKey{}, info) -} - -func (h *statshandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context { - return context.WithValue(ctx, rpcCtxKey{}, info) -} - -func (h *statshandler) HandleConn(ctx context.Context, s stats.ConnStats) { - h.mu.Lock() - defer h.mu.Unlock() - h.gotConn = append(h.gotConn, &gotData{ctx, s.IsClient(), s}) -} - -func (h *statshandler) HandleRPC(ctx context.Context, s stats.RPCStats) { - h.mu.Lock() - defer h.mu.Unlock() - h.gotRPC = append(h.gotRPC, &gotData{ctx, s.IsClient(), s}) -} - -func checkConnStats(t *testing.T, got []*gotData) { - if len(got) <= 0 || len(got)%2 != 0 { - for i, g := range got { - t.Errorf(" - %v, %T = %+v, ctx: %v", i, g.s, g.s, g.ctx) - } - t.Fatalf("got %v stats, want even positive number", len(got)) - } - // The first conn stats must be a ConnBegin. - checkConnBegin(t, got[0], nil) - // The last conn stats must be a ConnEnd. - checkConnEnd(t, got[len(got)-1], nil) -} - -func checkServerStats(t *testing.T, got []*gotData, expect *expectedData, checkFuncs []func(t *testing.T, d *gotData, e *expectedData)) { - if len(got) != len(checkFuncs) { - for i, g := range got { - t.Errorf(" - %v, %T", i, g.s) - } - t.Fatalf("got %v stats, want %v stats", len(got), len(checkFuncs)) - } - - var rpcctx context.Context - for i := 0; i < len(got); i++ { - if _, ok := got[i].s.(stats.RPCStats); ok { - if rpcctx != nil && got[i].ctx != rpcctx { - t.Fatalf("got different contexts with stats %T", got[i].s) - } - rpcctx = got[i].ctx - } - } - - for i, f := range checkFuncs { - f(t, got[i], expect) - } -} - -func testServerStats(t *testing.T, tc *testConfig, cc *rpcConfig, checkFuncs []func(t *testing.T, d *gotData, e *expectedData)) { - h := &statshandler{} - te := newTest(t, tc, nil, h) - te.startServer(&testServer{}) - defer te.tearDown() - - var ( - reqs []*testpb.SimpleRequest - resps []*testpb.SimpleResponse - err error - ) - if !cc.streaming { - req, resp, e := te.doUnaryCall(cc) - reqs = []*testpb.SimpleRequest{req} - resps = []*testpb.SimpleResponse{resp} - err = e - } else { - reqs, resps, err = te.doFullDuplexCallRoundtrip(cc) - } - if cc.success != (err == nil) { - t.Fatalf("cc.success: %v, got error: %v", cc.success, err) - } - te.cc.Close() - te.srv.GracefulStop() // Wait for the server to stop. - - for { - h.mu.Lock() - if len(h.gotRPC) >= len(checkFuncs) { - h.mu.Unlock() - break - } - h.mu.Unlock() - time.Sleep(10 * time.Millisecond) - } - - for { - h.mu.Lock() - if _, ok := h.gotConn[len(h.gotConn)-1].s.(*stats.ConnEnd); ok { - h.mu.Unlock() - break - } - h.mu.Unlock() - time.Sleep(10 * time.Millisecond) - } - - expect := &expectedData{ - serverAddr: te.srvAddr, - compression: tc.compress, - requests: reqs, - responses: resps, - err: err, - } - if !cc.streaming { - expect.method = "/grpc.testing.TestService/UnaryCall" - } else { - expect.method = "/grpc.testing.TestService/FullDuplexCall" - } - - checkConnStats(t, h.gotConn) - checkServerStats(t, h.gotRPC, expect, checkFuncs) -} - -func TestServerStatsUnaryRPC(t *testing.T) { - testServerStats(t, &testConfig{compress: ""}, &rpcConfig{success: true}, []func(t *testing.T, d *gotData, e *expectedData){ - checkInHeader, - checkBegin, - checkInPayload, - checkOutHeader, - checkOutPayload, - checkOutTrailer, - checkEnd, - }) -} - -func TestServerStatsUnaryRPCError(t *testing.T) { - testServerStats(t, &testConfig{compress: ""}, &rpcConfig{success: false}, []func(t *testing.T, d *gotData, e *expectedData){ - checkInHeader, - checkBegin, - checkInPayload, - checkOutHeader, - checkOutTrailer, - checkEnd, - }) -} - -func TestServerStatsStreamingRPC(t *testing.T) { - count := 5 - checkFuncs := []func(t *testing.T, d *gotData, e *expectedData){ - checkInHeader, - checkBegin, - checkOutHeader, - } - ioPayFuncs := []func(t *testing.T, d *gotData, e *expectedData){ - checkInPayload, - checkOutPayload, - } - for i := 0; i < count; i++ { - checkFuncs = append(checkFuncs, ioPayFuncs...) - } - checkFuncs = append(checkFuncs, - checkOutTrailer, - checkEnd, - ) - testServerStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: true, streaming: true}, checkFuncs) -} - -func TestServerStatsStreamingRPCError(t *testing.T) { - count := 5 - testServerStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: false, streaming: true}, []func(t *testing.T, d *gotData, e *expectedData){ - checkInHeader, - checkBegin, - checkOutHeader, - checkInPayload, - checkOutTrailer, - checkEnd, - }) -} - -type checkFuncWithCount struct { - f func(t *testing.T, d *gotData, e *expectedData) - c int // expected count -} - -func checkClientStats(t *testing.T, got []*gotData, expect *expectedData, checkFuncs map[int]*checkFuncWithCount) { - var expectLen int - for _, v := range checkFuncs { - expectLen += v.c - } - if len(got) != expectLen { - for i, g := range got { - t.Errorf(" - %v, %T", i, g.s) - } - t.Fatalf("got %v stats, want %v stats", len(got), expectLen) - } - - var rpcctx context.Context - for i := 0; i < len(got); i++ { - if _, ok := got[i].s.(stats.RPCStats); ok { - if rpcctx != nil && got[i].ctx != rpcctx { - t.Fatalf("got different contexts with stats %T", got[i].s) - } - rpcctx = got[i].ctx - } - } - - for _, s := range got { - switch s.s.(type) { - case *stats.Begin: - if checkFuncs[begin].c <= 0 { - t.Fatalf("unexpected stats: %T", s.s) - } - checkFuncs[begin].f(t, s, expect) - checkFuncs[begin].c-- - case *stats.OutHeader: - if checkFuncs[outHeader].c <= 0 { - t.Fatalf("unexpected stats: %T", s.s) - } - checkFuncs[outHeader].f(t, s, expect) - checkFuncs[outHeader].c-- - case *stats.OutPayload: - if checkFuncs[outPayload].c <= 0 { - t.Fatalf("unexpected stats: %T", s.s) - } - checkFuncs[outPayload].f(t, s, expect) - checkFuncs[outPayload].c-- - case *stats.InHeader: - if checkFuncs[inHeader].c <= 0 { - t.Fatalf("unexpected stats: %T", s.s) - } - checkFuncs[inHeader].f(t, s, expect) - checkFuncs[inHeader].c-- - case *stats.InPayload: - if checkFuncs[inPayload].c <= 0 { - t.Fatalf("unexpected stats: %T", s.s) - } - checkFuncs[inPayload].f(t, s, expect) - checkFuncs[inPayload].c-- - case *stats.InTrailer: - if checkFuncs[inTrailer].c <= 0 { - t.Fatalf("unexpected stats: %T", s.s) - } - checkFuncs[inTrailer].f(t, s, expect) - checkFuncs[inTrailer].c-- - case *stats.End: - if checkFuncs[end].c <= 0 { - t.Fatalf("unexpected stats: %T", s.s) - } - checkFuncs[end].f(t, s, expect) - checkFuncs[end].c-- - case *stats.ConnBegin: - if checkFuncs[connbegin].c <= 0 { - t.Fatalf("unexpected stats: %T", s.s) - } - checkFuncs[connbegin].f(t, s, expect) - checkFuncs[connbegin].c-- - case *stats.ConnEnd: - if checkFuncs[connend].c <= 0 { - t.Fatalf("unexpected stats: %T", s.s) - } - checkFuncs[connend].f(t, s, expect) - checkFuncs[connend].c-- - default: - t.Fatalf("unexpected stats: %T", s.s) - } - } -} - -func testClientStats(t *testing.T, tc *testConfig, cc *rpcConfig, checkFuncs map[int]*checkFuncWithCount) { - h := &statshandler{} - te := newTest(t, tc, h, nil) - te.startServer(&testServer{}) - defer te.tearDown() - - var ( - reqs []*testpb.SimpleRequest - resps []*testpb.SimpleResponse - err error - ) - if !cc.streaming { - req, resp, e := te.doUnaryCall(cc) - reqs = []*testpb.SimpleRequest{req} - resps = []*testpb.SimpleResponse{resp} - err = e - } else { - reqs, resps, err = te.doFullDuplexCallRoundtrip(cc) - } - if cc.success != (err == nil) { - t.Fatalf("cc.success: %v, got error: %v", cc.success, err) - } - te.cc.Close() - te.srv.GracefulStop() // Wait for the server to stop. - - lenRPCStats := 0 - for _, v := range checkFuncs { - lenRPCStats += v.c - } - for { - h.mu.Lock() - if len(h.gotRPC) >= lenRPCStats { - h.mu.Unlock() - break - } - h.mu.Unlock() - time.Sleep(10 * time.Millisecond) - } - - for { - h.mu.Lock() - if _, ok := h.gotConn[len(h.gotConn)-1].s.(*stats.ConnEnd); ok { - h.mu.Unlock() - break - } - h.mu.Unlock() - time.Sleep(10 * time.Millisecond) - } - - expect := &expectedData{ - serverAddr: te.srvAddr, - compression: tc.compress, - requests: reqs, - responses: resps, - failfast: cc.failfast, - err: err, - } - if !cc.streaming { - expect.method = "/grpc.testing.TestService/UnaryCall" - } else { - expect.method = "/grpc.testing.TestService/FullDuplexCall" - } - - checkConnStats(t, h.gotConn) - checkClientStats(t, h.gotRPC, expect, checkFuncs) -} - -func TestClientStatsUnaryRPC(t *testing.T) { - testClientStats(t, &testConfig{compress: ""}, &rpcConfig{success: true, failfast: false}, map[int]*checkFuncWithCount{ - begin: {checkBegin, 1}, - outHeader: {checkOutHeader, 1}, - outPayload: {checkOutPayload, 1}, - inHeader: {checkInHeader, 1}, - inPayload: {checkInPayload, 1}, - inTrailer: {checkInTrailer, 1}, - end: {checkEnd, 1}, - }) -} - -func TestClientStatsUnaryRPCError(t *testing.T) { - testClientStats(t, &testConfig{compress: ""}, &rpcConfig{success: false, failfast: false}, map[int]*checkFuncWithCount{ - begin: {checkBegin, 1}, - outHeader: {checkOutHeader, 1}, - outPayload: {checkOutPayload, 1}, - inHeader: {checkInHeader, 1}, - inTrailer: {checkInTrailer, 1}, - end: {checkEnd, 1}, - }) -} - -func TestClientStatsStreamingRPC(t *testing.T) { - count := 5 - testClientStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: true, failfast: false, streaming: true}, map[int]*checkFuncWithCount{ - begin: {checkBegin, 1}, - outHeader: {checkOutHeader, 1}, - outPayload: {checkOutPayload, count}, - inHeader: {checkInHeader, 1}, - inPayload: {checkInPayload, count}, - inTrailer: {checkInTrailer, 1}, - end: {checkEnd, 1}, - }) -} - -func TestClientStatsStreamingRPCError(t *testing.T) { - count := 5 - testClientStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: false, failfast: false, streaming: true}, map[int]*checkFuncWithCount{ - begin: {checkBegin, 1}, - outHeader: {checkOutHeader, 1}, - outPayload: {checkOutPayload, 1}, - inHeader: {checkInHeader, 1}, - inTrailer: {checkInTrailer, 1}, - end: {checkEnd, 1}, - }) -} diff --git a/vendor/google.golang.org/grpc/stream.go b/vendor/google.golang.org/grpc/stream.go index 0ef2077..4681054 100644 --- a/vendor/google.golang.org/grpc/stream.go +++ b/vendor/google.golang.org/grpc/stream.go @@ -37,6 +37,7 @@ import ( "bytes" "errors" "io" + "math" "sync" "time" @@ -44,7 +45,6 @@ import ( "golang.org/x/net/trace" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" - "google.golang.org/grpc/stats" "google.golang.org/grpc/transport" ) @@ -97,7 +97,7 @@ type ClientStream interface { // NewClientStream creates a new Stream for the client side. This is called // by generated code. -func NewClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (_ ClientStream, err error) { +func NewClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (ClientStream, error) { if cc.dopts.streamInt != nil { return cc.dopts.streamInt(ctx, desc, cc, method, newClientStream, opts...) } @@ -106,18 +106,11 @@ func NewClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (_ ClientStream, err error) { var ( - t transport.ClientTransport - s *transport.Stream - put func() - cancel context.CancelFunc + t transport.ClientTransport + s *transport.Stream + put func() ) c := defaultCallInfo - if mc, ok := cc.getMethodConfig(method); ok { - c.failFast = !mc.WaitForReady - if mc.Timeout > 0 { - ctx, cancel = context.WithTimeout(ctx, mc.Timeout) - } - } for _, o := range opts { if err := o.before(&c); err != nil { return nil, toRPCErr(err) @@ -150,26 +143,6 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth } }() } - sh := cc.dopts.copts.StatsHandler - if sh != nil { - ctx = sh.TagRPC(ctx, &stats.RPCTagInfo{FullMethodName: method}) - begin := &stats.Begin{ - Client: true, - BeginTime: time.Now(), - FailFast: c.failFast, - } - sh.HandleRPC(ctx, begin) - } - defer func() { - if err != nil && sh != nil { - // Only handle end stats if err != nil. - end := &stats.End{ - Client: true, - Error: err, - } - sh.HandleRPC(ctx, end) - } - }() gopts := BalancerGetOptions{ BlockingWait: !c.failFast, } @@ -207,14 +180,12 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth break } cs := &clientStream{ - opts: opts, - c: c, - desc: desc, - codec: cc.dopts.codec, - cp: cc.dopts.cp, - dc: cc.dopts.dc, - maxMsgSize: cc.dopts.maxMsgSize, - cancel: cancel, + opts: opts, + c: c, + desc: desc, + codec: cc.dopts.codec, + cp: cc.dopts.cp, + dc: cc.dopts.dc, put: put, t: t, @@ -223,9 +194,6 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth tracing: EnableTracing, trInfo: trInfo, - - statsCtx: ctx, - statsHandler: cc.dopts.copts.StatsHandler, } if cc.dopts.cp != nil { cs.cbuf = new(bytes.Buffer) @@ -259,18 +227,16 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth // clientStream implements a client side Stream. type clientStream struct { - opts []CallOption - c callInfo - t transport.ClientTransport - s *transport.Stream - p *parser - desc *StreamDesc - codec Codec - cp Compressor - cbuf *bytes.Buffer - dc Decompressor - maxMsgSize int - cancel context.CancelFunc + opts []CallOption + c callInfo + t transport.ClientTransport + s *transport.Stream + p *parser + desc *StreamDesc + codec Codec + cp Compressor + cbuf *bytes.Buffer + dc Decompressor tracing bool // set to EnableTracing when the clientStream is created. @@ -280,12 +246,6 @@ type clientStream struct { // trInfo.tr is set when the clientStream is created (if EnableTracing is true), // and is set to nil when the clientStream's finish method is called. trInfo traceInfo - - // statsCtx keeps the user context for stats handling. - // All stats collection should use the statsCtx (instead of the stream context) - // so that all the generated stats for a particular RPC can be associated in the processing phase. - statsCtx context.Context - statsHandler stats.Handler } func (cs *clientStream) Context() context.Context { @@ -314,8 +274,6 @@ func (cs *clientStream) SendMsg(m interface{}) (err error) { } cs.mu.Unlock() } - // TODO Investigate how to signal the stats handling party. - // generate error stats if err != nil && err != io.EOF? defer func() { if err != nil { cs.finish(err) @@ -338,13 +296,7 @@ func (cs *clientStream) SendMsg(m interface{}) (err error) { } err = toRPCErr(err) }() - var outPayload *stats.OutPayload - if cs.statsHandler != nil { - outPayload = &stats.OutPayload{ - Client: true, - } - } - out, err := encode(cs.codec, m, cs.cp, cs.cbuf, outPayload) + out, err := encode(cs.codec, m, cs.cp, cs.cbuf) defer func() { if cs.cbuf != nil { cs.cbuf.Reset() @@ -353,37 +305,11 @@ func (cs *clientStream) SendMsg(m interface{}) (err error) { if err != nil { return Errorf(codes.Internal, "grpc: %v", err) } - err = cs.t.Write(cs.s, out, &transport.Options{Last: false}) - if err == nil && outPayload != nil { - outPayload.SentTime = time.Now() - cs.statsHandler.HandleRPC(cs.statsCtx, outPayload) - } - return err + return cs.t.Write(cs.s, out, &transport.Options{Last: false}) } func (cs *clientStream) RecvMsg(m interface{}) (err error) { - defer func() { - if err != nil && cs.statsHandler != nil { - // Only generate End if err != nil. - // If err == nil, it's not the last RecvMsg. - // The last RecvMsg gets either an RPC error or io.EOF. - end := &stats.End{ - Client: true, - EndTime: time.Now(), - } - if err != io.EOF { - end.Error = toRPCErr(err) - } - cs.statsHandler.HandleRPC(cs.statsCtx, end) - } - }() - var inPayload *stats.InPayload - if cs.statsHandler != nil { - inPayload = &stats.InPayload{ - Client: true, - } - } - err = recv(cs.p, cs.codec, cs.s, cs.dc, m, cs.maxMsgSize, inPayload) + err = recv(cs.p, cs.codec, cs.s, cs.dc, m, math.MaxInt32) defer func() { // err != nil indicates the termination of the stream. if err != nil { @@ -398,15 +324,11 @@ func (cs *clientStream) RecvMsg(m interface{}) (err error) { } cs.mu.Unlock() } - if inPayload != nil { - cs.statsHandler.HandleRPC(cs.statsCtx, inPayload) - } if !cs.desc.ClientStreams || cs.desc.ServerStreams { return } // Special handling for client streaming rpc. - // This recv expects EOF or errors, so we don't collect inPayload. - err = recv(cs.p, cs.codec, cs.s, cs.dc, m, cs.maxMsgSize, nil) + err = recv(cs.p, cs.codec, cs.s, cs.dc, m, math.MaxInt32) cs.closeTransportStream(err) if err == nil { return toRPCErr(errors.New("grpc: client streaming protocol violation: get , want ")) @@ -462,11 +384,6 @@ func (cs *clientStream) closeTransportStream(err error) { } func (cs *clientStream) finish(err error) { - defer func() { - if cs.cancel != nil { - cs.cancel() - } - }() cs.mu.Lock() defer cs.mu.Unlock() for _, o := range cs.opts { @@ -524,8 +441,6 @@ type serverStream struct { statusDesc string trInfo *traceInfo - statsHandler stats.Handler - mu sync.Mutex // protects trInfo.tr after the service handler runs. } @@ -567,11 +482,7 @@ func (ss *serverStream) SendMsg(m interface{}) (err error) { ss.mu.Unlock() } }() - var outPayload *stats.OutPayload - if ss.statsHandler != nil { - outPayload = &stats.OutPayload{} - } - out, err := encode(ss.codec, m, ss.cp, ss.cbuf, outPayload) + out, err := encode(ss.codec, m, ss.cp, ss.cbuf) defer func() { if ss.cbuf != nil { ss.cbuf.Reset() @@ -584,10 +495,6 @@ func (ss *serverStream) SendMsg(m interface{}) (err error) { if err := ss.t.Write(ss.s, out, &transport.Options{Last: false}); err != nil { return toRPCErr(err) } - if outPayload != nil { - outPayload.SentTime = time.Now() - ss.statsHandler.HandleRPC(ss.s.Context(), outPayload) - } return nil } @@ -606,11 +513,7 @@ func (ss *serverStream) RecvMsg(m interface{}) (err error) { ss.mu.Unlock() } }() - var inPayload *stats.InPayload - if ss.statsHandler != nil { - inPayload = &stats.InPayload{} - } - if err := recv(ss.p, ss.codec, ss.s, ss.dc, m, ss.maxMsgSize, inPayload); err != nil { + if err := recv(ss.p, ss.codec, ss.s, ss.dc, m, ss.maxMsgSize); err != nil { if err == io.EOF { return err } @@ -619,8 +522,5 @@ func (ss *serverStream) RecvMsg(m interface{}) (err error) { } return toRPCErr(err) } - if inPayload != nil { - ss.statsHandler.HandleRPC(ss.s.Context(), inPayload) - } return nil } diff --git a/vendor/google.golang.org/grpc/stress/client/main.go b/vendor/google.golang.org/grpc/stress/client/main.go index dff85ff..89df93d 100644 --- a/vendor/google.golang.org/grpc/stress/client/main.go +++ b/vendor/google.golang.org/grpc/stress/client/main.go @@ -47,7 +47,6 @@ import ( "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" - "google.golang.org/grpc/credentials" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/interop" testpb "google.golang.org/grpc/interop/grpc_testing" @@ -61,12 +60,6 @@ var ( numChannelsPerServer = flag.Int("num_channels_per_server", 1, "Number of channels (i.e connections) to each server") numStubsPerChannel = flag.Int("num_stubs_per_channel", 1, "Number of client stubs per each connection to server") metricsPort = flag.Int("metrics_port", 8081, "The port at which the stress client exposes QPS metrics") - useTLS = flag.Bool("use_tls", false, "Connection uses TLS if true, else plain TCP") - testCA = flag.Bool("use_test_ca", false, "Whether to replace platform root CAs with test CA as the CA root") - tlsServerName = flag.String("server_host_override", "foo.test.google.fr", "The server name use to verify the hostname returned by TLS handshake if it is not empty. Otherwise, --server_host is used.") - - // The test CA root cert file - testCAFile = "testdata/ca.pem" ) // testCaseWithWeight contains the test case type and its weight. @@ -91,13 +84,7 @@ func parseTestCases(testCaseString string) []testCaseWithWeight { "large_unary", "client_streaming", "server_streaming", - "ping_pong", - "empty_stream", - "timeout_on_sleeping_server", - "cancel_after_begin", - "cancel_after_first_response", - "status_code_and_message", - "custom_metadata": + "empty_stream": default: panic(fmt.Sprintf("unknown test type: %s", testCase[0])) } @@ -225,38 +212,29 @@ func performRPCs(gauge *gauge, conn *grpc.ClientConn, selector *weightedRandomTe var numCalls int64 startTime := time.Now() for { - test := selector.getNextTest() - switch test { - case "empty_unary": - interop.DoEmptyUnaryCall(client, grpc.FailFast(false)) - case "large_unary": - interop.DoLargeUnaryCall(client, grpc.FailFast(false)) - case "client_streaming": - interop.DoClientStreaming(client, grpc.FailFast(false)) - case "server_streaming": - interop.DoServerStreaming(client, grpc.FailFast(false)) - case "ping_pong": - interop.DoPingPong(client, grpc.FailFast(false)) - case "empty_stream": - interop.DoEmptyStream(client, grpc.FailFast(false)) - case "timeout_on_sleeping_server": - interop.DoTimeoutOnSleepingServer(client, grpc.FailFast(false)) - case "cancel_after_begin": - interop.DoCancelAfterBegin(client, grpc.FailFast(false)) - case "cancel_after_first_response": - interop.DoCancelAfterFirstResponse(client, grpc.FailFast(false)) - case "status_code_and_message": - interop.DoStatusCodeAndMessage(client, grpc.FailFast(false)) - case "custom_metadata": - interop.DoCustomMetadata(client, grpc.FailFast(false)) - } - numCalls++ - gauge.set(int64(float64(numCalls) / time.Since(startTime).Seconds())) - + done := make(chan bool, 1) + go func() { + test := selector.getNextTest() + switch test { + case "empty_unary": + interop.DoEmptyUnaryCall(client) + case "large_unary": + interop.DoLargeUnaryCall(client) + case "client_streaming": + interop.DoClientStreaming(client) + case "server_streaming": + interop.DoServerStreaming(client) + case "empty_stream": + interop.DoEmptyStream(client) + } + done <- true + }() select { case <-stop: return - default: + case <-done: + numCalls++ + gauge.set(int64(float64(numCalls) / time.Since(startTime).Seconds())) } } } @@ -264,13 +242,10 @@ func performRPCs(gauge *gauge, conn *grpc.ClientConn, selector *weightedRandomTe func logParameterInfo(addresses []string, tests []testCaseWithWeight) { grpclog.Printf("server_addresses: %s", *serverAddresses) grpclog.Printf("test_cases: %s", *testCases) - grpclog.Printf("test_duration_secs: %d", *testDurationSecs) + grpclog.Printf("test_duration-secs: %d", *testDurationSecs) grpclog.Printf("num_channels_per_server: %d", *numChannelsPerServer) grpclog.Printf("num_stubs_per_channel: %d", *numStubsPerChannel) grpclog.Printf("metrics_port: %d", *metricsPort) - grpclog.Printf("use_tls: %t", *useTLS) - grpclog.Printf("use_test_ca: %t", *testCA) - grpclog.Printf("server_host_override: %s", *tlsServerName) grpclog.Println("addresses:") for i, addr := range addresses { @@ -282,30 +257,6 @@ func logParameterInfo(addresses []string, tests []testCaseWithWeight) { } } -func newConn(address string, useTLS, testCA bool, tlsServerName string) (*grpc.ClientConn, error) { - var opts []grpc.DialOption - if useTLS { - var sn string - if tlsServerName != "" { - sn = tlsServerName - } - var creds credentials.TransportCredentials - if testCA { - var err error - creds, err = credentials.NewClientTLSFromFile(testCAFile, sn) - if err != nil { - grpclog.Fatalf("Failed to create TLS credentials %v", err) - } - } else { - creds = credentials.NewClientTLSFromCert(nil, sn) - } - opts = append(opts, grpc.WithTransportCredentials(creds)) - } else { - opts = append(opts, grpc.WithInsecure()) - } - return grpc.Dial(address, opts...) -} - func main() { flag.Parse() addresses := strings.Split(*serverAddresses, ",") @@ -320,7 +271,7 @@ func main() { for serverIndex, address := range addresses { for connIndex := 0; connIndex < *numChannelsPerServer; connIndex++ { - conn, err := newConn(address, *useTLS, *testCA, *tlsServerName) + conn, err := grpc.Dial(address, grpc.WithInsecure()) if err != nil { grpclog.Fatalf("Fail to dial: %v", err) } diff --git a/vendor/google.golang.org/grpc/stress/client/testdata/ca.pem b/vendor/google.golang.org/grpc/stress/client/testdata/ca.pem deleted file mode 100644 index 6c8511a..0000000 --- a/vendor/google.golang.org/grpc/stress/client/testdata/ca.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSjCCAbOgAwIBAgIJAJHGGR4dGioHMA0GCSqGSIb3DQEBCwUAMFYxCzAJBgNV -BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX -aWRnaXRzIFB0eSBMdGQxDzANBgNVBAMTBnRlc3RjYTAeFw0xNDExMTEyMjMxMjla -Fw0yNDExMDgyMjMxMjlaMFYxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0 -YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxDzANBgNVBAMT -BnRlc3RjYTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwEDfBV5MYdlHVHJ7 -+L4nxrZy7mBfAVXpOc5vMYztssUI7mL2/iYujiIXM+weZYNTEpLdjyJdu7R5gGUu -g1jSVK/EPHfc74O7AyZU34PNIP4Sh33N+/A5YexrNgJlPY+E3GdVYi4ldWJjgkAd -Qah2PH5ACLrIIC6tRka9hcaBlIECAwEAAaMgMB4wDAYDVR0TBAUwAwEB/zAOBgNV -HQ8BAf8EBAMCAgQwDQYJKoZIhvcNAQELBQADgYEAHzC7jdYlzAVmddi/gdAeKPau -sPBG/C2HCWqHzpCUHcKuvMzDVkY/MP2o6JIW2DBbY64bO/FceExhjcykgaYtCH/m -oIU63+CFOTtR7otyQAWHqXa7q4SbCDlG7DyRFxqG0txPtGvy12lgldA2+RgcigQG -Dfcog5wrJytaQ6UA0wE= ------END CERTIFICATE----- diff --git a/vendor/google.golang.org/grpc/stress/client/testdata/server1.key b/vendor/google.golang.org/grpc/stress/client/testdata/server1.key deleted file mode 100644 index 143a5b8..0000000 --- a/vendor/google.golang.org/grpc/stress/client/testdata/server1.key +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAOHDFScoLCVJpYDD -M4HYtIdV6Ake/sMNaaKdODjDMsux/4tDydlumN+fm+AjPEK5GHhGn1BgzkWF+slf -3BxhrA/8dNsnunstVA7ZBgA/5qQxMfGAq4wHNVX77fBZOgp9VlSMVfyd9N8YwbBY -AckOeUQadTi2X1S6OgJXgQ0m3MWhAgMBAAECgYAn7qGnM2vbjJNBm0VZCkOkTIWm -V10okw7EPJrdL2mkre9NasghNXbE1y5zDshx5Nt3KsazKOxTT8d0Jwh/3KbaN+YY -tTCbKGW0pXDRBhwUHRcuRzScjli8Rih5UOCiZkhefUTcRb6xIhZJuQy71tjaSy0p -dHZRmYyBYO2YEQ8xoQJBAPrJPhMBkzmEYFtyIEqAxQ/o/A6E+E4w8i+KM7nQCK7q -K4JXzyXVAjLfyBZWHGM2uro/fjqPggGD6QH1qXCkI4MCQQDmdKeb2TrKRh5BY1LR -81aJGKcJ2XbcDu6wMZK4oqWbTX2KiYn9GB0woM6nSr/Y6iy1u145YzYxEV/iMwff -DJULAkB8B2MnyzOg0pNFJqBJuH29bKCcHa8gHJzqXhNO5lAlEbMK95p/P2Wi+4Hd -aiEIAF1BF326QJcvYKmwSmrORp85AkAlSNxRJ50OWrfMZnBgzVjDx3xG6KsFQVk2 -ol6VhqL6dFgKUORFUWBvnKSyhjJxurlPEahV6oo6+A+mPhFY8eUvAkAZQyTdupP3 -XEFQKctGz+9+gKkemDp7LBBMEMBXrGTLPhpEfcjv/7KPdnFHYmhYeBTBnuVmTVWe -F98XJ7tIFfJq ------END PRIVATE KEY----- diff --git a/vendor/google.golang.org/grpc/stress/client/testdata/server1.pem b/vendor/google.golang.org/grpc/stress/client/testdata/server1.pem deleted file mode 100644 index f3d43fc..0000000 --- a/vendor/google.golang.org/grpc/stress/client/testdata/server1.pem +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICnDCCAgWgAwIBAgIBBzANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJBVTET -MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ -dHkgTHRkMQ8wDQYDVQQDEwZ0ZXN0Y2EwHhcNMTUxMTA0MDIyMDI0WhcNMjUxMTAx -MDIyMDI0WjBlMQswCQYDVQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNV -BAcTB0NoaWNhZ28xFTATBgNVBAoTDEV4YW1wbGUsIENvLjEaMBgGA1UEAxQRKi50 -ZXN0Lmdvb2dsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAOHDFSco -LCVJpYDDM4HYtIdV6Ake/sMNaaKdODjDMsux/4tDydlumN+fm+AjPEK5GHhGn1Bg -zkWF+slf3BxhrA/8dNsnunstVA7ZBgA/5qQxMfGAq4wHNVX77fBZOgp9VlSMVfyd -9N8YwbBYAckOeUQadTi2X1S6OgJXgQ0m3MWhAgMBAAGjazBpMAkGA1UdEwQCMAAw -CwYDVR0PBAQDAgXgME8GA1UdEQRIMEaCECoudGVzdC5nb29nbGUuZnKCGHdhdGVy -em9vaS50ZXN0Lmdvb2dsZS5iZYISKi50ZXN0LnlvdXR1YmUuY29thwTAqAEDMA0G -CSqGSIb3DQEBCwUAA4GBAJFXVifQNub1LUP4JlnX5lXNlo8FxZ2a12AFQs+bzoJ6 -hM044EDjqyxUqSbVePK0ni3w1fHQB5rY9yYC5f8G7aqqTY1QOhoUk8ZTSTRpnkTh -y4jjdvTZeLDVBlueZUTDRmy2feY5aZIU18vFDK08dTG0A87pppuv1LNIR3loveU8 ------END CERTIFICATE----- diff --git a/vendor/google.golang.org/grpc/tap/tap.go b/vendor/google.golang.org/grpc/tap/tap.go deleted file mode 100644 index 0f36647..0000000 --- a/vendor/google.golang.org/grpc/tap/tap.go +++ /dev/null @@ -1,54 +0,0 @@ -/* - * - * Copyright 2016, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// Package tap defines the function handles which are executed on the transport -// layer of gRPC-Go and related information. Everything here is EXPERIMENTAL. -package tap - -import ( - "golang.org/x/net/context" -) - -// Info defines the relevant information needed by the handles. -type Info struct { - // FullMethodName is the string of grpc method (in the format of - // /package.service/method). - FullMethodName string - // TODO: More to be added. -} - -// ServerInHandle defines the function which runs when a new stream is created -// on the server side. Note that it is executed in the per-connection I/O goroutine(s) instead -// of per-RPC goroutine. Therefore, users should NOT have any blocking/time-consuming -// work in this handle. Otherwise all the RPCs would slow down. -type ServerInHandle func(ctx context.Context, info *Info) (context.Context, error) diff --git a/vendor/google.golang.org/grpc/test/end2end_test.go b/vendor/google.golang.org/grpc/test/end2end_test.go index 98d590e..5e942dc 100644 --- a/vendor/google.golang.org/grpc/test/end2end_test.go +++ b/vendor/google.golang.org/grpc/test/end2end_test.go @@ -65,7 +65,6 @@ import ( "google.golang.org/grpc/internal" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" - "google.golang.org/grpc/tap" testpb "google.golang.org/grpc/test/grpc_testing" ) @@ -419,7 +418,6 @@ type test struct { testServer testpb.TestServiceServer // nil means none healthServer *health.Server // nil means disabled maxStream uint32 - tapHandle tap.ServerInHandle maxMsgSize int userAgent string clientCompression bool @@ -428,8 +426,6 @@ type test struct { streamClientInt grpc.StreamClientInterceptor unaryServerInt grpc.UnaryServerInterceptor streamServerInt grpc.StreamServerInterceptor - unknownHandler grpc.StreamHandler - sc <-chan grpc.ServiceConfig // srv and srvAddr are set once startServer is called. srv *grpc.Server @@ -452,9 +448,7 @@ func (te *test) tearDown() { te.restoreLogs() te.restoreLogs = nil } - if te.srv != nil { - te.srv.Stop() - } + te.srv.Stop() } // newTest returns a new test using the provided testing.T and @@ -479,9 +473,6 @@ func (te *test) startServer(ts testpb.TestServiceServer) { if te.maxMsgSize > 0 { sopts = append(sopts, grpc.MaxMsgSize(te.maxMsgSize)) } - if te.tapHandle != nil { - sopts = append(sopts, grpc.InTapHandle(te.tapHandle)) - } if te.serverCompression { sopts = append(sopts, grpc.RPCCompressor(grpc.NewGZIPCompressor()), @@ -494,13 +485,10 @@ func (te *test) startServer(ts testpb.TestServiceServer) { if te.streamServerInt != nil { sopts = append(sopts, grpc.StreamInterceptor(te.streamServerInt)) } - if te.unknownHandler != nil { - sopts = append(sopts, grpc.UnknownServiceHandler(te.unknownHandler)) - } la := "localhost:0" switch te.e.network { case "unix": - la = "/tmp/testsock" + fmt.Sprintf("%d", time.Now().UnixNano()) + la = "/tmp/testsock" + fmt.Sprintf("%d", time.Now()) syscall.Unlink(la) } lis, err := net.Listen(te.e.network, la) @@ -554,10 +542,6 @@ func (te *test) clientConn() *grpc.ClientConn { grpc.WithUserAgent(te.userAgent), } - if te.sc != nil { - opts = append(opts, grpc.WithServiceConfig(te.sc)) - } - if te.clientCompression { opts = append(opts, grpc.WithCompressor(grpc.NewGZIPCompressor()), @@ -570,9 +554,6 @@ func (te *test) clientConn() *grpc.ClientConn { if te.streamClientInt != nil { opts = append(opts, grpc.WithStreamInterceptor(te.streamClientInt)) } - if te.maxMsgSize > 0 { - opts = append(opts, grpc.WithMaxMsgSize(te.maxMsgSize)) - } switch te.e.security { case "tls": creds, err := credentials.NewClientTLSFromFile(tlsDir+"ca.pem", "x.test.youtube.com") @@ -644,10 +625,7 @@ func testTimeoutOnDeadServer(t *testing.T, e env) { } te.srv.Stop() ctx, _ := context.WithTimeout(context.Background(), time.Millisecond) - _, err := tc.EmptyCall(ctx, &testpb.Empty{}, grpc.FailFast(false)) - if e.balancer && grpc.Code(err) != codes.DeadlineExceeded { - // If e.balancer == nil, the ac will stop reconnecting because the dialer returns non-temp error, - // the error will be an internal error. + if _, err := tc.EmptyCall(ctx, &testpb.Empty{}, grpc.FailFast(false)); grpc.Code(err) != codes.DeadlineExceeded { t.Fatalf("TestService/EmptyCall(%v, _) = _, %v, want _, error code: %s", ctx, err, codes.DeadlineExceeded) } awaitNewConnLogOutput() @@ -1027,141 +1005,6 @@ func testFailFast(t *testing.T, e env) { awaitNewConnLogOutput() } -func TestServiceConfig(t *testing.T) { - defer leakCheck(t)() - for _, e := range listTestEnv() { - testServiceConfig(t, e) - } -} - -func testServiceConfig(t *testing.T, e env) { - te := newTest(t, e) - ch := make(chan grpc.ServiceConfig) - te.sc = ch - te.userAgent = testAppUA - te.declareLogNoise( - "transport: http2Client.notifyError got notified that the client transport was broken EOF", - "grpc: addrConn.transportMonitor exits due to: grpc: the connection is closing", - "grpc: addrConn.resetTransport failed to create client transport: connection error", - "Failed to dial : context canceled; please retry.", - ) - defer te.tearDown() - - var wg sync.WaitGroup - wg.Add(1) - go func() { - defer wg.Done() - mc := grpc.MethodConfig{ - WaitForReady: true, - Timeout: time.Millisecond, - } - m := make(map[string]grpc.MethodConfig) - m["/grpc.testing.TestService/EmptyCall"] = mc - m["/grpc.testing.TestService/FullDuplexCall"] = mc - sc := grpc.ServiceConfig{ - Methods: m, - } - ch <- sc - }() - cc := te.clientConn() - tc := testpb.NewTestServiceClient(cc) - // The following RPCs are expected to become non-fail-fast ones with 1ms deadline. - if _, err := tc.EmptyCall(context.Background(), &testpb.Empty{}); grpc.Code(err) != codes.DeadlineExceeded { - t.Fatalf("TestService/EmptyCall(_, _) = _, %v, want _, %s", err, codes.DeadlineExceeded) - } - if _, err := tc.FullDuplexCall(context.Background()); grpc.Code(err) != codes.DeadlineExceeded { - t.Fatalf("TestService/FullDuplexCall(_) = _, %v, want %s", err, codes.DeadlineExceeded) - } - wg.Wait() - // Generate a service config update. - mc := grpc.MethodConfig{ - WaitForReady: false, - } - m := make(map[string]grpc.MethodConfig) - m["/grpc.testing.TestService/EmptyCall"] = mc - m["/grpc.testing.TestService/FullDuplexCall"] = mc - sc := grpc.ServiceConfig{ - Methods: m, - } - ch <- sc - // Loop until the new update becomes effective. - for { - if _, err := tc.EmptyCall(context.Background(), &testpb.Empty{}); grpc.Code(err) != codes.Unavailable { - continue - } - break - } - // The following RPCs are expected to become fail-fast. - if _, err := tc.EmptyCall(context.Background(), &testpb.Empty{}); grpc.Code(err) != codes.Unavailable { - t.Fatalf("TestService/EmptyCall(_, _) = _, %v, want _, %s", err, codes.Unavailable) - } - if _, err := tc.FullDuplexCall(context.Background()); grpc.Code(err) != codes.Unavailable { - t.Fatalf("TestService/FullDuplexCall(_) = _, %v, want %s", err, codes.Unavailable) - } -} - -func TestTap(t *testing.T) { - defer leakCheck(t)() - for _, e := range listTestEnv() { - if e.name == "handler-tls" { - continue - } - testTap(t, e) - } -} - -type myTap struct { - cnt int -} - -func (t *myTap) handle(ctx context.Context, info *tap.Info) (context.Context, error) { - if info != nil { - if info.FullMethodName == "/grpc.testing.TestService/EmptyCall" { - t.cnt++ - } else if info.FullMethodName == "/grpc.testing.TestService/UnaryCall" { - return nil, fmt.Errorf("tap error") - } - } - return ctx, nil -} - -func testTap(t *testing.T, e env) { - te := newTest(t, e) - te.userAgent = testAppUA - ttap := &myTap{} - te.tapHandle = ttap.handle - te.declareLogNoise( - "transport: http2Client.notifyError got notified that the client transport was broken EOF", - "grpc: addrConn.transportMonitor exits due to: grpc: the connection is closing", - "grpc: addrConn.resetTransport failed to create client transport: connection error", - ) - te.startServer(&testServer{security: e.security}) - defer te.tearDown() - - cc := te.clientConn() - tc := testpb.NewTestServiceClient(cc) - if _, err := tc.EmptyCall(context.Background(), &testpb.Empty{}); err != nil { - t.Fatalf("TestService/EmptyCall(_, _) = _, %v, want _, ", err) - } - if ttap.cnt != 1 { - t.Fatalf("Get the count in ttap %d, want 1", ttap.cnt) - } - - payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, 31) - if err != nil { - t.Fatal(err) - } - - req := &testpb.SimpleRequest{ - ResponseType: testpb.PayloadType_COMPRESSABLE.Enum(), - ResponseSize: proto.Int32(45), - Payload: payload, - } - if _, err := tc.UnaryCall(context.Background(), req); grpc.Code(err) != codes.Unavailable { - t.Fatalf("TestService/UnaryCall(_, _) = _, %v, want _, %s", err, codes.Unavailable) - } -} - func healthCheck(d time.Duration, cc *grpc.ClientConn, serviceName string) (*healthpb.HealthCheckResponse, error) { ctx, _ := context.WithTimeout(context.Background(), d) hc := healthpb.NewHealthClient(cc) @@ -1241,33 +1084,6 @@ func testHealthCheckOff(t *testing.T, e env) { } } -func TestUnknownHandler(t *testing.T) { - defer leakCheck(t)() - // An example unknownHandler that returns a different code and a different method, making sure that we do not - // expose what methods are implemented to a client that is not authenticated. - unknownHandler := func(srv interface{}, stream grpc.ServerStream) error { - return grpc.Errorf(codes.Unauthenticated, "user unauthenticated") - } - for _, e := range listTestEnv() { - // TODO(bradfitz): Temporarily skip this env due to #619. - if e.name == "handler-tls" { - continue - } - testUnknownHandler(t, e, unknownHandler) - } -} - -func testUnknownHandler(t *testing.T, e env, unknownHandler grpc.StreamHandler) { - te := newTest(t, e) - te.unknownHandler = unknownHandler - te.startServer(&testServer{security: e.security}) - defer te.tearDown() - want := grpc.Errorf(codes.Unauthenticated, "user unauthenticated") - if _, err := healthCheck(1*time.Second, te.clientConn(), ""); !equalErrors(err, want) { - t.Fatalf("Health/Check(_, _) = _, %v, want _, %v", err, want) - } -} - func TestHealthCheckServingStatus(t *testing.T) { defer leakCheck(t)() for _, e := range listTestEnv() { @@ -1430,34 +1246,22 @@ func testExceedMsgLimit(t *testing.T, e env) { tc := testpb.NewTestServiceClient(te.clientConn()) argSize := int32(te.maxMsgSize + 1) - const smallSize = 1 + const respSize = 1 payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, argSize) if err != nil { t.Fatal(err) } - smallPayload, err := newPayload(testpb.PayloadType_COMPRESSABLE, smallSize) - if err != nil { - t.Fatal(err) - } - // test on server side for unary RPC req := &testpb.SimpleRequest{ ResponseType: testpb.PayloadType_COMPRESSABLE.Enum(), - ResponseSize: proto.Int32(smallSize), + ResponseSize: proto.Int32(respSize), Payload: payload, } if _, err := tc.UnaryCall(context.Background(), req); err == nil || grpc.Code(err) != codes.Internal { t.Fatalf("TestService/UnaryCall(_, _) = _, %v, want _, error code: %s", err, codes.Internal) } - // test on client side for unary RPC - req.ResponseSize = proto.Int32(int32(te.maxMsgSize) + 1) - req.Payload = smallPayload - if _, err := tc.UnaryCall(context.Background(), req); err == nil || grpc.Code(err) != codes.Internal { - t.Fatalf("TestService/UnaryCall(_, _) = _, %v, want _, error code: %s", err, codes.Internal) - } - // test on server side for streaming RPC stream, err := tc.FullDuplexCall(te.ctx) if err != nil { t.Fatalf("%v.FullDuplexCall(_) = _, %v, want ", tc, err) @@ -1484,58 +1288,6 @@ func testExceedMsgLimit(t *testing.T, e env) { if _, err := stream.Recv(); err == nil || grpc.Code(err) != codes.Internal { t.Fatalf("%v.Recv() = _, %v, want _, error code: %s", stream, err, codes.Internal) } - - // test on client side for streaming RPC - stream, err = tc.FullDuplexCall(te.ctx) - if err != nil { - t.Fatalf("%v.FullDuplexCall(_) = _, %v, want ", tc, err) - } - respParam[0].Size = proto.Int32(int32(te.maxMsgSize) + 1) - sreq.Payload = smallPayload - if err := stream.Send(sreq); err != nil { - t.Fatalf("%v.Send(%v) = %v, want ", stream, sreq, err) - } - if _, err := stream.Recv(); err == nil || grpc.Code(err) != codes.Internal { - t.Fatalf("%v.Recv() = _, %v, want _, error code: %s", stream, err, codes.Internal) - } - -} - -func TestPeerClientSide(t *testing.T) { - defer leakCheck(t)() - for _, e := range listTestEnv() { - testPeerClientSide(t, e) - } -} - -func testPeerClientSide(t *testing.T, e env) { - te := newTest(t, e) - te.userAgent = testAppUA - te.startServer(&testServer{security: e.security}) - defer te.tearDown() - tc := testpb.NewTestServiceClient(te.clientConn()) - peer := new(peer.Peer) - if _, err := tc.EmptyCall(context.Background(), &testpb.Empty{}, grpc.Peer(peer), grpc.FailFast(false)); err != nil { - t.Fatalf("TestService/EmptyCall(_, _) = _, %v, want _, ", err) - } - pa := peer.Addr.String() - if e.network == "unix" { - if pa != te.srvAddr { - t.Fatalf("peer.Addr = %v, want %v", pa, te.srvAddr) - } - return - } - _, pp, err := net.SplitHostPort(pa) - if err != nil { - t.Fatalf("Failed to parse address from peer.") - } - _, sp, err := net.SplitHostPort(te.srvAddr) - if err != nil { - t.Fatalf("Failed to parse address of test server.") - } - if pp != sp { - t.Fatalf("peer.Addr = localhost:%v, want localhost:%v", pp, sp) - } } func TestMetadataUnaryRPC(t *testing.T) { @@ -2447,6 +2199,85 @@ func testFailedServerStreaming(t *testing.T, e env) { } } +// checkTimeoutErrorServer is a gRPC server checks context timeout error in FullDuplexCall(). +// It is only used in TestStreamingRPCTimeoutServerError. +type checkTimeoutErrorServer struct { + t *testing.T + done chan struct{} + testpb.TestServiceServer +} + +func (s *checkTimeoutErrorServer) FullDuplexCall(stream testpb.TestService_FullDuplexCallServer) error { + defer close(s.done) + for { + _, err := stream.Recv() + if err != nil { + if grpc.Code(err) != codes.DeadlineExceeded { + s.t.Errorf("stream.Recv() = _, %v, want error code %s", err, codes.DeadlineExceeded) + } + return err + } + if err := stream.Send(&testpb.StreamingOutputCallResponse{ + Payload: &testpb.Payload{ + Body: []byte{'0'}, + }, + }); err != nil { + if grpc.Code(err) != codes.DeadlineExceeded { + s.t.Errorf("stream.Send(_) = %v, want error code %s", err, codes.DeadlineExceeded) + } + return err + } + } +} + +func TestStreamingRPCTimeoutServerError(t *testing.T) { + defer leakCheck(t)() + for _, e := range listTestEnv() { + testStreamingRPCTimeoutServerError(t, e) + } +} + +// testStreamingRPCTimeoutServerError tests the server side behavior. +// When context timeout happens on client side, server should get deadline exceeded error. +func testStreamingRPCTimeoutServerError(t *testing.T, e env) { + te := newTest(t, e) + serverDone := make(chan struct{}) + te.startServer(&checkTimeoutErrorServer{t: t, done: serverDone}) + defer te.tearDown() + + cc := te.clientConn() + tc := testpb.NewTestServiceClient(cc) + + req := &testpb.StreamingOutputCallRequest{} + for duration := 50 * time.Millisecond; ; duration *= 2 { + ctx, _ := context.WithTimeout(context.Background(), duration) + stream, err := tc.FullDuplexCall(ctx, grpc.FailFast(false)) + if grpc.Code(err) == codes.DeadlineExceeded { + // Redo test with double timeout. + continue + } + if err != nil { + t.Errorf("%v.FullDuplexCall(_) = _, %v, want ", tc, err) + return + } + for { + err := stream.Send(req) + if err != nil { + break + } + _, err = stream.Recv() + if err != nil { + break + } + } + + // Wait for context timeout on server before closing connection + // to make sure the server will get timeout error. + <-serverDone + break + } +} + // concurrentSendServer is a TestServiceServer whose // StreamingOutputCall makes ten serial Send calls, sending payloads // "0".."9", inclusive. TestServerStreamingConcurrent verifies they @@ -2653,48 +2484,6 @@ func testExceedMaxStreamsLimit(t *testing.T, e env) { } } -const defaultMaxStreamsClient = 100 - -func TestExceedDefaultMaxStreamsLimit(t *testing.T) { - defer leakCheck(t)() - for _, e := range listTestEnv() { - testExceedDefaultMaxStreamsLimit(t, e) - } -} - -func testExceedDefaultMaxStreamsLimit(t *testing.T, e env) { - te := newTest(t, e) - te.declareLogNoise( - "http2Client.notifyError got notified that the client transport was broken", - "Conn.resetTransport failed to create client transport", - "grpc: the connection is closing", - ) - // When masStream is set to 0 the server doesn't send a settings frame for - // MaxConcurrentStreams, essentially allowing infinite (math.MaxInt32) streams. - // In such a case, there should be a default cap on the client-side. - te.maxStream = 0 - te.startServer(&testServer{security: e.security}) - defer te.tearDown() - - cc := te.clientConn() - tc := testpb.NewTestServiceClient(cc) - - // Create as many streams as a client can. - for i := 0; i < defaultMaxStreamsClient; i++ { - if _, err := tc.StreamingInputCall(te.ctx); err != nil { - t.Fatalf("%v.StreamingInputCall(_) = _, %v, want _, ", tc, err) - } - } - - // Trying to create one more should timeout. - ctx, cancel := context.WithTimeout(context.Background(), time.Second) - defer cancel() - _, err := tc.StreamingInputCall(ctx) - if err == nil || grpc.Code(err) != codes.DeadlineExceeded { - t.Fatalf("%v.StreamingInputCall(_) = _, %v, want _, %s", tc, err, codes.DeadlineExceeded) - } -} - func TestStreamsQuotaRecovery(t *testing.T) { defer leakCheck(t)() for _, e := range listTestEnv() { @@ -3329,117 +3118,6 @@ func TestServerCredsDispatch(t *testing.T) { } } -func TestFlowControlLogicalRace(t *testing.T) { - // Test for a regression of https://github.com/grpc/grpc-go/issues/632, - // and other flow control bugs. - - defer leakCheck(t)() - - const ( - itemCount = 100 - itemSize = 1 << 10 - recvCount = 2 - maxFailures = 3 - - requestTimeout = time.Second - ) - - requestCount := 10000 - if raceMode { - requestCount = 1000 - } - - lis, err := net.Listen("tcp", ":0") - if err != nil { - t.Fatalf("Failed to listen: %v", err) - } - defer lis.Close() - - s := grpc.NewServer() - testpb.RegisterTestServiceServer(s, &flowControlLogicalRaceServer{ - itemCount: itemCount, - itemSize: itemSize, - }) - defer s.Stop() - - go s.Serve(lis) - - ctx := context.Background() - - cc, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure(), grpc.WithBlock()) - if err != nil { - t.Fatalf("grpc.Dial(%q) = %v", lis.Addr().String(), err) - } - defer cc.Close() - cl := testpb.NewTestServiceClient(cc) - - failures := 0 - for i := 0; i < requestCount; i++ { - ctx, cancel := context.WithTimeout(ctx, requestTimeout) - output, err := cl.StreamingOutputCall(ctx, &testpb.StreamingOutputCallRequest{}) - if err != nil { - t.Fatalf("StreamingOutputCall; err = %q", err) - } - - j := 0 - loop: - for ; j < recvCount; j++ { - _, err := output.Recv() - if err != nil { - if err == io.EOF { - break loop - } - switch grpc.Code(err) { - case codes.DeadlineExceeded: - break loop - default: - t.Fatalf("Recv; err = %q", err) - } - } - } - cancel() - <-ctx.Done() - - if j < recvCount { - t.Errorf("got %d responses to request %d", j, i) - failures++ - if failures >= maxFailures { - // Continue past the first failure to see if the connection is - // entirely broken, or if only a single RPC was affected - break - } - } - } -} - -type flowControlLogicalRaceServer struct { - testpb.TestServiceServer - - itemSize int - itemCount int -} - -func (s *flowControlLogicalRaceServer) StreamingOutputCall(req *testpb.StreamingOutputCallRequest, srv testpb.TestService_StreamingOutputCallServer) error { - for i := 0; i < s.itemCount; i++ { - err := srv.Send(&testpb.StreamingOutputCallResponse{ - Payload: &testpb.Payload{ - // Sending a large stream of data which the client reject - // helps to trigger some types of flow control bugs. - // - // Reallocating memory here is inefficient, but the stress it - // puts on the GC leads to more frequent flow control - // failures. The GC likely causes more variety in the - // goroutine scheduling orders. - Body: bytes.Repeat([]byte("a"), s.itemSize), - }, - }) - if err != nil { - return err - } - } - return nil -} - // interestingGoroutines returns all goroutines we care about for the purpose // of leak checking. It excludes testing or runtime ones. func interestingGoroutines() (gs []string) { @@ -3460,7 +3138,6 @@ func interestingGoroutines() (gs []string) { strings.Contains(stack, "testing.tRunner(") || strings.Contains(stack, "runtime.goexit") || strings.Contains(stack, "created by runtime.gc") || - strings.Contains(stack, "created by runtime/trace.Start") || strings.Contains(stack, "created by google3/base/go/log.init") || strings.Contains(stack, "interestingGoroutines") || strings.Contains(stack, "runtime.MHeap_Scavenger") || diff --git a/vendor/google.golang.org/grpc/transport/control.go b/vendor/google.golang.org/grpc/transport/control.go index 0edbe53..4ef0830 100644 --- a/vendor/google.golang.org/grpc/transport/control.go +++ b/vendor/google.golang.org/grpc/transport/control.go @@ -35,9 +35,7 @@ package transport import ( "fmt" - "math" "sync" - "time" "golang.org/x/net/http2" ) @@ -46,12 +44,8 @@ const ( // The default value of flow control window size in HTTP2 spec. defaultWindowSize = 65535 // The initial window size for flow control. - initialWindowSize = defaultWindowSize // for an RPC - initialConnWindowSize = defaultWindowSize * 16 // for a connection - infinity = time.Duration(math.MaxInt64) - defaultKeepaliveTime = infinity - defaultKeepaliveTimeout = time.Duration(20 * time.Second) - defaultMaxStreamsClient = 100 + initialWindowSize = defaultWindowSize // for an RPC + initialConnWindowSize = defaultWindowSize * 16 // for a connection ) // The following defines various control items which could flow through @@ -117,9 +111,35 @@ func newQuotaPool(q int) *quotaPool { return qb } -// add cancels the pending quota sent on acquired, incremented by v and sends +// add adds n to the available quota and tries to send it on acquire. +func (qb *quotaPool) add(n int) { + qb.mu.Lock() + defer qb.mu.Unlock() + qb.quota += n + if qb.quota <= 0 { + return + } + select { + case qb.c <- qb.quota: + qb.quota = 0 + default: + } +} + +// cancel cancels the pending quota sent on acquire, if any. +func (qb *quotaPool) cancel() { + qb.mu.Lock() + defer qb.mu.Unlock() + select { + case n := <-qb.c: + qb.quota += n + default: + } +} + +// reset cancels the pending quota sent on acquired, incremented by v and sends // it back on acquire. -func (qb *quotaPool) add(v int) { +func (qb *quotaPool) reset(v int) { qb.mu.Lock() defer qb.mu.Unlock() select { @@ -131,10 +151,6 @@ func (qb *quotaPool) add(v int) { if qb.quota <= 0 { return } - // After the pool has been created, this is the only place that sends on - // the channel. Since mu is held at this point and any quota that was sent - // on the channel has been retrieved, we know that this code will always - // place any positive quota value on the channel. select { case qb.c <- qb.quota: qb.quota = 0 diff --git a/vendor/google.golang.org/grpc/transport/handler_server.go b/vendor/google.golang.org/grpc/transport/handler_server.go index 10b6dc0..114e349 100644 --- a/vendor/google.golang.org/grpc/transport/handler_server.go +++ b/vendor/google.golang.org/grpc/transport/handler_server.go @@ -268,7 +268,7 @@ func (ht *serverHandlerTransport) WriteHeader(s *Stream, md metadata.MD) error { }) } -func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), traceCtx func(context.Context, string) context.Context) { +func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream)) { // With this transport type there will be exactly 1 stream: this HTTP request. var ctx context.Context diff --git a/vendor/google.golang.org/grpc/transport/handler_server_test.go b/vendor/google.golang.org/grpc/transport/handler_server_test.go index 44adf2e..84fc917 100644 --- a/vendor/google.golang.org/grpc/transport/handler_server_test.go +++ b/vendor/google.golang.org/grpc/transport/handler_server_test.go @@ -188,7 +188,7 @@ func TestHandlerTransport_NewServerHandlerTransport(t *testing.T) { }, RequestURI: "/service/foo.bar", }, - wantErr: `stream error: code = Internal desc = "malformed time-out: transport: timeout unit is not recognized: \"tomorrow\""`, + wantErr: `stream error: code = 13 desc = "malformed time-out: transport: timeout unit is not recognized: \"tomorrow\""`, }, { name: "with metadata", @@ -300,10 +300,7 @@ func TestHandlerTransport_HandleStreams(t *testing.T) { st.bodyw.Close() // no body st.ht.WriteStatus(s, codes.OK, "") } - st.ht.HandleStreams( - func(s *Stream) { go handleStream(s) }, - func(ctx context.Context, method string) context.Context { return ctx }, - ) + st.ht.HandleStreams(func(s *Stream) { go handleStream(s) }) wantHeader := http.Header{ "Date": nil, "Content-Type": {"application/grpc"}, @@ -330,10 +327,7 @@ func handleStreamCloseBodyTest(t *testing.T, statusCode codes.Code, msg string) handleStream := func(s *Stream) { st.ht.WriteStatus(s, statusCode, msg) } - st.ht.HandleStreams( - func(s *Stream) { go handleStream(s) }, - func(ctx context.Context, method string) context.Context { return ctx }, - ) + st.ht.HandleStreams(func(s *Stream) { go handleStream(s) }) wantHeader := http.Header{ "Date": nil, "Content-Type": {"application/grpc"}, @@ -381,10 +375,7 @@ func TestHandlerTransport_HandleStreams_Timeout(t *testing.T) { } ht.WriteStatus(s, codes.DeadlineExceeded, "too slow") } - ht.HandleStreams( - func(s *Stream) { go runStream(s) }, - func(ctx context.Context, method string) context.Context { return ctx }, - ) + ht.HandleStreams(func(s *Stream) { go runStream(s) }) wantHeader := http.Header{ "Date": nil, "Content-Type": {"application/grpc"}, diff --git a/vendor/google.golang.org/grpc/transport/http2_client.go b/vendor/google.golang.org/grpc/transport/http2_client.go index 627a590..2b0f680 100644 --- a/vendor/google.golang.org/grpc/transport/http2_client.go +++ b/vendor/google.golang.org/grpc/transport/http2_client.go @@ -41,7 +41,6 @@ import ( "net" "strings" "sync" - "sync/atomic" "time" "golang.org/x/net/context" @@ -50,23 +49,18 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/keepalive" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" - "google.golang.org/grpc/stats" ) // http2Client implements the ClientTransport interface with HTTP2. type http2Client struct { - ctx context.Context - target string // server name/addr - userAgent string - md interface{} - conn net.Conn // underlying communication channel - remoteAddr net.Addr - localAddr net.Addr - authInfo credentials.AuthInfo // auth info about the connection - nextID uint32 // the next stream ID to be used + target string // server name/addr + userAgent string + md interface{} + conn net.Conn // underlying communication channel + authInfo credentials.AuthInfo // auth info about the connection + nextID uint32 // the next stream ID to be used // writableChan synchronizes write access to the transport. // A writer acquires the write lock by sending a value on writableChan @@ -82,8 +76,6 @@ type http2Client struct { // goAway is closed to notify the upper layer (i.e., addrConn.transportMonitor) // that the server sent GoAway on this transport. goAway chan struct{} - // awakenKeepalive is used to wake up keepalive when after it has gone dormant. - awakenKeepalive chan struct{} framer *framer hBuf *bytes.Buffer // the buffer for HPACK encoding @@ -103,13 +95,6 @@ type http2Client struct { creds []credentials.PerRPCCredentials - // Boolean to keep track of reading activity on transport. - // 1 is true and 0 is false. - activity uint32 // Accessed atomically. - kp keepalive.ClientParameters - - statsHandler stats.Handler - mu sync.Mutex // guard the following variables state transportState // the state of underlying connection activeStreams map[uint32]*Stream @@ -165,9 +150,6 @@ func newHTTP2Client(ctx context.Context, addr TargetInfo, opts ConnectOptions) ( scheme := "http" conn, err := dial(ctx, opts.Dialer, addr.Addr) if err != nil { - if opts.FailOnNonTempDialError { - return nil, connectionErrorf(isTemporary(err), err, "transport: %v", err) - } return nil, connectionErrorf(true, err, "transport: %v", err) } // Any further errors will close the underlying connection @@ -191,31 +173,19 @@ func newHTTP2Client(ctx context.Context, addr TargetInfo, opts ConnectOptions) ( if opts.UserAgent != "" { ua = opts.UserAgent + " " + ua } - kp := opts.KeepaliveParams - // Validate keepalive parameters. - if kp.Time == 0 { - kp.Time = defaultKeepaliveTime - } - if kp.Timeout == 0 { - kp.Timeout = defaultKeepaliveTimeout - } var buf bytes.Buffer t := &http2Client{ - ctx: ctx, - target: addr.Addr, - userAgent: ua, - md: addr.Metadata, - conn: conn, - remoteAddr: conn.RemoteAddr(), - localAddr: conn.LocalAddr(), - authInfo: authInfo, + target: addr.Addr, + userAgent: ua, + md: addr.Metadata, + conn: conn, + authInfo: authInfo, // The client initiated stream id is odd starting from 1. nextID: 1, writableChan: make(chan int, 1), shutdownChan: make(chan struct{}), errorChan: make(chan struct{}), goAway: make(chan struct{}), - awakenKeepalive: make(chan struct{}, 1), framer: newFramer(conn), hBuf: &buf, hEnc: hpack.NewEncoder(&buf), @@ -226,24 +196,8 @@ func newHTTP2Client(ctx context.Context, addr TargetInfo, opts ConnectOptions) ( state: reachable, activeStreams: make(map[uint32]*Stream), creds: opts.PerRPCCredentials, - maxStreams: defaultMaxStreamsClient, - streamsQuota: newQuotaPool(defaultMaxStreamsClient), + maxStreams: math.MaxInt32, streamSendQuota: defaultWindowSize, - kp: kp, - statsHandler: opts.StatsHandler, - } - // Make sure awakenKeepalive can't be written upon. - // keepalive routine will make it writable, if need be. - t.awakenKeepalive <- struct{}{} - if t.statsHandler != nil { - t.ctx = t.statsHandler.TagConn(t.ctx, &stats.ConnTagInfo{ - RemoteAddr: t.remoteAddr, - LocalAddr: t.localAddr, - }) - connBegin := &stats.ConnBegin{ - Client: true, - } - t.statsHandler.HandleConn(t.ctx, connBegin) } // Start the reader goroutine for incoming message. Each transport has // a dedicated goroutine which reads HTTP2 frame from network. Then it @@ -279,9 +233,6 @@ func newHTTP2Client(ctx context.Context, addr TargetInfo, opts ConnectOptions) ( } } go t.controller() - if t.kp.Time != infinity { - go t.keepalive() - } t.writableChan <- 0 return t, nil } @@ -319,13 +270,12 @@ func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr) *Stream { // streams. func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Stream, err error) { pr := &peer.Peer{ - Addr: t.remoteAddr, + Addr: t.conn.RemoteAddr(), } // Attach Auth info if there is any. if t.authInfo != nil { pr.AuthInfo = t.authInfo } - userCtx := ctx ctx = peer.NewContext(ctx, pr) authData := make(map[string]string) for _, c := range t.creds { @@ -363,18 +313,21 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea t.mu.Unlock() return nil, ErrConnClosing } + checkStreamsQuota := t.streamsQuota != nil t.mu.Unlock() - sq, err := wait(ctx, nil, nil, t.shutdownChan, t.streamsQuota.acquire()) - if err != nil { - return nil, err - } - // Returns the quota balance back. - if sq > 1 { - t.streamsQuota.add(sq - 1) + if checkStreamsQuota { + sq, err := wait(ctx, nil, nil, t.shutdownChan, t.streamsQuota.acquire()) + if err != nil { + return nil, err + } + // Returns the quota balance back. + if sq > 1 { + t.streamsQuota.add(sq - 1) + } } if _, err := wait(ctx, nil, nil, t.shutdownChan, t.writableChan); err != nil { // Return the quota back now because there is no stream returned to the caller. - if _, ok := err.(StreamError); ok { + if _, ok := err.(StreamError); ok && checkStreamsQuota { t.streamsQuota.add(1) } return nil, err @@ -382,7 +335,9 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea t.mu.Lock() if t.state == draining { t.mu.Unlock() - t.streamsQuota.add(1) + if checkStreamsQuota { + t.streamsQuota.add(1) + } // Need to make t writable again so that the rpc in flight can still proceed. t.writableChan <- 0 return nil, ErrStreamDrain @@ -392,19 +347,18 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea return nil, ErrConnClosing } s := t.newStream(ctx, callHdr) - s.clientStatsCtx = userCtx t.activeStreams[s.id] = s - // If the number of active streams change from 0 to 1, then check if keepalive - // has gone dormant. If so, wake it up. - if len(t.activeStreams) == 1 { - select { - case t.awakenKeepalive <- struct{}{}: - t.framer.writePing(false, false, [8]byte{}) - default: - } - } + // This stream is not counted when applySetings(...) initialize t.streamsQuota. + // Reset t.streamsQuota to the right value. + var reset bool + if !checkStreamsQuota && t.streamsQuota != nil { + reset = true + } t.mu.Unlock() + if reset { + t.streamsQuota.reset(-1) + } // HPACK encodes various headers. Note that once WriteField(...) is // called, the corresponding headers/continuation frame has to be sent @@ -459,7 +413,6 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea } } first := true - bufLen := t.hBuf.Len() // Sends the headers in a single batch even when they span multiple frames. for !endHeaders { size := t.hBuf.Len() @@ -494,17 +447,6 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea return nil, connectionErrorf(true, err, "transport: %v", err) } } - if t.statsHandler != nil { - outHeader := &stats.OutHeader{ - Client: true, - WireLength: bufLen, - FullMethod: callHdr.Method, - RemoteAddr: t.remoteAddr, - LocalAddr: t.localAddr, - Compression: callHdr.SendCompress, - } - t.statsHandler.HandleRPC(s.clientStatsCtx, outHeader) - } t.writableChan <- 0 return s, nil } @@ -512,11 +454,15 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea // CloseStream clears the footprint of a stream when the stream is not needed any more. // This must not be executed in reader's goroutine. func (t *http2Client) CloseStream(s *Stream, err error) { + var updateStreams bool t.mu.Lock() if t.activeStreams == nil { t.mu.Unlock() return } + if t.streamsQuota != nil { + updateStreams = true + } delete(t.activeStreams, s.id) if t.state == draining && len(t.activeStreams) == 0 { // The transport is draining and s is the last live stream on t. @@ -525,27 +471,10 @@ func (t *http2Client) CloseStream(s *Stream, err error) { return } t.mu.Unlock() - // rstStream is true in case the stream is being closed at the client-side - // and the server needs to be intimated about it by sending a RST_STREAM - // frame. - // To make sure this frame is written to the wire before the headers of the - // next stream waiting for streamsQuota, we add to streamsQuota pool only - // after having acquired the writableChan to send RST_STREAM out (look at - // the controller() routine). - var rstStream bool - var rstError http2.ErrCode - defer func() { - // In case, the client doesn't have to send RST_STREAM to server - // we can safely add back to streamsQuota pool now. - if !rstStream { - t.streamsQuota.add(1) - return - } - t.controlBuf.put(&resetStream{s.id, rstError}) - }() + if updateStreams { + t.streamsQuota.add(1) + } s.mu.Lock() - rstStream = s.rstStream - rstError = s.rstError if q := s.fc.resetPendingData(); q > 0 { if n := t.fc.onRead(q); n > 0 { t.controlBuf.put(&windowUpdate{0, n}) @@ -561,9 +490,8 @@ func (t *http2Client) CloseStream(s *Stream, err error) { } s.state = streamDone s.mu.Unlock() - if _, ok := err.(StreamError); ok { - rstStream = true - rstError = http2.ErrCodeCancel + if se, ok := err.(StreamError); ok && se.Code != codes.DeadlineExceeded { + t.controlBuf.put(&resetStream{s.id, http2.ErrCodeCancel}) } } @@ -597,12 +525,6 @@ func (t *http2Client) Close() (err error) { s.mu.Unlock() s.write(recvMsg{err: ErrConnClosing}) } - if t.statsHandler != nil { - connEnd := &stats.ConnEnd{ - Client: true, - } - t.statsHandler.HandleConn(t.ctx, connEnd) - } return } @@ -660,14 +582,19 @@ func (t *http2Client) Write(s *Stream, data []byte, opts *Options) error { var p []byte if r.Len() > 0 { size := http2MaxFrameLen + s.sendQuotaPool.add(0) // Wait until the stream has some quota to send the data. sq, err := wait(s.ctx, s.done, s.goAway, t.shutdownChan, s.sendQuotaPool.acquire()) if err != nil { return err } + t.sendQuotaPool.add(0) // Wait until the transport has some quota to send the data. tq, err := wait(s.ctx, s.done, s.goAway, t.shutdownChan, t.sendQuotaPool.acquire()) if err != nil { + if _, ok := err.(StreamError); ok || err == io.EOF { + t.sendQuotaPool.cancel() + } return err } if sq < size { @@ -777,7 +704,7 @@ func (t *http2Client) updateWindow(s *Stream, n uint32) { } func (t *http2Client) handleData(f *http2.DataFrame) { - size := f.Header().Length + size := len(f.Data()) if err := t.fc.onData(uint32(size)); err != nil { t.notifyError(connectionErrorf(true, err, "%v", err)) return @@ -791,11 +718,6 @@ func (t *http2Client) handleData(f *http2.DataFrame) { return } if size > 0 { - if f.Header().Flags.Has(http2.FlagDataPadded) { - if w := t.fc.onRead(uint32(size) - uint32(len(f.Data()))); w > 0 { - t.controlBuf.put(&windowUpdate{0, w}) - } - } s.mu.Lock() if s.state == streamDone { s.mu.Unlock() @@ -809,27 +731,19 @@ func (t *http2Client) handleData(f *http2.DataFrame) { s.state = streamDone s.statusCode = codes.Internal s.statusDesc = err.Error() - s.rstStream = true - s.rstError = http2.ErrCodeFlowControl close(s.done) s.mu.Unlock() s.write(recvMsg{err: io.EOF}) + t.controlBuf.put(&resetStream{s.id, http2.ErrCodeFlowControl}) return } - if f.Header().Flags.Has(http2.FlagDataPadded) { - if w := s.fc.onRead(uint32(size) - uint32(len(f.Data()))); w > 0 { - t.controlBuf.put(&windowUpdate{s.id, w}) - } - } s.mu.Unlock() // TODO(bradfitz, zhaoq): A copy is required here because there is no // guarantee f.Data() is consumed before the arrival of next frame. // Can this copy be eliminated? - if len(f.Data()) > 0 { - data := make([]byte, len(f.Data())) - copy(data, f.Data()) - s.write(recvMsg{data: data}) - } + data := make([]byte, size) + copy(data, f.Data()) + s.write(recvMsg{data: data}) } // The server has closed the stream without sending trailers. Record that // the read direction is closed, and set the status appropriately. @@ -960,24 +874,6 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { } endStream := frame.StreamEnded() - var isHeader bool - defer func() { - if t.statsHandler != nil { - if isHeader { - inHeader := &stats.InHeader{ - Client: true, - WireLength: int(frame.Header().Length), - } - t.statsHandler.HandleRPC(s.clientStatsCtx, inHeader) - } else { - inTrailer := &stats.InTrailer{ - Client: true, - WireLength: int(frame.Header().Length), - } - t.statsHandler.HandleRPC(s.clientStatsCtx, inTrailer) - } - } - }() s.mu.Lock() if !endStream { @@ -989,7 +885,6 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { } close(s.headerChan) s.headerDone = true - isHeader = true } if !endStream || s.state == streamDone { s.mu.Unlock() @@ -1030,7 +925,6 @@ func (t *http2Client) reader() { t.notifyError(err) return } - atomic.CompareAndSwapUint32(&t.activity, 0, 1) sf, ok := frame.(*http2.SettingsFrame) if !ok { t.notifyError(err) @@ -1041,7 +935,6 @@ func (t *http2Client) reader() { // loop to keep reading incoming messages on this transport. for { frame, err := t.framer.readFrame() - atomic.CompareAndSwapUint32(&t.activity, 0, 1) if err != nil { // Abort an active stream if the http2.Framer returns a // http2.StreamError. This can happen only if the server's response @@ -1093,15 +986,21 @@ func (t *http2Client) applySettings(ss []http2.Setting) { s.Val = math.MaxInt32 } t.mu.Lock() + reset := t.streamsQuota != nil + if !reset { + t.streamsQuota = newQuotaPool(int(s.Val) - len(t.activeStreams)) + } ms := t.maxStreams t.maxStreams = int(s.Val) t.mu.Unlock() - t.streamsQuota.add(int(s.Val) - ms) + if reset { + t.streamsQuota.reset(int(s.Val) - ms) + } case http2.SettingInitialWindowSize: t.mu.Lock() for _, stream := range t.activeStreams { // Adjust the sending quota for each stream. - stream.sendQuotaPool.add(int(s.Val - t.streamSendQuota)) + stream.sendQuotaPool.reset(int(s.Val - t.streamSendQuota)) } t.streamSendQuota = s.Val t.mu.Unlock() @@ -1129,12 +1028,6 @@ func (t *http2Client) controller() { t.framer.writeSettings(true, i.ss...) } case *resetStream: - // If the server needs to be to intimated about stream closing, - // then we need to make sure the RST_STREAM frame is written to - // the wire before the headers of the next stream waiting on - // streamQuota. We ensure this by adding to the streamsQuota pool - // only after having acquired the writableChan to send RST_STREAM. - t.streamsQuota.add(1) t.framer.writeRSTStream(true, i.streamID, i.code) case *flushIO: t.framer.flushWrite() @@ -1154,61 +1047,6 @@ func (t *http2Client) controller() { } } -// keepalive running in a separate goroutune makes sure the connection is alive by sending pings. -func (t *http2Client) keepalive() { - p := &ping{data: [8]byte{}} - timer := time.NewTimer(t.kp.Time) - for { - select { - case <-timer.C: - if atomic.CompareAndSwapUint32(&t.activity, 1, 0) { - timer.Reset(t.kp.Time) - continue - } - // Check if keepalive should go dormant. - t.mu.Lock() - if len(t.activeStreams) < 1 && !t.kp.PermitWithoutStream { - // Make awakenKeepalive writable. - <-t.awakenKeepalive - t.mu.Unlock() - select { - case <-t.awakenKeepalive: - // If the control gets here a ping has been sent - // need to reset the timer with keepalive.Timeout. - case <-t.shutdownChan: - return - } - } else { - t.mu.Unlock() - // Send ping. - t.controlBuf.put(p) - } - - // By the time control gets here a ping has been sent one way or the other. - timer.Reset(t.kp.Timeout) - select { - case <-timer.C: - if atomic.CompareAndSwapUint32(&t.activity, 1, 0) { - timer.Reset(t.kp.Time) - continue - } - t.Close() - return - case <-t.shutdownChan: - if !timer.Stop() { - <-timer.C - } - return - } - case <-t.shutdownChan: - if !timer.Stop() { - <-timer.C - } - return - } - } -} - func (t *http2Client) Error() <-chan struct{} { return t.errorChan } diff --git a/vendor/google.golang.org/grpc/transport/http2_server.go b/vendor/google.golang.org/grpc/transport/http2_server.go index f5c590f..a62fb7c 100644 --- a/vendor/google.golang.org/grpc/transport/http2_server.go +++ b/vendor/google.golang.org/grpc/transport/http2_server.go @@ -50,8 +50,6 @@ import ( "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/tap" ) // ErrIllegalHeaderWrite indicates that setting header is illegal because of @@ -60,13 +58,9 @@ var ErrIllegalHeaderWrite = errors.New("transport: the stream is done or WriteHe // http2Server implements the ServerTransport interface with HTTP2. type http2Server struct { - ctx context.Context conn net.Conn - remoteAddr net.Addr - localAddr net.Addr maxStreamID uint32 // max stream ID ever seen authInfo credentials.AuthInfo // auth info about the connection - inTapHandle tap.ServerInHandle // writableChan synchronizes write access to the transport. // A writer acquires the write lock by receiving a value on writableChan // and releases it by sending on writableChan. @@ -88,8 +82,6 @@ type http2Server struct { // sendQuotaPool provides flow control to outbound message. sendQuotaPool *quotaPool - stats stats.Handler - mu sync.Mutex // guard the following state transportState activeStreams map[uint32]*Stream @@ -99,13 +91,12 @@ type http2Server struct { // newHTTP2Server constructs a ServerTransport based on HTTP2. ConnectionError is // returned if something goes wrong. -func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err error) { +func newHTTP2Server(conn net.Conn, maxStreams uint32, authInfo credentials.AuthInfo) (_ ServerTransport, err error) { framer := newFramer(conn) // Send initial settings as connection preface to client. var settings []http2.Setting // TODO(zhaoq): Have a better way to signal "no limit" because 0 is // permitted in the HTTP2 spec. - maxStreams := config.MaxStreams if maxStreams == 0 { maxStreams = math.MaxUint32 } else { @@ -130,16 +121,12 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err } var buf bytes.Buffer t := &http2Server{ - ctx: context.Background(), conn: conn, - remoteAddr: conn.RemoteAddr(), - localAddr: conn.LocalAddr(), - authInfo: config.AuthInfo, + authInfo: authInfo, framer: framer, hBuf: &buf, hEnc: hpack.NewEncoder(&buf), maxStreams: maxStreams, - inTapHandle: config.InTapHandle, controlBuf: newRecvBuffer(), fc: &inFlow{limit: initialConnWindowSize}, sendQuotaPool: newQuotaPool(defaultWindowSize), @@ -148,15 +135,6 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err shutdownChan: make(chan struct{}), activeStreams: make(map[uint32]*Stream), streamSendQuota: defaultWindowSize, - stats: config.StatsHandler, - } - if t.stats != nil { - t.ctx = t.stats.TagConn(t.ctx, &stats.ConnTagInfo{ - RemoteAddr: t.remoteAddr, - LocalAddr: t.localAddr, - }) - connBegin := &stats.ConnBegin{} - t.stats.HandleConn(t.ctx, connBegin) } go t.controller() t.writableChan <- 0 @@ -164,7 +142,7 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err } // operateHeader takes action on the decoded headers. -func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(*Stream), traceCtx func(context.Context, string) context.Context) (close bool) { +func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(*Stream)) (close bool) { buf := newRecvBuffer() s := &Stream{ id: frame.Header().StreamID, @@ -190,12 +168,12 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( } s.recvCompress = state.encoding if state.timeoutSet { - s.ctx, s.cancel = context.WithTimeout(t.ctx, state.timeout) + s.ctx, s.cancel = context.WithTimeout(context.TODO(), state.timeout) } else { - s.ctx, s.cancel = context.WithCancel(t.ctx) + s.ctx, s.cancel = context.WithCancel(context.TODO()) } pr := &peer.Peer{ - Addr: t.remoteAddr, + Addr: t.conn.RemoteAddr(), } // Attach Auth info if there is any. if t.authInfo != nil { @@ -217,18 +195,6 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( } s.recvCompress = state.encoding s.method = state.method - if t.inTapHandle != nil { - var err error - info := &tap.Info{ - FullMethodName: state.method, - } - s.ctx, err = t.inTapHandle(s.ctx, info) - if err != nil { - // TODO: Log the real error. - t.controlBuf.put(&resetStream{s.id, http2.ErrCodeRefusedStream}) - return - } - } t.mu.Lock() if t.state != reachable { t.mu.Unlock() @@ -252,26 +218,13 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( s.windowHandler = func(n int) { t.updateWindow(s, uint32(n)) } - s.ctx = traceCtx(s.ctx, s.method) - if t.stats != nil { - s.ctx = t.stats.TagRPC(s.ctx, &stats.RPCTagInfo{FullMethodName: s.method}) - inHeader := &stats.InHeader{ - FullMethod: s.method, - RemoteAddr: t.remoteAddr, - LocalAddr: t.localAddr, - Compression: s.recvCompress, - WireLength: int(frame.Header().Length), - } - t.stats.HandleRPC(s.ctx, inHeader) - } handle(s) return } // HandleStreams receives incoming streams using the given handler. This is // typically run in a separate goroutine. -// traceCtx attaches trace to ctx and returns the new context. -func (t *http2Server) HandleStreams(handle func(*Stream), traceCtx func(context.Context, string) context.Context) { +func (t *http2Server) HandleStreams(handle func(*Stream)) { // Check the validity of client preface. preface := make([]byte, len(clientPreface)) if _, err := io.ReadFull(t.conn, preface); err != nil { @@ -326,7 +279,7 @@ func (t *http2Server) HandleStreams(handle func(*Stream), traceCtx func(context. } switch frame := frame.(type) { case *http2.MetaHeadersFrame: - if t.operateHeaders(frame, handle, traceCtx) { + if t.operateHeaders(frame, handle) { t.Close() break } @@ -381,7 +334,7 @@ func (t *http2Server) updateWindow(s *Stream, n uint32) { } func (t *http2Server) handleData(f *http2.DataFrame) { - size := f.Header().Length + size := len(f.Data()) if err := t.fc.onData(uint32(size)); err != nil { grpclog.Printf("transport: http2Server %v", err) t.Close() @@ -396,11 +349,6 @@ func (t *http2Server) handleData(f *http2.DataFrame) { return } if size > 0 { - if f.Header().Flags.Has(http2.FlagDataPadded) { - if w := t.fc.onRead(uint32(size) - uint32(len(f.Data()))); w > 0 { - t.controlBuf.put(&windowUpdate{0, w}) - } - } s.mu.Lock() if s.state == streamDone { s.mu.Unlock() @@ -416,20 +364,13 @@ func (t *http2Server) handleData(f *http2.DataFrame) { t.controlBuf.put(&resetStream{s.id, http2.ErrCodeFlowControl}) return } - if f.Header().Flags.Has(http2.FlagDataPadded) { - if w := s.fc.onRead(uint32(size) - uint32(len(f.Data()))); w > 0 { - t.controlBuf.put(&windowUpdate{s.id, w}) - } - } s.mu.Unlock() // TODO(bradfitz, zhaoq): A copy is required here because there is no // guarantee f.Data() is consumed before the arrival of next frame. // Can this copy be eliminated? - if len(f.Data()) > 0 { - data := make([]byte, len(f.Data())) - copy(data, f.Data()) - s.write(recvMsg{data: data}) - } + data := make([]byte, size) + copy(data, f.Data()) + s.write(recvMsg{data: data}) } if f.Header().Flags.Has(http2.FlagDataEndStream) { // Received the end of stream from the client. @@ -551,16 +492,9 @@ func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error { t.hEnc.WriteField(hpack.HeaderField{Name: k, Value: entry}) } } - bufLen := t.hBuf.Len() if err := t.writeHeaders(s, t.hBuf, false); err != nil { return err } - if t.stats != nil { - outHeader := &stats.OutHeader{ - WireLength: bufLen, - } - t.stats.HandleRPC(s.Context(), outHeader) - } t.writableChan <- 0 return nil } @@ -613,17 +547,10 @@ func (t *http2Server) WriteStatus(s *Stream, statusCode codes.Code, statusDesc s t.hEnc.WriteField(hpack.HeaderField{Name: k, Value: entry}) } } - bufLen := t.hBuf.Len() if err := t.writeHeaders(s, t.hBuf, true); err != nil { t.Close() return err } - if t.stats != nil { - outTrailer := &stats.OutTrailer{ - WireLength: bufLen, - } - t.stats.HandleRPC(s.Context(), outTrailer) - } t.closeStream(s) t.writableChan <- 0 return nil @@ -652,14 +579,19 @@ func (t *http2Server) Write(s *Stream, data []byte, opts *Options) error { return nil } size := http2MaxFrameLen + s.sendQuotaPool.add(0) // Wait until the stream has some quota to send the data. sq, err := wait(s.ctx, nil, nil, t.shutdownChan, s.sendQuotaPool.acquire()) if err != nil { return err } + t.sendQuotaPool.add(0) // Wait until the transport has some quota to send the data. tq, err := wait(s.ctx, nil, nil, t.shutdownChan, t.sendQuotaPool.acquire()) if err != nil { + if _, ok := err.(StreamError); ok { + t.sendQuotaPool.cancel() + } return err } if sq < size { @@ -727,7 +659,7 @@ func (t *http2Server) applySettings(ss []http2.Setting) { t.mu.Lock() defer t.mu.Unlock() for _, stream := range t.activeStreams { - stream.sendQuotaPool.add(int(s.Val - t.streamSendQuota)) + stream.sendQuotaPool.reset(int(s.Val - t.streamSendQuota)) } t.streamSendQuota = s.Val } @@ -804,10 +736,6 @@ func (t *http2Server) Close() (err error) { for _, s := range streams { s.cancel() } - if t.stats != nil { - connEnd := &stats.ConnEnd{} - t.stats.HandleConn(t.ctx, connEnd) - } return } @@ -839,7 +767,7 @@ func (t *http2Server) closeStream(s *Stream) { } func (t *http2Server) RemoteAddr() net.Addr { - return t.remoteAddr + return t.conn.RemoteAddr() } func (t *http2Server) Drain() { diff --git a/vendor/google.golang.org/grpc/transport/transport.go b/vendor/google.golang.org/grpc/transport/transport.go index beb0a52..413f749 100644 --- a/vendor/google.golang.org/grpc/transport/transport.go +++ b/vendor/google.golang.org/grpc/transport/transport.go @@ -45,13 +45,10 @@ import ( "sync" "golang.org/x/net/context" - "golang.org/x/net/http2" + "golang.org/x/net/trace" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" - "google.golang.org/grpc/keepalive" "google.golang.org/grpc/metadata" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/tap" ) // recvMsg represents the received msg from the transport. All transport @@ -170,11 +167,6 @@ type Stream struct { id uint32 // nil for client side Stream. st ServerTransport - // clientStatsCtx keeps the user context for stats handling. - // It's only valid on client side. Server side stats context is same as s.ctx. - // All client side stats collection should use the clientStatsCtx (instead of the stream context) - // so that all the generated stats for a particular RPC can be associated in the processing phase. - clientStatsCtx context.Context // ctx is the associated context of the stream. ctx context.Context // cancel is always nil for client side Stream. @@ -215,11 +207,6 @@ type Stream struct { // the status received from the server. statusCode codes.Code statusDesc string - // rstStream indicates whether a RST_STREAM frame needs to be sent - // to the server to signify that this stream is closing. - rstStream bool - // rstError is the error that needs to be sent along with the RST_STREAM frame. - rstError http2.ErrCode } // RecvCompress returns the compression algorithm applied to the inbound @@ -279,6 +266,11 @@ func (s *Stream) Context() context.Context { return s.ctx } +// TraceContext recreates the context of s with a trace.Trace. +func (s *Stream) TraceContext(tr trace.Trace) { + s.ctx = trace.NewContext(s.ctx, tr) +} + // Method returns the method for the stream. func (s *Stream) Method() string { return s.method @@ -363,39 +355,22 @@ const ( draining ) -// ServerConfig consists of all the configurations to establish a server transport. -type ServerConfig struct { - MaxStreams uint32 - AuthInfo credentials.AuthInfo - InTapHandle tap.ServerInHandle - StatsHandler stats.Handler -} - // NewServerTransport creates a ServerTransport with conn or non-nil error // if it fails. -func NewServerTransport(protocol string, conn net.Conn, config *ServerConfig) (ServerTransport, error) { - return newHTTP2Server(conn, config) +func NewServerTransport(protocol string, conn net.Conn, maxStreams uint32, authInfo credentials.AuthInfo) (ServerTransport, error) { + return newHTTP2Server(conn, maxStreams, authInfo) } // ConnectOptions covers all relevant options for communicating with the server. type ConnectOptions struct { // UserAgent is the application user agent. UserAgent string - // Authority is the :authority pseudo-header to use. This field has no effect if - // TransportCredentials is set. - Authority string // Dialer specifies how to dial a network address. Dialer func(context.Context, string) (net.Conn, error) - // FailOnNonTempDialError specifies if gRPC fails on non-temporary dial errors. - FailOnNonTempDialError bool // PerRPCCredentials stores the PerRPCCredentials required to issue RPCs. PerRPCCredentials []credentials.PerRPCCredentials // TransportCredentials stores the Authenticator required to setup a client connection. TransportCredentials credentials.TransportCredentials - // KeepaliveParams stores the keepalive parameters. - KeepaliveParams keepalive.ClientParameters - // StatsHandler stores the handler for stats. - StatsHandler stats.Handler } // TargetInfo contains the information of the target such as network address and metadata. @@ -491,7 +466,7 @@ type ClientTransport interface { // Write methods for a given Stream will be called serially. type ServerTransport interface { // HandleStreams receives incoming streams using the given handler. - HandleStreams(func(*Stream), func(context.Context, string) context.Context) + HandleStreams(func(*Stream)) // WriteHeader sends the header metadata for the given stream. // WriteHeader may not be called on all streams. @@ -577,7 +552,7 @@ type StreamError struct { } func (e StreamError) Error() string { - return fmt.Sprintf("stream error: code = %s desc = %q", e.Code, e.Desc) + return fmt.Sprintf("stream error: code = %d desc = %q", e.Code, e.Desc) } // ContextErr converts the error from context package into a StreamError. diff --git a/vendor/google.golang.org/grpc/transport/transport_test.go b/vendor/google.golang.org/grpc/transport/transport_test.go index 05686fb..81320e6 100644 --- a/vendor/google.golang.org/grpc/transport/transport_test.go +++ b/vendor/google.golang.org/grpc/transport/transport_test.go @@ -49,7 +49,6 @@ import ( "golang.org/x/net/http2" "golang.org/x/net/http2/hpack" "google.golang.org/grpc/codes" - "google.golang.org/grpc/keepalive" ) type server struct { @@ -180,10 +179,7 @@ func (s *server) start(t *testing.T, port int, maxStreams uint32, ht hType) { if err != nil { return } - config := &ServerConfig{ - MaxStreams: maxStreams, - } - transport, err := NewServerTransport("http2", conn, config) + transport, err := NewServerTransport("http2", conn, maxStreams, nil) if err != nil { return } @@ -198,33 +194,22 @@ func (s *server) start(t *testing.T, port int, maxStreams uint32, ht hType) { h := &testStreamHandler{transport.(*http2Server)} switch ht { case suspended: - go transport.HandleStreams(h.handleStreamSuspension, - func(ctx context.Context, method string) context.Context { - return ctx - }) + go transport.HandleStreams(h.handleStreamSuspension) case misbehaved: go transport.HandleStreams(func(s *Stream) { go h.handleStreamMisbehave(t, s) - }, func(ctx context.Context, method string) context.Context { - return ctx }) case encodingRequiredStatus: go transport.HandleStreams(func(s *Stream) { go h.handleStreamEncodingRequiredStatus(t, s) - }, func(ctx context.Context, method string) context.Context { - return ctx }) case invalidHeaderField: go transport.HandleStreams(func(s *Stream) { go h.handleStreamInvalidHeaderField(t, s) - }, func(ctx context.Context, method string) context.Context { - return ctx }) default: go transport.HandleStreams(func(s *Stream) { go h.handleStream(t, s) - }, func(ctx context.Context, method string) context.Context { - return ctx }) } } @@ -252,10 +237,6 @@ func (s *server) stop() { } func setUp(t *testing.T, port int, maxStreams uint32, ht hType) (*server, ClientTransport) { - return setUpWithOptions(t, port, maxStreams, ht, ConnectOptions{}) -} - -func setUpWithOptions(t *testing.T, port int, maxStreams uint32, ht hType, copts ConnectOptions) (*server, ClientTransport) { server := &server{startedErr: make(chan error, 1)} go server.start(t, port, maxStreams, ht) server.wait(t, 2*time.Second) @@ -267,135 +248,13 @@ func setUpWithOptions(t *testing.T, port int, maxStreams uint32, ht hType, copts target := TargetInfo{ Addr: addr, } - ct, connErr = NewClientTransport(context.Background(), target, copts) + ct, connErr = NewClientTransport(context.Background(), target, ConnectOptions{}) if connErr != nil { t.Fatalf("failed to create transport: %v", connErr) } return server, ct } -func setUpWithNoPingServer(t *testing.T, copts ConnectOptions, done chan net.Conn) ClientTransport { - lis, err := net.Listen("tcp", "localhost:0") - if err != nil { - t.Fatalf("Failed to listen: %v", err) - } - // Launch a non responsive server. - go func() { - defer lis.Close() - conn, err := lis.Accept() - if err != nil { - t.Errorf("Error at server-side while accepting: %v", err) - close(done) - return - } - done <- conn - }() - tr, err := NewClientTransport(context.Background(), TargetInfo{Addr: lis.Addr().String()}, copts) - if err != nil { - // Server clean-up. - lis.Close() - if conn, ok := <-done; ok { - conn.Close() - } - t.Fatalf("Failed to dial: %v", err) - } - return tr -} - -func TestKeepaliveClientClosesIdleTransport(t *testing.T) { - done := make(chan net.Conn, 1) - tr := setUpWithNoPingServer(t, ConnectOptions{KeepaliveParams: keepalive.ClientParameters{ - Time: 2 * time.Second, // Keepalive time = 2 sec. - Timeout: 1 * time.Second, // Keepalive timeout = 1 sec. - PermitWithoutStream: true, // Run keepalive even with no RPCs. - }}, done) - defer tr.Close() - conn, ok := <-done - if !ok { - t.Fatalf("Server didn't return connection object") - } - defer conn.Close() - // Sleep for keepalive to close the connection. - time.Sleep(4 * time.Second) - // Assert that the connection was closed. - ct := tr.(*http2Client) - ct.mu.Lock() - defer ct.mu.Unlock() - if ct.state == reachable { - t.Fatalf("Test Failed: Expected client transport to have closed.") - } -} - -func TestKeepaliveClientStaysHealthyOnIdleTransport(t *testing.T) { - done := make(chan net.Conn, 1) - tr := setUpWithNoPingServer(t, ConnectOptions{KeepaliveParams: keepalive.ClientParameters{ - Time: 2 * time.Second, // Keepalive time = 2 sec. - Timeout: 1 * time.Second, // Keepalive timeout = 1 sec. - }}, done) - defer tr.Close() - conn, ok := <-done - if !ok { - t.Fatalf("server didn't reutrn connection object") - } - defer conn.Close() - // Give keepalive some time. - time.Sleep(4 * time.Second) - // Assert that connections is still healthy. - ct := tr.(*http2Client) - ct.mu.Lock() - defer ct.mu.Unlock() - if ct.state != reachable { - t.Fatalf("Test failed: Expected client transport to be healthy.") - } -} - -func TestKeepaliveClientClosesWithActiveStreams(t *testing.T) { - done := make(chan net.Conn, 1) - tr := setUpWithNoPingServer(t, ConnectOptions{KeepaliveParams: keepalive.ClientParameters{ - Time: 2 * time.Second, // Keepalive time = 2 sec. - Timeout: 1 * time.Second, // Keepalive timeout = 1 sec. - }}, done) - defer tr.Close() - conn, ok := <-done - if !ok { - t.Fatalf("Server didn't return connection object") - } - defer conn.Close() - // Create a stream. - _, err := tr.NewStream(context.Background(), &CallHdr{}) - if err != nil { - t.Fatalf("Failed to create a new stream: %v", err) - } - // Give keepalive some time. - time.Sleep(4 * time.Second) - // Assert that transport was closed. - ct := tr.(*http2Client) - ct.mu.Lock() - defer ct.mu.Unlock() - if ct.state == reachable { - t.Fatalf("Test failed: Expected client transport to have closed.") - } -} - -func TestKeepaliveClientStaysHealthyWithResponsiveServer(t *testing.T) { - s, tr := setUpWithOptions(t, 0, math.MaxUint32, normal, ConnectOptions{KeepaliveParams: keepalive.ClientParameters{ - Time: 2 * time.Second, // Keepalive time = 2 sec. - Timeout: 1 * time.Second, // Keepalive timeout = 1 sec. - PermitWithoutStream: true, // Run keepalive even with no RPCs. - }}) - defer s.stop() - defer tr.Close() - // Give keep alive some time. - time.Sleep(4 * time.Second) - // Assert that transport is healthy. - ct := tr.(*http2Client) - ct.mu.Lock() - defer ct.mu.Unlock() - if ct.state != reachable { - t.Fatalf("Test failed: Expected client transport to be healthy.") - } -} - func TestClientSendAndReceive(t *testing.T) { server, ct := setUp(t, 0, math.MaxUint32, normal) callHdr := &CallHdr{ @@ -634,10 +493,7 @@ func TestMaxStreams(t *testing.T) { case <-cc.streamsQuota.acquire(): t.Fatalf("streamsQuota.acquire() becomes readable mistakenly.") default: - cc.streamsQuota.mu.Lock() - quota := cc.streamsQuota.quota - cc.streamsQuota.mu.Unlock() - if quota != 0 { + if cc.streamsQuota.quota != 0 { t.Fatalf("streamsQuota.quota got non-zero quota mistakenly.") } }