From e5c3df5b2f0a1ffc4cb755cbe6b30b435e35de37 Mon Sep 17 00:00:00 2001 From: Daniel Low Date: Thu, 21 Jul 2016 15:00:04 +0100 Subject: [PATCH] Fix compatibility with latest grpc library --- options.go | 4 +- patch/get_transport.go | 11 + proxy.go | 7 +- testservice/test.pb.go | 762 ++++++++++++++++++++++++++++++++++++++--- 4 files changed, 739 insertions(+), 45 deletions(-) create mode 100644 patch/get_transport.go diff --git a/options.go b/options.go index 4150b59..4f24fcb 100644 --- a/options.go +++ b/options.go @@ -18,7 +18,7 @@ import ( ) type options struct { - creds credentials.Credentials + creds credentials.TransportCredentials logger grpclog.Logger maxConcurrentStreams uint32 } @@ -43,7 +43,7 @@ func MaxConcurrentStreams(n uint32) ProxyOption { } // Creds returns a ProxyOption that sets credentials for server connections. -func Creds(c credentials.Credentials) ProxyOption { +func Creds(c credentials.TransportCredentials) ProxyOption { return func(o *options) { o.creds = c } diff --git a/patch/get_transport.go b/patch/get_transport.go new file mode 100644 index 0000000..562d23e --- /dev/null +++ b/patch/get_transport.go @@ -0,0 +1,11 @@ +package grpc + +import ( + "golang.org/x/net/context" + "google.golang.org/grpc/transport" +) + +// GetTransport returns the balancer of the connection. +func (cc *ClientConn) GetTransport(ctx context.Context) (transport.ClientTransport, func(), error) { + return cc.getTransport(ctx, BalancerGetOptions{}) +} diff --git a/proxy.go b/proxy.go index dbef917..dacac2a 100644 --- a/proxy.go +++ b/proxy.go @@ -84,7 +84,7 @@ func (s *Proxy) Serve(lis net.Listener) error { return err } var authInfo credentials.AuthInfo = nil - if creds, ok := s.opts.creds.(credentials.TransportAuthenticator); ok { + if creds, ok := s.opts.creds.(credentials.TransportCredentials); ok { var conn net.Conn conn, authInfo, err = creds.ServerHandshake(c) if err != nil { @@ -206,8 +206,9 @@ func backendTransportStream(director StreamDirector, ctx context.Context) (trans return nil, nil, grpc.Errorf(codes.Aborted, "cant dial to backend: %v", err) } } - // TODO(michal): ClientConn.Picker() IS NOT IN UPSTREAM GRPC! https://github.com/grpc/grpc-go/pull/397 - backendTrans, err := grpcConn.Picker().Pick(ctx) + // TODO(michal): ClientConn.GetTransport() IS NOT IN UPSTREAM GRPC! + // To make this work, copy patch/get_transport.go to google.golang.org/grpc/ + backendTrans, _, err := grpcConn.GetTransport(ctx) frontendStream, _ := transport.StreamFromContext(ctx) callHdr := &transport.CallHdr{ Method: frontendStream.Method(), diff --git a/testservice/test.pb.go b/testservice/test.pb.go index 022348b..0d5d9e3 100644 --- a/testservice/test.pb.go +++ b/testservice/test.pb.go @@ -1,62 +1,233 @@ -// Code generated by protoc-gen-go. +// Code generated by protoc-gen-gogo. // source: test.proto // DO NOT EDIT! /* -Package mwitkow_testproto is a generated protocol buffer package. + Package mwitkow_testproto is a generated protocol buffer package. -It is generated from these files: - test.proto + It is generated from these files: + test.proto -It has these top-level messages: - Empty - PingRequest - PingResponse + It has these top-level messages: + Empty + PingRequest + PingResponse */ package mwitkow_testproto import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" + +import "math" + +import "fmt" +import "strings" +import github_com_golang_protobuf_proto "github.com/golang/protobuf/proto" +import "sort" +import "strconv" +import "reflect" import ( context "golang.org/x/net/context" grpc "google.golang.org/grpc" ) +import "io" + // 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. +const _ = proto.ProtoPackageIsVersion1 + type Empty struct { } -func (m *Empty) Reset() { *m = Empty{} } -func (m *Empty) String() string { return proto.CompactTextString(m) } -func (*Empty) ProtoMessage() {} +func (m *Empty) Reset() { *m = Empty{} } +func (m *Empty) String() string { return proto.CompactTextString(m) } +func (*Empty) ProtoMessage() {} +func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptorTest, []int{0} } type PingRequest struct { - Value string `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"` + Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` } -func (m *PingRequest) Reset() { *m = PingRequest{} } -func (m *PingRequest) String() string { return proto.CompactTextString(m) } -func (*PingRequest) ProtoMessage() {} +func (m *PingRequest) Reset() { *m = PingRequest{} } +func (m *PingRequest) String() string { return proto.CompactTextString(m) } +func (*PingRequest) ProtoMessage() {} +func (*PingRequest) Descriptor() ([]byte, []int) { return fileDescriptorTest, []int{1} } type PingResponse struct { - Value string `protobuf:"bytes,1,opt,name=Value" json:"Value,omitempty"` - Counter int32 `protobuf:"varint,2,opt,name=counter" json:"counter,omitempty"` + Value string `protobuf:"bytes,1,opt,name=Value,json=value,proto3" json:"Value,omitempty"` + Counter int32 `protobuf:"varint,2,opt,name=counter,proto3" json:"counter,omitempty"` +} + +func (m *PingResponse) Reset() { *m = PingResponse{} } +func (m *PingResponse) String() string { return proto.CompactTextString(m) } +func (*PingResponse) ProtoMessage() {} +func (*PingResponse) Descriptor() ([]byte, []int) { return fileDescriptorTest, []int{2} } + +func init() { + proto.RegisterType((*Empty)(nil), "mwitkow.testproto.Empty") + proto.RegisterType((*PingRequest)(nil), "mwitkow.testproto.PingRequest") + proto.RegisterType((*PingResponse)(nil), "mwitkow.testproto.PingResponse") +} +func (this *Empty) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*Empty) + if !ok { + that2, ok := that.(Empty) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + return true +} +func (this *PingRequest) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*PingRequest) + if !ok { + that2, ok := that.(PingRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if this.Value != that1.Value { + return false + } + return true } +func (this *PingResponse) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } -func (m *PingResponse) Reset() { *m = PingResponse{} } -func (m *PingResponse) String() string { return proto.CompactTextString(m) } -func (*PingResponse) ProtoMessage() {} + that1, ok := that.(*PingResponse) + if !ok { + that2, ok := that.(PingResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if this.Value != that1.Value { + return false + } + if this.Counter != that1.Counter { + return false + } + return true +} +func (this *Empty) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 4) + s = append(s, "&mwitkow_testproto.Empty{") + s = append(s, "}") + return strings.Join(s, "") +} +func (this *PingRequest) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&mwitkow_testproto.PingRequest{") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func (this *PingResponse) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&mwitkow_testproto.PingResponse{") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + s = append(s, "Counter: "+fmt.Sprintf("%#v", this.Counter)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringTest(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func extensionToGoStringTest(e map[int32]github_com_golang_protobuf_proto.Extension) string { + if e == nil { + return "nil" + } + s := "map[int32]proto.Extension{" + keys := make([]int, 0, len(e)) + for k := range e { + keys = append(keys, int(k)) + } + sort.Ints(keys) + ss := []string{} + for _, k := range keys { + ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) + } + s += strings.Join(ss, ",") + "}" + return s +} // 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.SupportPackageIsVersion3 + // Client API for TestService service type TestServiceClient interface { @@ -102,7 +273,7 @@ func (c *testServiceClient) PingError(ctx context.Context, in *PingRequest, opts } func (c *testServiceClient) PingList(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (TestService_PingListClient, error) { - stream, err := grpc.NewClientStream(ctx, &_TestService_serviceDesc.Streams[0], c.cc, "/mwitkow.testproto.TestService/PingList", opts...) + stream, err := grpc.NewClientStream(ctx, &TestService_serviceDesc.Streams[0], c.cc, "/mwitkow.testproto.TestService/PingList", opts...) if err != nil { return nil, err } @@ -143,43 +314,61 @@ type TestServiceServer interface { } func RegisterTestServiceServer(s *grpc.Server, srv TestServiceServer) { - s.RegisterService(&_TestService_serviceDesc, srv) + s.RegisterService(&TestService_serviceDesc, srv) } -func _TestService_PingEmpty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _TestService_PingEmpty_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 } - out, err := srv.(TestServiceServer).PingEmpty(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(TestServiceServer).PingEmpty(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/mwitkow.testproto.TestService/PingEmpty", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TestServiceServer).PingEmpty(ctx, req.(*Empty)) + } + return interceptor(ctx, in, info, handler) } -func _TestService_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _TestService_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(PingRequest) if err := dec(in); err != nil { return nil, err } - out, err := srv.(TestServiceServer).Ping(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(TestServiceServer).Ping(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/mwitkow.testproto.TestService/Ping", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TestServiceServer).Ping(ctx, req.(*PingRequest)) + } + return interceptor(ctx, in, info, handler) } -func _TestService_PingError_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { +func _TestService_PingError_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(PingRequest) if err := dec(in); err != nil { return nil, err } - out, err := srv.(TestServiceServer).PingError(ctx, in) - if err != nil { - return nil, err + if interceptor == nil { + return srv.(TestServiceServer).PingError(ctx, in) } - return out, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/mwitkow.testproto.TestService/PingError", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TestServiceServer).PingError(ctx, req.(*PingRequest)) + } + return interceptor(ctx, in, info, handler) } func _TestService_PingList_Handler(srv interface{}, stream grpc.ServerStream) error { @@ -203,7 +392,7 @@ func (x *testServicePingListServer) Send(m *PingResponse) error { return x.ServerStream.SendMsg(m) } -var _TestService_serviceDesc = grpc.ServiceDesc{ +var TestService_serviceDesc = grpc.ServiceDesc{ ServiceName: "mwitkow.testproto.TestService", HandlerType: (*TestServiceServer)(nil), Methods: []grpc.MethodDesc{ @@ -227,4 +416,497 @@ var _TestService_serviceDesc = grpc.ServiceDesc{ ServerStreams: true, }, }, + Metadata: fileDescriptorTest, +} + +func (m *Empty) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *Empty) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + return i, nil +} + +func (m *PingRequest) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *PingRequest) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Value) > 0 { + data[i] = 0xa + i++ + i = encodeVarintTest(data, i, uint64(len(m.Value))) + i += copy(data[i:], m.Value) + } + return i, nil +} + +func (m *PingResponse) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *PingResponse) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Value) > 0 { + data[i] = 0xa + i++ + i = encodeVarintTest(data, i, uint64(len(m.Value))) + i += copy(data[i:], m.Value) + } + if m.Counter != 0 { + data[i] = 0x10 + i++ + i = encodeVarintTest(data, i, uint64(m.Counter)) + } + return i, nil +} + +func encodeFixed64Test(data []byte, offset int, v uint64) int { + data[offset] = uint8(v) + data[offset+1] = uint8(v >> 8) + data[offset+2] = uint8(v >> 16) + data[offset+3] = uint8(v >> 24) + data[offset+4] = uint8(v >> 32) + data[offset+5] = uint8(v >> 40) + data[offset+6] = uint8(v >> 48) + data[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Test(data []byte, offset int, v uint32) int { + data[offset] = uint8(v) + data[offset+1] = uint8(v >> 8) + data[offset+2] = uint8(v >> 16) + data[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintTest(data []byte, offset int, v uint64) int { + for v >= 1<<7 { + data[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + data[offset] = uint8(v) + return offset + 1 +} +func (m *Empty) Size() (n int) { + var l int + _ = l + return n +} + +func (m *PingRequest) Size() (n int) { + var l int + _ = l + l = len(m.Value) + if l > 0 { + n += 1 + l + sovTest(uint64(l)) + } + return n +} + +func (m *PingResponse) Size() (n int) { + var l int + _ = l + l = len(m.Value) + if l > 0 { + n += 1 + l + sovTest(uint64(l)) + } + if m.Counter != 0 { + n += 1 + sovTest(uint64(m.Counter)) + } + return n +} + +func sovTest(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozTest(x uint64) (n int) { + return sovTest(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Empty) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Empty: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Empty: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTest(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTest + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PingRequest) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PingRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PingRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTest + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(data[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTest(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTest + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PingResponse) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PingResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PingResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTest + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(data[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Counter", wireType) + } + m.Counter = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + m.Counter |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTest(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTest + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTest(data []byte) (n int, err error) { + l := len(data) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTest + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTest + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if data[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTest + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthTest + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTest + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipTest(data[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthTest = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTest = fmt.Errorf("proto: integer overflow") +) + +var fileDescriptorTest = []byte{ + // 244 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, 0x12, 0xcc, 0x2d, 0xcf, 0x2c, 0xc9, 0xce, 0x2f, 0xd7, + 0x03, 0x89, 0x81, 0x85, 0x94, 0xd8, 0xb9, 0x58, 0x5d, 0x73, 0x0b, 0x4a, 0x2a, 0x95, 0x94, 0xb9, + 0xb8, 0x03, 0x32, 0xf3, 0xd2, 0x83, 0x52, 0x0b, 0x4b, 0x81, 0x92, 0x42, 0x22, 0x5c, 0xac, 0x65, + 0x89, 0x39, 0xa5, 0xa9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x10, 0x8e, 0x92, 0x1d, 0x17, + 0x0f, 0x44, 0x51, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0x2a, 0x48, 0x55, 0x18, 0x86, 0x2a, 0x21, 0x09, + 0x2e, 0xf6, 0xe4, 0xfc, 0xd2, 0xbc, 0x92, 0xd4, 0x22, 0x09, 0x26, 0xa0, 0x38, 0x6b, 0x10, 0x8c, + 0x6b, 0xb4, 0x87, 0x89, 0x8b, 0x3b, 0x04, 0x68, 0x7c, 0x70, 0x6a, 0x51, 0x59, 0x66, 0x72, 0xaa, + 0x90, 0x07, 0x17, 0x27, 0xc8, 0x3c, 0xb0, 0x0b, 0x84, 0x24, 0xf4, 0x30, 0x9c, 0xa7, 0x07, 0x96, + 0x91, 0x92, 0xc7, 0x22, 0x83, 0xec, 0x0e, 0x25, 0x06, 0x21, 0x4f, 0x2e, 0x16, 0x90, 0x88, 0x90, + 0x1c, 0x4e, 0xa5, 0x60, 0x7f, 0x11, 0x63, 0x94, 0x3b, 0xd4, 0x51, 0x45, 0x45, 0xf9, 0x45, 0x04, + 0xcd, 0xc3, 0xe9, 0x68, 0xa0, 0x41, 0xfe, 0x5c, 0x1c, 0x20, 0xa5, 0x3e, 0x99, 0xc0, 0xf0, 0xa4, + 0xdc, 0x5d, 0x06, 0x8c, 0x4e, 0x0a, 0x17, 0x1e, 0xca, 0x31, 0x7c, 0x78, 0x28, 0xc7, 0xb8, 0xe2, + 0x91, 0x1c, 0xe3, 0x09, 0x20, 0xbe, 0x00, 0xc4, 0x0f, 0x80, 0x78, 0xc2, 0x63, 0x39, 0x86, 0x19, + 0x40, 0x9c, 0xc4, 0x06, 0xd6, 0x69, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xcf, 0x30, 0xf3, 0xf0, + 0xf6, 0x01, 0x00, 0x00, }