Merge pull request #1512 from venezia/add_reflection
Add reflection to gRPC API (configurable)
This commit is contained in:
		| @@ -12,11 +12,13 @@ Admins that wish to expose the gRPC service must add the following entry to the | ||||
| grpc: | ||||
|   # Cannot be the same address as an HTTP(S) service. | ||||
|   addr: 127.0.0.1:5557 | ||||
|   # Server certs. If TLS credentials aren't provided dex will generate self-signed ones. | ||||
|   # Server certs. If TLS credentials aren't provided dex will run in plaintext (HTTP) mode. | ||||
|   tlsCert: /etc/dex/grpc.crt | ||||
|   tlsKey: /etc/dex/grpc.key | ||||
|   # Client auth CA. | ||||
|   tlsClientCA: /etc/dex/client.crt | ||||
|   # enable reflection | ||||
|   reflection: true | ||||
| ``` | ||||
|  | ||||
| ## Generating clients | ||||
|   | ||||
| @@ -152,6 +152,7 @@ type GRPC struct { | ||||
| 	TLSCert     string `json:"tlsCert"` | ||||
| 	TLSKey      string `json:"tlsKey"` | ||||
| 	TLSClientCA string `json:"tlsClientCA"` | ||||
| 	Reflection  bool   `json:"reflection"` | ||||
| } | ||||
|  | ||||
| // Storage holds app's storage configuration. | ||||
|   | ||||
| @@ -21,6 +21,7 @@ import ( | ||||
| 	"github.com/spf13/cobra" | ||||
| 	"google.golang.org/grpc" | ||||
| 	"google.golang.org/grpc/credentials" | ||||
| 	"google.golang.org/grpc/reflection" | ||||
|  | ||||
| 	"github.com/dexidp/dex/api" | ||||
| 	"github.com/dexidp/dex/pkg/log" | ||||
| @@ -283,6 +284,10 @@ func serve(cmd *cobra.Command, args []string) error { | ||||
| 				s := grpc.NewServer(grpcOptions...) | ||||
| 				api.RegisterDexServer(s, server.NewAPI(serverConfig.Storage, logger)) | ||||
| 				grpcMetrics.InitializeMetrics(s) | ||||
| 				if c.GRPC.Reflection { | ||||
| 					logger.Info("enabling reflection in grpc service") | ||||
| 					reflection.Register(s) | ||||
| 				} | ||||
| 				err = s.Serve(list) | ||||
| 				return fmt.Errorf("listening on %s failed: %v", c.GRPC.Addr, err) | ||||
| 			}() | ||||
|   | ||||
							
								
								
									
										18
									
								
								vendor/google.golang.org/grpc/reflection/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								vendor/google.golang.org/grpc/reflection/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
| # Reflection | ||||
|  | ||||
| Package reflection implements server reflection service. | ||||
|  | ||||
| The service implemented is defined in: https://github.com/grpc/grpc/blob/master/src/proto/grpc/reflection/v1alpha/reflection.proto. | ||||
|  | ||||
| To register server reflection on a gRPC server: | ||||
| ```go | ||||
| import "google.golang.org/grpc/reflection" | ||||
|  | ||||
| s := grpc.NewServer() | ||||
| pb.RegisterYourOwnServer(s, &server{}) | ||||
|  | ||||
| // Register reflection service on gRPC server. | ||||
| reflection.Register(s) | ||||
|  | ||||
| s.Serve(lis) | ||||
| ``` | ||||
							
								
								
									
										939
									
								
								vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										939
									
								
								vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,939 @@ | ||||
| // Code generated by protoc-gen-go. DO NOT EDIT. | ||||
| // source: grpc_reflection_v1alpha/reflection.proto | ||||
|  | ||||
| package grpc_reflection_v1alpha | ||||
|  | ||||
| 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 | ||||
|  | ||||
| // The message sent by the client when calling ServerReflectionInfo method. | ||||
| type ServerReflectionRequest struct { | ||||
| 	Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` | ||||
| 	// To use reflection service, the client should set one of the following | ||||
| 	// fields in message_request. The server distinguishes requests by their | ||||
| 	// defined field and then handles them using corresponding methods. | ||||
| 	// | ||||
| 	// Types that are valid to be assigned to MessageRequest: | ||||
| 	//	*ServerReflectionRequest_FileByFilename | ||||
| 	//	*ServerReflectionRequest_FileContainingSymbol | ||||
| 	//	*ServerReflectionRequest_FileContainingExtension | ||||
| 	//	*ServerReflectionRequest_AllExtensionNumbersOfType | ||||
| 	//	*ServerReflectionRequest_ListServices | ||||
| 	MessageRequest       isServerReflectionRequest_MessageRequest `protobuf_oneof:"message_request"` | ||||
| 	XXX_NoUnkeyedLiteral struct{}                                 `json:"-"` | ||||
| 	XXX_unrecognized     []byte                                   `json:"-"` | ||||
| 	XXX_sizecache        int32                                    `json:"-"` | ||||
| } | ||||
|  | ||||
| func (m *ServerReflectionRequest) Reset()         { *m = ServerReflectionRequest{} } | ||||
| func (m *ServerReflectionRequest) String() string { return proto.CompactTextString(m) } | ||||
| func (*ServerReflectionRequest) ProtoMessage()    {} | ||||
| func (*ServerReflectionRequest) Descriptor() ([]byte, []int) { | ||||
| 	return fileDescriptor_reflection_178bd1e101bf8b63, []int{0} | ||||
| } | ||||
| func (m *ServerReflectionRequest) XXX_Unmarshal(b []byte) error { | ||||
| 	return xxx_messageInfo_ServerReflectionRequest.Unmarshal(m, b) | ||||
| } | ||||
| func (m *ServerReflectionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { | ||||
| 	return xxx_messageInfo_ServerReflectionRequest.Marshal(b, m, deterministic) | ||||
| } | ||||
| func (dst *ServerReflectionRequest) XXX_Merge(src proto.Message) { | ||||
| 	xxx_messageInfo_ServerReflectionRequest.Merge(dst, src) | ||||
| } | ||||
| func (m *ServerReflectionRequest) XXX_Size() int { | ||||
| 	return xxx_messageInfo_ServerReflectionRequest.Size(m) | ||||
| } | ||||
| func (m *ServerReflectionRequest) XXX_DiscardUnknown() { | ||||
| 	xxx_messageInfo_ServerReflectionRequest.DiscardUnknown(m) | ||||
| } | ||||
|  | ||||
| var xxx_messageInfo_ServerReflectionRequest proto.InternalMessageInfo | ||||
|  | ||||
| func (m *ServerReflectionRequest) GetHost() string { | ||||
| 	if m != nil { | ||||
| 		return m.Host | ||||
| 	} | ||||
| 	return "" | ||||
| } | ||||
|  | ||||
| type isServerReflectionRequest_MessageRequest interface { | ||||
| 	isServerReflectionRequest_MessageRequest() | ||||
| } | ||||
|  | ||||
| type ServerReflectionRequest_FileByFilename struct { | ||||
| 	FileByFilename string `protobuf:"bytes,3,opt,name=file_by_filename,json=fileByFilename,proto3,oneof"` | ||||
| } | ||||
|  | ||||
| type ServerReflectionRequest_FileContainingSymbol struct { | ||||
| 	FileContainingSymbol string `protobuf:"bytes,4,opt,name=file_containing_symbol,json=fileContainingSymbol,proto3,oneof"` | ||||
| } | ||||
|  | ||||
| type ServerReflectionRequest_FileContainingExtension struct { | ||||
| 	FileContainingExtension *ExtensionRequest `protobuf:"bytes,5,opt,name=file_containing_extension,json=fileContainingExtension,proto3,oneof"` | ||||
| } | ||||
|  | ||||
| type ServerReflectionRequest_AllExtensionNumbersOfType struct { | ||||
| 	AllExtensionNumbersOfType string `protobuf:"bytes,6,opt,name=all_extension_numbers_of_type,json=allExtensionNumbersOfType,proto3,oneof"` | ||||
| } | ||||
|  | ||||
| type ServerReflectionRequest_ListServices struct { | ||||
| 	ListServices string `protobuf:"bytes,7,opt,name=list_services,json=listServices,proto3,oneof"` | ||||
| } | ||||
|  | ||||
| func (*ServerReflectionRequest_FileByFilename) isServerReflectionRequest_MessageRequest() {} | ||||
|  | ||||
| func (*ServerReflectionRequest_FileContainingSymbol) isServerReflectionRequest_MessageRequest() {} | ||||
|  | ||||
| func (*ServerReflectionRequest_FileContainingExtension) isServerReflectionRequest_MessageRequest() {} | ||||
|  | ||||
| func (*ServerReflectionRequest_AllExtensionNumbersOfType) isServerReflectionRequest_MessageRequest() {} | ||||
|  | ||||
| func (*ServerReflectionRequest_ListServices) isServerReflectionRequest_MessageRequest() {} | ||||
|  | ||||
| func (m *ServerReflectionRequest) GetMessageRequest() isServerReflectionRequest_MessageRequest { | ||||
| 	if m != nil { | ||||
| 		return m.MessageRequest | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func (m *ServerReflectionRequest) GetFileByFilename() string { | ||||
| 	if x, ok := m.GetMessageRequest().(*ServerReflectionRequest_FileByFilename); ok { | ||||
| 		return x.FileByFilename | ||||
| 	} | ||||
| 	return "" | ||||
| } | ||||
|  | ||||
| func (m *ServerReflectionRequest) GetFileContainingSymbol() string { | ||||
| 	if x, ok := m.GetMessageRequest().(*ServerReflectionRequest_FileContainingSymbol); ok { | ||||
| 		return x.FileContainingSymbol | ||||
| 	} | ||||
| 	return "" | ||||
| } | ||||
|  | ||||
| func (m *ServerReflectionRequest) GetFileContainingExtension() *ExtensionRequest { | ||||
| 	if x, ok := m.GetMessageRequest().(*ServerReflectionRequest_FileContainingExtension); ok { | ||||
| 		return x.FileContainingExtension | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func (m *ServerReflectionRequest) GetAllExtensionNumbersOfType() string { | ||||
| 	if x, ok := m.GetMessageRequest().(*ServerReflectionRequest_AllExtensionNumbersOfType); ok { | ||||
| 		return x.AllExtensionNumbersOfType | ||||
| 	} | ||||
| 	return "" | ||||
| } | ||||
|  | ||||
| func (m *ServerReflectionRequest) GetListServices() string { | ||||
| 	if x, ok := m.GetMessageRequest().(*ServerReflectionRequest_ListServices); ok { | ||||
| 		return x.ListServices | ||||
| 	} | ||||
| 	return "" | ||||
| } | ||||
|  | ||||
| // XXX_OneofFuncs is for the internal use of the proto package. | ||||
| func (*ServerReflectionRequest) 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 _ServerReflectionRequest_OneofMarshaler, _ServerReflectionRequest_OneofUnmarshaler, _ServerReflectionRequest_OneofSizer, []interface{}{ | ||||
| 		(*ServerReflectionRequest_FileByFilename)(nil), | ||||
| 		(*ServerReflectionRequest_FileContainingSymbol)(nil), | ||||
| 		(*ServerReflectionRequest_FileContainingExtension)(nil), | ||||
| 		(*ServerReflectionRequest_AllExtensionNumbersOfType)(nil), | ||||
| 		(*ServerReflectionRequest_ListServices)(nil), | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func _ServerReflectionRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { | ||||
| 	m := msg.(*ServerReflectionRequest) | ||||
| 	// message_request | ||||
| 	switch x := m.MessageRequest.(type) { | ||||
| 	case *ServerReflectionRequest_FileByFilename: | ||||
| 		b.EncodeVarint(3<<3 | proto.WireBytes) | ||||
| 		b.EncodeStringBytes(x.FileByFilename) | ||||
| 	case *ServerReflectionRequest_FileContainingSymbol: | ||||
| 		b.EncodeVarint(4<<3 | proto.WireBytes) | ||||
| 		b.EncodeStringBytes(x.FileContainingSymbol) | ||||
| 	case *ServerReflectionRequest_FileContainingExtension: | ||||
| 		b.EncodeVarint(5<<3 | proto.WireBytes) | ||||
| 		if err := b.EncodeMessage(x.FileContainingExtension); err != nil { | ||||
| 			return err | ||||
| 		} | ||||
| 	case *ServerReflectionRequest_AllExtensionNumbersOfType: | ||||
| 		b.EncodeVarint(6<<3 | proto.WireBytes) | ||||
| 		b.EncodeStringBytes(x.AllExtensionNumbersOfType) | ||||
| 	case *ServerReflectionRequest_ListServices: | ||||
| 		b.EncodeVarint(7<<3 | proto.WireBytes) | ||||
| 		b.EncodeStringBytes(x.ListServices) | ||||
| 	case nil: | ||||
| 	default: | ||||
| 		return fmt.Errorf("ServerReflectionRequest.MessageRequest has unexpected type %T", x) | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func _ServerReflectionRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { | ||||
| 	m := msg.(*ServerReflectionRequest) | ||||
| 	switch tag { | ||||
| 	case 3: // message_request.file_by_filename | ||||
| 		if wire != proto.WireBytes { | ||||
| 			return true, proto.ErrInternalBadWireType | ||||
| 		} | ||||
| 		x, err := b.DecodeStringBytes() | ||||
| 		m.MessageRequest = &ServerReflectionRequest_FileByFilename{x} | ||||
| 		return true, err | ||||
| 	case 4: // message_request.file_containing_symbol | ||||
| 		if wire != proto.WireBytes { | ||||
| 			return true, proto.ErrInternalBadWireType | ||||
| 		} | ||||
| 		x, err := b.DecodeStringBytes() | ||||
| 		m.MessageRequest = &ServerReflectionRequest_FileContainingSymbol{x} | ||||
| 		return true, err | ||||
| 	case 5: // message_request.file_containing_extension | ||||
| 		if wire != proto.WireBytes { | ||||
| 			return true, proto.ErrInternalBadWireType | ||||
| 		} | ||||
| 		msg := new(ExtensionRequest) | ||||
| 		err := b.DecodeMessage(msg) | ||||
| 		m.MessageRequest = &ServerReflectionRequest_FileContainingExtension{msg} | ||||
| 		return true, err | ||||
| 	case 6: // message_request.all_extension_numbers_of_type | ||||
| 		if wire != proto.WireBytes { | ||||
| 			return true, proto.ErrInternalBadWireType | ||||
| 		} | ||||
| 		x, err := b.DecodeStringBytes() | ||||
| 		m.MessageRequest = &ServerReflectionRequest_AllExtensionNumbersOfType{x} | ||||
| 		return true, err | ||||
| 	case 7: // message_request.list_services | ||||
| 		if wire != proto.WireBytes { | ||||
| 			return true, proto.ErrInternalBadWireType | ||||
| 		} | ||||
| 		x, err := b.DecodeStringBytes() | ||||
| 		m.MessageRequest = &ServerReflectionRequest_ListServices{x} | ||||
| 		return true, err | ||||
| 	default: | ||||
| 		return false, nil | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func _ServerReflectionRequest_OneofSizer(msg proto.Message) (n int) { | ||||
| 	m := msg.(*ServerReflectionRequest) | ||||
| 	// message_request | ||||
| 	switch x := m.MessageRequest.(type) { | ||||
| 	case *ServerReflectionRequest_FileByFilename: | ||||
| 		n += 1 // tag and wire | ||||
| 		n += proto.SizeVarint(uint64(len(x.FileByFilename))) | ||||
| 		n += len(x.FileByFilename) | ||||
| 	case *ServerReflectionRequest_FileContainingSymbol: | ||||
| 		n += 1 // tag and wire | ||||
| 		n += proto.SizeVarint(uint64(len(x.FileContainingSymbol))) | ||||
| 		n += len(x.FileContainingSymbol) | ||||
| 	case *ServerReflectionRequest_FileContainingExtension: | ||||
| 		s := proto.Size(x.FileContainingExtension) | ||||
| 		n += 1 // tag and wire | ||||
| 		n += proto.SizeVarint(uint64(s)) | ||||
| 		n += s | ||||
| 	case *ServerReflectionRequest_AllExtensionNumbersOfType: | ||||
| 		n += 1 // tag and wire | ||||
| 		n += proto.SizeVarint(uint64(len(x.AllExtensionNumbersOfType))) | ||||
| 		n += len(x.AllExtensionNumbersOfType) | ||||
| 	case *ServerReflectionRequest_ListServices: | ||||
| 		n += 1 // tag and wire | ||||
| 		n += proto.SizeVarint(uint64(len(x.ListServices))) | ||||
| 		n += len(x.ListServices) | ||||
| 	case nil: | ||||
| 	default: | ||||
| 		panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) | ||||
| 	} | ||||
| 	return n | ||||
| } | ||||
|  | ||||
| // The type name and extension number sent by the client when requesting | ||||
| // file_containing_extension. | ||||
| type ExtensionRequest struct { | ||||
| 	// Fully-qualified type name. The format should be <package>.<type> | ||||
| 	ContainingType       string   `protobuf:"bytes,1,opt,name=containing_type,json=containingType,proto3" json:"containing_type,omitempty"` | ||||
| 	ExtensionNumber      int32    `protobuf:"varint,2,opt,name=extension_number,json=extensionNumber,proto3" json:"extension_number,omitempty"` | ||||
| 	XXX_NoUnkeyedLiteral struct{} `json:"-"` | ||||
| 	XXX_unrecognized     []byte   `json:"-"` | ||||
| 	XXX_sizecache        int32    `json:"-"` | ||||
| } | ||||
|  | ||||
| func (m *ExtensionRequest) Reset()         { *m = ExtensionRequest{} } | ||||
| func (m *ExtensionRequest) String() string { return proto.CompactTextString(m) } | ||||
| func (*ExtensionRequest) ProtoMessage()    {} | ||||
| func (*ExtensionRequest) Descriptor() ([]byte, []int) { | ||||
| 	return fileDescriptor_reflection_178bd1e101bf8b63, []int{1} | ||||
| } | ||||
| func (m *ExtensionRequest) XXX_Unmarshal(b []byte) error { | ||||
| 	return xxx_messageInfo_ExtensionRequest.Unmarshal(m, b) | ||||
| } | ||||
| func (m *ExtensionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { | ||||
| 	return xxx_messageInfo_ExtensionRequest.Marshal(b, m, deterministic) | ||||
| } | ||||
| func (dst *ExtensionRequest) XXX_Merge(src proto.Message) { | ||||
| 	xxx_messageInfo_ExtensionRequest.Merge(dst, src) | ||||
| } | ||||
| func (m *ExtensionRequest) XXX_Size() int { | ||||
| 	return xxx_messageInfo_ExtensionRequest.Size(m) | ||||
| } | ||||
| func (m *ExtensionRequest) XXX_DiscardUnknown() { | ||||
| 	xxx_messageInfo_ExtensionRequest.DiscardUnknown(m) | ||||
| } | ||||
|  | ||||
| var xxx_messageInfo_ExtensionRequest proto.InternalMessageInfo | ||||
|  | ||||
| func (m *ExtensionRequest) GetContainingType() string { | ||||
| 	if m != nil { | ||||
| 		return m.ContainingType | ||||
| 	} | ||||
| 	return "" | ||||
| } | ||||
|  | ||||
| func (m *ExtensionRequest) GetExtensionNumber() int32 { | ||||
| 	if m != nil { | ||||
| 		return m.ExtensionNumber | ||||
| 	} | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| // The message sent by the server to answer ServerReflectionInfo method. | ||||
| type ServerReflectionResponse struct { | ||||
| 	ValidHost       string                   `protobuf:"bytes,1,opt,name=valid_host,json=validHost,proto3" json:"valid_host,omitempty"` | ||||
| 	OriginalRequest *ServerReflectionRequest `protobuf:"bytes,2,opt,name=original_request,json=originalRequest,proto3" json:"original_request,omitempty"` | ||||
| 	// The server sets one of the following fields according to the | ||||
| 	// message_request in the request. | ||||
| 	// | ||||
| 	// Types that are valid to be assigned to MessageResponse: | ||||
| 	//	*ServerReflectionResponse_FileDescriptorResponse | ||||
| 	//	*ServerReflectionResponse_AllExtensionNumbersResponse | ||||
| 	//	*ServerReflectionResponse_ListServicesResponse | ||||
| 	//	*ServerReflectionResponse_ErrorResponse | ||||
| 	MessageResponse      isServerReflectionResponse_MessageResponse `protobuf_oneof:"message_response"` | ||||
| 	XXX_NoUnkeyedLiteral struct{}                                   `json:"-"` | ||||
| 	XXX_unrecognized     []byte                                     `json:"-"` | ||||
| 	XXX_sizecache        int32                                      `json:"-"` | ||||
| } | ||||
|  | ||||
| func (m *ServerReflectionResponse) Reset()         { *m = ServerReflectionResponse{} } | ||||
| func (m *ServerReflectionResponse) String() string { return proto.CompactTextString(m) } | ||||
| func (*ServerReflectionResponse) ProtoMessage()    {} | ||||
| func (*ServerReflectionResponse) Descriptor() ([]byte, []int) { | ||||
| 	return fileDescriptor_reflection_178bd1e101bf8b63, []int{2} | ||||
| } | ||||
| func (m *ServerReflectionResponse) XXX_Unmarshal(b []byte) error { | ||||
| 	return xxx_messageInfo_ServerReflectionResponse.Unmarshal(m, b) | ||||
| } | ||||
| func (m *ServerReflectionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { | ||||
| 	return xxx_messageInfo_ServerReflectionResponse.Marshal(b, m, deterministic) | ||||
| } | ||||
| func (dst *ServerReflectionResponse) XXX_Merge(src proto.Message) { | ||||
| 	xxx_messageInfo_ServerReflectionResponse.Merge(dst, src) | ||||
| } | ||||
| func (m *ServerReflectionResponse) XXX_Size() int { | ||||
| 	return xxx_messageInfo_ServerReflectionResponse.Size(m) | ||||
| } | ||||
| func (m *ServerReflectionResponse) XXX_DiscardUnknown() { | ||||
| 	xxx_messageInfo_ServerReflectionResponse.DiscardUnknown(m) | ||||
| } | ||||
|  | ||||
| var xxx_messageInfo_ServerReflectionResponse proto.InternalMessageInfo | ||||
|  | ||||
| func (m *ServerReflectionResponse) GetValidHost() string { | ||||
| 	if m != nil { | ||||
| 		return m.ValidHost | ||||
| 	} | ||||
| 	return "" | ||||
| } | ||||
|  | ||||
| func (m *ServerReflectionResponse) GetOriginalRequest() *ServerReflectionRequest { | ||||
| 	if m != nil { | ||||
| 		return m.OriginalRequest | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| type isServerReflectionResponse_MessageResponse interface { | ||||
| 	isServerReflectionResponse_MessageResponse() | ||||
| } | ||||
|  | ||||
| type ServerReflectionResponse_FileDescriptorResponse struct { | ||||
| 	FileDescriptorResponse *FileDescriptorResponse `protobuf:"bytes,4,opt,name=file_descriptor_response,json=fileDescriptorResponse,proto3,oneof"` | ||||
| } | ||||
|  | ||||
| type ServerReflectionResponse_AllExtensionNumbersResponse struct { | ||||
| 	AllExtensionNumbersResponse *ExtensionNumberResponse `protobuf:"bytes,5,opt,name=all_extension_numbers_response,json=allExtensionNumbersResponse,proto3,oneof"` | ||||
| } | ||||
|  | ||||
| type ServerReflectionResponse_ListServicesResponse struct { | ||||
| 	ListServicesResponse *ListServiceResponse `protobuf:"bytes,6,opt,name=list_services_response,json=listServicesResponse,proto3,oneof"` | ||||
| } | ||||
|  | ||||
| type ServerReflectionResponse_ErrorResponse struct { | ||||
| 	ErrorResponse *ErrorResponse `protobuf:"bytes,7,opt,name=error_response,json=errorResponse,proto3,oneof"` | ||||
| } | ||||
|  | ||||
| func (*ServerReflectionResponse_FileDescriptorResponse) isServerReflectionResponse_MessageResponse() {} | ||||
|  | ||||
| func (*ServerReflectionResponse_AllExtensionNumbersResponse) isServerReflectionResponse_MessageResponse() { | ||||
| } | ||||
|  | ||||
| func (*ServerReflectionResponse_ListServicesResponse) isServerReflectionResponse_MessageResponse() {} | ||||
|  | ||||
| func (*ServerReflectionResponse_ErrorResponse) isServerReflectionResponse_MessageResponse() {} | ||||
|  | ||||
| func (m *ServerReflectionResponse) GetMessageResponse() isServerReflectionResponse_MessageResponse { | ||||
| 	if m != nil { | ||||
| 		return m.MessageResponse | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func (m *ServerReflectionResponse) GetFileDescriptorResponse() *FileDescriptorResponse { | ||||
| 	if x, ok := m.GetMessageResponse().(*ServerReflectionResponse_FileDescriptorResponse); ok { | ||||
| 		return x.FileDescriptorResponse | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func (m *ServerReflectionResponse) GetAllExtensionNumbersResponse() *ExtensionNumberResponse { | ||||
| 	if x, ok := m.GetMessageResponse().(*ServerReflectionResponse_AllExtensionNumbersResponse); ok { | ||||
| 		return x.AllExtensionNumbersResponse | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func (m *ServerReflectionResponse) GetListServicesResponse() *ListServiceResponse { | ||||
| 	if x, ok := m.GetMessageResponse().(*ServerReflectionResponse_ListServicesResponse); ok { | ||||
| 		return x.ListServicesResponse | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func (m *ServerReflectionResponse) GetErrorResponse() *ErrorResponse { | ||||
| 	if x, ok := m.GetMessageResponse().(*ServerReflectionResponse_ErrorResponse); ok { | ||||
| 		return x.ErrorResponse | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| // XXX_OneofFuncs is for the internal use of the proto package. | ||||
| func (*ServerReflectionResponse) 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 _ServerReflectionResponse_OneofMarshaler, _ServerReflectionResponse_OneofUnmarshaler, _ServerReflectionResponse_OneofSizer, []interface{}{ | ||||
| 		(*ServerReflectionResponse_FileDescriptorResponse)(nil), | ||||
| 		(*ServerReflectionResponse_AllExtensionNumbersResponse)(nil), | ||||
| 		(*ServerReflectionResponse_ListServicesResponse)(nil), | ||||
| 		(*ServerReflectionResponse_ErrorResponse)(nil), | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func _ServerReflectionResponse_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { | ||||
| 	m := msg.(*ServerReflectionResponse) | ||||
| 	// message_response | ||||
| 	switch x := m.MessageResponse.(type) { | ||||
| 	case *ServerReflectionResponse_FileDescriptorResponse: | ||||
| 		b.EncodeVarint(4<<3 | proto.WireBytes) | ||||
| 		if err := b.EncodeMessage(x.FileDescriptorResponse); err != nil { | ||||
| 			return err | ||||
| 		} | ||||
| 	case *ServerReflectionResponse_AllExtensionNumbersResponse: | ||||
| 		b.EncodeVarint(5<<3 | proto.WireBytes) | ||||
| 		if err := b.EncodeMessage(x.AllExtensionNumbersResponse); err != nil { | ||||
| 			return err | ||||
| 		} | ||||
| 	case *ServerReflectionResponse_ListServicesResponse: | ||||
| 		b.EncodeVarint(6<<3 | proto.WireBytes) | ||||
| 		if err := b.EncodeMessage(x.ListServicesResponse); err != nil { | ||||
| 			return err | ||||
| 		} | ||||
| 	case *ServerReflectionResponse_ErrorResponse: | ||||
| 		b.EncodeVarint(7<<3 | proto.WireBytes) | ||||
| 		if err := b.EncodeMessage(x.ErrorResponse); err != nil { | ||||
| 			return err | ||||
| 		} | ||||
| 	case nil: | ||||
| 	default: | ||||
| 		return fmt.Errorf("ServerReflectionResponse.MessageResponse has unexpected type %T", x) | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func _ServerReflectionResponse_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { | ||||
| 	m := msg.(*ServerReflectionResponse) | ||||
| 	switch tag { | ||||
| 	case 4: // message_response.file_descriptor_response | ||||
| 		if wire != proto.WireBytes { | ||||
| 			return true, proto.ErrInternalBadWireType | ||||
| 		} | ||||
| 		msg := new(FileDescriptorResponse) | ||||
| 		err := b.DecodeMessage(msg) | ||||
| 		m.MessageResponse = &ServerReflectionResponse_FileDescriptorResponse{msg} | ||||
| 		return true, err | ||||
| 	case 5: // message_response.all_extension_numbers_response | ||||
| 		if wire != proto.WireBytes { | ||||
| 			return true, proto.ErrInternalBadWireType | ||||
| 		} | ||||
| 		msg := new(ExtensionNumberResponse) | ||||
| 		err := b.DecodeMessage(msg) | ||||
| 		m.MessageResponse = &ServerReflectionResponse_AllExtensionNumbersResponse{msg} | ||||
| 		return true, err | ||||
| 	case 6: // message_response.list_services_response | ||||
| 		if wire != proto.WireBytes { | ||||
| 			return true, proto.ErrInternalBadWireType | ||||
| 		} | ||||
| 		msg := new(ListServiceResponse) | ||||
| 		err := b.DecodeMessage(msg) | ||||
| 		m.MessageResponse = &ServerReflectionResponse_ListServicesResponse{msg} | ||||
| 		return true, err | ||||
| 	case 7: // message_response.error_response | ||||
| 		if wire != proto.WireBytes { | ||||
| 			return true, proto.ErrInternalBadWireType | ||||
| 		} | ||||
| 		msg := new(ErrorResponse) | ||||
| 		err := b.DecodeMessage(msg) | ||||
| 		m.MessageResponse = &ServerReflectionResponse_ErrorResponse{msg} | ||||
| 		return true, err | ||||
| 	default: | ||||
| 		return false, nil | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func _ServerReflectionResponse_OneofSizer(msg proto.Message) (n int) { | ||||
| 	m := msg.(*ServerReflectionResponse) | ||||
| 	// message_response | ||||
| 	switch x := m.MessageResponse.(type) { | ||||
| 	case *ServerReflectionResponse_FileDescriptorResponse: | ||||
| 		s := proto.Size(x.FileDescriptorResponse) | ||||
| 		n += 1 // tag and wire | ||||
| 		n += proto.SizeVarint(uint64(s)) | ||||
| 		n += s | ||||
| 	case *ServerReflectionResponse_AllExtensionNumbersResponse: | ||||
| 		s := proto.Size(x.AllExtensionNumbersResponse) | ||||
| 		n += 1 // tag and wire | ||||
| 		n += proto.SizeVarint(uint64(s)) | ||||
| 		n += s | ||||
| 	case *ServerReflectionResponse_ListServicesResponse: | ||||
| 		s := proto.Size(x.ListServicesResponse) | ||||
| 		n += 1 // tag and wire | ||||
| 		n += proto.SizeVarint(uint64(s)) | ||||
| 		n += s | ||||
| 	case *ServerReflectionResponse_ErrorResponse: | ||||
| 		s := proto.Size(x.ErrorResponse) | ||||
| 		n += 1 // tag and wire | ||||
| 		n += proto.SizeVarint(uint64(s)) | ||||
| 		n += s | ||||
| 	case nil: | ||||
| 	default: | ||||
| 		panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) | ||||
| 	} | ||||
| 	return n | ||||
| } | ||||
|  | ||||
| // Serialized FileDescriptorProto messages sent by the server answering | ||||
| // a file_by_filename, file_containing_symbol, or file_containing_extension | ||||
| // request. | ||||
| type FileDescriptorResponse struct { | ||||
| 	// Serialized FileDescriptorProto messages. We avoid taking a dependency on | ||||
| 	// descriptor.proto, which uses proto2 only features, by making them opaque | ||||
| 	// bytes instead. | ||||
| 	FileDescriptorProto  [][]byte `protobuf:"bytes,1,rep,name=file_descriptor_proto,json=fileDescriptorProto,proto3" json:"file_descriptor_proto,omitempty"` | ||||
| 	XXX_NoUnkeyedLiteral struct{} `json:"-"` | ||||
| 	XXX_unrecognized     []byte   `json:"-"` | ||||
| 	XXX_sizecache        int32    `json:"-"` | ||||
| } | ||||
|  | ||||
| func (m *FileDescriptorResponse) Reset()         { *m = FileDescriptorResponse{} } | ||||
| func (m *FileDescriptorResponse) String() string { return proto.CompactTextString(m) } | ||||
| func (*FileDescriptorResponse) ProtoMessage()    {} | ||||
| func (*FileDescriptorResponse) Descriptor() ([]byte, []int) { | ||||
| 	return fileDescriptor_reflection_178bd1e101bf8b63, []int{3} | ||||
| } | ||||
| func (m *FileDescriptorResponse) XXX_Unmarshal(b []byte) error { | ||||
| 	return xxx_messageInfo_FileDescriptorResponse.Unmarshal(m, b) | ||||
| } | ||||
| func (m *FileDescriptorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { | ||||
| 	return xxx_messageInfo_FileDescriptorResponse.Marshal(b, m, deterministic) | ||||
| } | ||||
| func (dst *FileDescriptorResponse) XXX_Merge(src proto.Message) { | ||||
| 	xxx_messageInfo_FileDescriptorResponse.Merge(dst, src) | ||||
| } | ||||
| func (m *FileDescriptorResponse) XXX_Size() int { | ||||
| 	return xxx_messageInfo_FileDescriptorResponse.Size(m) | ||||
| } | ||||
| func (m *FileDescriptorResponse) XXX_DiscardUnknown() { | ||||
| 	xxx_messageInfo_FileDescriptorResponse.DiscardUnknown(m) | ||||
| } | ||||
|  | ||||
| var xxx_messageInfo_FileDescriptorResponse proto.InternalMessageInfo | ||||
|  | ||||
| func (m *FileDescriptorResponse) GetFileDescriptorProto() [][]byte { | ||||
| 	if m != nil { | ||||
| 		return m.FileDescriptorProto | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| // A list of extension numbers sent by the server answering | ||||
| // all_extension_numbers_of_type request. | ||||
| type ExtensionNumberResponse struct { | ||||
| 	// Full name of the base type, including the package name. The format | ||||
| 	// is <package>.<type> | ||||
| 	BaseTypeName         string   `protobuf:"bytes,1,opt,name=base_type_name,json=baseTypeName,proto3" json:"base_type_name,omitempty"` | ||||
| 	ExtensionNumber      []int32  `protobuf:"varint,2,rep,packed,name=extension_number,json=extensionNumber,proto3" json:"extension_number,omitempty"` | ||||
| 	XXX_NoUnkeyedLiteral struct{} `json:"-"` | ||||
| 	XXX_unrecognized     []byte   `json:"-"` | ||||
| 	XXX_sizecache        int32    `json:"-"` | ||||
| } | ||||
|  | ||||
| func (m *ExtensionNumberResponse) Reset()         { *m = ExtensionNumberResponse{} } | ||||
| func (m *ExtensionNumberResponse) String() string { return proto.CompactTextString(m) } | ||||
| func (*ExtensionNumberResponse) ProtoMessage()    {} | ||||
| func (*ExtensionNumberResponse) Descriptor() ([]byte, []int) { | ||||
| 	return fileDescriptor_reflection_178bd1e101bf8b63, []int{4} | ||||
| } | ||||
| func (m *ExtensionNumberResponse) XXX_Unmarshal(b []byte) error { | ||||
| 	return xxx_messageInfo_ExtensionNumberResponse.Unmarshal(m, b) | ||||
| } | ||||
| func (m *ExtensionNumberResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { | ||||
| 	return xxx_messageInfo_ExtensionNumberResponse.Marshal(b, m, deterministic) | ||||
| } | ||||
| func (dst *ExtensionNumberResponse) XXX_Merge(src proto.Message) { | ||||
| 	xxx_messageInfo_ExtensionNumberResponse.Merge(dst, src) | ||||
| } | ||||
| func (m *ExtensionNumberResponse) XXX_Size() int { | ||||
| 	return xxx_messageInfo_ExtensionNumberResponse.Size(m) | ||||
| } | ||||
| func (m *ExtensionNumberResponse) XXX_DiscardUnknown() { | ||||
| 	xxx_messageInfo_ExtensionNumberResponse.DiscardUnknown(m) | ||||
| } | ||||
|  | ||||
| var xxx_messageInfo_ExtensionNumberResponse proto.InternalMessageInfo | ||||
|  | ||||
| func (m *ExtensionNumberResponse) GetBaseTypeName() string { | ||||
| 	if m != nil { | ||||
| 		return m.BaseTypeName | ||||
| 	} | ||||
| 	return "" | ||||
| } | ||||
|  | ||||
| func (m *ExtensionNumberResponse) GetExtensionNumber() []int32 { | ||||
| 	if m != nil { | ||||
| 		return m.ExtensionNumber | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| // A list of ServiceResponse sent by the server answering list_services request. | ||||
| type ListServiceResponse struct { | ||||
| 	// The information of each service may be expanded in the future, so we use | ||||
| 	// ServiceResponse message to encapsulate it. | ||||
| 	Service              []*ServiceResponse `protobuf:"bytes,1,rep,name=service,proto3" json:"service,omitempty"` | ||||
| 	XXX_NoUnkeyedLiteral struct{}           `json:"-"` | ||||
| 	XXX_unrecognized     []byte             `json:"-"` | ||||
| 	XXX_sizecache        int32              `json:"-"` | ||||
| } | ||||
|  | ||||
| func (m *ListServiceResponse) Reset()         { *m = ListServiceResponse{} } | ||||
| func (m *ListServiceResponse) String() string { return proto.CompactTextString(m) } | ||||
| func (*ListServiceResponse) ProtoMessage()    {} | ||||
| func (*ListServiceResponse) Descriptor() ([]byte, []int) { | ||||
| 	return fileDescriptor_reflection_178bd1e101bf8b63, []int{5} | ||||
| } | ||||
| func (m *ListServiceResponse) XXX_Unmarshal(b []byte) error { | ||||
| 	return xxx_messageInfo_ListServiceResponse.Unmarshal(m, b) | ||||
| } | ||||
| func (m *ListServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { | ||||
| 	return xxx_messageInfo_ListServiceResponse.Marshal(b, m, deterministic) | ||||
| } | ||||
| func (dst *ListServiceResponse) XXX_Merge(src proto.Message) { | ||||
| 	xxx_messageInfo_ListServiceResponse.Merge(dst, src) | ||||
| } | ||||
| func (m *ListServiceResponse) XXX_Size() int { | ||||
| 	return xxx_messageInfo_ListServiceResponse.Size(m) | ||||
| } | ||||
| func (m *ListServiceResponse) XXX_DiscardUnknown() { | ||||
| 	xxx_messageInfo_ListServiceResponse.DiscardUnknown(m) | ||||
| } | ||||
|  | ||||
| var xxx_messageInfo_ListServiceResponse proto.InternalMessageInfo | ||||
|  | ||||
| func (m *ListServiceResponse) GetService() []*ServiceResponse { | ||||
| 	if m != nil { | ||||
| 		return m.Service | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| // The information of a single service used by ListServiceResponse to answer | ||||
| // list_services request. | ||||
| type ServiceResponse struct { | ||||
| 	// Full name of a registered service, including its package name. The format | ||||
| 	// is <package>.<service> | ||||
| 	Name                 string   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` | ||||
| 	XXX_NoUnkeyedLiteral struct{} `json:"-"` | ||||
| 	XXX_unrecognized     []byte   `json:"-"` | ||||
| 	XXX_sizecache        int32    `json:"-"` | ||||
| } | ||||
|  | ||||
| func (m *ServiceResponse) Reset()         { *m = ServiceResponse{} } | ||||
| func (m *ServiceResponse) String() string { return proto.CompactTextString(m) } | ||||
| func (*ServiceResponse) ProtoMessage()    {} | ||||
| func (*ServiceResponse) Descriptor() ([]byte, []int) { | ||||
| 	return fileDescriptor_reflection_178bd1e101bf8b63, []int{6} | ||||
| } | ||||
| func (m *ServiceResponse) XXX_Unmarshal(b []byte) error { | ||||
| 	return xxx_messageInfo_ServiceResponse.Unmarshal(m, b) | ||||
| } | ||||
| func (m *ServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { | ||||
| 	return xxx_messageInfo_ServiceResponse.Marshal(b, m, deterministic) | ||||
| } | ||||
| func (dst *ServiceResponse) XXX_Merge(src proto.Message) { | ||||
| 	xxx_messageInfo_ServiceResponse.Merge(dst, src) | ||||
| } | ||||
| func (m *ServiceResponse) XXX_Size() int { | ||||
| 	return xxx_messageInfo_ServiceResponse.Size(m) | ||||
| } | ||||
| func (m *ServiceResponse) XXX_DiscardUnknown() { | ||||
| 	xxx_messageInfo_ServiceResponse.DiscardUnknown(m) | ||||
| } | ||||
|  | ||||
| var xxx_messageInfo_ServiceResponse proto.InternalMessageInfo | ||||
|  | ||||
| func (m *ServiceResponse) GetName() string { | ||||
| 	if m != nil { | ||||
| 		return m.Name | ||||
| 	} | ||||
| 	return "" | ||||
| } | ||||
|  | ||||
| // The error code and error message sent by the server when an error occurs. | ||||
| type ErrorResponse struct { | ||||
| 	// This field uses the error codes defined in grpc::StatusCode. | ||||
| 	ErrorCode            int32    `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3" json:"error_code,omitempty"` | ||||
| 	ErrorMessage         string   `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` | ||||
| 	XXX_NoUnkeyedLiteral struct{} `json:"-"` | ||||
| 	XXX_unrecognized     []byte   `json:"-"` | ||||
| 	XXX_sizecache        int32    `json:"-"` | ||||
| } | ||||
|  | ||||
| func (m *ErrorResponse) Reset()         { *m = ErrorResponse{} } | ||||
| func (m *ErrorResponse) String() string { return proto.CompactTextString(m) } | ||||
| func (*ErrorResponse) ProtoMessage()    {} | ||||
| func (*ErrorResponse) Descriptor() ([]byte, []int) { | ||||
| 	return fileDescriptor_reflection_178bd1e101bf8b63, []int{7} | ||||
| } | ||||
| func (m *ErrorResponse) XXX_Unmarshal(b []byte) error { | ||||
| 	return xxx_messageInfo_ErrorResponse.Unmarshal(m, b) | ||||
| } | ||||
| func (m *ErrorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { | ||||
| 	return xxx_messageInfo_ErrorResponse.Marshal(b, m, deterministic) | ||||
| } | ||||
| func (dst *ErrorResponse) XXX_Merge(src proto.Message) { | ||||
| 	xxx_messageInfo_ErrorResponse.Merge(dst, src) | ||||
| } | ||||
| func (m *ErrorResponse) XXX_Size() int { | ||||
| 	return xxx_messageInfo_ErrorResponse.Size(m) | ||||
| } | ||||
| func (m *ErrorResponse) XXX_DiscardUnknown() { | ||||
| 	xxx_messageInfo_ErrorResponse.DiscardUnknown(m) | ||||
| } | ||||
|  | ||||
| var xxx_messageInfo_ErrorResponse proto.InternalMessageInfo | ||||
|  | ||||
| func (m *ErrorResponse) GetErrorCode() int32 { | ||||
| 	if m != nil { | ||||
| 		return m.ErrorCode | ||||
| 	} | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| func (m *ErrorResponse) GetErrorMessage() string { | ||||
| 	if m != nil { | ||||
| 		return m.ErrorMessage | ||||
| 	} | ||||
| 	return "" | ||||
| } | ||||
|  | ||||
| func init() { | ||||
| 	proto.RegisterType((*ServerReflectionRequest)(nil), "grpc.reflection.v1alpha.ServerReflectionRequest") | ||||
| 	proto.RegisterType((*ExtensionRequest)(nil), "grpc.reflection.v1alpha.ExtensionRequest") | ||||
| 	proto.RegisterType((*ServerReflectionResponse)(nil), "grpc.reflection.v1alpha.ServerReflectionResponse") | ||||
| 	proto.RegisterType((*FileDescriptorResponse)(nil), "grpc.reflection.v1alpha.FileDescriptorResponse") | ||||
| 	proto.RegisterType((*ExtensionNumberResponse)(nil), "grpc.reflection.v1alpha.ExtensionNumberResponse") | ||||
| 	proto.RegisterType((*ListServiceResponse)(nil), "grpc.reflection.v1alpha.ListServiceResponse") | ||||
| 	proto.RegisterType((*ServiceResponse)(nil), "grpc.reflection.v1alpha.ServiceResponse") | ||||
| 	proto.RegisterType((*ErrorResponse)(nil), "grpc.reflection.v1alpha.ErrorResponse") | ||||
| } | ||||
|  | ||||
| // 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 | ||||
|  | ||||
| // ServerReflectionClient is the client API for ServerReflection service. | ||||
| // | ||||
| // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. | ||||
| type ServerReflectionClient interface { | ||||
| 	// The reflection service is structured as a bidirectional stream, ensuring | ||||
| 	// all related requests go to a single server. | ||||
| 	ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (ServerReflection_ServerReflectionInfoClient, error) | ||||
| } | ||||
|  | ||||
| type serverReflectionClient struct { | ||||
| 	cc *grpc.ClientConn | ||||
| } | ||||
|  | ||||
| func NewServerReflectionClient(cc *grpc.ClientConn) ServerReflectionClient { | ||||
| 	return &serverReflectionClient{cc} | ||||
| } | ||||
|  | ||||
| func (c *serverReflectionClient) ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (ServerReflection_ServerReflectionInfoClient, error) { | ||||
| 	stream, err := c.cc.NewStream(ctx, &_ServerReflection_serviceDesc.Streams[0], "/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo", opts...) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	x := &serverReflectionServerReflectionInfoClient{stream} | ||||
| 	return x, nil | ||||
| } | ||||
|  | ||||
| type ServerReflection_ServerReflectionInfoClient interface { | ||||
| 	Send(*ServerReflectionRequest) error | ||||
| 	Recv() (*ServerReflectionResponse, error) | ||||
| 	grpc.ClientStream | ||||
| } | ||||
|  | ||||
| type serverReflectionServerReflectionInfoClient struct { | ||||
| 	grpc.ClientStream | ||||
| } | ||||
|  | ||||
| func (x *serverReflectionServerReflectionInfoClient) Send(m *ServerReflectionRequest) error { | ||||
| 	return x.ClientStream.SendMsg(m) | ||||
| } | ||||
|  | ||||
| func (x *serverReflectionServerReflectionInfoClient) Recv() (*ServerReflectionResponse, error) { | ||||
| 	m := new(ServerReflectionResponse) | ||||
| 	if err := x.ClientStream.RecvMsg(m); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return m, nil | ||||
| } | ||||
|  | ||||
| // ServerReflectionServer is the server API for ServerReflection service. | ||||
| type ServerReflectionServer interface { | ||||
| 	// The reflection service is structured as a bidirectional stream, ensuring | ||||
| 	// all related requests go to a single server. | ||||
| 	ServerReflectionInfo(ServerReflection_ServerReflectionInfoServer) error | ||||
| } | ||||
|  | ||||
| func RegisterServerReflectionServer(s *grpc.Server, srv ServerReflectionServer) { | ||||
| 	s.RegisterService(&_ServerReflection_serviceDesc, srv) | ||||
| } | ||||
|  | ||||
| func _ServerReflection_ServerReflectionInfo_Handler(srv interface{}, stream grpc.ServerStream) error { | ||||
| 	return srv.(ServerReflectionServer).ServerReflectionInfo(&serverReflectionServerReflectionInfoServer{stream}) | ||||
| } | ||||
|  | ||||
| type ServerReflection_ServerReflectionInfoServer interface { | ||||
| 	Send(*ServerReflectionResponse) error | ||||
| 	Recv() (*ServerReflectionRequest, error) | ||||
| 	grpc.ServerStream | ||||
| } | ||||
|  | ||||
| type serverReflectionServerReflectionInfoServer struct { | ||||
| 	grpc.ServerStream | ||||
| } | ||||
|  | ||||
| func (x *serverReflectionServerReflectionInfoServer) Send(m *ServerReflectionResponse) error { | ||||
| 	return x.ServerStream.SendMsg(m) | ||||
| } | ||||
|  | ||||
| func (x *serverReflectionServerReflectionInfoServer) Recv() (*ServerReflectionRequest, error) { | ||||
| 	m := new(ServerReflectionRequest) | ||||
| 	if err := x.ServerStream.RecvMsg(m); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return m, nil | ||||
| } | ||||
|  | ||||
| var _ServerReflection_serviceDesc = grpc.ServiceDesc{ | ||||
| 	ServiceName: "grpc.reflection.v1alpha.ServerReflection", | ||||
| 	HandlerType: (*ServerReflectionServer)(nil), | ||||
| 	Methods:     []grpc.MethodDesc{}, | ||||
| 	Streams: []grpc.StreamDesc{ | ||||
| 		{ | ||||
| 			StreamName:    "ServerReflectionInfo", | ||||
| 			Handler:       _ServerReflection_ServerReflectionInfo_Handler, | ||||
| 			ServerStreams: true, | ||||
| 			ClientStreams: true, | ||||
| 		}, | ||||
| 	}, | ||||
| 	Metadata: "grpc_reflection_v1alpha/reflection.proto", | ||||
| } | ||||
|  | ||||
| func init() { | ||||
| 	proto.RegisterFile("grpc_reflection_v1alpha/reflection.proto", fileDescriptor_reflection_178bd1e101bf8b63) | ||||
| } | ||||
|  | ||||
| var fileDescriptor_reflection_178bd1e101bf8b63 = []byte{ | ||||
| 	// 656 bytes of a gzipped FileDescriptorProto | ||||
| 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x51, 0x73, 0xd2, 0x40, | ||||
| 	0x10, 0x6e, 0x5a, 0x68, 0x87, 0x85, 0x02, 0x5e, 0x2b, 0xa4, 0x3a, 0x75, 0x98, 0x68, 0x35, 0x75, | ||||
| 	0x1c, 0xda, 0xe2, 0x8c, 0x3f, 0x80, 0xaa, 0x83, 0x33, 0xb5, 0x75, 0x0e, 0x5f, 0x1c, 0x1f, 0x6e, | ||||
| 	0x02, 0x2c, 0x34, 0x1a, 0x72, 0xf1, 0x2e, 0x45, 0x79, 0xf2, 0x47, 0xf8, 0xa3, 0xfc, 0x4b, 0x3e, | ||||
| 	0x3a, 0x77, 0x09, 0x21, 0xa4, 0x44, 0xa7, 0x4f, 0x30, 0xdf, 0xee, 0xde, 0xb7, 0xbb, 0xdf, 0xb7, | ||||
| 	0x01, 0x7b, 0x22, 0x82, 0x21, 0x13, 0x38, 0xf6, 0x70, 0x18, 0xba, 0xdc, 0x67, 0xb3, 0x33, 0xc7, | ||||
| 	0x0b, 0xae, 0x9d, 0x93, 0x25, 0xd4, 0x0e, 0x04, 0x0f, 0x39, 0x69, 0xaa, 0xcc, 0x76, 0x0a, 0x8e, | ||||
| 	0x33, 0xad, 0x3f, 0x9b, 0xd0, 0xec, 0xa3, 0x98, 0xa1, 0xa0, 0x49, 0x90, 0xe2, 0xb7, 0x1b, 0x94, | ||||
| 	0x21, 0x21, 0x50, 0xb8, 0xe6, 0x32, 0x34, 0x8d, 0x96, 0x61, 0x97, 0xa8, 0xfe, 0x4f, 0x9e, 0x43, | ||||
| 	0x7d, 0xec, 0x7a, 0xc8, 0x06, 0x73, 0xa6, 0x7e, 0x7d, 0x67, 0x8a, 0xe6, 0x96, 0x8a, 0xf7, 0x36, | ||||
| 	0x68, 0x55, 0x21, 0xdd, 0xf9, 0xdb, 0x18, 0x27, 0xaf, 0xa0, 0xa1, 0x73, 0x87, 0xdc, 0x0f, 0x1d, | ||||
| 	0xd7, 0x77, 0xfd, 0x09, 0x93, 0xf3, 0xe9, 0x80, 0x7b, 0x66, 0x21, 0xae, 0xd8, 0x57, 0xf1, 0xf3, | ||||
| 	0x24, 0xdc, 0xd7, 0x51, 0x32, 0x81, 0x83, 0x6c, 0x1d, 0xfe, 0x08, 0xd1, 0x97, 0x2e, 0xf7, 0xcd, | ||||
| 	0x62, 0xcb, 0xb0, 0xcb, 0x9d, 0xe3, 0x76, 0xce, 0x40, 0xed, 0x37, 0x8b, 0xcc, 0x78, 0x8a, 0xde, | ||||
| 	0x06, 0x6d, 0xae, 0xb2, 0x24, 0x19, 0xa4, 0x0b, 0x87, 0x8e, 0xe7, 0x2d, 0x1f, 0x67, 0xfe, 0xcd, | ||||
| 	0x74, 0x80, 0x42, 0x32, 0x3e, 0x66, 0xe1, 0x3c, 0x40, 0x73, 0x3b, 0xee, 0xf3, 0xc0, 0xf1, 0xbc, | ||||
| 	0xa4, 0xec, 0x32, 0x4a, 0xba, 0x1a, 0x7f, 0x9c, 0x07, 0x48, 0x8e, 0x60, 0xd7, 0x73, 0x65, 0xc8, | ||||
| 	0x24, 0x8a, 0x99, 0x3b, 0x44, 0x69, 0xee, 0xc4, 0x35, 0x15, 0x05, 0xf7, 0x63, 0xb4, 0x7b, 0x0f, | ||||
| 	0x6a, 0x53, 0x94, 0xd2, 0x99, 0x20, 0x13, 0x51, 0x63, 0xd6, 0x18, 0xea, 0xd9, 0x66, 0xc9, 0x33, | ||||
| 	0xa8, 0xa5, 0xa6, 0xd6, 0x3d, 0x44, 0xdb, 0xaf, 0x2e, 0x61, 0x4d, 0x7b, 0x0c, 0xf5, 0x6c, 0xdb, | ||||
| 	0xe6, 0x66, 0xcb, 0xb0, 0x8b, 0xb4, 0x86, 0xab, 0x8d, 0x5a, 0xbf, 0x0b, 0x60, 0xde, 0x96, 0x58, | ||||
| 	0x06, 0xdc, 0x97, 0x48, 0x0e, 0x01, 0x66, 0x8e, 0xe7, 0x8e, 0x58, 0x4a, 0xe9, 0x92, 0x46, 0x7a, | ||||
| 	0x4a, 0xee, 0xcf, 0x50, 0xe7, 0xc2, 0x9d, 0xb8, 0xbe, 0xe3, 0x2d, 0xfa, 0xd6, 0x34, 0xe5, 0xce, | ||||
| 	0x69, 0xae, 0x02, 0x39, 0x76, 0xa2, 0xb5, 0xc5, 0x4b, 0x8b, 0x61, 0xbf, 0x82, 0xa9, 0x75, 0x1e, | ||||
| 	0xa1, 0x1c, 0x0a, 0x37, 0x08, 0xb9, 0x60, 0x22, 0xee, 0x4b, 0x3b, 0xa4, 0xdc, 0x39, 0xc9, 0x25, | ||||
| 	0x51, 0x26, 0x7b, 0x9d, 0xd4, 0x2d, 0xc6, 0xe9, 0x6d, 0x50, 0x6d, 0xb9, 0xdb, 0x11, 0xf2, 0x1d, | ||||
| 	0x1e, 0xad, 0xd7, 0x3a, 0xa1, 0x2c, 0xfe, 0x67, 0xae, 0x8c, 0x01, 0x52, 0x9c, 0x0f, 0xd7, 0xd8, | ||||
| 	0x23, 0x21, 0x1e, 0x41, 0x63, 0xc5, 0x20, 0x4b, 0xc2, 0x6d, 0x4d, 0xf8, 0x22, 0x97, 0xf0, 0x62, | ||||
| 	0x69, 0xa0, 0x14, 0xd9, 0x7e, 0xda, 0x57, 0x09, 0xcb, 0x15, 0x54, 0x51, 0x88, 0xf4, 0x06, 0x77, | ||||
| 	0xf4, 0xeb, 0x4f, 0xf3, 0xc7, 0x51, 0xe9, 0xa9, 0x77, 0x77, 0x31, 0x0d, 0x74, 0x09, 0xd4, 0x97, | ||||
| 	0x86, 0x8d, 0x30, 0xeb, 0x02, 0x1a, 0xeb, 0xf7, 0x4e, 0x3a, 0x70, 0x3f, 0x2b, 0xa5, 0xfe, 0xf0, | ||||
| 	0x98, 0x46, 0x6b, 0xcb, 0xae, 0xd0, 0xbd, 0x55, 0x51, 0x3e, 0xa8, 0x90, 0xf5, 0x05, 0x9a, 0x39, | ||||
| 	0x2b, 0x25, 0x4f, 0xa0, 0x3a, 0x70, 0x24, 0xea, 0x03, 0x60, 0xfa, 0x1b, 0x13, 0x39, 0xb3, 0xa2, | ||||
| 	0x50, 0xe5, 0xff, 0x4b, 0xf5, 0x7d, 0x59, 0x7f, 0x03, 0x5b, 0xeb, 0x6e, 0xe0, 0x13, 0xec, 0xad, | ||||
| 	0xd9, 0x26, 0xe9, 0xc2, 0x4e, 0x2c, 0x8b, 0x6e, 0xb4, 0xdc, 0xb1, 0xff, 0xe9, 0xea, 0x54, 0x29, | ||||
| 	0x5d, 0x14, 0x5a, 0x47, 0x50, 0xcb, 0x3e, 0x4b, 0xa0, 0x90, 0x6a, 0x5a, 0xff, 0xb7, 0xfa, 0xb0, | ||||
| 	0xbb, 0xb2, 0x71, 0x75, 0x79, 0x91, 0x62, 0x43, 0x3e, 0x8a, 0x52, 0x8b, 0xb4, 0xa4, 0x91, 0x73, | ||||
| 	0x3e, 0x42, 0xf2, 0x18, 0x22, 0x41, 0x58, 0xac, 0x82, 0x3e, 0xbb, 0x12, 0xad, 0x68, 0xf0, 0x7d, | ||||
| 	0x84, 0x75, 0x7e, 0x19, 0x50, 0xcf, 0x9e, 0x1b, 0xf9, 0x09, 0xfb, 0x59, 0xec, 0x9d, 0x3f, 0xe6, | ||||
| 	0xe4, 0xce, 0x17, 0xfb, 0xe0, 0xec, 0x0e, 0x15, 0xd1, 0x54, 0xb6, 0x71, 0x6a, 0x0c, 0xb6, 0xb5, | ||||
| 	0xf4, 0x2f, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x85, 0x02, 0x09, 0x9d, 0x9f, 0x06, 0x00, 0x00, | ||||
| } | ||||
							
								
								
									
										136
									
								
								vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.proto
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										136
									
								
								vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.proto
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,136 @@ | ||||
| // Copyright 2016 gRPC authors. | ||||
| // | ||||
| // 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. | ||||
|  | ||||
| // Service exported by server reflection | ||||
|  | ||||
| syntax = "proto3"; | ||||
|  | ||||
| package grpc.reflection.v1alpha; | ||||
|  | ||||
| service ServerReflection { | ||||
|   // The reflection service is structured as a bidirectional stream, ensuring | ||||
|   // all related requests go to a single server. | ||||
|   rpc ServerReflectionInfo(stream ServerReflectionRequest) | ||||
|       returns (stream ServerReflectionResponse); | ||||
| } | ||||
|  | ||||
| // The message sent by the client when calling ServerReflectionInfo method. | ||||
| message ServerReflectionRequest { | ||||
|   string host = 1; | ||||
|   // To use reflection service, the client should set one of the following | ||||
|   // fields in message_request. The server distinguishes requests by their | ||||
|   // defined field and then handles them using corresponding methods. | ||||
|   oneof message_request { | ||||
|     // Find a proto file by the file name. | ||||
|     string file_by_filename = 3; | ||||
|  | ||||
|     // Find the proto file that declares the given fully-qualified symbol name. | ||||
|     // This field should be a fully-qualified symbol name | ||||
|     // (e.g. <package>.<service>[.<method>] or <package>.<type>). | ||||
|     string file_containing_symbol = 4; | ||||
|  | ||||
|     // Find the proto file which defines an extension extending the given | ||||
|     // message type with the given field number. | ||||
|     ExtensionRequest file_containing_extension = 5; | ||||
|  | ||||
|     // Finds the tag numbers used by all known extensions of extendee_type, and | ||||
|     // appends them to ExtensionNumberResponse in an undefined order. | ||||
|     // Its corresponding method is best-effort: it's not guaranteed that the | ||||
|     // reflection service will implement this method, and it's not guaranteed | ||||
|     // that this method will provide all extensions. Returns | ||||
|     // StatusCode::UNIMPLEMENTED if it's not implemented. | ||||
|     // This field should be a fully-qualified type name. The format is | ||||
|     // <package>.<type> | ||||
|     string all_extension_numbers_of_type = 6; | ||||
|  | ||||
|     // List the full names of registered services. The content will not be | ||||
|     // checked. | ||||
|     string list_services = 7; | ||||
|   } | ||||
| } | ||||
|  | ||||
| // The type name and extension number sent by the client when requesting | ||||
| // file_containing_extension. | ||||
| message ExtensionRequest { | ||||
|   // Fully-qualified type name. The format should be <package>.<type> | ||||
|   string containing_type = 1; | ||||
|   int32 extension_number = 2; | ||||
| } | ||||
|  | ||||
| // The message sent by the server to answer ServerReflectionInfo method. | ||||
| message ServerReflectionResponse { | ||||
|   string valid_host = 1; | ||||
|   ServerReflectionRequest original_request = 2; | ||||
|   // The server sets one of the following fields according to the | ||||
|   // message_request in the request. | ||||
|   oneof message_response { | ||||
|     // This message is used to answer file_by_filename, file_containing_symbol, | ||||
|     // file_containing_extension requests with transitive dependencies. | ||||
|     // As the repeated label is not allowed in oneof fields, we use a | ||||
|     // FileDescriptorResponse message to encapsulate the repeated fields. | ||||
|     // The reflection service is allowed to avoid sending FileDescriptorProtos | ||||
|     // that were previously sent in response to earlier requests in the stream. | ||||
|     FileDescriptorResponse file_descriptor_response = 4; | ||||
|  | ||||
|     // This message is used to answer all_extension_numbers_of_type requests. | ||||
|     ExtensionNumberResponse all_extension_numbers_response = 5; | ||||
|  | ||||
|     // This message is used to answer list_services requests. | ||||
|     ListServiceResponse list_services_response = 6; | ||||
|  | ||||
|     // This message is used when an error occurs. | ||||
|     ErrorResponse error_response = 7; | ||||
|   } | ||||
| } | ||||
|  | ||||
| // Serialized FileDescriptorProto messages sent by the server answering | ||||
| // a file_by_filename, file_containing_symbol, or file_containing_extension | ||||
| // request. | ||||
| message FileDescriptorResponse { | ||||
|   // Serialized FileDescriptorProto messages. We avoid taking a dependency on | ||||
|   // descriptor.proto, which uses proto2 only features, by making them opaque | ||||
|   // bytes instead. | ||||
|   repeated bytes file_descriptor_proto = 1; | ||||
| } | ||||
|  | ||||
| // A list of extension numbers sent by the server answering | ||||
| // all_extension_numbers_of_type request. | ||||
| message ExtensionNumberResponse { | ||||
|   // Full name of the base type, including the package name. The format | ||||
|   // is <package>.<type> | ||||
|   string base_type_name = 1; | ||||
|   repeated int32 extension_number = 2; | ||||
| } | ||||
|  | ||||
| // A list of ServiceResponse sent by the server answering list_services request. | ||||
| message ListServiceResponse { | ||||
|   // The information of each service may be expanded in the future, so we use | ||||
|   // ServiceResponse message to encapsulate it. | ||||
|   repeated ServiceResponse service = 1; | ||||
| } | ||||
|  | ||||
| // The information of a single service used by ListServiceResponse to answer | ||||
| // list_services request. | ||||
| message ServiceResponse { | ||||
|   // Full name of a registered service, including its package name. The format | ||||
|   // is <package>.<service> | ||||
|   string name = 1; | ||||
| } | ||||
|  | ||||
| // The error code and error message sent by the server when an error occurs. | ||||
| message ErrorResponse { | ||||
|   // This field uses the error codes defined in grpc::StatusCode. | ||||
|   int32 error_code = 1; | ||||
|   string error_message = 2; | ||||
| } | ||||
							
								
								
									
										454
									
								
								vendor/google.golang.org/grpc/reflection/serverreflection.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										454
									
								
								vendor/google.golang.org/grpc/reflection/serverreflection.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,454 @@ | ||||
| /* | ||||
|  * | ||||
|  * Copyright 2016 gRPC authors. | ||||
|  * | ||||
|  * 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. | ||||
|  * | ||||
|  */ | ||||
|  | ||||
| //go:generate protoc --go_out=plugins=grpc:. grpc_reflection_v1alpha/reflection.proto | ||||
|  | ||||
| /* | ||||
| Package reflection implements server reflection service. | ||||
|  | ||||
| The service implemented is defined in: | ||||
| https://github.com/grpc/grpc/blob/master/src/proto/grpc/reflection/v1alpha/reflection.proto. | ||||
|  | ||||
| To register server reflection on a gRPC server: | ||||
| 	import "google.golang.org/grpc/reflection" | ||||
|  | ||||
| 	s := grpc.NewServer() | ||||
| 	pb.RegisterYourOwnServer(s, &server{}) | ||||
|  | ||||
| 	// Register reflection service on gRPC server. | ||||
| 	reflection.Register(s) | ||||
|  | ||||
| 	s.Serve(lis) | ||||
|  | ||||
| */ | ||||
| package reflection // import "google.golang.org/grpc/reflection" | ||||
|  | ||||
| import ( | ||||
| 	"bytes" | ||||
| 	"compress/gzip" | ||||
| 	"fmt" | ||||
| 	"io" | ||||
| 	"io/ioutil" | ||||
| 	"reflect" | ||||
| 	"sort" | ||||
| 	"sync" | ||||
|  | ||||
| 	"github.com/golang/protobuf/proto" | ||||
| 	dpb "github.com/golang/protobuf/protoc-gen-go/descriptor" | ||||
| 	"google.golang.org/grpc" | ||||
| 	"google.golang.org/grpc/codes" | ||||
| 	rpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha" | ||||
| 	"google.golang.org/grpc/status" | ||||
| ) | ||||
|  | ||||
| type serverReflectionServer struct { | ||||
| 	s *grpc.Server | ||||
|  | ||||
| 	initSymbols  sync.Once | ||||
| 	serviceNames []string | ||||
| 	symbols      map[string]*dpb.FileDescriptorProto // map of fully-qualified names to files | ||||
| } | ||||
|  | ||||
| // Register registers the server reflection service on the given gRPC server. | ||||
| func Register(s *grpc.Server) { | ||||
| 	rpb.RegisterServerReflectionServer(s, &serverReflectionServer{ | ||||
| 		s: s, | ||||
| 	}) | ||||
| } | ||||
|  | ||||
| // protoMessage is used for type assertion on proto messages. | ||||
| // Generated proto message implements function Descriptor(), but Descriptor() | ||||
| // is not part of interface proto.Message. This interface is needed to | ||||
| // call Descriptor(). | ||||
| type protoMessage interface { | ||||
| 	Descriptor() ([]byte, []int) | ||||
| } | ||||
|  | ||||
| func (s *serverReflectionServer) getSymbols() (svcNames []string, symbolIndex map[string]*dpb.FileDescriptorProto) { | ||||
| 	s.initSymbols.Do(func() { | ||||
| 		serviceInfo := s.s.GetServiceInfo() | ||||
|  | ||||
| 		s.symbols = map[string]*dpb.FileDescriptorProto{} | ||||
| 		s.serviceNames = make([]string, 0, len(serviceInfo)) | ||||
| 		processed := map[string]struct{}{} | ||||
| 		for svc, info := range serviceInfo { | ||||
| 			s.serviceNames = append(s.serviceNames, svc) | ||||
| 			fdenc, ok := parseMetadata(info.Metadata) | ||||
| 			if !ok { | ||||
| 				continue | ||||
| 			} | ||||
| 			fd, err := decodeFileDesc(fdenc) | ||||
| 			if err != nil { | ||||
| 				continue | ||||
| 			} | ||||
| 			s.processFile(fd, processed) | ||||
| 		} | ||||
| 		sort.Strings(s.serviceNames) | ||||
| 	}) | ||||
|  | ||||
| 	return s.serviceNames, s.symbols | ||||
| } | ||||
|  | ||||
| func (s *serverReflectionServer) processFile(fd *dpb.FileDescriptorProto, processed map[string]struct{}) { | ||||
| 	filename := fd.GetName() | ||||
| 	if _, ok := processed[filename]; ok { | ||||
| 		return | ||||
| 	} | ||||
| 	processed[filename] = struct{}{} | ||||
|  | ||||
| 	prefix := fd.GetPackage() | ||||
|  | ||||
| 	for _, msg := range fd.MessageType { | ||||
| 		s.processMessage(fd, prefix, msg) | ||||
| 	} | ||||
| 	for _, en := range fd.EnumType { | ||||
| 		s.processEnum(fd, prefix, en) | ||||
| 	} | ||||
| 	for _, ext := range fd.Extension { | ||||
| 		s.processField(fd, prefix, ext) | ||||
| 	} | ||||
| 	for _, svc := range fd.Service { | ||||
| 		svcName := fqn(prefix, svc.GetName()) | ||||
| 		s.symbols[svcName] = fd | ||||
| 		for _, meth := range svc.Method { | ||||
| 			name := fqn(svcName, meth.GetName()) | ||||
| 			s.symbols[name] = fd | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	for _, dep := range fd.Dependency { | ||||
| 		fdenc := proto.FileDescriptor(dep) | ||||
| 		fdDep, err := decodeFileDesc(fdenc) | ||||
| 		if err != nil { | ||||
| 			continue | ||||
| 		} | ||||
| 		s.processFile(fdDep, processed) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (s *serverReflectionServer) processMessage(fd *dpb.FileDescriptorProto, prefix string, msg *dpb.DescriptorProto) { | ||||
| 	msgName := fqn(prefix, msg.GetName()) | ||||
| 	s.symbols[msgName] = fd | ||||
|  | ||||
| 	for _, nested := range msg.NestedType { | ||||
| 		s.processMessage(fd, msgName, nested) | ||||
| 	} | ||||
| 	for _, en := range msg.EnumType { | ||||
| 		s.processEnum(fd, msgName, en) | ||||
| 	} | ||||
| 	for _, ext := range msg.Extension { | ||||
| 		s.processField(fd, msgName, ext) | ||||
| 	} | ||||
| 	for _, fld := range msg.Field { | ||||
| 		s.processField(fd, msgName, fld) | ||||
| 	} | ||||
| 	for _, oneof := range msg.OneofDecl { | ||||
| 		oneofName := fqn(msgName, oneof.GetName()) | ||||
| 		s.symbols[oneofName] = fd | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (s *serverReflectionServer) processEnum(fd *dpb.FileDescriptorProto, prefix string, en *dpb.EnumDescriptorProto) { | ||||
| 	enName := fqn(prefix, en.GetName()) | ||||
| 	s.symbols[enName] = fd | ||||
|  | ||||
| 	for _, val := range en.Value { | ||||
| 		valName := fqn(enName, val.GetName()) | ||||
| 		s.symbols[valName] = fd | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (s *serverReflectionServer) processField(fd *dpb.FileDescriptorProto, prefix string, fld *dpb.FieldDescriptorProto) { | ||||
| 	fldName := fqn(prefix, fld.GetName()) | ||||
| 	s.symbols[fldName] = fd | ||||
| } | ||||
|  | ||||
| func fqn(prefix, name string) string { | ||||
| 	if prefix == "" { | ||||
| 		return name | ||||
| 	} | ||||
| 	return prefix + "." + name | ||||
| } | ||||
|  | ||||
| // fileDescForType gets the file descriptor for the given type. | ||||
| // The given type should be a proto message. | ||||
| func (s *serverReflectionServer) fileDescForType(st reflect.Type) (*dpb.FileDescriptorProto, error) { | ||||
| 	m, ok := reflect.Zero(reflect.PtrTo(st)).Interface().(protoMessage) | ||||
| 	if !ok { | ||||
| 		return nil, fmt.Errorf("failed to create message from type: %v", st) | ||||
| 	} | ||||
| 	enc, _ := m.Descriptor() | ||||
|  | ||||
| 	return decodeFileDesc(enc) | ||||
| } | ||||
|  | ||||
| // decodeFileDesc does decompression and unmarshalling on the given | ||||
| // file descriptor byte slice. | ||||
| func decodeFileDesc(enc []byte) (*dpb.FileDescriptorProto, error) { | ||||
| 	raw, err := decompress(enc) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to decompress enc: %v", err) | ||||
| 	} | ||||
|  | ||||
| 	fd := new(dpb.FileDescriptorProto) | ||||
| 	if err := proto.Unmarshal(raw, fd); err != nil { | ||||
| 		return nil, fmt.Errorf("bad descriptor: %v", err) | ||||
| 	} | ||||
| 	return fd, nil | ||||
| } | ||||
|  | ||||
| // decompress does gzip decompression. | ||||
| 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) | ||||
| 	} | ||||
| 	out, err := ioutil.ReadAll(r) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("bad gzipped descriptor: %v", err) | ||||
| 	} | ||||
| 	return out, nil | ||||
| } | ||||
|  | ||||
| func typeForName(name string) (reflect.Type, error) { | ||||
| 	pt := proto.MessageType(name) | ||||
| 	if pt == nil { | ||||
| 		return nil, fmt.Errorf("unknown type: %q", name) | ||||
| 	} | ||||
| 	st := pt.Elem() | ||||
|  | ||||
| 	return st, nil | ||||
| } | ||||
|  | ||||
| func fileDescContainingExtension(st reflect.Type, ext int32) (*dpb.FileDescriptorProto, error) { | ||||
| 	m, ok := reflect.Zero(reflect.PtrTo(st)).Interface().(proto.Message) | ||||
| 	if !ok { | ||||
| 		return nil, fmt.Errorf("failed to create message from type: %v", st) | ||||
| 	} | ||||
|  | ||||
| 	var extDesc *proto.ExtensionDesc | ||||
| 	for id, desc := range proto.RegisteredExtensions(m) { | ||||
| 		if id == ext { | ||||
| 			extDesc = desc | ||||
| 			break | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if extDesc == nil { | ||||
| 		return nil, fmt.Errorf("failed to find registered extension for extension number %v", ext) | ||||
| 	} | ||||
|  | ||||
| 	return decodeFileDesc(proto.FileDescriptor(extDesc.Filename)) | ||||
| } | ||||
|  | ||||
| func (s *serverReflectionServer) allExtensionNumbersForType(st reflect.Type) ([]int32, error) { | ||||
| 	m, ok := reflect.Zero(reflect.PtrTo(st)).Interface().(proto.Message) | ||||
| 	if !ok { | ||||
| 		return nil, fmt.Errorf("failed to create message from type: %v", st) | ||||
| 	} | ||||
|  | ||||
| 	exts := proto.RegisteredExtensions(m) | ||||
| 	out := make([]int32, 0, len(exts)) | ||||
| 	for id := range exts { | ||||
| 		out = append(out, id) | ||||
| 	} | ||||
| 	return out, nil | ||||
| } | ||||
|  | ||||
| // fileDescEncodingByFilename finds the file descriptor for given filename, | ||||
| // does marshalling on it and returns the marshalled result. | ||||
| func (s *serverReflectionServer) fileDescEncodingByFilename(name string) ([]byte, error) { | ||||
| 	enc := proto.FileDescriptor(name) | ||||
| 	if enc == nil { | ||||
| 		return nil, fmt.Errorf("unknown file: %v", name) | ||||
| 	} | ||||
| 	fd, err := decodeFileDesc(enc) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return proto.Marshal(fd) | ||||
| } | ||||
|  | ||||
| // parseMetadata finds the file descriptor bytes specified meta. | ||||
| // For SupportPackageIsVersion4, m is the name of the proto file, we | ||||
| // call proto.FileDescriptor to get the byte slice. | ||||
| // For SupportPackageIsVersion3, m is a byte slice itself. | ||||
| func parseMetadata(meta interface{}) ([]byte, bool) { | ||||
| 	// Check if meta is the file name. | ||||
| 	if fileNameForMeta, ok := meta.(string); ok { | ||||
| 		return proto.FileDescriptor(fileNameForMeta), true | ||||
| 	} | ||||
|  | ||||
| 	// Check if meta is the byte slice. | ||||
| 	if enc, ok := meta.([]byte); ok { | ||||
| 		return enc, true | ||||
| 	} | ||||
|  | ||||
| 	return nil, false | ||||
| } | ||||
|  | ||||
| // fileDescEncodingContainingSymbol finds the file descriptor containing the given symbol, | ||||
| // does marshalling on it and returns the marshalled result. | ||||
| // The given symbol can be a type, a service or a method. | ||||
| func (s *serverReflectionServer) fileDescEncodingContainingSymbol(name string) ([]byte, error) { | ||||
| 	_, symbols := s.getSymbols() | ||||
| 	fd := symbols[name] | ||||
| 	if fd == nil { | ||||
| 		// Check if it's a type name that was not present in the | ||||
| 		// transitive dependencies of the registered services. | ||||
| 		if st, err := typeForName(name); err == nil { | ||||
| 			fd, err = s.fileDescForType(st) | ||||
| 			if err != nil { | ||||
| 				return nil, err | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if fd == nil { | ||||
| 		return nil, fmt.Errorf("unknown symbol: %v", name) | ||||
| 	} | ||||
|  | ||||
| 	return proto.Marshal(fd) | ||||
| } | ||||
|  | ||||
| // fileDescEncodingContainingExtension finds the file descriptor containing given extension, | ||||
| // does marshalling on it and returns the marshalled result. | ||||
| func (s *serverReflectionServer) fileDescEncodingContainingExtension(typeName string, extNum int32) ([]byte, error) { | ||||
| 	st, err := typeForName(typeName) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	fd, err := fileDescContainingExtension(st, extNum) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return proto.Marshal(fd) | ||||
| } | ||||
|  | ||||
| // allExtensionNumbersForTypeName returns all extension numbers for the given type. | ||||
| func (s *serverReflectionServer) allExtensionNumbersForTypeName(name string) ([]int32, error) { | ||||
| 	st, err := typeForName(name) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	extNums, err := s.allExtensionNumbersForType(st) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return extNums, nil | ||||
| } | ||||
|  | ||||
| // ServerReflectionInfo is the reflection service handler. | ||||
| func (s *serverReflectionServer) ServerReflectionInfo(stream rpb.ServerReflection_ServerReflectionInfoServer) error { | ||||
| 	for { | ||||
| 		in, err := stream.Recv() | ||||
| 		if err == io.EOF { | ||||
| 			return nil | ||||
| 		} | ||||
| 		if err != nil { | ||||
| 			return err | ||||
| 		} | ||||
|  | ||||
| 		out := &rpb.ServerReflectionResponse{ | ||||
| 			ValidHost:       in.Host, | ||||
| 			OriginalRequest: in, | ||||
| 		} | ||||
| 		switch req := in.MessageRequest.(type) { | ||||
| 		case *rpb.ServerReflectionRequest_FileByFilename: | ||||
| 			b, err := s.fileDescEncodingByFilename(req.FileByFilename) | ||||
| 			if err != nil { | ||||
| 				out.MessageResponse = &rpb.ServerReflectionResponse_ErrorResponse{ | ||||
| 					ErrorResponse: &rpb.ErrorResponse{ | ||||
| 						ErrorCode:    int32(codes.NotFound), | ||||
| 						ErrorMessage: err.Error(), | ||||
| 					}, | ||||
| 				} | ||||
| 			} else { | ||||
| 				out.MessageResponse = &rpb.ServerReflectionResponse_FileDescriptorResponse{ | ||||
| 					FileDescriptorResponse: &rpb.FileDescriptorResponse{FileDescriptorProto: [][]byte{b}}, | ||||
| 				} | ||||
| 			} | ||||
| 		case *rpb.ServerReflectionRequest_FileContainingSymbol: | ||||
| 			b, err := s.fileDescEncodingContainingSymbol(req.FileContainingSymbol) | ||||
| 			if err != nil { | ||||
| 				out.MessageResponse = &rpb.ServerReflectionResponse_ErrorResponse{ | ||||
| 					ErrorResponse: &rpb.ErrorResponse{ | ||||
| 						ErrorCode:    int32(codes.NotFound), | ||||
| 						ErrorMessage: err.Error(), | ||||
| 					}, | ||||
| 				} | ||||
| 			} else { | ||||
| 				out.MessageResponse = &rpb.ServerReflectionResponse_FileDescriptorResponse{ | ||||
| 					FileDescriptorResponse: &rpb.FileDescriptorResponse{FileDescriptorProto: [][]byte{b}}, | ||||
| 				} | ||||
| 			} | ||||
| 		case *rpb.ServerReflectionRequest_FileContainingExtension: | ||||
| 			typeName := req.FileContainingExtension.ContainingType | ||||
| 			extNum := req.FileContainingExtension.ExtensionNumber | ||||
| 			b, err := s.fileDescEncodingContainingExtension(typeName, extNum) | ||||
| 			if err != nil { | ||||
| 				out.MessageResponse = &rpb.ServerReflectionResponse_ErrorResponse{ | ||||
| 					ErrorResponse: &rpb.ErrorResponse{ | ||||
| 						ErrorCode:    int32(codes.NotFound), | ||||
| 						ErrorMessage: err.Error(), | ||||
| 					}, | ||||
| 				} | ||||
| 			} else { | ||||
| 				out.MessageResponse = &rpb.ServerReflectionResponse_FileDescriptorResponse{ | ||||
| 					FileDescriptorResponse: &rpb.FileDescriptorResponse{FileDescriptorProto: [][]byte{b}}, | ||||
| 				} | ||||
| 			} | ||||
| 		case *rpb.ServerReflectionRequest_AllExtensionNumbersOfType: | ||||
| 			extNums, err := s.allExtensionNumbersForTypeName(req.AllExtensionNumbersOfType) | ||||
| 			if err != nil { | ||||
| 				out.MessageResponse = &rpb.ServerReflectionResponse_ErrorResponse{ | ||||
| 					ErrorResponse: &rpb.ErrorResponse{ | ||||
| 						ErrorCode:    int32(codes.NotFound), | ||||
| 						ErrorMessage: err.Error(), | ||||
| 					}, | ||||
| 				} | ||||
| 			} else { | ||||
| 				out.MessageResponse = &rpb.ServerReflectionResponse_AllExtensionNumbersResponse{ | ||||
| 					AllExtensionNumbersResponse: &rpb.ExtensionNumberResponse{ | ||||
| 						BaseTypeName:    req.AllExtensionNumbersOfType, | ||||
| 						ExtensionNumber: extNums, | ||||
| 					}, | ||||
| 				} | ||||
| 			} | ||||
| 		case *rpb.ServerReflectionRequest_ListServices: | ||||
| 			svcNames, _ := s.getSymbols() | ||||
| 			serviceResponses := make([]*rpb.ServiceResponse, len(svcNames)) | ||||
| 			for i, n := range svcNames { | ||||
| 				serviceResponses[i] = &rpb.ServiceResponse{ | ||||
| 					Name: n, | ||||
| 				} | ||||
| 			} | ||||
| 			out.MessageResponse = &rpb.ServerReflectionResponse_ListServicesResponse{ | ||||
| 				ListServicesResponse: &rpb.ListServiceResponse{ | ||||
| 					Service: serviceResponses, | ||||
| 				}, | ||||
| 			} | ||||
| 		default: | ||||
| 			return status.Errorf(codes.InvalidArgument, "invalid MessageRequest: %v", in.MessageRequest) | ||||
| 		} | ||||
|  | ||||
| 		if err := stream.Send(out); err != nil { | ||||
| 			return err | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										8
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							| @@ -31,10 +31,10 @@ github.com/golang/protobuf/protoc-gen-go | ||||
| github.com/golang/protobuf/proto | ||||
| github.com/golang/protobuf/protoc-gen-go/generator | ||||
| github.com/golang/protobuf/protoc-gen-go/grpc | ||||
| github.com/golang/protobuf/ptypes | ||||
| github.com/golang/protobuf/protoc-gen-go/descriptor | ||||
| github.com/golang/protobuf/protoc-gen-go/generator/internal/remap | ||||
| github.com/golang/protobuf/protoc-gen-go/plugin | ||||
| github.com/golang/protobuf/ptypes | ||||
| github.com/golang/protobuf/ptypes/any | ||||
| github.com/golang/protobuf/ptypes/duration | ||||
| github.com/golang/protobuf/ptypes/timestamp | ||||
| @@ -141,10 +141,12 @@ google.golang.org/appengine/internal/remote_api | ||||
| google.golang.org/genproto/googleapis/rpc/status | ||||
| # google.golang.org/grpc v1.22.1 | ||||
| google.golang.org/grpc | ||||
| google.golang.org/grpc/codes | ||||
| google.golang.org/grpc/status | ||||
| google.golang.org/grpc/credentials | ||||
| google.golang.org/grpc/reflection | ||||
| google.golang.org/grpc/balancer | ||||
| google.golang.org/grpc/balancer/roundrobin | ||||
| google.golang.org/grpc/codes | ||||
| google.golang.org/grpc/connectivity | ||||
| google.golang.org/grpc/encoding | ||||
| google.golang.org/grpc/encoding/proto | ||||
| @@ -167,9 +169,9 @@ google.golang.org/grpc/resolver/dns | ||||
| google.golang.org/grpc/resolver/passthrough | ||||
| google.golang.org/grpc/serviceconfig | ||||
| google.golang.org/grpc/stats | ||||
| google.golang.org/grpc/status | ||||
| google.golang.org/grpc/tap | ||||
| google.golang.org/grpc/credentials/internal | ||||
| google.golang.org/grpc/reflection/grpc_reflection_v1alpha | ||||
| google.golang.org/grpc/health/grpc_health_v1 | ||||
| google.golang.org/grpc/balancer/base | ||||
| google.golang.org/grpc/binarylog/grpc_binarylog_v1 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user