snapshot of https://github.com/grpc/grpc-go.git (master, 2026-09-15; blobs > 131072B omitted)
Some checks failed
codecov / upload (push) Failing after 13m59s
CodeQL / Analyze (push) Failing after 1s
govulncheck / govulncheck (.) (push) Failing after 1s
govulncheck / govulncheck (./cmd/protoc-gen-go-grpc) (push) Failing after 1s
govulncheck / govulncheck (./gcp/observability) (push) Failing after 1s
govulncheck / govulncheck (./security/advancedtls) (push) Failing after 1s
govulncheck / govulncheck (./stats/opencensus) (push) Failing after 1s
Testing / vet-proto (push) Failing after 1s
Testing / tests (arm, latest) (push) Waiting to run
Testing / extras (latest) (push) Failing after 1s
Testing / static checks (latest-1) (push) Failing after 1s
Testing / tests (-race, latest) (push) Failing after 1s
Testing / tests (i386, latest) (push) Failing after 1s
Testing / tests (latest) (push) Failing after 1s
Testing / tests (latest-1) (push) Failing after 1s
Lock Threads / lock (push) Failing after 1s
Stale bot / stale (push) Failing after 1s
Some checks failed
codecov / upload (push) Failing after 13m59s
CodeQL / Analyze (push) Failing after 1s
govulncheck / govulncheck (.) (push) Failing after 1s
govulncheck / govulncheck (./cmd/protoc-gen-go-grpc) (push) Failing after 1s
govulncheck / govulncheck (./gcp/observability) (push) Failing after 1s
govulncheck / govulncheck (./security/advancedtls) (push) Failing after 1s
govulncheck / govulncheck (./stats/opencensus) (push) Failing after 1s
Testing / vet-proto (push) Failing after 1s
Testing / tests (arm, latest) (push) Waiting to run
Testing / extras (latest) (push) Failing after 1s
Testing / static checks (latest-1) (push) Failing after 1s
Testing / tests (-race, latest) (push) Failing after 1s
Testing / tests (i386, latest) (push) Failing after 1s
Testing / tests (latest) (push) Failing after 1s
Testing / tests (latest-1) (push) Failing after 1s
Lock Threads / lock (push) Failing after 1s
Stale bot / stale (push) Failing after 1s
This commit is contained in:
18
reflection/README.md
Normal file
18
reflection/README.md
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/v1/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)
|
||||
```
|
||||
57
reflection/adapt.go
Normal file
57
reflection/adapt.go
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2023 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package reflection
|
||||
|
||||
import (
|
||||
"google.golang.org/grpc/reflection/internal"
|
||||
|
||||
v1reflectiongrpc "google.golang.org/grpc/reflection/grpc_reflection_v1"
|
||||
v1reflectionpb "google.golang.org/grpc/reflection/grpc_reflection_v1"
|
||||
v1alphareflectiongrpc "google.golang.org/grpc/reflection/grpc_reflection_v1alpha"
|
||||
)
|
||||
|
||||
// asV1Alpha returns an implementation of the v1alpha version of the reflection
|
||||
// interface that delegates all calls to the given v1 version.
|
||||
func asV1Alpha(svr v1reflectiongrpc.ServerReflectionServer) v1alphareflectiongrpc.ServerReflectionServer {
|
||||
return v1AlphaServerImpl{svr: svr}
|
||||
}
|
||||
|
||||
type v1AlphaServerImpl struct {
|
||||
svr v1reflectiongrpc.ServerReflectionServer
|
||||
}
|
||||
|
||||
func (s v1AlphaServerImpl) ServerReflectionInfo(stream v1alphareflectiongrpc.ServerReflection_ServerReflectionInfoServer) error {
|
||||
return s.svr.ServerReflectionInfo(v1AlphaServerStreamAdapter{stream})
|
||||
}
|
||||
|
||||
type v1AlphaServerStreamAdapter struct {
|
||||
v1alphareflectiongrpc.ServerReflection_ServerReflectionInfoServer
|
||||
}
|
||||
|
||||
func (s v1AlphaServerStreamAdapter) Send(response *v1reflectionpb.ServerReflectionResponse) error {
|
||||
return s.ServerReflection_ServerReflectionInfoServer.Send(internal.V1ToV1AlphaResponse(response))
|
||||
}
|
||||
|
||||
func (s v1AlphaServerStreamAdapter) Recv() (*v1reflectionpb.ServerReflectionRequest, error) {
|
||||
resp, err := s.ServerReflection_ServerReflectionInfoServer.Recv()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return internal.V1AlphaToV1Request(resp), nil
|
||||
}
|
||||
777
reflection/grpc_reflection_v1/reflection.pb.go
Normal file
777
reflection/grpc_reflection_v1/reflection.pb.go
Normal file
@@ -0,0 +1,777 @@
|
||||
// Copyright 2016 The 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. A more complete description of how
|
||||
// server reflection works can be found at
|
||||
// https://github.com/grpc/grpc/blob/master/doc/server-reflection.md
|
||||
//
|
||||
// The canonical version of this proto can be found at
|
||||
// https://github.com/grpc/grpc-proto/blob/master/grpc/reflection/v1/reflection.proto
|
||||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.12
|
||||
// protoc v5.27.1
|
||||
// source: grpc/reflection/v1/reflection.proto
|
||||
|
||||
package grpc_reflection_v1
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// The message sent by the client when calling ServerReflectionInfo method.
|
||||
type ServerReflectionRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
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"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ServerReflectionRequest) Reset() {
|
||||
*x = ServerReflectionRequest{}
|
||||
mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ServerReflectionRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ServerReflectionRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ServerReflectionRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ServerReflectionRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ServerReflectionRequest) Descriptor() ([]byte, []int) {
|
||||
return file_grpc_reflection_v1_reflection_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *ServerReflectionRequest) GetHost() string {
|
||||
if x != nil {
|
||||
return x.Host
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ServerReflectionRequest) GetMessageRequest() isServerReflectionRequest_MessageRequest {
|
||||
if x != nil {
|
||||
return x.MessageRequest
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ServerReflectionRequest) GetFileByFilename() string {
|
||||
if x != nil {
|
||||
if x, ok := x.MessageRequest.(*ServerReflectionRequest_FileByFilename); ok {
|
||||
return x.FileByFilename
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ServerReflectionRequest) GetFileContainingSymbol() string {
|
||||
if x != nil {
|
||||
if x, ok := x.MessageRequest.(*ServerReflectionRequest_FileContainingSymbol); ok {
|
||||
return x.FileContainingSymbol
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ServerReflectionRequest) GetFileContainingExtension() *ExtensionRequest {
|
||||
if x != nil {
|
||||
if x, ok := x.MessageRequest.(*ServerReflectionRequest_FileContainingExtension); ok {
|
||||
return x.FileContainingExtension
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ServerReflectionRequest) GetAllExtensionNumbersOfType() string {
|
||||
if x != nil {
|
||||
if x, ok := x.MessageRequest.(*ServerReflectionRequest_AllExtensionNumbersOfType); ok {
|
||||
return x.AllExtensionNumbersOfType
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ServerReflectionRequest) GetListServices() string {
|
||||
if x != nil {
|
||||
if x, ok := x.MessageRequest.(*ServerReflectionRequest_ListServices); ok {
|
||||
return x.ListServices
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type isServerReflectionRequest_MessageRequest interface {
|
||||
isServerReflectionRequest_MessageRequest()
|
||||
}
|
||||
|
||||
type ServerReflectionRequest_FileByFilename struct {
|
||||
// Find a proto file by the file name.
|
||||
FileByFilename string `protobuf:"bytes,3,opt,name=file_by_filename,json=fileByFilename,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ServerReflectionRequest_FileContainingSymbol struct {
|
||||
// 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>).
|
||||
FileContainingSymbol string `protobuf:"bytes,4,opt,name=file_containing_symbol,json=fileContainingSymbol,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ServerReflectionRequest_FileContainingExtension struct {
|
||||
// Find the proto file which defines an extension extending the given
|
||||
// message type with the given field number.
|
||||
FileContainingExtension *ExtensionRequest `protobuf:"bytes,5,opt,name=file_containing_extension,json=fileContainingExtension,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ServerReflectionRequest_AllExtensionNumbersOfType struct {
|
||||
// Finds the tag numbers used by all known extensions of the given message
|
||||
// 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>
|
||||
AllExtensionNumbersOfType string `protobuf:"bytes,6,opt,name=all_extension_numbers_of_type,json=allExtensionNumbersOfType,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ServerReflectionRequest_ListServices struct {
|
||||
// List the full names of registered services. The content will not be
|
||||
// checked.
|
||||
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() {}
|
||||
|
||||
// The type name and extension number sent by the client when requesting
|
||||
// file_containing_extension.
|
||||
type ExtensionRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// 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"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ExtensionRequest) Reset() {
|
||||
*x = ExtensionRequest{}
|
||||
mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ExtensionRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ExtensionRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ExtensionRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ExtensionRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ExtensionRequest) Descriptor() ([]byte, []int) {
|
||||
return file_grpc_reflection_v1_reflection_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *ExtensionRequest) GetContainingType() string {
|
||||
if x != nil {
|
||||
return x.ContainingType
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ExtensionRequest) GetExtensionNumber() int32 {
|
||||
if x != nil {
|
||||
return x.ExtensionNumber
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// The message sent by the server to answer ServerReflectionInfo method.
|
||||
type ServerReflectionResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
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"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ServerReflectionResponse) Reset() {
|
||||
*x = ServerReflectionResponse{}
|
||||
mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ServerReflectionResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ServerReflectionResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ServerReflectionResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ServerReflectionResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ServerReflectionResponse) Descriptor() ([]byte, []int) {
|
||||
return file_grpc_reflection_v1_reflection_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *ServerReflectionResponse) GetValidHost() string {
|
||||
if x != nil {
|
||||
return x.ValidHost
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ServerReflectionResponse) GetOriginalRequest() *ServerReflectionRequest {
|
||||
if x != nil {
|
||||
return x.OriginalRequest
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ServerReflectionResponse) GetMessageResponse() isServerReflectionResponse_MessageResponse {
|
||||
if x != nil {
|
||||
return x.MessageResponse
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ServerReflectionResponse) GetFileDescriptorResponse() *FileDescriptorResponse {
|
||||
if x != nil {
|
||||
if x, ok := x.MessageResponse.(*ServerReflectionResponse_FileDescriptorResponse); ok {
|
||||
return x.FileDescriptorResponse
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ServerReflectionResponse) GetAllExtensionNumbersResponse() *ExtensionNumberResponse {
|
||||
if x != nil {
|
||||
if x, ok := x.MessageResponse.(*ServerReflectionResponse_AllExtensionNumbersResponse); ok {
|
||||
return x.AllExtensionNumbersResponse
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ServerReflectionResponse) GetListServicesResponse() *ListServiceResponse {
|
||||
if x != nil {
|
||||
if x, ok := x.MessageResponse.(*ServerReflectionResponse_ListServicesResponse); ok {
|
||||
return x.ListServicesResponse
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ServerReflectionResponse) GetErrorResponse() *ErrorResponse {
|
||||
if x != nil {
|
||||
if x, ok := x.MessageResponse.(*ServerReflectionResponse_ErrorResponse); ok {
|
||||
return x.ErrorResponse
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type isServerReflectionResponse_MessageResponse interface {
|
||||
isServerReflectionResponse_MessageResponse()
|
||||
}
|
||||
|
||||
type ServerReflectionResponse_FileDescriptorResponse struct {
|
||||
// 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 *FileDescriptorResponse `protobuf:"bytes,4,opt,name=file_descriptor_response,json=fileDescriptorResponse,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ServerReflectionResponse_AllExtensionNumbersResponse struct {
|
||||
// This message is used to answer all_extension_numbers_of_type requests.
|
||||
AllExtensionNumbersResponse *ExtensionNumberResponse `protobuf:"bytes,5,opt,name=all_extension_numbers_response,json=allExtensionNumbersResponse,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ServerReflectionResponse_ListServicesResponse struct {
|
||||
// This message is used to answer list_services requests.
|
||||
ListServicesResponse *ListServiceResponse `protobuf:"bytes,6,opt,name=list_services_response,json=listServicesResponse,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ServerReflectionResponse_ErrorResponse struct {
|
||||
// This message is used when an error occurs.
|
||||
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() {}
|
||||
|
||||
// Serialized FileDescriptorProto messages sent by the server answering
|
||||
// a file_by_filename, file_containing_symbol, or file_containing_extension
|
||||
// request.
|
||||
type FileDescriptorResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// 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"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *FileDescriptorResponse) Reset() {
|
||||
*x = FileDescriptorResponse{}
|
||||
mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *FileDescriptorResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FileDescriptorResponse) ProtoMessage() {}
|
||||
|
||||
func (x *FileDescriptorResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use FileDescriptorResponse.ProtoReflect.Descriptor instead.
|
||||
func (*FileDescriptorResponse) Descriptor() ([]byte, []int) {
|
||||
return file_grpc_reflection_v1_reflection_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *FileDescriptorResponse) GetFileDescriptorProto() [][]byte {
|
||||
if x != nil {
|
||||
return x.FileDescriptorProto
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// A list of extension numbers sent by the server answering
|
||||
// all_extension_numbers_of_type request.
|
||||
type ExtensionNumberResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// 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"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ExtensionNumberResponse) Reset() {
|
||||
*x = ExtensionNumberResponse{}
|
||||
mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ExtensionNumberResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ExtensionNumberResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ExtensionNumberResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ExtensionNumberResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ExtensionNumberResponse) Descriptor() ([]byte, []int) {
|
||||
return file_grpc_reflection_v1_reflection_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *ExtensionNumberResponse) GetBaseTypeName() string {
|
||||
if x != nil {
|
||||
return x.BaseTypeName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ExtensionNumberResponse) GetExtensionNumber() []int32 {
|
||||
if x != nil {
|
||||
return x.ExtensionNumber
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// A list of ServiceResponse sent by the server answering list_services request.
|
||||
type ListServiceResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// 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"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ListServiceResponse) Reset() {
|
||||
*x = ListServiceResponse{}
|
||||
mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ListServiceResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListServiceResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ListServiceResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[5]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ListServiceResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ListServiceResponse) Descriptor() ([]byte, []int) {
|
||||
return file_grpc_reflection_v1_reflection_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *ListServiceResponse) GetService() []*ServiceResponse {
|
||||
if x != nil {
|
||||
return x.Service
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// The information of a single service used by ListServiceResponse to answer
|
||||
// list_services request.
|
||||
type ServiceResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// 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"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ServiceResponse) Reset() {
|
||||
*x = ServiceResponse{}
|
||||
mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ServiceResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ServiceResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ServiceResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[6]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ServiceResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ServiceResponse) Descriptor() ([]byte, []int) {
|
||||
return file_grpc_reflection_v1_reflection_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *ServiceResponse) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// The error code and error message sent by the server when an error occurs.
|
||||
type ErrorResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// 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"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ErrorResponse) Reset() {
|
||||
*x = ErrorResponse{}
|
||||
mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ErrorResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ErrorResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ErrorResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[7]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ErrorResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ErrorResponse) Descriptor() ([]byte, []int) {
|
||||
return file_grpc_reflection_v1_reflection_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *ErrorResponse) GetErrorCode() int32 {
|
||||
if x != nil {
|
||||
return x.ErrorCode
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ErrorResponse) GetErrorMessage() string {
|
||||
if x != nil {
|
||||
return x.ErrorMessage
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_grpc_reflection_v1_reflection_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_grpc_reflection_v1_reflection_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"#grpc/reflection/v1/reflection.proto\x12\x12grpc.reflection.v1\"\xf3\x02\n" +
|
||||
"\x17ServerReflectionRequest\x12\x12\n" +
|
||||
"\x04host\x18\x01 \x01(\tR\x04host\x12*\n" +
|
||||
"\x10file_by_filename\x18\x03 \x01(\tH\x00R\x0efileByFilename\x126\n" +
|
||||
"\x16file_containing_symbol\x18\x04 \x01(\tH\x00R\x14fileContainingSymbol\x12b\n" +
|
||||
"\x19file_containing_extension\x18\x05 \x01(\v2$.grpc.reflection.v1.ExtensionRequestH\x00R\x17fileContainingExtension\x12B\n" +
|
||||
"\x1dall_extension_numbers_of_type\x18\x06 \x01(\tH\x00R\x19allExtensionNumbersOfType\x12%\n" +
|
||||
"\rlist_services\x18\a \x01(\tH\x00R\flistServicesB\x11\n" +
|
||||
"\x0fmessage_request\"f\n" +
|
||||
"\x10ExtensionRequest\x12'\n" +
|
||||
"\x0fcontaining_type\x18\x01 \x01(\tR\x0econtainingType\x12)\n" +
|
||||
"\x10extension_number\x18\x02 \x01(\x05R\x0fextensionNumber\"\xae\x04\n" +
|
||||
"\x18ServerReflectionResponse\x12\x1d\n" +
|
||||
"\n" +
|
||||
"valid_host\x18\x01 \x01(\tR\tvalidHost\x12V\n" +
|
||||
"\x10original_request\x18\x02 \x01(\v2+.grpc.reflection.v1.ServerReflectionRequestR\x0foriginalRequest\x12f\n" +
|
||||
"\x18file_descriptor_response\x18\x04 \x01(\v2*.grpc.reflection.v1.FileDescriptorResponseH\x00R\x16fileDescriptorResponse\x12r\n" +
|
||||
"\x1eall_extension_numbers_response\x18\x05 \x01(\v2+.grpc.reflection.v1.ExtensionNumberResponseH\x00R\x1ballExtensionNumbersResponse\x12_\n" +
|
||||
"\x16list_services_response\x18\x06 \x01(\v2'.grpc.reflection.v1.ListServiceResponseH\x00R\x14listServicesResponse\x12J\n" +
|
||||
"\x0eerror_response\x18\a \x01(\v2!.grpc.reflection.v1.ErrorResponseH\x00R\rerrorResponseB\x12\n" +
|
||||
"\x10message_response\"L\n" +
|
||||
"\x16FileDescriptorResponse\x122\n" +
|
||||
"\x15file_descriptor_proto\x18\x01 \x03(\fR\x13fileDescriptorProto\"j\n" +
|
||||
"\x17ExtensionNumberResponse\x12$\n" +
|
||||
"\x0ebase_type_name\x18\x01 \x01(\tR\fbaseTypeName\x12)\n" +
|
||||
"\x10extension_number\x18\x02 \x03(\x05R\x0fextensionNumber\"T\n" +
|
||||
"\x13ListServiceResponse\x12=\n" +
|
||||
"\aservice\x18\x01 \x03(\v2#.grpc.reflection.v1.ServiceResponseR\aservice\"%\n" +
|
||||
"\x0fServiceResponse\x12\x12\n" +
|
||||
"\x04name\x18\x01 \x01(\tR\x04name\"S\n" +
|
||||
"\rErrorResponse\x12\x1d\n" +
|
||||
"\n" +
|
||||
"error_code\x18\x01 \x01(\x05R\terrorCode\x12#\n" +
|
||||
"\rerror_message\x18\x02 \x01(\tR\ferrorMessage2\x89\x01\n" +
|
||||
"\x10ServerReflection\x12u\n" +
|
||||
"\x14ServerReflectionInfo\x12+.grpc.reflection.v1.ServerReflectionRequest\x1a,.grpc.reflection.v1.ServerReflectionResponse(\x010\x01Bf\n" +
|
||||
"\x15io.grpc.reflection.v1B\x15ServerReflectionProtoP\x01Z4google.golang.org/grpc/reflection/grpc_reflection_v1b\x06proto3"
|
||||
|
||||
var (
|
||||
file_grpc_reflection_v1_reflection_proto_rawDescOnce sync.Once
|
||||
file_grpc_reflection_v1_reflection_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_grpc_reflection_v1_reflection_proto_rawDescGZIP() []byte {
|
||||
file_grpc_reflection_v1_reflection_proto_rawDescOnce.Do(func() {
|
||||
file_grpc_reflection_v1_reflection_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_grpc_reflection_v1_reflection_proto_rawDesc), len(file_grpc_reflection_v1_reflection_proto_rawDesc)))
|
||||
})
|
||||
return file_grpc_reflection_v1_reflection_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_grpc_reflection_v1_reflection_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||
var file_grpc_reflection_v1_reflection_proto_goTypes = []any{
|
||||
(*ServerReflectionRequest)(nil), // 0: grpc.reflection.v1.ServerReflectionRequest
|
||||
(*ExtensionRequest)(nil), // 1: grpc.reflection.v1.ExtensionRequest
|
||||
(*ServerReflectionResponse)(nil), // 2: grpc.reflection.v1.ServerReflectionResponse
|
||||
(*FileDescriptorResponse)(nil), // 3: grpc.reflection.v1.FileDescriptorResponse
|
||||
(*ExtensionNumberResponse)(nil), // 4: grpc.reflection.v1.ExtensionNumberResponse
|
||||
(*ListServiceResponse)(nil), // 5: grpc.reflection.v1.ListServiceResponse
|
||||
(*ServiceResponse)(nil), // 6: grpc.reflection.v1.ServiceResponse
|
||||
(*ErrorResponse)(nil), // 7: grpc.reflection.v1.ErrorResponse
|
||||
}
|
||||
var file_grpc_reflection_v1_reflection_proto_depIdxs = []int32{
|
||||
1, // 0: grpc.reflection.v1.ServerReflectionRequest.file_containing_extension:type_name -> grpc.reflection.v1.ExtensionRequest
|
||||
0, // 1: grpc.reflection.v1.ServerReflectionResponse.original_request:type_name -> grpc.reflection.v1.ServerReflectionRequest
|
||||
3, // 2: grpc.reflection.v1.ServerReflectionResponse.file_descriptor_response:type_name -> grpc.reflection.v1.FileDescriptorResponse
|
||||
4, // 3: grpc.reflection.v1.ServerReflectionResponse.all_extension_numbers_response:type_name -> grpc.reflection.v1.ExtensionNumberResponse
|
||||
5, // 4: grpc.reflection.v1.ServerReflectionResponse.list_services_response:type_name -> grpc.reflection.v1.ListServiceResponse
|
||||
7, // 5: grpc.reflection.v1.ServerReflectionResponse.error_response:type_name -> grpc.reflection.v1.ErrorResponse
|
||||
6, // 6: grpc.reflection.v1.ListServiceResponse.service:type_name -> grpc.reflection.v1.ServiceResponse
|
||||
0, // 7: grpc.reflection.v1.ServerReflection.ServerReflectionInfo:input_type -> grpc.reflection.v1.ServerReflectionRequest
|
||||
2, // 8: grpc.reflection.v1.ServerReflection.ServerReflectionInfo:output_type -> grpc.reflection.v1.ServerReflectionResponse
|
||||
8, // [8:9] is the sub-list for method output_type
|
||||
7, // [7:8] is the sub-list for method input_type
|
||||
7, // [7:7] is the sub-list for extension type_name
|
||||
7, // [7:7] is the sub-list for extension extendee
|
||||
0, // [0:7] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_grpc_reflection_v1_reflection_proto_init() }
|
||||
func file_grpc_reflection_v1_reflection_proto_init() {
|
||||
if File_grpc_reflection_v1_reflection_proto != nil {
|
||||
return
|
||||
}
|
||||
file_grpc_reflection_v1_reflection_proto_msgTypes[0].OneofWrappers = []any{
|
||||
(*ServerReflectionRequest_FileByFilename)(nil),
|
||||
(*ServerReflectionRequest_FileContainingSymbol)(nil),
|
||||
(*ServerReflectionRequest_FileContainingExtension)(nil),
|
||||
(*ServerReflectionRequest_AllExtensionNumbersOfType)(nil),
|
||||
(*ServerReflectionRequest_ListServices)(nil),
|
||||
}
|
||||
file_grpc_reflection_v1_reflection_proto_msgTypes[2].OneofWrappers = []any{
|
||||
(*ServerReflectionResponse_FileDescriptorResponse)(nil),
|
||||
(*ServerReflectionResponse_AllExtensionNumbersResponse)(nil),
|
||||
(*ServerReflectionResponse_ListServicesResponse)(nil),
|
||||
(*ServerReflectionResponse_ErrorResponse)(nil),
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_grpc_reflection_v1_reflection_proto_rawDesc), len(file_grpc_reflection_v1_reflection_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 8,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_grpc_reflection_v1_reflection_proto_goTypes,
|
||||
DependencyIndexes: file_grpc_reflection_v1_reflection_proto_depIdxs,
|
||||
MessageInfos: file_grpc_reflection_v1_reflection_proto_msgTypes,
|
||||
}.Build()
|
||||
File_grpc_reflection_v1_reflection_proto = out.File
|
||||
file_grpc_reflection_v1_reflection_proto_goTypes = nil
|
||||
file_grpc_reflection_v1_reflection_proto_depIdxs = nil
|
||||
}
|
||||
138
reflection/grpc_reflection_v1/reflection_grpc.pb.go
Normal file
138
reflection/grpc_reflection_v1/reflection_grpc.pb.go
Normal file
@@ -0,0 +1,138 @@
|
||||
// Copyright 2016 The 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. A more complete description of how
|
||||
// server reflection works can be found at
|
||||
// https://github.com/grpc/grpc/blob/master/doc/server-reflection.md
|
||||
//
|
||||
// The canonical version of this proto can be found at
|
||||
// https://github.com/grpc/grpc-proto/blob/master/grpc/reflection/v1/reflection.proto
|
||||
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.6.2
|
||||
// - protoc v5.27.1
|
||||
// source: grpc/reflection/v1/reflection.proto
|
||||
|
||||
package grpc_reflection_v1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
ServerReflection_ServerReflectionInfo_FullMethodName = "/grpc.reflection.v1.ServerReflection/ServerReflectionInfo"
|
||||
)
|
||||
|
||||
// ServerReflectionClient is the client API for ServerReflection service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#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) (grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse], error)
|
||||
}
|
||||
|
||||
type serverReflectionClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewServerReflectionClient(cc grpc.ClientConnInterface) ServerReflectionClient {
|
||||
return &serverReflectionClient{cc}
|
||||
}
|
||||
|
||||
func (c *serverReflectionClient) ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse], error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
stream, err := c.cc.NewStream(ctx, &ServerReflection_ServiceDesc.Streams[0], ServerReflection_ServerReflectionInfo_FullMethodName, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &grpc.GenericClientStream[ServerReflectionRequest, ServerReflectionResponse]{ClientStream: stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||
type ServerReflection_ServerReflectionInfoClient = grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse]
|
||||
|
||||
// ServerReflectionServer is the server API for ServerReflection service.
|
||||
// All implementations should embed UnimplementedServerReflectionServer
|
||||
// for forward compatibility.
|
||||
type ServerReflectionServer interface {
|
||||
// The reflection service is structured as a bidirectional stream, ensuring
|
||||
// all related requests go to a single server.
|
||||
ServerReflectionInfo(grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse]) error
|
||||
}
|
||||
|
||||
// UnimplementedServerReflectionServer should be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedServerReflectionServer struct{}
|
||||
|
||||
func (UnimplementedServerReflectionServer) ServerReflectionInfo(grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse]) error {
|
||||
return status.Error(codes.Unimplemented, "method ServerReflectionInfo not implemented")
|
||||
}
|
||||
func (UnimplementedServerReflectionServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeServerReflectionServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to ServerReflectionServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeServerReflectionServer interface {
|
||||
mustEmbedUnimplementedServerReflectionServer()
|
||||
}
|
||||
|
||||
func RegisterServerReflectionServer(s grpc.ServiceRegistrar, srv ServerReflectionServer) {
|
||||
// If the following call panics, it indicates UnimplementedServerReflectionServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&ServerReflection_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _ServerReflection_ServerReflectionInfo_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(ServerReflectionServer).ServerReflectionInfo(&grpc.GenericServerStream[ServerReflectionRequest, ServerReflectionResponse]{ServerStream: stream})
|
||||
}
|
||||
|
||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||
type ServerReflection_ServerReflectionInfoServer = grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse]
|
||||
|
||||
// ServerReflection_ServiceDesc is the grpc.ServiceDesc for ServerReflection service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var ServerReflection_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "grpc.reflection.v1.ServerReflection",
|
||||
HandlerType: (*ServerReflectionServer)(nil),
|
||||
Methods: []grpc.MethodDesc{},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
StreamName: "ServerReflectionInfo",
|
||||
Handler: _ServerReflection_ServerReflectionInfo_Handler,
|
||||
ServerStreams: true,
|
||||
ClientStreams: true,
|
||||
},
|
||||
},
|
||||
Metadata: "grpc/reflection/v1/reflection.proto",
|
||||
}
|
||||
847
reflection/grpc_reflection_v1alpha/reflection.pb.go
Normal file
847
reflection/grpc_reflection_v1alpha/reflection.pb.go
Normal file
@@ -0,0 +1,847 @@
|
||||
// Copyright 2016 The 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
|
||||
|
||||
// Warning: this entire file is deprecated. Use this instead:
|
||||
// https://github.com/grpc/grpc-proto/blob/master/grpc/reflection/v1/reflection.proto
|
||||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.12
|
||||
// protoc v5.27.1
|
||||
// grpc/reflection/v1alpha/reflection.proto is a deprecated file.
|
||||
|
||||
package grpc_reflection_v1alpha
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// The message sent by the client when calling ServerReflectionInfo method.
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
type ServerReflectionRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
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"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ServerReflectionRequest) Reset() {
|
||||
*x = ServerReflectionRequest{}
|
||||
mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ServerReflectionRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ServerReflectionRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ServerReflectionRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ServerReflectionRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ServerReflectionRequest) Descriptor() ([]byte, []int) {
|
||||
return file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
func (x *ServerReflectionRequest) GetHost() string {
|
||||
if x != nil {
|
||||
return x.Host
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ServerReflectionRequest) GetMessageRequest() isServerReflectionRequest_MessageRequest {
|
||||
if x != nil {
|
||||
return x.MessageRequest
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
func (x *ServerReflectionRequest) GetFileByFilename() string {
|
||||
if x != nil {
|
||||
if x, ok := x.MessageRequest.(*ServerReflectionRequest_FileByFilename); ok {
|
||||
return x.FileByFilename
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
func (x *ServerReflectionRequest) GetFileContainingSymbol() string {
|
||||
if x != nil {
|
||||
if x, ok := x.MessageRequest.(*ServerReflectionRequest_FileContainingSymbol); ok {
|
||||
return x.FileContainingSymbol
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
func (x *ServerReflectionRequest) GetFileContainingExtension() *ExtensionRequest {
|
||||
if x != nil {
|
||||
if x, ok := x.MessageRequest.(*ServerReflectionRequest_FileContainingExtension); ok {
|
||||
return x.FileContainingExtension
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
func (x *ServerReflectionRequest) GetAllExtensionNumbersOfType() string {
|
||||
if x != nil {
|
||||
if x, ok := x.MessageRequest.(*ServerReflectionRequest_AllExtensionNumbersOfType); ok {
|
||||
return x.AllExtensionNumbersOfType
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
func (x *ServerReflectionRequest) GetListServices() string {
|
||||
if x != nil {
|
||||
if x, ok := x.MessageRequest.(*ServerReflectionRequest_ListServices); ok {
|
||||
return x.ListServices
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type isServerReflectionRequest_MessageRequest interface {
|
||||
isServerReflectionRequest_MessageRequest()
|
||||
}
|
||||
|
||||
type ServerReflectionRequest_FileByFilename struct {
|
||||
// Find a proto file by the file name.
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
FileByFilename string `protobuf:"bytes,3,opt,name=file_by_filename,json=fileByFilename,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ServerReflectionRequest_FileContainingSymbol struct {
|
||||
// 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>).
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
FileContainingSymbol string `protobuf:"bytes,4,opt,name=file_containing_symbol,json=fileContainingSymbol,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ServerReflectionRequest_FileContainingExtension struct {
|
||||
// Find the proto file which defines an extension extending the given
|
||||
// message type with the given field number.
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
FileContainingExtension *ExtensionRequest `protobuf:"bytes,5,opt,name=file_containing_extension,json=fileContainingExtension,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ServerReflectionRequest_AllExtensionNumbersOfType struct {
|
||||
// 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>
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
AllExtensionNumbersOfType string `protobuf:"bytes,6,opt,name=all_extension_numbers_of_type,json=allExtensionNumbersOfType,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ServerReflectionRequest_ListServices struct {
|
||||
// List the full names of registered services. The content will not be
|
||||
// checked.
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
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() {}
|
||||
|
||||
// The type name and extension number sent by the client when requesting
|
||||
// file_containing_extension.
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
type ExtensionRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// Fully-qualified type name. The format should be <package>.<type>
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
ContainingType string `protobuf:"bytes,1,opt,name=containing_type,json=containingType,proto3" json:"containing_type,omitempty"`
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
ExtensionNumber int32 `protobuf:"varint,2,opt,name=extension_number,json=extensionNumber,proto3" json:"extension_number,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ExtensionRequest) Reset() {
|
||||
*x = ExtensionRequest{}
|
||||
mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ExtensionRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ExtensionRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ExtensionRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ExtensionRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ExtensionRequest) Descriptor() ([]byte, []int) {
|
||||
return file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
func (x *ExtensionRequest) GetContainingType() string {
|
||||
if x != nil {
|
||||
return x.ContainingType
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
func (x *ExtensionRequest) GetExtensionNumber() int32 {
|
||||
if x != nil {
|
||||
return x.ExtensionNumber
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// The message sent by the server to answer ServerReflectionInfo method.
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
type ServerReflectionResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
ValidHost string `protobuf:"bytes,1,opt,name=valid_host,json=validHost,proto3" json:"valid_host,omitempty"`
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
OriginalRequest *ServerReflectionRequest `protobuf:"bytes,2,opt,name=original_request,json=originalRequest,proto3" json:"original_request,omitempty"`
|
||||
// The server set 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"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ServerReflectionResponse) Reset() {
|
||||
*x = ServerReflectionResponse{}
|
||||
mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ServerReflectionResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ServerReflectionResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ServerReflectionResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ServerReflectionResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ServerReflectionResponse) Descriptor() ([]byte, []int) {
|
||||
return file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
func (x *ServerReflectionResponse) GetValidHost() string {
|
||||
if x != nil {
|
||||
return x.ValidHost
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
func (x *ServerReflectionResponse) GetOriginalRequest() *ServerReflectionRequest {
|
||||
if x != nil {
|
||||
return x.OriginalRequest
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ServerReflectionResponse) GetMessageResponse() isServerReflectionResponse_MessageResponse {
|
||||
if x != nil {
|
||||
return x.MessageResponse
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
func (x *ServerReflectionResponse) GetFileDescriptorResponse() *FileDescriptorResponse {
|
||||
if x != nil {
|
||||
if x, ok := x.MessageResponse.(*ServerReflectionResponse_FileDescriptorResponse); ok {
|
||||
return x.FileDescriptorResponse
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
func (x *ServerReflectionResponse) GetAllExtensionNumbersResponse() *ExtensionNumberResponse {
|
||||
if x != nil {
|
||||
if x, ok := x.MessageResponse.(*ServerReflectionResponse_AllExtensionNumbersResponse); ok {
|
||||
return x.AllExtensionNumbersResponse
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
func (x *ServerReflectionResponse) GetListServicesResponse() *ListServiceResponse {
|
||||
if x != nil {
|
||||
if x, ok := x.MessageResponse.(*ServerReflectionResponse_ListServicesResponse); ok {
|
||||
return x.ListServicesResponse
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
func (x *ServerReflectionResponse) GetErrorResponse() *ErrorResponse {
|
||||
if x != nil {
|
||||
if x, ok := x.MessageResponse.(*ServerReflectionResponse_ErrorResponse); ok {
|
||||
return x.ErrorResponse
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type isServerReflectionResponse_MessageResponse interface {
|
||||
isServerReflectionResponse_MessageResponse()
|
||||
}
|
||||
|
||||
type ServerReflectionResponse_FileDescriptorResponse struct {
|
||||
// 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.
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
FileDescriptorResponse *FileDescriptorResponse `protobuf:"bytes,4,opt,name=file_descriptor_response,json=fileDescriptorResponse,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ServerReflectionResponse_AllExtensionNumbersResponse struct {
|
||||
// This message is used to answer all_extension_numbers_of_type request.
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
AllExtensionNumbersResponse *ExtensionNumberResponse `protobuf:"bytes,5,opt,name=all_extension_numbers_response,json=allExtensionNumbersResponse,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ServerReflectionResponse_ListServicesResponse struct {
|
||||
// This message is used to answer list_services request.
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
ListServicesResponse *ListServiceResponse `protobuf:"bytes,6,opt,name=list_services_response,json=listServicesResponse,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ServerReflectionResponse_ErrorResponse struct {
|
||||
// This message is used when an error occurs.
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
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() {}
|
||||
|
||||
// Serialized FileDescriptorProto messages sent by the server answering
|
||||
// a file_by_filename, file_containing_symbol, or file_containing_extension
|
||||
// request.
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
type FileDescriptorResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// Serialized FileDescriptorProto messages. We avoid taking a dependency on
|
||||
// descriptor.proto, which uses proto2 only features, by making them opaque
|
||||
// bytes instead.
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
FileDescriptorProto [][]byte `protobuf:"bytes,1,rep,name=file_descriptor_proto,json=fileDescriptorProto,proto3" json:"file_descriptor_proto,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *FileDescriptorResponse) Reset() {
|
||||
*x = FileDescriptorResponse{}
|
||||
mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *FileDescriptorResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FileDescriptorResponse) ProtoMessage() {}
|
||||
|
||||
func (x *FileDescriptorResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use FileDescriptorResponse.ProtoReflect.Descriptor instead.
|
||||
func (*FileDescriptorResponse) Descriptor() ([]byte, []int) {
|
||||
return file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
func (x *FileDescriptorResponse) GetFileDescriptorProto() [][]byte {
|
||||
if x != nil {
|
||||
return x.FileDescriptorProto
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// A list of extension numbers sent by the server answering
|
||||
// all_extension_numbers_of_type request.
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
type ExtensionNumberResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// Full name of the base type, including the package name. The format
|
||||
// is <package>.<type>
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
BaseTypeName string `protobuf:"bytes,1,opt,name=base_type_name,json=baseTypeName,proto3" json:"base_type_name,omitempty"`
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
ExtensionNumber []int32 `protobuf:"varint,2,rep,packed,name=extension_number,json=extensionNumber,proto3" json:"extension_number,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ExtensionNumberResponse) Reset() {
|
||||
*x = ExtensionNumberResponse{}
|
||||
mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ExtensionNumberResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ExtensionNumberResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ExtensionNumberResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ExtensionNumberResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ExtensionNumberResponse) Descriptor() ([]byte, []int) {
|
||||
return file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
func (x *ExtensionNumberResponse) GetBaseTypeName() string {
|
||||
if x != nil {
|
||||
return x.BaseTypeName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
func (x *ExtensionNumberResponse) GetExtensionNumber() []int32 {
|
||||
if x != nil {
|
||||
return x.ExtensionNumber
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// A list of ServiceResponse sent by the server answering list_services request.
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
type ListServiceResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// The information of each service may be expanded in the future, so we use
|
||||
// ServiceResponse message to encapsulate it.
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
Service []*ServiceResponse `protobuf:"bytes,1,rep,name=service,proto3" json:"service,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ListServiceResponse) Reset() {
|
||||
*x = ListServiceResponse{}
|
||||
mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ListServiceResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListServiceResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ListServiceResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[5]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ListServiceResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ListServiceResponse) Descriptor() ([]byte, []int) {
|
||||
return file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
func (x *ListServiceResponse) GetService() []*ServiceResponse {
|
||||
if x != nil {
|
||||
return x.Service
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// The information of a single service used by ListServiceResponse to answer
|
||||
// list_services request.
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
type ServiceResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// Full name of a registered service, including its package name. The format
|
||||
// is <package>.<service>
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ServiceResponse) Reset() {
|
||||
*x = ServiceResponse{}
|
||||
mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ServiceResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ServiceResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ServiceResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[6]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ServiceResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ServiceResponse) Descriptor() ([]byte, []int) {
|
||||
return file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
func (x *ServiceResponse) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// The error code and error message sent by the server when an error occurs.
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
type ErrorResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// This field uses the error codes defined in grpc::StatusCode.
|
||||
//
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
ErrorCode int32 `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3" json:"error_code,omitempty"`
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ErrorResponse) Reset() {
|
||||
*x = ErrorResponse{}
|
||||
mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ErrorResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ErrorResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ErrorResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[7]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ErrorResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ErrorResponse) Descriptor() ([]byte, []int) {
|
||||
return file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
func (x *ErrorResponse) GetErrorCode() int32 {
|
||||
if x != nil {
|
||||
return x.ErrorCode
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated.
|
||||
func (x *ErrorResponse) GetErrorMessage() string {
|
||||
if x != nil {
|
||||
return x.ErrorMessage
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_grpc_reflection_v1alpha_reflection_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_grpc_reflection_v1alpha_reflection_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"(grpc/reflection/v1alpha/reflection.proto\x12\x17grpc.reflection.v1alpha\"\xf8\x02\n" +
|
||||
"\x17ServerReflectionRequest\x12\x12\n" +
|
||||
"\x04host\x18\x01 \x01(\tR\x04host\x12*\n" +
|
||||
"\x10file_by_filename\x18\x03 \x01(\tH\x00R\x0efileByFilename\x126\n" +
|
||||
"\x16file_containing_symbol\x18\x04 \x01(\tH\x00R\x14fileContainingSymbol\x12g\n" +
|
||||
"\x19file_containing_extension\x18\x05 \x01(\v2).grpc.reflection.v1alpha.ExtensionRequestH\x00R\x17fileContainingExtension\x12B\n" +
|
||||
"\x1dall_extension_numbers_of_type\x18\x06 \x01(\tH\x00R\x19allExtensionNumbersOfType\x12%\n" +
|
||||
"\rlist_services\x18\a \x01(\tH\x00R\flistServicesB\x11\n" +
|
||||
"\x0fmessage_request\"f\n" +
|
||||
"\x10ExtensionRequest\x12'\n" +
|
||||
"\x0fcontaining_type\x18\x01 \x01(\tR\x0econtainingType\x12)\n" +
|
||||
"\x10extension_number\x18\x02 \x01(\x05R\x0fextensionNumber\"\xc7\x04\n" +
|
||||
"\x18ServerReflectionResponse\x12\x1d\n" +
|
||||
"\n" +
|
||||
"valid_host\x18\x01 \x01(\tR\tvalidHost\x12[\n" +
|
||||
"\x10original_request\x18\x02 \x01(\v20.grpc.reflection.v1alpha.ServerReflectionRequestR\x0foriginalRequest\x12k\n" +
|
||||
"\x18file_descriptor_response\x18\x04 \x01(\v2/.grpc.reflection.v1alpha.FileDescriptorResponseH\x00R\x16fileDescriptorResponse\x12w\n" +
|
||||
"\x1eall_extension_numbers_response\x18\x05 \x01(\v20.grpc.reflection.v1alpha.ExtensionNumberResponseH\x00R\x1ballExtensionNumbersResponse\x12d\n" +
|
||||
"\x16list_services_response\x18\x06 \x01(\v2,.grpc.reflection.v1alpha.ListServiceResponseH\x00R\x14listServicesResponse\x12O\n" +
|
||||
"\x0eerror_response\x18\a \x01(\v2&.grpc.reflection.v1alpha.ErrorResponseH\x00R\rerrorResponseB\x12\n" +
|
||||
"\x10message_response\"L\n" +
|
||||
"\x16FileDescriptorResponse\x122\n" +
|
||||
"\x15file_descriptor_proto\x18\x01 \x03(\fR\x13fileDescriptorProto\"j\n" +
|
||||
"\x17ExtensionNumberResponse\x12$\n" +
|
||||
"\x0ebase_type_name\x18\x01 \x01(\tR\fbaseTypeName\x12)\n" +
|
||||
"\x10extension_number\x18\x02 \x03(\x05R\x0fextensionNumber\"Y\n" +
|
||||
"\x13ListServiceResponse\x12B\n" +
|
||||
"\aservice\x18\x01 \x03(\v2(.grpc.reflection.v1alpha.ServiceResponseR\aservice\"%\n" +
|
||||
"\x0fServiceResponse\x12\x12\n" +
|
||||
"\x04name\x18\x01 \x01(\tR\x04name\"S\n" +
|
||||
"\rErrorResponse\x12\x1d\n" +
|
||||
"\n" +
|
||||
"error_code\x18\x01 \x01(\x05R\terrorCode\x12#\n" +
|
||||
"\rerror_message\x18\x02 \x01(\tR\ferrorMessage2\x93\x01\n" +
|
||||
"\x10ServerReflection\x12\x7f\n" +
|
||||
"\x14ServerReflectionInfo\x120.grpc.reflection.v1alpha.ServerReflectionRequest\x1a1.grpc.reflection.v1alpha.ServerReflectionResponse(\x010\x01Bs\n" +
|
||||
"\x1aio.grpc.reflection.v1alphaB\x15ServerReflectionProtoP\x01Z9google.golang.org/grpc/reflection/grpc_reflection_v1alpha\xb8\x01\x01b\x06proto3"
|
||||
|
||||
var (
|
||||
file_grpc_reflection_v1alpha_reflection_proto_rawDescOnce sync.Once
|
||||
file_grpc_reflection_v1alpha_reflection_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP() []byte {
|
||||
file_grpc_reflection_v1alpha_reflection_proto_rawDescOnce.Do(func() {
|
||||
file_grpc_reflection_v1alpha_reflection_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_grpc_reflection_v1alpha_reflection_proto_rawDesc), len(file_grpc_reflection_v1alpha_reflection_proto_rawDesc)))
|
||||
})
|
||||
return file_grpc_reflection_v1alpha_reflection_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_grpc_reflection_v1alpha_reflection_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||
var file_grpc_reflection_v1alpha_reflection_proto_goTypes = []any{
|
||||
(*ServerReflectionRequest)(nil), // 0: grpc.reflection.v1alpha.ServerReflectionRequest
|
||||
(*ExtensionRequest)(nil), // 1: grpc.reflection.v1alpha.ExtensionRequest
|
||||
(*ServerReflectionResponse)(nil), // 2: grpc.reflection.v1alpha.ServerReflectionResponse
|
||||
(*FileDescriptorResponse)(nil), // 3: grpc.reflection.v1alpha.FileDescriptorResponse
|
||||
(*ExtensionNumberResponse)(nil), // 4: grpc.reflection.v1alpha.ExtensionNumberResponse
|
||||
(*ListServiceResponse)(nil), // 5: grpc.reflection.v1alpha.ListServiceResponse
|
||||
(*ServiceResponse)(nil), // 6: grpc.reflection.v1alpha.ServiceResponse
|
||||
(*ErrorResponse)(nil), // 7: grpc.reflection.v1alpha.ErrorResponse
|
||||
}
|
||||
var file_grpc_reflection_v1alpha_reflection_proto_depIdxs = []int32{
|
||||
1, // 0: grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_extension:type_name -> grpc.reflection.v1alpha.ExtensionRequest
|
||||
0, // 1: grpc.reflection.v1alpha.ServerReflectionResponse.original_request:type_name -> grpc.reflection.v1alpha.ServerReflectionRequest
|
||||
3, // 2: grpc.reflection.v1alpha.ServerReflectionResponse.file_descriptor_response:type_name -> grpc.reflection.v1alpha.FileDescriptorResponse
|
||||
4, // 3: grpc.reflection.v1alpha.ServerReflectionResponse.all_extension_numbers_response:type_name -> grpc.reflection.v1alpha.ExtensionNumberResponse
|
||||
5, // 4: grpc.reflection.v1alpha.ServerReflectionResponse.list_services_response:type_name -> grpc.reflection.v1alpha.ListServiceResponse
|
||||
7, // 5: grpc.reflection.v1alpha.ServerReflectionResponse.error_response:type_name -> grpc.reflection.v1alpha.ErrorResponse
|
||||
6, // 6: grpc.reflection.v1alpha.ListServiceResponse.service:type_name -> grpc.reflection.v1alpha.ServiceResponse
|
||||
0, // 7: grpc.reflection.v1alpha.ServerReflection.ServerReflectionInfo:input_type -> grpc.reflection.v1alpha.ServerReflectionRequest
|
||||
2, // 8: grpc.reflection.v1alpha.ServerReflection.ServerReflectionInfo:output_type -> grpc.reflection.v1alpha.ServerReflectionResponse
|
||||
8, // [8:9] is the sub-list for method output_type
|
||||
7, // [7:8] is the sub-list for method input_type
|
||||
7, // [7:7] is the sub-list for extension type_name
|
||||
7, // [7:7] is the sub-list for extension extendee
|
||||
0, // [0:7] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_grpc_reflection_v1alpha_reflection_proto_init() }
|
||||
func file_grpc_reflection_v1alpha_reflection_proto_init() {
|
||||
if File_grpc_reflection_v1alpha_reflection_proto != nil {
|
||||
return
|
||||
}
|
||||
file_grpc_reflection_v1alpha_reflection_proto_msgTypes[0].OneofWrappers = []any{
|
||||
(*ServerReflectionRequest_FileByFilename)(nil),
|
||||
(*ServerReflectionRequest_FileContainingSymbol)(nil),
|
||||
(*ServerReflectionRequest_FileContainingExtension)(nil),
|
||||
(*ServerReflectionRequest_AllExtensionNumbersOfType)(nil),
|
||||
(*ServerReflectionRequest_ListServices)(nil),
|
||||
}
|
||||
file_grpc_reflection_v1alpha_reflection_proto_msgTypes[2].OneofWrappers = []any{
|
||||
(*ServerReflectionResponse_FileDescriptorResponse)(nil),
|
||||
(*ServerReflectionResponse_AllExtensionNumbersResponse)(nil),
|
||||
(*ServerReflectionResponse_ListServicesResponse)(nil),
|
||||
(*ServerReflectionResponse_ErrorResponse)(nil),
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_grpc_reflection_v1alpha_reflection_proto_rawDesc), len(file_grpc_reflection_v1alpha_reflection_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 8,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_grpc_reflection_v1alpha_reflection_proto_goTypes,
|
||||
DependencyIndexes: file_grpc_reflection_v1alpha_reflection_proto_depIdxs,
|
||||
MessageInfos: file_grpc_reflection_v1alpha_reflection_proto_msgTypes,
|
||||
}.Build()
|
||||
File_grpc_reflection_v1alpha_reflection_proto = out.File
|
||||
file_grpc_reflection_v1alpha_reflection_proto_goTypes = nil
|
||||
file_grpc_reflection_v1alpha_reflection_proto_depIdxs = nil
|
||||
}
|
||||
135
reflection/grpc_reflection_v1alpha/reflection_grpc.pb.go
Normal file
135
reflection/grpc_reflection_v1alpha/reflection_grpc.pb.go
Normal file
@@ -0,0 +1,135 @@
|
||||
// Copyright 2016 The 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
|
||||
|
||||
// Warning: this entire file is deprecated. Use this instead:
|
||||
// https://github.com/grpc/grpc-proto/blob/master/grpc/reflection/v1/reflection.proto
|
||||
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.6.2
|
||||
// - protoc v5.27.1
|
||||
// grpc/reflection/v1alpha/reflection.proto is a deprecated file.
|
||||
|
||||
package grpc_reflection_v1alpha
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
ServerReflection_ServerReflectionInfo_FullMethodName = "/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo"
|
||||
)
|
||||
|
||||
// ServerReflectionClient is the client API for ServerReflection service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#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) (grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse], error)
|
||||
}
|
||||
|
||||
type serverReflectionClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewServerReflectionClient(cc grpc.ClientConnInterface) ServerReflectionClient {
|
||||
return &serverReflectionClient{cc}
|
||||
}
|
||||
|
||||
func (c *serverReflectionClient) ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse], error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
stream, err := c.cc.NewStream(ctx, &ServerReflection_ServiceDesc.Streams[0], ServerReflection_ServerReflectionInfo_FullMethodName, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &grpc.GenericClientStream[ServerReflectionRequest, ServerReflectionResponse]{ClientStream: stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||
type ServerReflection_ServerReflectionInfoClient = grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse]
|
||||
|
||||
// ServerReflectionServer is the server API for ServerReflection service.
|
||||
// All implementations should embed UnimplementedServerReflectionServer
|
||||
// for forward compatibility.
|
||||
type ServerReflectionServer interface {
|
||||
// The reflection service is structured as a bidirectional stream, ensuring
|
||||
// all related requests go to a single server.
|
||||
ServerReflectionInfo(grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse]) error
|
||||
}
|
||||
|
||||
// UnimplementedServerReflectionServer should be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedServerReflectionServer struct{}
|
||||
|
||||
func (UnimplementedServerReflectionServer) ServerReflectionInfo(grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse]) error {
|
||||
return status.Error(codes.Unimplemented, "method ServerReflectionInfo not implemented")
|
||||
}
|
||||
func (UnimplementedServerReflectionServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeServerReflectionServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to ServerReflectionServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeServerReflectionServer interface {
|
||||
mustEmbedUnimplementedServerReflectionServer()
|
||||
}
|
||||
|
||||
func RegisterServerReflectionServer(s grpc.ServiceRegistrar, srv ServerReflectionServer) {
|
||||
// If the following call panics, it indicates UnimplementedServerReflectionServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&ServerReflection_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _ServerReflection_ServerReflectionInfo_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(ServerReflectionServer).ServerReflectionInfo(&grpc.GenericServerStream[ServerReflectionRequest, ServerReflectionResponse]{ServerStream: stream})
|
||||
}
|
||||
|
||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||
type ServerReflection_ServerReflectionInfoServer = grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse]
|
||||
|
||||
// ServerReflection_ServiceDesc is the grpc.ServiceDesc for ServerReflection service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
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",
|
||||
}
|
||||
138
reflection/grpc_testing/proto2.pb.go
Normal file
138
reflection/grpc_testing/proto2.pb.go
Normal file
@@ -0,0 +1,138 @@
|
||||
// Copyright 2017 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.
|
||||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.12
|
||||
// protoc v5.27.1
|
||||
// source: reflection/grpc_testing/proto2.proto
|
||||
|
||||
package grpc_testing
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type ToBeExtended struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Foo *int32 `protobuf:"varint,1,req,name=foo" json:"foo,omitempty"`
|
||||
extensionFields protoimpl.ExtensionFields
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ToBeExtended) Reset() {
|
||||
*x = ToBeExtended{}
|
||||
mi := &file_reflection_grpc_testing_proto2_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ToBeExtended) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ToBeExtended) ProtoMessage() {}
|
||||
|
||||
func (x *ToBeExtended) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_reflection_grpc_testing_proto2_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ToBeExtended.ProtoReflect.Descriptor instead.
|
||||
func (*ToBeExtended) Descriptor() ([]byte, []int) {
|
||||
return file_reflection_grpc_testing_proto2_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *ToBeExtended) GetFoo() int32 {
|
||||
if x != nil && x.Foo != nil {
|
||||
return *x.Foo
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_reflection_grpc_testing_proto2_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_reflection_grpc_testing_proto2_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"$reflection/grpc_testing/proto2.proto\x12\fgrpc.testing\"&\n" +
|
||||
"\fToBeExtended\x12\x10\n" +
|
||||
"\x03foo\x18\x01 \x02(\x05R\x03foo*\x04\b\n" +
|
||||
"\x10\x1fB0Z.google.golang.org/grpc/reflection/grpc_testing"
|
||||
|
||||
var (
|
||||
file_reflection_grpc_testing_proto2_proto_rawDescOnce sync.Once
|
||||
file_reflection_grpc_testing_proto2_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_reflection_grpc_testing_proto2_proto_rawDescGZIP() []byte {
|
||||
file_reflection_grpc_testing_proto2_proto_rawDescOnce.Do(func() {
|
||||
file_reflection_grpc_testing_proto2_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_reflection_grpc_testing_proto2_proto_rawDesc), len(file_reflection_grpc_testing_proto2_proto_rawDesc)))
|
||||
})
|
||||
return file_reflection_grpc_testing_proto2_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_reflection_grpc_testing_proto2_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_reflection_grpc_testing_proto2_proto_goTypes = []any{
|
||||
(*ToBeExtended)(nil), // 0: grpc.testing.ToBeExtended
|
||||
}
|
||||
var file_reflection_grpc_testing_proto2_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_reflection_grpc_testing_proto2_proto_init() }
|
||||
func file_reflection_grpc_testing_proto2_proto_init() {
|
||||
if File_reflection_grpc_testing_proto2_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_reflection_grpc_testing_proto2_proto_rawDesc), len(file_reflection_grpc_testing_proto2_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_reflection_grpc_testing_proto2_proto_goTypes,
|
||||
DependencyIndexes: file_reflection_grpc_testing_proto2_proto_depIdxs,
|
||||
MessageInfos: file_reflection_grpc_testing_proto2_proto_msgTypes,
|
||||
}.Build()
|
||||
File_reflection_grpc_testing_proto2_proto = out.File
|
||||
file_reflection_grpc_testing_proto2_proto_goTypes = nil
|
||||
file_reflection_grpc_testing_proto2_proto_depIdxs = nil
|
||||
}
|
||||
24
reflection/grpc_testing/proto2.proto
Normal file
24
reflection/grpc_testing/proto2.proto
Normal file
@@ -0,0 +1,24 @@
|
||||
// Copyright 2017 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.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
option go_package = "google.golang.org/grpc/reflection/grpc_testing";
|
||||
|
||||
package grpc.testing;
|
||||
|
||||
message ToBeExtended {
|
||||
required int32 foo = 1;
|
||||
extensions 10 to 30;
|
||||
}
|
||||
186
reflection/grpc_testing/proto2_ext.pb.go
Normal file
186
reflection/grpc_testing/proto2_ext.pb.go
Normal file
@@ -0,0 +1,186 @@
|
||||
// Copyright 2017 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.
|
||||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.12
|
||||
// protoc v5.27.1
|
||||
// source: reflection/grpc_testing/proto2_ext.proto
|
||||
|
||||
package grpc_testing
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type Extension struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Whatzit *int32 `protobuf:"varint,1,opt,name=whatzit" json:"whatzit,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Extension) Reset() {
|
||||
*x = Extension{}
|
||||
mi := &file_reflection_grpc_testing_proto2_ext_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Extension) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Extension) ProtoMessage() {}
|
||||
|
||||
func (x *Extension) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_reflection_grpc_testing_proto2_ext_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Extension.ProtoReflect.Descriptor instead.
|
||||
func (*Extension) Descriptor() ([]byte, []int) {
|
||||
return file_reflection_grpc_testing_proto2_ext_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Extension) GetWhatzit() int32 {
|
||||
if x != nil && x.Whatzit != nil {
|
||||
return *x.Whatzit
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var file_reflection_grpc_testing_proto2_ext_proto_extTypes = []protoimpl.ExtensionInfo{
|
||||
{
|
||||
ExtendedType: (*ToBeExtended)(nil),
|
||||
ExtensionType: (*int32)(nil),
|
||||
Field: 13,
|
||||
Name: "grpc.testing.foo",
|
||||
Tag: "varint,13,opt,name=foo",
|
||||
Filename: "reflection/grpc_testing/proto2_ext.proto",
|
||||
},
|
||||
{
|
||||
ExtendedType: (*ToBeExtended)(nil),
|
||||
ExtensionType: (*Extension)(nil),
|
||||
Field: 17,
|
||||
Name: "grpc.testing.bar",
|
||||
Tag: "bytes,17,opt,name=bar",
|
||||
Filename: "reflection/grpc_testing/proto2_ext.proto",
|
||||
},
|
||||
{
|
||||
ExtendedType: (*ToBeExtended)(nil),
|
||||
ExtensionType: (*SearchRequest)(nil),
|
||||
Field: 19,
|
||||
Name: "grpc.testing.baz",
|
||||
Tag: "bytes,19,opt,name=baz",
|
||||
Filename: "reflection/grpc_testing/proto2_ext.proto",
|
||||
},
|
||||
}
|
||||
|
||||
// Extension fields to ToBeExtended.
|
||||
var (
|
||||
// optional int32 foo = 13;
|
||||
E_Foo = &file_reflection_grpc_testing_proto2_ext_proto_extTypes[0]
|
||||
// optional grpc.testing.Extension bar = 17;
|
||||
E_Bar = &file_reflection_grpc_testing_proto2_ext_proto_extTypes[1]
|
||||
// optional grpc.testing.SearchRequest baz = 19;
|
||||
E_Baz = &file_reflection_grpc_testing_proto2_ext_proto_extTypes[2]
|
||||
)
|
||||
|
||||
var File_reflection_grpc_testing_proto2_ext_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_reflection_grpc_testing_proto2_ext_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"(reflection/grpc_testing/proto2_ext.proto\x12\fgrpc.testing\x1a$reflection/grpc_testing/proto2.proto\x1a\"reflection/grpc_testing/test.proto\"%\n" +
|
||||
"\tExtension\x12\x18\n" +
|
||||
"\awhatzit\x18\x01 \x01(\x05R\awhatzit:,\n" +
|
||||
"\x03foo\x12\x1a.grpc.testing.ToBeExtended\x18\r \x01(\x05R\x03foo:E\n" +
|
||||
"\x03bar\x12\x1a.grpc.testing.ToBeExtended\x18\x11 \x01(\v2\x17.grpc.testing.ExtensionR\x03bar:I\n" +
|
||||
"\x03baz\x12\x1a.grpc.testing.ToBeExtended\x18\x13 \x01(\v2\x1b.grpc.testing.SearchRequestR\x03bazB0Z.google.golang.org/grpc/reflection/grpc_testing"
|
||||
|
||||
var (
|
||||
file_reflection_grpc_testing_proto2_ext_proto_rawDescOnce sync.Once
|
||||
file_reflection_grpc_testing_proto2_ext_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_reflection_grpc_testing_proto2_ext_proto_rawDescGZIP() []byte {
|
||||
file_reflection_grpc_testing_proto2_ext_proto_rawDescOnce.Do(func() {
|
||||
file_reflection_grpc_testing_proto2_ext_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_reflection_grpc_testing_proto2_ext_proto_rawDesc), len(file_reflection_grpc_testing_proto2_ext_proto_rawDesc)))
|
||||
})
|
||||
return file_reflection_grpc_testing_proto2_ext_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_reflection_grpc_testing_proto2_ext_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_reflection_grpc_testing_proto2_ext_proto_goTypes = []any{
|
||||
(*Extension)(nil), // 0: grpc.testing.Extension
|
||||
(*ToBeExtended)(nil), // 1: grpc.testing.ToBeExtended
|
||||
(*SearchRequest)(nil), // 2: grpc.testing.SearchRequest
|
||||
}
|
||||
var file_reflection_grpc_testing_proto2_ext_proto_depIdxs = []int32{
|
||||
1, // 0: grpc.testing.foo:extendee -> grpc.testing.ToBeExtended
|
||||
1, // 1: grpc.testing.bar:extendee -> grpc.testing.ToBeExtended
|
||||
1, // 2: grpc.testing.baz:extendee -> grpc.testing.ToBeExtended
|
||||
0, // 3: grpc.testing.bar:type_name -> grpc.testing.Extension
|
||||
2, // 4: grpc.testing.baz:type_name -> grpc.testing.SearchRequest
|
||||
5, // [5:5] is the sub-list for method output_type
|
||||
5, // [5:5] is the sub-list for method input_type
|
||||
3, // [3:5] is the sub-list for extension type_name
|
||||
0, // [0:3] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_reflection_grpc_testing_proto2_ext_proto_init() }
|
||||
func file_reflection_grpc_testing_proto2_ext_proto_init() {
|
||||
if File_reflection_grpc_testing_proto2_ext_proto != nil {
|
||||
return
|
||||
}
|
||||
file_reflection_grpc_testing_proto2_proto_init()
|
||||
file_reflection_grpc_testing_test_proto_init()
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_reflection_grpc_testing_proto2_ext_proto_rawDesc), len(file_reflection_grpc_testing_proto2_ext_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 3,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_reflection_grpc_testing_proto2_ext_proto_goTypes,
|
||||
DependencyIndexes: file_reflection_grpc_testing_proto2_ext_proto_depIdxs,
|
||||
MessageInfos: file_reflection_grpc_testing_proto2_ext_proto_msgTypes,
|
||||
ExtensionInfos: file_reflection_grpc_testing_proto2_ext_proto_extTypes,
|
||||
}.Build()
|
||||
File_reflection_grpc_testing_proto2_ext_proto = out.File
|
||||
file_reflection_grpc_testing_proto2_ext_proto_goTypes = nil
|
||||
file_reflection_grpc_testing_proto2_ext_proto_depIdxs = nil
|
||||
}
|
||||
32
reflection/grpc_testing/proto2_ext.proto
Normal file
32
reflection/grpc_testing/proto2_ext.proto
Normal file
@@ -0,0 +1,32 @@
|
||||
// Copyright 2017 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.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
option go_package = "google.golang.org/grpc/reflection/grpc_testing";
|
||||
|
||||
package grpc.testing;
|
||||
|
||||
import "reflection/grpc_testing/proto2.proto";
|
||||
import "reflection/grpc_testing/test.proto";
|
||||
|
||||
extend ToBeExtended {
|
||||
optional int32 foo = 13;
|
||||
optional Extension bar = 17;
|
||||
optional SearchRequest baz = 19;
|
||||
}
|
||||
|
||||
message Extension {
|
||||
optional int32 whatzit = 1;
|
||||
}
|
||||
171
reflection/grpc_testing/proto2_ext2.pb.go
Normal file
171
reflection/grpc_testing/proto2_ext2.pb.go
Normal file
@@ -0,0 +1,171 @@
|
||||
// Copyright 2017 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.
|
||||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.12
|
||||
// protoc v5.27.1
|
||||
// source: reflection/grpc_testing/proto2_ext2.proto
|
||||
|
||||
package grpc_testing
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type AnotherExtension struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Whatchamacallit *int32 `protobuf:"varint,1,opt,name=whatchamacallit" json:"whatchamacallit,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *AnotherExtension) Reset() {
|
||||
*x = AnotherExtension{}
|
||||
mi := &file_reflection_grpc_testing_proto2_ext2_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *AnotherExtension) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AnotherExtension) ProtoMessage() {}
|
||||
|
||||
func (x *AnotherExtension) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_reflection_grpc_testing_proto2_ext2_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AnotherExtension.ProtoReflect.Descriptor instead.
|
||||
func (*AnotherExtension) Descriptor() ([]byte, []int) {
|
||||
return file_reflection_grpc_testing_proto2_ext2_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *AnotherExtension) GetWhatchamacallit() int32 {
|
||||
if x != nil && x.Whatchamacallit != nil {
|
||||
return *x.Whatchamacallit
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var file_reflection_grpc_testing_proto2_ext2_proto_extTypes = []protoimpl.ExtensionInfo{
|
||||
{
|
||||
ExtendedType: (*ToBeExtended)(nil),
|
||||
ExtensionType: (*string)(nil),
|
||||
Field: 23,
|
||||
Name: "grpc.testing.frob",
|
||||
Tag: "bytes,23,opt,name=frob",
|
||||
Filename: "reflection/grpc_testing/proto2_ext2.proto",
|
||||
},
|
||||
{
|
||||
ExtendedType: (*ToBeExtended)(nil),
|
||||
ExtensionType: (*AnotherExtension)(nil),
|
||||
Field: 29,
|
||||
Name: "grpc.testing.nitz",
|
||||
Tag: "bytes,29,opt,name=nitz",
|
||||
Filename: "reflection/grpc_testing/proto2_ext2.proto",
|
||||
},
|
||||
}
|
||||
|
||||
// Extension fields to ToBeExtended.
|
||||
var (
|
||||
// optional string frob = 23;
|
||||
E_Frob = &file_reflection_grpc_testing_proto2_ext2_proto_extTypes[0]
|
||||
// optional grpc.testing.AnotherExtension nitz = 29;
|
||||
E_Nitz = &file_reflection_grpc_testing_proto2_ext2_proto_extTypes[1]
|
||||
)
|
||||
|
||||
var File_reflection_grpc_testing_proto2_ext2_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_reflection_grpc_testing_proto2_ext2_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
")reflection/grpc_testing/proto2_ext2.proto\x12\fgrpc.testing\x1a$reflection/grpc_testing/proto2.proto\"<\n" +
|
||||
"\x10AnotherExtension\x12(\n" +
|
||||
"\x0fwhatchamacallit\x18\x01 \x01(\x05R\x0fwhatchamacallit:.\n" +
|
||||
"\x04frob\x12\x1a.grpc.testing.ToBeExtended\x18\x17 \x01(\tR\x04frob:N\n" +
|
||||
"\x04nitz\x12\x1a.grpc.testing.ToBeExtended\x18\x1d \x01(\v2\x1e.grpc.testing.AnotherExtensionR\x04nitzB0Z.google.golang.org/grpc/reflection/grpc_testing"
|
||||
|
||||
var (
|
||||
file_reflection_grpc_testing_proto2_ext2_proto_rawDescOnce sync.Once
|
||||
file_reflection_grpc_testing_proto2_ext2_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_reflection_grpc_testing_proto2_ext2_proto_rawDescGZIP() []byte {
|
||||
file_reflection_grpc_testing_proto2_ext2_proto_rawDescOnce.Do(func() {
|
||||
file_reflection_grpc_testing_proto2_ext2_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_reflection_grpc_testing_proto2_ext2_proto_rawDesc), len(file_reflection_grpc_testing_proto2_ext2_proto_rawDesc)))
|
||||
})
|
||||
return file_reflection_grpc_testing_proto2_ext2_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_reflection_grpc_testing_proto2_ext2_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_reflection_grpc_testing_proto2_ext2_proto_goTypes = []any{
|
||||
(*AnotherExtension)(nil), // 0: grpc.testing.AnotherExtension
|
||||
(*ToBeExtended)(nil), // 1: grpc.testing.ToBeExtended
|
||||
}
|
||||
var file_reflection_grpc_testing_proto2_ext2_proto_depIdxs = []int32{
|
||||
1, // 0: grpc.testing.frob:extendee -> grpc.testing.ToBeExtended
|
||||
1, // 1: grpc.testing.nitz:extendee -> grpc.testing.ToBeExtended
|
||||
0, // 2: grpc.testing.nitz:type_name -> grpc.testing.AnotherExtension
|
||||
3, // [3:3] is the sub-list for method output_type
|
||||
3, // [3:3] is the sub-list for method input_type
|
||||
2, // [2:3] is the sub-list for extension type_name
|
||||
0, // [0:2] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_reflection_grpc_testing_proto2_ext2_proto_init() }
|
||||
func file_reflection_grpc_testing_proto2_ext2_proto_init() {
|
||||
if File_reflection_grpc_testing_proto2_ext2_proto != nil {
|
||||
return
|
||||
}
|
||||
file_reflection_grpc_testing_proto2_proto_init()
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_reflection_grpc_testing_proto2_ext2_proto_rawDesc), len(file_reflection_grpc_testing_proto2_ext2_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 2,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_reflection_grpc_testing_proto2_ext2_proto_goTypes,
|
||||
DependencyIndexes: file_reflection_grpc_testing_proto2_ext2_proto_depIdxs,
|
||||
MessageInfos: file_reflection_grpc_testing_proto2_ext2_proto_msgTypes,
|
||||
ExtensionInfos: file_reflection_grpc_testing_proto2_ext2_proto_extTypes,
|
||||
}.Build()
|
||||
File_reflection_grpc_testing_proto2_ext2_proto = out.File
|
||||
file_reflection_grpc_testing_proto2_ext2_proto_goTypes = nil
|
||||
file_reflection_grpc_testing_proto2_ext2_proto_depIdxs = nil
|
||||
}
|
||||
30
reflection/grpc_testing/proto2_ext2.proto
Normal file
30
reflection/grpc_testing/proto2_ext2.proto
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright 2017 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.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
option go_package = "google.golang.org/grpc/reflection/grpc_testing";
|
||||
|
||||
package grpc.testing;
|
||||
|
||||
import "reflection/grpc_testing/proto2.proto";
|
||||
|
||||
extend ToBeExtended {
|
||||
optional string frob = 23;
|
||||
optional AnotherExtension nitz = 29;
|
||||
}
|
||||
|
||||
message AnotherExtension {
|
||||
optional int32 whatchamacallit = 1;
|
||||
}
|
||||
256
reflection/grpc_testing/test.pb.go
Normal file
256
reflection/grpc_testing/test.pb.go
Normal file
@@ -0,0 +1,256 @@
|
||||
// Copyright 2017 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.
|
||||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.12
|
||||
// protoc v5.27.1
|
||||
// source: reflection/grpc_testing/test.proto
|
||||
|
||||
package grpc_testing
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type SearchResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Results []*SearchResponse_Result `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *SearchResponse) Reset() {
|
||||
*x = SearchResponse{}
|
||||
mi := &file_reflection_grpc_testing_test_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *SearchResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SearchResponse) ProtoMessage() {}
|
||||
|
||||
func (x *SearchResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_reflection_grpc_testing_test_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SearchResponse.ProtoReflect.Descriptor instead.
|
||||
func (*SearchResponse) Descriptor() ([]byte, []int) {
|
||||
return file_reflection_grpc_testing_test_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *SearchResponse) GetResults() []*SearchResponse_Result {
|
||||
if x != nil {
|
||||
return x.Results
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type SearchRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *SearchRequest) Reset() {
|
||||
*x = SearchRequest{}
|
||||
mi := &file_reflection_grpc_testing_test_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *SearchRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SearchRequest) ProtoMessage() {}
|
||||
|
||||
func (x *SearchRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_reflection_grpc_testing_test_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SearchRequest.ProtoReflect.Descriptor instead.
|
||||
func (*SearchRequest) Descriptor() ([]byte, []int) {
|
||||
return file_reflection_grpc_testing_test_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *SearchRequest) GetQuery() string {
|
||||
if x != nil {
|
||||
return x.Query
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type SearchResponse_Result struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
|
||||
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
|
||||
Snippets []string `protobuf:"bytes,3,rep,name=snippets,proto3" json:"snippets,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *SearchResponse_Result) Reset() {
|
||||
*x = SearchResponse_Result{}
|
||||
mi := &file_reflection_grpc_testing_test_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *SearchResponse_Result) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SearchResponse_Result) ProtoMessage() {}
|
||||
|
||||
func (x *SearchResponse_Result) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_reflection_grpc_testing_test_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SearchResponse_Result.ProtoReflect.Descriptor instead.
|
||||
func (*SearchResponse_Result) Descriptor() ([]byte, []int) {
|
||||
return file_reflection_grpc_testing_test_proto_rawDescGZIP(), []int{0, 0}
|
||||
}
|
||||
|
||||
func (x *SearchResponse_Result) GetUrl() string {
|
||||
if x != nil {
|
||||
return x.Url
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *SearchResponse_Result) GetTitle() string {
|
||||
if x != nil {
|
||||
return x.Title
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *SearchResponse_Result) GetSnippets() []string {
|
||||
if x != nil {
|
||||
return x.Snippets
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_reflection_grpc_testing_test_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_reflection_grpc_testing_test_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\"reflection/grpc_testing/test.proto\x12\fgrpc.testing\"\x9d\x01\n" +
|
||||
"\x0eSearchResponse\x12=\n" +
|
||||
"\aresults\x18\x01 \x03(\v2#.grpc.testing.SearchResponse.ResultR\aresults\x1aL\n" +
|
||||
"\x06Result\x12\x10\n" +
|
||||
"\x03url\x18\x01 \x01(\tR\x03url\x12\x14\n" +
|
||||
"\x05title\x18\x02 \x01(\tR\x05title\x12\x1a\n" +
|
||||
"\bsnippets\x18\x03 \x03(\tR\bsnippets\"%\n" +
|
||||
"\rSearchRequest\x12\x14\n" +
|
||||
"\x05query\x18\x01 \x01(\tR\x05query2\xa6\x01\n" +
|
||||
"\rSearchService\x12C\n" +
|
||||
"\x06Search\x12\x1b.grpc.testing.SearchRequest\x1a\x1c.grpc.testing.SearchResponse\x12P\n" +
|
||||
"\x0fStreamingSearch\x12\x1b.grpc.testing.SearchRequest\x1a\x1c.grpc.testing.SearchResponse(\x010\x01B0Z.google.golang.org/grpc/reflection/grpc_testingb\x06proto3"
|
||||
|
||||
var (
|
||||
file_reflection_grpc_testing_test_proto_rawDescOnce sync.Once
|
||||
file_reflection_grpc_testing_test_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_reflection_grpc_testing_test_proto_rawDescGZIP() []byte {
|
||||
file_reflection_grpc_testing_test_proto_rawDescOnce.Do(func() {
|
||||
file_reflection_grpc_testing_test_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_reflection_grpc_testing_test_proto_rawDesc), len(file_reflection_grpc_testing_test_proto_rawDesc)))
|
||||
})
|
||||
return file_reflection_grpc_testing_test_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_reflection_grpc_testing_test_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_reflection_grpc_testing_test_proto_goTypes = []any{
|
||||
(*SearchResponse)(nil), // 0: grpc.testing.SearchResponse
|
||||
(*SearchRequest)(nil), // 1: grpc.testing.SearchRequest
|
||||
(*SearchResponse_Result)(nil), // 2: grpc.testing.SearchResponse.Result
|
||||
}
|
||||
var file_reflection_grpc_testing_test_proto_depIdxs = []int32{
|
||||
2, // 0: grpc.testing.SearchResponse.results:type_name -> grpc.testing.SearchResponse.Result
|
||||
1, // 1: grpc.testing.SearchService.Search:input_type -> grpc.testing.SearchRequest
|
||||
1, // 2: grpc.testing.SearchService.StreamingSearch:input_type -> grpc.testing.SearchRequest
|
||||
0, // 3: grpc.testing.SearchService.Search:output_type -> grpc.testing.SearchResponse
|
||||
0, // 4: grpc.testing.SearchService.StreamingSearch:output_type -> grpc.testing.SearchResponse
|
||||
3, // [3:5] is the sub-list for method output_type
|
||||
1, // [1:3] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_reflection_grpc_testing_test_proto_init() }
|
||||
func file_reflection_grpc_testing_test_proto_init() {
|
||||
if File_reflection_grpc_testing_test_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_reflection_grpc_testing_test_proto_rawDesc), len(file_reflection_grpc_testing_test_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 3,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_reflection_grpc_testing_test_proto_goTypes,
|
||||
DependencyIndexes: file_reflection_grpc_testing_test_proto_depIdxs,
|
||||
MessageInfos: file_reflection_grpc_testing_test_proto_msgTypes,
|
||||
}.Build()
|
||||
File_reflection_grpc_testing_test_proto = out.File
|
||||
file_reflection_grpc_testing_test_proto_goTypes = nil
|
||||
file_reflection_grpc_testing_test_proto_depIdxs = nil
|
||||
}
|
||||
37
reflection/grpc_testing/test.proto
Normal file
37
reflection/grpc_testing/test.proto
Normal file
@@ -0,0 +1,37 @@
|
||||
// Copyright 2017 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = "google.golang.org/grpc/reflection/grpc_testing";
|
||||
|
||||
package grpc.testing;
|
||||
|
||||
message SearchResponse {
|
||||
message Result {
|
||||
string url = 1;
|
||||
string title = 2;
|
||||
repeated string snippets = 3;
|
||||
}
|
||||
repeated Result results = 1;
|
||||
}
|
||||
|
||||
message SearchRequest {
|
||||
string query = 1;
|
||||
}
|
||||
|
||||
service SearchService {
|
||||
rpc Search(SearchRequest) returns (SearchResponse);
|
||||
rpc StreamingSearch(stream SearchRequest) returns (stream SearchResponse);
|
||||
}
|
||||
168
reflection/grpc_testing/test_grpc.pb.go
Normal file
168
reflection/grpc_testing/test_grpc.pb.go
Normal file
@@ -0,0 +1,168 @@
|
||||
// Copyright 2017 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.
|
||||
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.6.2
|
||||
// - protoc v5.27.1
|
||||
// source: reflection/grpc_testing/test.proto
|
||||
|
||||
package grpc_testing
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
SearchService_Search_FullMethodName = "/grpc.testing.SearchService/Search"
|
||||
SearchService_StreamingSearch_FullMethodName = "/grpc.testing.SearchService/StreamingSearch"
|
||||
)
|
||||
|
||||
// SearchServiceClient is the client API for SearchService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type SearchServiceClient interface {
|
||||
Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchResponse, error)
|
||||
StreamingSearch(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[SearchRequest, SearchResponse], error)
|
||||
}
|
||||
|
||||
type searchServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewSearchServiceClient(cc grpc.ClientConnInterface) SearchServiceClient {
|
||||
return &searchServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *searchServiceClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SearchResponse)
|
||||
err := c.cc.Invoke(ctx, SearchService_Search_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *searchServiceClient) StreamingSearch(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[SearchRequest, SearchResponse], error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
stream, err := c.cc.NewStream(ctx, &SearchService_ServiceDesc.Streams[0], SearchService_StreamingSearch_FullMethodName, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &grpc.GenericClientStream[SearchRequest, SearchResponse]{ClientStream: stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||
type SearchService_StreamingSearchClient = grpc.BidiStreamingClient[SearchRequest, SearchResponse]
|
||||
|
||||
// SearchServiceServer is the server API for SearchService service.
|
||||
// All implementations must embed UnimplementedSearchServiceServer
|
||||
// for forward compatibility.
|
||||
type SearchServiceServer interface {
|
||||
Search(context.Context, *SearchRequest) (*SearchResponse, error)
|
||||
StreamingSearch(grpc.BidiStreamingServer[SearchRequest, SearchResponse]) error
|
||||
mustEmbedUnimplementedSearchServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedSearchServiceServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedSearchServiceServer struct{}
|
||||
|
||||
func (UnimplementedSearchServiceServer) Search(context.Context, *SearchRequest) (*SearchResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Search not implemented")
|
||||
}
|
||||
func (UnimplementedSearchServiceServer) StreamingSearch(grpc.BidiStreamingServer[SearchRequest, SearchResponse]) error {
|
||||
return status.Error(codes.Unimplemented, "method StreamingSearch not implemented")
|
||||
}
|
||||
func (UnimplementedSearchServiceServer) mustEmbedUnimplementedSearchServiceServer() {}
|
||||
func (UnimplementedSearchServiceServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeSearchServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to SearchServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeSearchServiceServer interface {
|
||||
mustEmbedUnimplementedSearchServiceServer()
|
||||
}
|
||||
|
||||
func RegisterSearchServiceServer(s grpc.ServiceRegistrar, srv SearchServiceServer) {
|
||||
// If the following call panics, it indicates UnimplementedSearchServiceServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&SearchService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _SearchService_Search_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SearchRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SearchServiceServer).Search(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: SearchService_Search_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SearchServiceServer).Search(ctx, req.(*SearchRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _SearchService_StreamingSearch_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(SearchServiceServer).StreamingSearch(&grpc.GenericServerStream[SearchRequest, SearchResponse]{ServerStream: stream})
|
||||
}
|
||||
|
||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||
type SearchService_StreamingSearchServer = grpc.BidiStreamingServer[SearchRequest, SearchResponse]
|
||||
|
||||
// SearchService_ServiceDesc is the grpc.ServiceDesc for SearchService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var SearchService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "grpc.testing.SearchService",
|
||||
HandlerType: (*SearchServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Search",
|
||||
Handler: _SearchService_Search_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
StreamName: "StreamingSearch",
|
||||
Handler: _SearchService_StreamingSearch_Handler,
|
||||
ServerStreams: true,
|
||||
ClientStreams: true,
|
||||
},
|
||||
},
|
||||
Metadata: "reflection/grpc_testing/test.proto",
|
||||
}
|
||||
436
reflection/internal/internal.go
Normal file
436
reflection/internal/internal.go
Normal file
@@ -0,0 +1,436 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2024 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.
|
||||
*
|
||||
*/
|
||||
|
||||
// Package internal contains code that is shared by both reflection package and
|
||||
// the test package. The packages are split in this way inorder to avoid
|
||||
// dependency to deprecated package github.com/golang/protobuf.
|
||||
package internal
|
||||
|
||||
import (
|
||||
"io"
|
||||
"sort"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/reflect/protodesc"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoregistry"
|
||||
|
||||
v1reflectiongrpc "google.golang.org/grpc/reflection/grpc_reflection_v1"
|
||||
v1reflectionpb "google.golang.org/grpc/reflection/grpc_reflection_v1"
|
||||
v1alphareflectiongrpc "google.golang.org/grpc/reflection/grpc_reflection_v1alpha"
|
||||
v1alphareflectionpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha"
|
||||
)
|
||||
|
||||
// ServiceInfoProvider is an interface used to retrieve metadata about the
|
||||
// services to expose.
|
||||
type ServiceInfoProvider interface {
|
||||
GetServiceInfo() map[string]grpc.ServiceInfo
|
||||
}
|
||||
|
||||
// ExtensionResolver is the interface used to query details about extensions.
|
||||
// This interface is satisfied by protoregistry.GlobalTypes.
|
||||
type ExtensionResolver interface {
|
||||
protoregistry.ExtensionTypeResolver
|
||||
RangeExtensionsByMessage(message protoreflect.FullName, f func(protoreflect.ExtensionType) bool)
|
||||
}
|
||||
|
||||
// ServerReflectionServer is the server API for ServerReflection service.
|
||||
type ServerReflectionServer struct {
|
||||
v1alphareflectiongrpc.UnimplementedServerReflectionServer
|
||||
S ServiceInfoProvider
|
||||
DescResolver protodesc.Resolver
|
||||
ExtResolver ExtensionResolver
|
||||
}
|
||||
|
||||
// FileDescWithDependencies returns a slice of serialized fileDescriptors in
|
||||
// wire format ([]byte). The fileDescriptors will include fd and all the
|
||||
// transitive dependencies of fd with names not in sentFileDescriptors.
|
||||
func (s *ServerReflectionServer) FileDescWithDependencies(fd protoreflect.FileDescriptor, sentFileDescriptors map[string]bool) ([][]byte, error) {
|
||||
if fd.IsPlaceholder() {
|
||||
// If the given root file is a placeholder, treat it
|
||||
// as missing instead of serializing it.
|
||||
return nil, protoregistry.NotFound
|
||||
}
|
||||
var r [][]byte
|
||||
queue := []protoreflect.FileDescriptor{fd}
|
||||
for len(queue) > 0 {
|
||||
currentfd := queue[0]
|
||||
queue = queue[1:]
|
||||
if currentfd.IsPlaceholder() {
|
||||
// Skip any missing files in the dependency graph.
|
||||
continue
|
||||
}
|
||||
if sent := sentFileDescriptors[currentfd.Path()]; len(r) == 0 || !sent {
|
||||
sentFileDescriptors[currentfd.Path()] = true
|
||||
fdProto := protodesc.ToFileDescriptorProto(currentfd)
|
||||
currentfdEncoded, err := proto.Marshal(fdProto)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
r = append(r, currentfdEncoded)
|
||||
}
|
||||
for i := 0; i < currentfd.Imports().Len(); i++ {
|
||||
queue = append(queue, currentfd.Imports().Get(i))
|
||||
}
|
||||
}
|
||||
return r, nil
|
||||
}
|
||||
|
||||
// FileDescEncodingContainingSymbol finds the file descriptor containing the
|
||||
// given symbol, finds all of its previously unsent transitive dependencies,
|
||||
// does marshalling on them, and returns the marshalled result. The given symbol
|
||||
// can be a type, a service or a method.
|
||||
func (s *ServerReflectionServer) FileDescEncodingContainingSymbol(name string, sentFileDescriptors map[string]bool) ([][]byte, error) {
|
||||
d, err := s.DescResolver.FindDescriptorByName(protoreflect.FullName(name))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return s.FileDescWithDependencies(d.ParentFile(), sentFileDescriptors)
|
||||
}
|
||||
|
||||
// FileDescEncodingContainingExtension finds the file descriptor containing
|
||||
// given extension, finds all of its previously unsent transitive dependencies,
|
||||
// does marshalling on them, and returns the marshalled result.
|
||||
func (s *ServerReflectionServer) FileDescEncodingContainingExtension(typeName string, extNum int32, sentFileDescriptors map[string]bool) ([][]byte, error) {
|
||||
xt, err := s.ExtResolver.FindExtensionByNumber(protoreflect.FullName(typeName), protoreflect.FieldNumber(extNum))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return s.FileDescWithDependencies(xt.TypeDescriptor().ParentFile(), sentFileDescriptors)
|
||||
}
|
||||
|
||||
// AllExtensionNumbersForTypeName returns all extension numbers for the given type.
|
||||
func (s *ServerReflectionServer) AllExtensionNumbersForTypeName(name string) ([]int32, error) {
|
||||
var numbers []int32
|
||||
s.ExtResolver.RangeExtensionsByMessage(protoreflect.FullName(name), func(xt protoreflect.ExtensionType) bool {
|
||||
numbers = append(numbers, int32(xt.TypeDescriptor().Number()))
|
||||
return true
|
||||
})
|
||||
sort.Slice(numbers, func(i, j int) bool {
|
||||
return numbers[i] < numbers[j]
|
||||
})
|
||||
if len(numbers) == 0 {
|
||||
// maybe return an error if given type name is not known
|
||||
if _, err := s.DescResolver.FindDescriptorByName(protoreflect.FullName(name)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return numbers, nil
|
||||
}
|
||||
|
||||
// ListServices returns the names of services this server exposes.
|
||||
func (s *ServerReflectionServer) ListServices() []*v1reflectionpb.ServiceResponse {
|
||||
serviceInfo := s.S.GetServiceInfo()
|
||||
resp := make([]*v1reflectionpb.ServiceResponse, 0, len(serviceInfo))
|
||||
for svc := range serviceInfo {
|
||||
resp = append(resp, &v1reflectionpb.ServiceResponse{Name: svc})
|
||||
}
|
||||
sort.Slice(resp, func(i, j int) bool {
|
||||
return resp[i].Name < resp[j].Name
|
||||
})
|
||||
return resp
|
||||
}
|
||||
|
||||
// ServerReflectionInfo is the reflection service handler.
|
||||
func (s *ServerReflectionServer) ServerReflectionInfo(stream v1reflectiongrpc.ServerReflection_ServerReflectionInfoServer) error {
|
||||
sentFileDescriptors := make(map[string]bool)
|
||||
for {
|
||||
in, err := stream.Recv()
|
||||
if err == io.EOF {
|
||||
return nil
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
out := &v1reflectionpb.ServerReflectionResponse{
|
||||
ValidHost: in.Host,
|
||||
OriginalRequest: in,
|
||||
}
|
||||
switch req := in.MessageRequest.(type) {
|
||||
case *v1reflectionpb.ServerReflectionRequest_FileByFilename:
|
||||
var b [][]byte
|
||||
fd, err := s.DescResolver.FindFileByPath(req.FileByFilename)
|
||||
if err == nil {
|
||||
b, err = s.FileDescWithDependencies(fd, sentFileDescriptors)
|
||||
}
|
||||
if err != nil {
|
||||
out.MessageResponse = &v1reflectionpb.ServerReflectionResponse_ErrorResponse{
|
||||
ErrorResponse: &v1reflectionpb.ErrorResponse{
|
||||
ErrorCode: int32(codes.NotFound),
|
||||
ErrorMessage: err.Error(),
|
||||
},
|
||||
}
|
||||
} else {
|
||||
out.MessageResponse = &v1reflectionpb.ServerReflectionResponse_FileDescriptorResponse{
|
||||
FileDescriptorResponse: &v1reflectionpb.FileDescriptorResponse{FileDescriptorProto: b},
|
||||
}
|
||||
}
|
||||
case *v1reflectionpb.ServerReflectionRequest_FileContainingSymbol:
|
||||
b, err := s.FileDescEncodingContainingSymbol(req.FileContainingSymbol, sentFileDescriptors)
|
||||
if err != nil {
|
||||
out.MessageResponse = &v1reflectionpb.ServerReflectionResponse_ErrorResponse{
|
||||
ErrorResponse: &v1reflectionpb.ErrorResponse{
|
||||
ErrorCode: int32(codes.NotFound),
|
||||
ErrorMessage: err.Error(),
|
||||
},
|
||||
}
|
||||
} else {
|
||||
out.MessageResponse = &v1reflectionpb.ServerReflectionResponse_FileDescriptorResponse{
|
||||
FileDescriptorResponse: &v1reflectionpb.FileDescriptorResponse{FileDescriptorProto: b},
|
||||
}
|
||||
}
|
||||
case *v1reflectionpb.ServerReflectionRequest_FileContainingExtension:
|
||||
typeName := req.FileContainingExtension.ContainingType
|
||||
extNum := req.FileContainingExtension.ExtensionNumber
|
||||
b, err := s.FileDescEncodingContainingExtension(typeName, extNum, sentFileDescriptors)
|
||||
if err != nil {
|
||||
out.MessageResponse = &v1reflectionpb.ServerReflectionResponse_ErrorResponse{
|
||||
ErrorResponse: &v1reflectionpb.ErrorResponse{
|
||||
ErrorCode: int32(codes.NotFound),
|
||||
ErrorMessage: err.Error(),
|
||||
},
|
||||
}
|
||||
} else {
|
||||
out.MessageResponse = &v1reflectionpb.ServerReflectionResponse_FileDescriptorResponse{
|
||||
FileDescriptorResponse: &v1reflectionpb.FileDescriptorResponse{FileDescriptorProto: b},
|
||||
}
|
||||
}
|
||||
case *v1reflectionpb.ServerReflectionRequest_AllExtensionNumbersOfType:
|
||||
extNums, err := s.AllExtensionNumbersForTypeName(req.AllExtensionNumbersOfType)
|
||||
if err != nil {
|
||||
out.MessageResponse = &v1reflectionpb.ServerReflectionResponse_ErrorResponse{
|
||||
ErrorResponse: &v1reflectionpb.ErrorResponse{
|
||||
ErrorCode: int32(codes.NotFound),
|
||||
ErrorMessage: err.Error(),
|
||||
},
|
||||
}
|
||||
} else {
|
||||
out.MessageResponse = &v1reflectionpb.ServerReflectionResponse_AllExtensionNumbersResponse{
|
||||
AllExtensionNumbersResponse: &v1reflectionpb.ExtensionNumberResponse{
|
||||
BaseTypeName: req.AllExtensionNumbersOfType,
|
||||
ExtensionNumber: extNums,
|
||||
},
|
||||
}
|
||||
}
|
||||
case *v1reflectionpb.ServerReflectionRequest_ListServices:
|
||||
out.MessageResponse = &v1reflectionpb.ServerReflectionResponse_ListServicesResponse{
|
||||
ListServicesResponse: &v1reflectionpb.ListServiceResponse{
|
||||
Service: s.ListServices(),
|
||||
},
|
||||
}
|
||||
default:
|
||||
return status.Errorf(codes.InvalidArgument, "invalid MessageRequest: %v", in.MessageRequest)
|
||||
}
|
||||
|
||||
if err := stream.Send(out); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// V1ToV1AlphaResponse converts a v1 ServerReflectionResponse to a v1alpha.
|
||||
func V1ToV1AlphaResponse(v1 *v1reflectionpb.ServerReflectionResponse) *v1alphareflectionpb.ServerReflectionResponse {
|
||||
var v1alpha v1alphareflectionpb.ServerReflectionResponse
|
||||
v1alpha.ValidHost = v1.ValidHost
|
||||
if v1.OriginalRequest != nil {
|
||||
v1alpha.OriginalRequest = V1ToV1AlphaRequest(v1.OriginalRequest)
|
||||
}
|
||||
switch mr := v1.MessageResponse.(type) {
|
||||
case *v1reflectionpb.ServerReflectionResponse_FileDescriptorResponse:
|
||||
if mr != nil {
|
||||
v1alpha.MessageResponse = &v1alphareflectionpb.ServerReflectionResponse_FileDescriptorResponse{
|
||||
FileDescriptorResponse: &v1alphareflectionpb.FileDescriptorResponse{
|
||||
FileDescriptorProto: mr.FileDescriptorResponse.GetFileDescriptorProto(),
|
||||
},
|
||||
}
|
||||
}
|
||||
case *v1reflectionpb.ServerReflectionResponse_AllExtensionNumbersResponse:
|
||||
if mr != nil {
|
||||
v1alpha.MessageResponse = &v1alphareflectionpb.ServerReflectionResponse_AllExtensionNumbersResponse{
|
||||
AllExtensionNumbersResponse: &v1alphareflectionpb.ExtensionNumberResponse{
|
||||
BaseTypeName: mr.AllExtensionNumbersResponse.GetBaseTypeName(),
|
||||
ExtensionNumber: mr.AllExtensionNumbersResponse.GetExtensionNumber(),
|
||||
},
|
||||
}
|
||||
}
|
||||
case *v1reflectionpb.ServerReflectionResponse_ListServicesResponse:
|
||||
if mr != nil {
|
||||
svcs := make([]*v1alphareflectionpb.ServiceResponse, len(mr.ListServicesResponse.GetService()))
|
||||
for i, svc := range mr.ListServicesResponse.GetService() {
|
||||
svcs[i] = &v1alphareflectionpb.ServiceResponse{
|
||||
Name: svc.GetName(),
|
||||
}
|
||||
}
|
||||
v1alpha.MessageResponse = &v1alphareflectionpb.ServerReflectionResponse_ListServicesResponse{
|
||||
ListServicesResponse: &v1alphareflectionpb.ListServiceResponse{
|
||||
Service: svcs,
|
||||
},
|
||||
}
|
||||
}
|
||||
case *v1reflectionpb.ServerReflectionResponse_ErrorResponse:
|
||||
if mr != nil {
|
||||
v1alpha.MessageResponse = &v1alphareflectionpb.ServerReflectionResponse_ErrorResponse{
|
||||
ErrorResponse: &v1alphareflectionpb.ErrorResponse{
|
||||
ErrorCode: mr.ErrorResponse.GetErrorCode(),
|
||||
ErrorMessage: mr.ErrorResponse.GetErrorMessage(),
|
||||
},
|
||||
}
|
||||
}
|
||||
default:
|
||||
// no value set
|
||||
}
|
||||
return &v1alpha
|
||||
}
|
||||
|
||||
// V1AlphaToV1Request converts a v1alpha ServerReflectionRequest to a v1.
|
||||
func V1AlphaToV1Request(v1alpha *v1alphareflectionpb.ServerReflectionRequest) *v1reflectionpb.ServerReflectionRequest {
|
||||
var v1 v1reflectionpb.ServerReflectionRequest
|
||||
v1.Host = v1alpha.Host
|
||||
switch mr := v1alpha.MessageRequest.(type) {
|
||||
case *v1alphareflectionpb.ServerReflectionRequest_FileByFilename:
|
||||
v1.MessageRequest = &v1reflectionpb.ServerReflectionRequest_FileByFilename{
|
||||
FileByFilename: mr.FileByFilename,
|
||||
}
|
||||
case *v1alphareflectionpb.ServerReflectionRequest_FileContainingSymbol:
|
||||
v1.MessageRequest = &v1reflectionpb.ServerReflectionRequest_FileContainingSymbol{
|
||||
FileContainingSymbol: mr.FileContainingSymbol,
|
||||
}
|
||||
case *v1alphareflectionpb.ServerReflectionRequest_FileContainingExtension:
|
||||
if mr.FileContainingExtension != nil {
|
||||
v1.MessageRequest = &v1reflectionpb.ServerReflectionRequest_FileContainingExtension{
|
||||
FileContainingExtension: &v1reflectionpb.ExtensionRequest{
|
||||
ContainingType: mr.FileContainingExtension.GetContainingType(),
|
||||
ExtensionNumber: mr.FileContainingExtension.GetExtensionNumber(),
|
||||
},
|
||||
}
|
||||
}
|
||||
case *v1alphareflectionpb.ServerReflectionRequest_AllExtensionNumbersOfType:
|
||||
v1.MessageRequest = &v1reflectionpb.ServerReflectionRequest_AllExtensionNumbersOfType{
|
||||
AllExtensionNumbersOfType: mr.AllExtensionNumbersOfType,
|
||||
}
|
||||
case *v1alphareflectionpb.ServerReflectionRequest_ListServices:
|
||||
v1.MessageRequest = &v1reflectionpb.ServerReflectionRequest_ListServices{
|
||||
ListServices: mr.ListServices,
|
||||
}
|
||||
default:
|
||||
// no value set
|
||||
}
|
||||
return &v1
|
||||
}
|
||||
|
||||
// V1ToV1AlphaRequest converts a v1 ServerReflectionRequest to a v1alpha.
|
||||
func V1ToV1AlphaRequest(v1 *v1reflectionpb.ServerReflectionRequest) *v1alphareflectionpb.ServerReflectionRequest {
|
||||
var v1alpha v1alphareflectionpb.ServerReflectionRequest
|
||||
v1alpha.Host = v1.Host
|
||||
switch mr := v1.MessageRequest.(type) {
|
||||
case *v1reflectionpb.ServerReflectionRequest_FileByFilename:
|
||||
if mr != nil {
|
||||
v1alpha.MessageRequest = &v1alphareflectionpb.ServerReflectionRequest_FileByFilename{
|
||||
FileByFilename: mr.FileByFilename,
|
||||
}
|
||||
}
|
||||
case *v1reflectionpb.ServerReflectionRequest_FileContainingSymbol:
|
||||
if mr != nil {
|
||||
v1alpha.MessageRequest = &v1alphareflectionpb.ServerReflectionRequest_FileContainingSymbol{
|
||||
FileContainingSymbol: mr.FileContainingSymbol,
|
||||
}
|
||||
}
|
||||
case *v1reflectionpb.ServerReflectionRequest_FileContainingExtension:
|
||||
if mr != nil {
|
||||
v1alpha.MessageRequest = &v1alphareflectionpb.ServerReflectionRequest_FileContainingExtension{
|
||||
FileContainingExtension: &v1alphareflectionpb.ExtensionRequest{
|
||||
ContainingType: mr.FileContainingExtension.GetContainingType(),
|
||||
ExtensionNumber: mr.FileContainingExtension.GetExtensionNumber(),
|
||||
},
|
||||
}
|
||||
}
|
||||
case *v1reflectionpb.ServerReflectionRequest_AllExtensionNumbersOfType:
|
||||
if mr != nil {
|
||||
v1alpha.MessageRequest = &v1alphareflectionpb.ServerReflectionRequest_AllExtensionNumbersOfType{
|
||||
AllExtensionNumbersOfType: mr.AllExtensionNumbersOfType,
|
||||
}
|
||||
}
|
||||
case *v1reflectionpb.ServerReflectionRequest_ListServices:
|
||||
if mr != nil {
|
||||
v1alpha.MessageRequest = &v1alphareflectionpb.ServerReflectionRequest_ListServices{
|
||||
ListServices: mr.ListServices,
|
||||
}
|
||||
}
|
||||
default:
|
||||
// no value set
|
||||
}
|
||||
return &v1alpha
|
||||
}
|
||||
|
||||
// V1AlphaToV1Response converts a v1alpha ServerReflectionResponse to a v1.
|
||||
func V1AlphaToV1Response(v1alpha *v1alphareflectionpb.ServerReflectionResponse) *v1reflectionpb.ServerReflectionResponse {
|
||||
var v1 v1reflectionpb.ServerReflectionResponse
|
||||
v1.ValidHost = v1alpha.ValidHost
|
||||
if v1alpha.OriginalRequest != nil {
|
||||
v1.OriginalRequest = V1AlphaToV1Request(v1alpha.OriginalRequest)
|
||||
}
|
||||
switch mr := v1alpha.MessageResponse.(type) {
|
||||
case *v1alphareflectionpb.ServerReflectionResponse_FileDescriptorResponse:
|
||||
if mr != nil {
|
||||
v1.MessageResponse = &v1reflectionpb.ServerReflectionResponse_FileDescriptorResponse{
|
||||
FileDescriptorResponse: &v1reflectionpb.FileDescriptorResponse{
|
||||
FileDescriptorProto: mr.FileDescriptorResponse.GetFileDescriptorProto(),
|
||||
},
|
||||
}
|
||||
}
|
||||
case *v1alphareflectionpb.ServerReflectionResponse_AllExtensionNumbersResponse:
|
||||
if mr != nil {
|
||||
v1.MessageResponse = &v1reflectionpb.ServerReflectionResponse_AllExtensionNumbersResponse{
|
||||
AllExtensionNumbersResponse: &v1reflectionpb.ExtensionNumberResponse{
|
||||
BaseTypeName: mr.AllExtensionNumbersResponse.GetBaseTypeName(),
|
||||
ExtensionNumber: mr.AllExtensionNumbersResponse.GetExtensionNumber(),
|
||||
},
|
||||
}
|
||||
}
|
||||
case *v1alphareflectionpb.ServerReflectionResponse_ListServicesResponse:
|
||||
if mr != nil {
|
||||
svcs := make([]*v1reflectionpb.ServiceResponse, len(mr.ListServicesResponse.GetService()))
|
||||
for i, svc := range mr.ListServicesResponse.GetService() {
|
||||
svcs[i] = &v1reflectionpb.ServiceResponse{
|
||||
Name: svc.GetName(),
|
||||
}
|
||||
}
|
||||
v1.MessageResponse = &v1reflectionpb.ServerReflectionResponse_ListServicesResponse{
|
||||
ListServicesResponse: &v1reflectionpb.ListServiceResponse{
|
||||
Service: svcs,
|
||||
},
|
||||
}
|
||||
}
|
||||
case *v1alphareflectionpb.ServerReflectionResponse_ErrorResponse:
|
||||
if mr != nil {
|
||||
v1.MessageResponse = &v1reflectionpb.ServerReflectionResponse_ErrorResponse{
|
||||
ErrorResponse: &v1reflectionpb.ErrorResponse{
|
||||
ErrorCode: mr.ErrorResponse.GetErrorCode(),
|
||||
ErrorMessage: mr.ErrorResponse.GetErrorMessage(),
|
||||
},
|
||||
}
|
||||
}
|
||||
default:
|
||||
// no value set
|
||||
}
|
||||
return &v1
|
||||
}
|
||||
160
reflection/serverreflection.go
Normal file
160
reflection/serverreflection.go
Normal file
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
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 (
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/reflection/internal"
|
||||
"google.golang.org/protobuf/reflect/protodesc"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoregistry"
|
||||
|
||||
v1reflectiongrpc "google.golang.org/grpc/reflection/grpc_reflection_v1"
|
||||
v1alphareflectiongrpc "google.golang.org/grpc/reflection/grpc_reflection_v1alpha"
|
||||
)
|
||||
|
||||
// GRPCServer is the interface provided by a gRPC server. It is implemented by
|
||||
// *grpc.Server, but could also be implemented by other concrete types. It acts
|
||||
// as a registry, for accumulating the services exposed by the server.
|
||||
type GRPCServer interface {
|
||||
grpc.ServiceRegistrar
|
||||
ServiceInfoProvider
|
||||
}
|
||||
|
||||
var _ GRPCServer = (*grpc.Server)(nil)
|
||||
|
||||
// Register registers the server reflection service on the given gRPC server.
|
||||
// Both the v1 and v1alpha versions are registered.
|
||||
func Register(s GRPCServer) {
|
||||
svr := NewServerV1(ServerOptions{Services: s})
|
||||
v1alphareflectiongrpc.RegisterServerReflectionServer(s, asV1Alpha(svr))
|
||||
v1reflectiongrpc.RegisterServerReflectionServer(s, svr)
|
||||
}
|
||||
|
||||
// RegisterV1 registers only the v1 version of the server reflection service
|
||||
// on the given gRPC server. Many clients may only support v1alpha so most
|
||||
// users should use Register instead, at least until clients have upgraded.
|
||||
func RegisterV1(s GRPCServer) {
|
||||
svr := NewServerV1(ServerOptions{Services: s})
|
||||
v1reflectiongrpc.RegisterServerReflectionServer(s, svr)
|
||||
}
|
||||
|
||||
// ServiceInfoProvider is an interface used to retrieve metadata about the
|
||||
// services to expose.
|
||||
//
|
||||
// The reflection service is only interested in the service names, but the
|
||||
// signature is this way so that *grpc.Server implements it. So it is okay
|
||||
// for a custom implementation to return zero values for the
|
||||
// grpc.ServiceInfo values in the map.
|
||||
//
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This type is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
type ServiceInfoProvider interface {
|
||||
GetServiceInfo() map[string]grpc.ServiceInfo
|
||||
}
|
||||
|
||||
// ExtensionResolver is the interface used to query details about extensions.
|
||||
// This interface is satisfied by protoregistry.GlobalTypes.
|
||||
//
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This type is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
type ExtensionResolver interface {
|
||||
protoregistry.ExtensionTypeResolver
|
||||
RangeExtensionsByMessage(message protoreflect.FullName, f func(protoreflect.ExtensionType) bool)
|
||||
}
|
||||
|
||||
// ServerOptions represents the options used to construct a reflection server.
|
||||
//
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This type is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
type ServerOptions struct {
|
||||
// The source of advertised RPC services. If not specified, the reflection
|
||||
// server will report an empty list when asked to list services.
|
||||
//
|
||||
// This value will typically be a *grpc.Server. But the set of advertised
|
||||
// services can be customized by wrapping a *grpc.Server or using an
|
||||
// alternate implementation that returns a custom set of service names.
|
||||
Services ServiceInfoProvider
|
||||
// Optional resolver used to load descriptors. If not specified,
|
||||
// protoregistry.GlobalFiles will be used.
|
||||
DescriptorResolver protodesc.Resolver
|
||||
// Optional resolver used to query for known extensions. If not specified,
|
||||
// protoregistry.GlobalTypes will be used.
|
||||
ExtensionResolver ExtensionResolver
|
||||
}
|
||||
|
||||
// NewServer returns a reflection server implementation using the given options.
|
||||
// This can be used to customize behavior of the reflection service. Most usages
|
||||
// should prefer to use Register instead. For backwards compatibility reasons,
|
||||
// this returns the v1alpha version of the reflection server. For a v1 version
|
||||
// of the reflection server, see NewServerV1.
|
||||
//
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This function is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
func NewServer(opts ServerOptions) v1alphareflectiongrpc.ServerReflectionServer {
|
||||
return asV1Alpha(NewServerV1(opts))
|
||||
}
|
||||
|
||||
// NewServerV1 returns a reflection server implementation using the given options.
|
||||
// This can be used to customize behavior of the reflection service. Most usages
|
||||
// should prefer to use Register instead.
|
||||
//
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This function is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
func NewServerV1(opts ServerOptions) v1reflectiongrpc.ServerReflectionServer {
|
||||
if opts.DescriptorResolver == nil {
|
||||
opts.DescriptorResolver = protoregistry.GlobalFiles
|
||||
}
|
||||
if opts.ExtensionResolver == nil {
|
||||
opts.ExtensionResolver = protoregistry.GlobalTypes
|
||||
}
|
||||
return &internal.ServerReflectionServer{
|
||||
S: opts.Services,
|
||||
DescResolver: opts.DescriptorResolver,
|
||||
ExtResolver: opts.ExtensionResolver,
|
||||
}
|
||||
}
|
||||
856
reflection/test/serverreflection_test.go
Normal file
856
reflection/test/serverreflection_test.go
Normal file
@@ -0,0 +1,856 @@
|
||||
/*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package test_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"reflect"
|
||||
"sort"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
"google.golang.org/grpc/internal/grpctest"
|
||||
"google.golang.org/grpc/reflection"
|
||||
"google.golang.org/grpc/reflection/internal"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/reflect/protodesc"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoregistry"
|
||||
"google.golang.org/protobuf/types/descriptorpb"
|
||||
"google.golang.org/protobuf/types/dynamicpb"
|
||||
|
||||
v1reflectiongrpc "google.golang.org/grpc/reflection/grpc_reflection_v1"
|
||||
v1reflectionpb "google.golang.org/grpc/reflection/grpc_reflection_v1"
|
||||
v1alphareflectiongrpc "google.golang.org/grpc/reflection/grpc_reflection_v1alpha"
|
||||
pb "google.golang.org/grpc/reflection/grpc_testing"
|
||||
pbv3 "google.golang.org/grpc/testdata/grpc_testing_not_regenerated"
|
||||
)
|
||||
|
||||
var (
|
||||
s = reflection.NewServerV1(reflection.ServerOptions{}).(*internal.ServerReflectionServer)
|
||||
// fileDescriptor of each test proto file.
|
||||
fdProto2Ext *descriptorpb.FileDescriptorProto
|
||||
fdProto2Ext2 *descriptorpb.FileDescriptorProto
|
||||
fdDynamic *descriptorpb.FileDescriptorProto
|
||||
// reflection descriptors.
|
||||
fdDynamicFile protoreflect.FileDescriptor
|
||||
// fileDescriptor marshalled.
|
||||
fdTestByte []byte
|
||||
fdTestv3Byte []byte
|
||||
fdProto2Byte []byte
|
||||
fdProto2ExtByte []byte
|
||||
fdProto2Ext2Byte []byte
|
||||
fdDynamicByte []byte
|
||||
)
|
||||
|
||||
const defaultTestTimeout = 10 * time.Second
|
||||
|
||||
type x struct {
|
||||
grpctest.Tester
|
||||
}
|
||||
|
||||
func Test(t *testing.T) {
|
||||
grpctest.RunSubTests(t, x{})
|
||||
}
|
||||
|
||||
func loadFileDesc(filename string) (*descriptorpb.FileDescriptorProto, []byte) {
|
||||
fd, err := protoregistry.GlobalFiles.FindFileByPath(filename)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fdProto := protodesc.ToFileDescriptorProto(fd)
|
||||
b, err := proto.Marshal(fdProto)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("failed to marshal fd: %v", err))
|
||||
}
|
||||
return fdProto, b
|
||||
}
|
||||
|
||||
func loadFileDescDynamic(b []byte) (*descriptorpb.FileDescriptorProto, protoreflect.FileDescriptor, []byte) {
|
||||
m := new(descriptorpb.FileDescriptorProto)
|
||||
if err := proto.Unmarshal(b, m); err != nil {
|
||||
panic("failed to unmarshal dynamic proto raw descriptor")
|
||||
}
|
||||
|
||||
fd, err := protodesc.NewFile(m, nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = protoregistry.GlobalFiles.RegisterFile(fd)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
for i := 0; i < fd.Messages().Len(); i++ {
|
||||
m := fd.Messages().Get(i)
|
||||
if err := protoregistry.GlobalTypes.RegisterMessage(dynamicpb.NewMessageType(m)); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
return m, fd, b
|
||||
}
|
||||
|
||||
func init() {
|
||||
_, fdTestByte = loadFileDesc("reflection/grpc_testing/test.proto")
|
||||
_, fdTestv3Byte = loadFileDesc("testv3.proto")
|
||||
_, fdProto2Byte = loadFileDesc("reflection/grpc_testing/proto2.proto")
|
||||
fdProto2Ext, fdProto2ExtByte = loadFileDesc("reflection/grpc_testing/proto2_ext.proto")
|
||||
fdProto2Ext2, fdProto2Ext2Byte = loadFileDesc("reflection/grpc_testing/proto2_ext2.proto")
|
||||
fdDynamic, fdDynamicFile, fdDynamicByte = loadFileDescDynamic(pbv3.FileDynamicProtoRawDesc)
|
||||
}
|
||||
|
||||
func (x) TestFileDescContainingExtension(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
st string
|
||||
extNum int32
|
||||
want *descriptorpb.FileDescriptorProto
|
||||
}{
|
||||
{"grpc.testing.ToBeExtended", 13, fdProto2Ext},
|
||||
{"grpc.testing.ToBeExtended", 17, fdProto2Ext},
|
||||
{"grpc.testing.ToBeExtended", 19, fdProto2Ext},
|
||||
{"grpc.testing.ToBeExtended", 23, fdProto2Ext2},
|
||||
{"grpc.testing.ToBeExtended", 29, fdProto2Ext2},
|
||||
} {
|
||||
fd, err := s.FileDescEncodingContainingExtension(test.st, test.extNum, map[string]bool{})
|
||||
if err != nil {
|
||||
t.Errorf("fileDescContainingExtension(%q) return error: %v", test.st, err)
|
||||
continue
|
||||
}
|
||||
var actualFd descriptorpb.FileDescriptorProto
|
||||
if err := proto.Unmarshal(fd[0], &actualFd); err != nil {
|
||||
t.Errorf("fileDescContainingExtension(%q) return invalid bytes: %v", test.st, err)
|
||||
continue
|
||||
}
|
||||
if !proto.Equal(&actualFd, test.want) {
|
||||
t.Errorf("fileDescContainingExtension(%q) returned %q, but wanted %q", test.st, &actualFd, test.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// intArray is used to sort []int32
|
||||
type intArray []int32
|
||||
|
||||
func (s intArray) Len() int { return len(s) }
|
||||
func (s intArray) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
||||
func (s intArray) Less(i, j int) bool { return s[i] < s[j] }
|
||||
|
||||
func (x) TestAllExtensionNumbersForTypeName(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
st string
|
||||
want []int32
|
||||
}{
|
||||
{"grpc.testing.ToBeExtended", []int32{13, 17, 19, 23, 29}},
|
||||
} {
|
||||
r, err := s.AllExtensionNumbersForTypeName(test.st)
|
||||
sort.Sort(intArray(r))
|
||||
if err != nil || !reflect.DeepEqual(r, test.want) {
|
||||
t.Errorf("allExtensionNumbersForType(%q) = %v, %v, want %v, <nil>", test.st, r, err, test.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (x) TestFileDescWithDependencies(t *testing.T) {
|
||||
depFile, err := protodesc.NewFile(
|
||||
&descriptorpb.FileDescriptorProto{
|
||||
Name: proto.String("dep.proto"),
|
||||
}, nil,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %s", err)
|
||||
}
|
||||
|
||||
deps := &protoregistry.Files{}
|
||||
if err := deps.RegisterFile(depFile); err != nil {
|
||||
t.Fatalf("unexpected error: %s", err)
|
||||
}
|
||||
|
||||
rootFileProto := &descriptorpb.FileDescriptorProto{
|
||||
Name: proto.String("root.proto"),
|
||||
Dependency: []string{
|
||||
"google/protobuf/descriptor.proto",
|
||||
"reflection/grpc_testing/proto2_ext2.proto",
|
||||
"dep.proto",
|
||||
},
|
||||
}
|
||||
|
||||
// dep.proto is in deps; the other imports come from protoregistry.GlobalFiles
|
||||
resolver := &combinedResolver{first: protoregistry.GlobalFiles, second: deps}
|
||||
rootFile, err := protodesc.NewFile(rootFileProto, resolver)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %s", err)
|
||||
}
|
||||
|
||||
// Create a file hierarchy that contains a placeholder for dep.proto
|
||||
placeholderDep := placeholderFile{depFile}
|
||||
placeholderDeps := &protoregistry.Files{}
|
||||
if err := placeholderDeps.RegisterFile(placeholderDep); err != nil {
|
||||
t.Fatalf("unexpected error: %s", err)
|
||||
}
|
||||
resolver = &combinedResolver{first: protoregistry.GlobalFiles, second: placeholderDeps}
|
||||
|
||||
rootFileHasPlaceholderDep, err := protodesc.NewFile(rootFileProto, resolver)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %s", err)
|
||||
}
|
||||
|
||||
rootFileIsPlaceholder := placeholderFile{rootFile}
|
||||
|
||||
// Full transitive dependency graph of root.proto includes five files:
|
||||
// - root.proto
|
||||
// - google/protobuf/descriptor.proto
|
||||
// - reflection/grpc_testing/proto2_ext2.proto
|
||||
// - reflection/grpc_testing/proto2.proto
|
||||
// - dep.proto
|
||||
|
||||
for _, test := range []struct {
|
||||
name string
|
||||
sent []string
|
||||
root protoreflect.FileDescriptor
|
||||
expect []string
|
||||
}{
|
||||
{
|
||||
name: "send_all",
|
||||
root: rootFile,
|
||||
// expect full transitive closure
|
||||
expect: []string{
|
||||
"root.proto",
|
||||
"google/protobuf/descriptor.proto",
|
||||
"reflection/grpc_testing/proto2_ext2.proto",
|
||||
"reflection/grpc_testing/proto2.proto",
|
||||
"dep.proto",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "already_sent",
|
||||
sent: []string{
|
||||
"root.proto",
|
||||
"google/protobuf/descriptor.proto",
|
||||
"reflection/grpc_testing/proto2_ext2.proto",
|
||||
"reflection/grpc_testing/proto2.proto",
|
||||
"dep.proto",
|
||||
},
|
||||
root: rootFile,
|
||||
// expect only the root to be re-sent
|
||||
expect: []string{"root.proto"},
|
||||
},
|
||||
{
|
||||
name: "some_already_sent",
|
||||
sent: []string{
|
||||
"reflection/grpc_testing/proto2_ext2.proto",
|
||||
"reflection/grpc_testing/proto2.proto",
|
||||
},
|
||||
root: rootFile,
|
||||
expect: []string{
|
||||
"root.proto",
|
||||
"google/protobuf/descriptor.proto",
|
||||
"dep.proto",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "root_is_placeholder",
|
||||
root: rootFileIsPlaceholder,
|
||||
// expect error, no files
|
||||
},
|
||||
{
|
||||
name: "placeholder_skipped",
|
||||
root: rootFileHasPlaceholderDep,
|
||||
// dep.proto is a placeholder so is skipped
|
||||
expect: []string{
|
||||
"root.proto",
|
||||
"google/protobuf/descriptor.proto",
|
||||
"reflection/grpc_testing/proto2_ext2.proto",
|
||||
"reflection/grpc_testing/proto2.proto",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "placeholder_skipped_and_some_sent",
|
||||
sent: []string{
|
||||
"reflection/grpc_testing/proto2_ext2.proto",
|
||||
"reflection/grpc_testing/proto2.proto",
|
||||
},
|
||||
root: rootFileHasPlaceholderDep,
|
||||
expect: []string{
|
||||
"root.proto",
|
||||
"google/protobuf/descriptor.proto",
|
||||
},
|
||||
},
|
||||
} {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
s := reflection.NewServerV1(reflection.ServerOptions{}).(*internal.ServerReflectionServer)
|
||||
|
||||
sent := map[string]bool{}
|
||||
for _, path := range test.sent {
|
||||
sent[path] = true
|
||||
}
|
||||
|
||||
descriptors, err := s.FileDescWithDependencies(test.root, sent)
|
||||
if len(test.expect) == 0 {
|
||||
// if we're not expecting any files then we're expecting an error
|
||||
if err == nil {
|
||||
t.Fatalf("expecting an error; instead got %d files", len(descriptors))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
checkDescriptorResults(t, descriptors, test.expect)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func checkDescriptorResults(t *testing.T, descriptors [][]byte, expect []string) {
|
||||
t.Helper()
|
||||
if len(descriptors) != len(expect) {
|
||||
t.Errorf("expected result to contain %d descriptor(s); instead got %d", len(expect), len(descriptors))
|
||||
}
|
||||
names := map[string]struct{}{}
|
||||
for i, desc := range descriptors {
|
||||
var descProto descriptorpb.FileDescriptorProto
|
||||
if err := proto.Unmarshal(desc, &descProto); err != nil {
|
||||
t.Fatalf("could not unmarshal descriptor result #%d", i+1)
|
||||
}
|
||||
names[descProto.GetName()] = struct{}{}
|
||||
}
|
||||
actual := make([]string, 0, len(names))
|
||||
for name := range names {
|
||||
actual = append(actual, name)
|
||||
}
|
||||
sort.Strings(actual)
|
||||
sort.Strings(expect)
|
||||
if !reflect.DeepEqual(actual, expect) {
|
||||
t.Fatalf("expected file descriptors for %v; instead got %v", expect, actual)
|
||||
}
|
||||
}
|
||||
|
||||
type placeholderFile struct {
|
||||
protoreflect.FileDescriptor
|
||||
}
|
||||
|
||||
func (placeholderFile) IsPlaceholder() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
type combinedResolver struct {
|
||||
first, second protodesc.Resolver
|
||||
}
|
||||
|
||||
func (r *combinedResolver) FindFileByPath(path string) (protoreflect.FileDescriptor, error) {
|
||||
file, err := r.first.FindFileByPath(path)
|
||||
if err == nil {
|
||||
return file, nil
|
||||
}
|
||||
return r.second.FindFileByPath(path)
|
||||
}
|
||||
|
||||
func (r *combinedResolver) FindDescriptorByName(name protoreflect.FullName) (protoreflect.Descriptor, error) {
|
||||
desc, err := r.first.FindDescriptorByName(name)
|
||||
if err == nil {
|
||||
return desc, nil
|
||||
}
|
||||
return r.second.FindDescriptorByName(name)
|
||||
}
|
||||
|
||||
// Do end2end tests.
|
||||
|
||||
type server struct {
|
||||
pb.UnimplementedSearchServiceServer
|
||||
}
|
||||
|
||||
func (s *server) Search(context.Context, *pb.SearchRequest) (*pb.SearchResponse, error) {
|
||||
return &pb.SearchResponse{}, nil
|
||||
}
|
||||
|
||||
func (s *server) StreamingSearch(pb.SearchService_StreamingSearchServer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type serverV3 struct{}
|
||||
|
||||
func (s *serverV3) Search(context.Context, *pbv3.SearchRequestV3) (*pbv3.SearchResponseV3, error) {
|
||||
return &pbv3.SearchResponseV3{}, nil
|
||||
}
|
||||
|
||||
func (s *serverV3) StreamingSearch(pbv3.SearchServiceV3_StreamingSearchServer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x) TestReflectionEnd2end(t *testing.T) {
|
||||
// Start server.
|
||||
lis, err := net.Listen("tcp", "localhost:0")
|
||||
if err != nil {
|
||||
t.Fatalf("failed to listen: %v", err)
|
||||
}
|
||||
s := grpc.NewServer()
|
||||
pb.RegisterSearchServiceServer(s, &server{})
|
||||
pbv3.RegisterSearchServiceV3Server(s, &serverV3{})
|
||||
|
||||
registerDynamicProto(s, fdDynamic, fdDynamicFile)
|
||||
|
||||
// Register reflection service on s.
|
||||
reflection.Register(s)
|
||||
go s.Serve(lis)
|
||||
t.Cleanup(s.Stop)
|
||||
|
||||
// Create client.
|
||||
conn, err := grpc.NewClient(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||
if err != nil {
|
||||
t.Fatalf("cannot connect to server: %v", err)
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
clientV1 := v1reflectiongrpc.NewServerReflectionClient(conn)
|
||||
clientV1Alpha := v1alphareflectiongrpc.NewServerReflectionClient(conn)
|
||||
testCases := []struct {
|
||||
name string
|
||||
client v1reflectiongrpc.ServerReflectionClient
|
||||
}{
|
||||
{
|
||||
name: "v1",
|
||||
client: clientV1,
|
||||
},
|
||||
{
|
||||
name: "v1alpha",
|
||||
client: v1AlphaClientAdapter{stub: clientV1Alpha},
|
||||
},
|
||||
}
|
||||
for _, testCase := range testCases {
|
||||
c := testCase.client
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
|
||||
defer cancel()
|
||||
stream, err := c.ServerReflectionInfo(ctx, grpc.WaitForReady(true))
|
||||
if err != nil {
|
||||
t.Fatalf("cannot get ServerReflectionInfo: %v", err)
|
||||
}
|
||||
|
||||
testFileByFilenameTransitiveClosure(t, stream, true)
|
||||
testFileByFilenameTransitiveClosure(t, stream, false)
|
||||
testFileByFilename(t, stream)
|
||||
testFileByFilenameError(t, stream)
|
||||
testFileContainingSymbol(t, stream)
|
||||
testFileContainingSymbolError(t, stream)
|
||||
testFileContainingExtension(t, stream)
|
||||
testFileContainingExtensionError(t, stream)
|
||||
testAllExtensionNumbersOfType(t, stream)
|
||||
testAllExtensionNumbersOfTypeError(t, stream)
|
||||
testListServices(t, stream)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func testFileByFilenameTransitiveClosure(t *testing.T, stream v1reflectiongrpc.ServerReflection_ServerReflectionInfoClient, expectClosure bool) {
|
||||
filename := "reflection/grpc_testing/proto2_ext2.proto"
|
||||
if err := stream.Send(&v1reflectionpb.ServerReflectionRequest{
|
||||
MessageRequest: &v1reflectionpb.ServerReflectionRequest_FileByFilename{
|
||||
FileByFilename: filename,
|
||||
},
|
||||
}); err != nil {
|
||||
t.Fatalf("failed to send request: %v", err)
|
||||
}
|
||||
r, err := stream.Recv()
|
||||
if err != nil {
|
||||
// io.EOF is not ok.
|
||||
t.Fatalf("failed to recv response: %v", err)
|
||||
}
|
||||
switch r.MessageResponse.(type) {
|
||||
case *v1reflectionpb.ServerReflectionResponse_FileDescriptorResponse:
|
||||
if !reflect.DeepEqual(r.GetFileDescriptorResponse().FileDescriptorProto[0], fdProto2Ext2Byte) {
|
||||
t.Errorf("FileByFilename(%v)\nreceived: %q,\nwant: %q", filename, r.GetFileDescriptorResponse().FileDescriptorProto[0], fdProto2Ext2Byte)
|
||||
}
|
||||
if expectClosure {
|
||||
if len(r.GetFileDescriptorResponse().FileDescriptorProto) != 2 {
|
||||
t.Errorf("FileByFilename(%v) returned %v file descriptors, expected 2", filename, len(r.GetFileDescriptorResponse().FileDescriptorProto))
|
||||
} else if !reflect.DeepEqual(r.GetFileDescriptorResponse().FileDescriptorProto[1], fdProto2Byte) {
|
||||
t.Errorf("FileByFilename(%v)\nreceived: %q,\nwant: %q", filename, r.GetFileDescriptorResponse().FileDescriptorProto[1], fdProto2Byte)
|
||||
}
|
||||
} else if len(r.GetFileDescriptorResponse().FileDescriptorProto) != 1 {
|
||||
t.Errorf("FileByFilename(%v) returned %v file descriptors, expected 1", filename, len(r.GetFileDescriptorResponse().FileDescriptorProto))
|
||||
}
|
||||
default:
|
||||
t.Errorf("FileByFilename(%v) = %v, want type <ServerReflectionResponse_FileDescriptorResponse>", filename, r.MessageResponse)
|
||||
}
|
||||
}
|
||||
|
||||
func testFileByFilename(t *testing.T, stream v1reflectiongrpc.ServerReflection_ServerReflectionInfoClient) {
|
||||
for _, test := range []struct {
|
||||
filename string
|
||||
want []byte
|
||||
}{
|
||||
{"reflection/grpc_testing/test.proto", fdTestByte},
|
||||
{"reflection/grpc_testing/proto2.proto", fdProto2Byte},
|
||||
{"reflection/grpc_testing/proto2_ext.proto", fdProto2ExtByte},
|
||||
{"dynamic.proto", fdDynamicByte},
|
||||
} {
|
||||
if err := stream.Send(&v1reflectionpb.ServerReflectionRequest{
|
||||
MessageRequest: &v1reflectionpb.ServerReflectionRequest_FileByFilename{
|
||||
FileByFilename: test.filename,
|
||||
},
|
||||
}); err != nil {
|
||||
t.Fatalf("failed to send request: %v", err)
|
||||
}
|
||||
r, err := stream.Recv()
|
||||
if err != nil {
|
||||
// io.EOF is not ok.
|
||||
t.Fatalf("failed to recv response: %v", err)
|
||||
}
|
||||
|
||||
switch r.MessageResponse.(type) {
|
||||
case *v1reflectionpb.ServerReflectionResponse_FileDescriptorResponse:
|
||||
if !reflect.DeepEqual(r.GetFileDescriptorResponse().FileDescriptorProto[0], test.want) {
|
||||
t.Errorf("FileByFilename(%v)\nreceived: %q,\nwant: %q", test.filename, r.GetFileDescriptorResponse().FileDescriptorProto[0], test.want)
|
||||
}
|
||||
default:
|
||||
t.Errorf("FileByFilename(%v) = %v, want type <ServerReflectionResponse_FileDescriptorResponse>", test.filename, r.MessageResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testFileByFilenameError(t *testing.T, stream v1reflectiongrpc.ServerReflection_ServerReflectionInfoClient) {
|
||||
for _, test := range []string{
|
||||
"test.poto",
|
||||
"proo2.proto",
|
||||
"proto2_et.proto",
|
||||
} {
|
||||
if err := stream.Send(&v1reflectionpb.ServerReflectionRequest{
|
||||
MessageRequest: &v1reflectionpb.ServerReflectionRequest_FileByFilename{
|
||||
FileByFilename: test,
|
||||
},
|
||||
}); err != nil {
|
||||
t.Fatalf("failed to send request: %v", err)
|
||||
}
|
||||
r, err := stream.Recv()
|
||||
if err != nil {
|
||||
// io.EOF is not ok.
|
||||
t.Fatalf("failed to recv response: %v", err)
|
||||
}
|
||||
|
||||
switch r.MessageResponse.(type) {
|
||||
case *v1reflectionpb.ServerReflectionResponse_ErrorResponse:
|
||||
default:
|
||||
t.Errorf("FileByFilename(%v) = %v, want type <ServerReflectionResponse_ErrorResponse>", test, r.MessageResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testFileContainingSymbol(t *testing.T, stream v1reflectiongrpc.ServerReflection_ServerReflectionInfoClient) {
|
||||
for _, test := range []struct {
|
||||
symbol string
|
||||
want []byte
|
||||
}{
|
||||
{"grpc.testing.SearchService", fdTestByte},
|
||||
{"grpc.testing.SearchService.Search", fdTestByte},
|
||||
{"grpc.testing.SearchService.StreamingSearch", fdTestByte},
|
||||
{"grpc.testing.SearchResponse", fdTestByte},
|
||||
{"grpc.testing.ToBeExtended", fdProto2Byte},
|
||||
// Test support package v3.
|
||||
{"grpc.testingv3.SearchServiceV3", fdTestv3Byte},
|
||||
{"grpc.testingv3.SearchServiceV3.Search", fdTestv3Byte},
|
||||
{"grpc.testingv3.SearchServiceV3.StreamingSearch", fdTestv3Byte},
|
||||
{"grpc.testingv3.SearchResponseV3", fdTestv3Byte},
|
||||
// search for field, oneof, enum, and enum value symbols, too
|
||||
{"grpc.testingv3.SearchResponseV3.Result.snippets", fdTestv3Byte},
|
||||
{"grpc.testingv3.SearchResponseV3.Result.Value.val", fdTestv3Byte},
|
||||
{"grpc.testingv3.SearchResponseV3.Result.Value.str", fdTestv3Byte},
|
||||
{"grpc.testingv3.SearchResponseV3.State", fdTestv3Byte},
|
||||
{"grpc.testingv3.SearchResponseV3.FRESH", fdTestv3Byte},
|
||||
// Test dynamic symbols
|
||||
{"grpc.testing.DynamicService", fdDynamicByte},
|
||||
{"grpc.testing.DynamicReq", fdDynamicByte},
|
||||
{"grpc.testing.DynamicRes", fdDynamicByte},
|
||||
} {
|
||||
if err := stream.Send(&v1reflectionpb.ServerReflectionRequest{
|
||||
MessageRequest: &v1reflectionpb.ServerReflectionRequest_FileContainingSymbol{
|
||||
FileContainingSymbol: test.symbol,
|
||||
},
|
||||
}); err != nil {
|
||||
t.Fatalf("failed to send request: %v", err)
|
||||
}
|
||||
r, err := stream.Recv()
|
||||
if err != nil {
|
||||
// io.EOF is not ok.
|
||||
t.Fatalf("failed to recv response: %v", err)
|
||||
}
|
||||
|
||||
switch r.MessageResponse.(type) {
|
||||
case *v1reflectionpb.ServerReflectionResponse_FileDescriptorResponse:
|
||||
if !reflect.DeepEqual(r.GetFileDescriptorResponse().FileDescriptorProto[0], test.want) {
|
||||
t.Errorf("FileContainingSymbol(%v)\nreceived: %q,\nwant: %q", test.symbol, r.GetFileDescriptorResponse().FileDescriptorProto[0], test.want)
|
||||
}
|
||||
default:
|
||||
t.Errorf("FileContainingSymbol(%v) = %v, want type <ServerReflectionResponse_FileDescriptorResponse>", test.symbol, r.MessageResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testFileContainingSymbolError(t *testing.T, stream v1reflectiongrpc.ServerReflection_ServerReflectionInfoClient) {
|
||||
for _, test := range []string{
|
||||
"grpc.testing.SearchService_",
|
||||
"grpc.testing.SearchService.SearchE",
|
||||
"grpc.testing_.SearchResponse",
|
||||
"gpc.testing.ToBeExtended",
|
||||
} {
|
||||
if err := stream.Send(&v1reflectionpb.ServerReflectionRequest{
|
||||
MessageRequest: &v1reflectionpb.ServerReflectionRequest_FileContainingSymbol{
|
||||
FileContainingSymbol: test,
|
||||
},
|
||||
}); err != nil {
|
||||
t.Fatalf("failed to send request: %v", err)
|
||||
}
|
||||
r, err := stream.Recv()
|
||||
if err != nil {
|
||||
// io.EOF is not ok.
|
||||
t.Fatalf("failed to recv response: %v", err)
|
||||
}
|
||||
|
||||
switch r.MessageResponse.(type) {
|
||||
case *v1reflectionpb.ServerReflectionResponse_ErrorResponse:
|
||||
default:
|
||||
t.Errorf("FileContainingSymbol(%v) = %v, want type <ServerReflectionResponse_ErrorResponse>", test, r.MessageResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testFileContainingExtension(t *testing.T, stream v1reflectiongrpc.ServerReflection_ServerReflectionInfoClient) {
|
||||
for _, test := range []struct {
|
||||
typeName string
|
||||
extNum int32
|
||||
want []byte
|
||||
}{
|
||||
{"grpc.testing.ToBeExtended", 13, fdProto2ExtByte},
|
||||
{"grpc.testing.ToBeExtended", 17, fdProto2ExtByte},
|
||||
{"grpc.testing.ToBeExtended", 19, fdProto2ExtByte},
|
||||
{"grpc.testing.ToBeExtended", 23, fdProto2Ext2Byte},
|
||||
{"grpc.testing.ToBeExtended", 29, fdProto2Ext2Byte},
|
||||
} {
|
||||
if err := stream.Send(&v1reflectionpb.ServerReflectionRequest{
|
||||
MessageRequest: &v1reflectionpb.ServerReflectionRequest_FileContainingExtension{
|
||||
FileContainingExtension: &v1reflectionpb.ExtensionRequest{
|
||||
ContainingType: test.typeName,
|
||||
ExtensionNumber: test.extNum,
|
||||
},
|
||||
},
|
||||
}); err != nil {
|
||||
t.Fatalf("failed to send request: %v", err)
|
||||
}
|
||||
r, err := stream.Recv()
|
||||
if err != nil {
|
||||
// io.EOF is not ok.
|
||||
t.Fatalf("failed to recv response: %v", err)
|
||||
}
|
||||
|
||||
switch r.MessageResponse.(type) {
|
||||
case *v1reflectionpb.ServerReflectionResponse_FileDescriptorResponse:
|
||||
if !reflect.DeepEqual(r.GetFileDescriptorResponse().FileDescriptorProto[0], test.want) {
|
||||
t.Errorf("FileContainingExtension(%v, %v)\nreceived: %q,\nwant: %q", test.typeName, test.extNum, r.GetFileDescriptorResponse().FileDescriptorProto[0], test.want)
|
||||
}
|
||||
default:
|
||||
t.Errorf("FileContainingExtension(%v, %v) = %v, want type <ServerReflectionResponse_FileDescriptorResponse>", test.typeName, test.extNum, r.MessageResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testFileContainingExtensionError(t *testing.T, stream v1reflectiongrpc.ServerReflection_ServerReflectionInfoClient) {
|
||||
for _, test := range []struct {
|
||||
typeName string
|
||||
extNum int32
|
||||
}{
|
||||
{"grpc.testing.ToBExtended", 17},
|
||||
{"grpc.testing.ToBeExtended", 15},
|
||||
} {
|
||||
if err := stream.Send(&v1reflectionpb.ServerReflectionRequest{
|
||||
MessageRequest: &v1reflectionpb.ServerReflectionRequest_FileContainingExtension{
|
||||
FileContainingExtension: &v1reflectionpb.ExtensionRequest{
|
||||
ContainingType: test.typeName,
|
||||
ExtensionNumber: test.extNum,
|
||||
},
|
||||
},
|
||||
}); err != nil {
|
||||
t.Fatalf("failed to send request: %v", err)
|
||||
}
|
||||
r, err := stream.Recv()
|
||||
if err != nil {
|
||||
// io.EOF is not ok.
|
||||
t.Fatalf("failed to recv response: %v", err)
|
||||
}
|
||||
|
||||
switch r.MessageResponse.(type) {
|
||||
case *v1reflectionpb.ServerReflectionResponse_ErrorResponse:
|
||||
default:
|
||||
t.Errorf("FileContainingExtension(%v, %v) = %v, want type <ServerReflectionResponse_FileDescriptorResponse>", test.typeName, test.extNum, r.MessageResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testAllExtensionNumbersOfType(t *testing.T, stream v1reflectiongrpc.ServerReflection_ServerReflectionInfoClient) {
|
||||
for _, test := range []struct {
|
||||
typeName string
|
||||
want []int32
|
||||
}{
|
||||
{"grpc.testing.ToBeExtended", []int32{13, 17, 19, 23, 29}},
|
||||
{"grpc.testing.DynamicReq", nil},
|
||||
} {
|
||||
if err := stream.Send(&v1reflectionpb.ServerReflectionRequest{
|
||||
MessageRequest: &v1reflectionpb.ServerReflectionRequest_AllExtensionNumbersOfType{
|
||||
AllExtensionNumbersOfType: test.typeName,
|
||||
},
|
||||
}); err != nil {
|
||||
t.Fatalf("failed to send request: %v", err)
|
||||
}
|
||||
r, err := stream.Recv()
|
||||
if err != nil {
|
||||
// io.EOF is not ok.
|
||||
t.Fatalf("failed to recv response: %v", err)
|
||||
}
|
||||
|
||||
switch r.MessageResponse.(type) {
|
||||
case *v1reflectionpb.ServerReflectionResponse_AllExtensionNumbersResponse:
|
||||
extNum := r.GetAllExtensionNumbersResponse().ExtensionNumber
|
||||
sort.Sort(intArray(extNum))
|
||||
if r.GetAllExtensionNumbersResponse().BaseTypeName != test.typeName ||
|
||||
!reflect.DeepEqual(extNum, test.want) {
|
||||
t.Errorf("AllExtensionNumbersOfType(%v)\nreceived: %v,\nwant: {%q %v}", r.GetAllExtensionNumbersResponse(), test.typeName, test.typeName, test.want)
|
||||
}
|
||||
default:
|
||||
t.Errorf("AllExtensionNumbersOfType(%v) = %v, want type <ServerReflectionResponse_AllExtensionNumbersResponse>", test.typeName, r.MessageResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testAllExtensionNumbersOfTypeError(t *testing.T, stream v1reflectiongrpc.ServerReflection_ServerReflectionInfoClient) {
|
||||
for _, test := range []string{
|
||||
"grpc.testing.ToBeExtendedE",
|
||||
} {
|
||||
if err := stream.Send(&v1reflectionpb.ServerReflectionRequest{
|
||||
MessageRequest: &v1reflectionpb.ServerReflectionRequest_AllExtensionNumbersOfType{
|
||||
AllExtensionNumbersOfType: test,
|
||||
},
|
||||
}); err != nil {
|
||||
t.Fatalf("failed to send request: %v", err)
|
||||
}
|
||||
r, err := stream.Recv()
|
||||
if err != nil {
|
||||
// io.EOF is not ok.
|
||||
t.Fatalf("failed to recv response: %v", err)
|
||||
}
|
||||
|
||||
switch r.MessageResponse.(type) {
|
||||
case *v1reflectionpb.ServerReflectionResponse_ErrorResponse:
|
||||
default:
|
||||
t.Errorf("AllExtensionNumbersOfType(%v) = %v, want type <ServerReflectionResponse_ErrorResponse>", test, r.MessageResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testListServices(t *testing.T, stream v1reflectiongrpc.ServerReflection_ServerReflectionInfoClient) {
|
||||
if err := stream.Send(&v1reflectionpb.ServerReflectionRequest{
|
||||
MessageRequest: &v1reflectionpb.ServerReflectionRequest_ListServices{},
|
||||
}); err != nil {
|
||||
t.Fatalf("failed to send request: %v", err)
|
||||
}
|
||||
r, err := stream.Recv()
|
||||
if err != nil {
|
||||
// io.EOF is not ok.
|
||||
t.Fatalf("failed to recv response: %v", err)
|
||||
}
|
||||
|
||||
switch r.MessageResponse.(type) {
|
||||
case *v1reflectionpb.ServerReflectionResponse_ListServicesResponse:
|
||||
services := r.GetListServicesResponse().Service
|
||||
want := []string{
|
||||
"grpc.testingv3.SearchServiceV3",
|
||||
"grpc.testing.SearchService",
|
||||
"grpc.reflection.v1.ServerReflection",
|
||||
"grpc.reflection.v1alpha.ServerReflection",
|
||||
"grpc.testing.DynamicService",
|
||||
}
|
||||
// Compare service names in response with want.
|
||||
if len(services) != len(want) {
|
||||
t.Errorf("= %v, want service names: %v", services, want)
|
||||
}
|
||||
m := make(map[string]int)
|
||||
for _, e := range services {
|
||||
m[e.Name]++
|
||||
}
|
||||
for _, e := range want {
|
||||
if m[e] > 0 {
|
||||
m[e]--
|
||||
continue
|
||||
}
|
||||
t.Errorf("ListService\nreceived: %v,\nwant: %q", services, want)
|
||||
}
|
||||
default:
|
||||
t.Errorf("ListServices = %v, want type <ServerReflectionResponse_ListServicesResponse>", r.MessageResponse)
|
||||
}
|
||||
}
|
||||
|
||||
func registerDynamicProto(srv *grpc.Server, fdp *descriptorpb.FileDescriptorProto, fd protoreflect.FileDescriptor) {
|
||||
type emptyInterface any
|
||||
|
||||
for i := 0; i < fd.Services().Len(); i++ {
|
||||
s := fd.Services().Get(i)
|
||||
|
||||
sd := &grpc.ServiceDesc{
|
||||
ServiceName: string(s.FullName()),
|
||||
HandlerType: (*emptyInterface)(nil),
|
||||
Metadata: fdp.GetName(),
|
||||
}
|
||||
|
||||
for j := 0; j < s.Methods().Len(); j++ {
|
||||
m := s.Methods().Get(j)
|
||||
sd.Methods = append(sd.Methods, grpc.MethodDesc{
|
||||
MethodName: string(m.Name()),
|
||||
})
|
||||
}
|
||||
|
||||
srv.RegisterService(sd, struct{}{})
|
||||
}
|
||||
}
|
||||
|
||||
type v1AlphaClientAdapter struct {
|
||||
stub v1alphareflectiongrpc.ServerReflectionClient
|
||||
}
|
||||
|
||||
func (v v1AlphaClientAdapter) ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (v1reflectiongrpc.ServerReflection_ServerReflectionInfoClient, error) {
|
||||
stream, err := v.stub.ServerReflectionInfo(ctx, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v1AlphaClientStreamAdapter{stream}, nil
|
||||
}
|
||||
|
||||
type v1AlphaClientStreamAdapter struct {
|
||||
v1alphareflectiongrpc.ServerReflection_ServerReflectionInfoClient
|
||||
}
|
||||
|
||||
func (s v1AlphaClientStreamAdapter) Send(request *v1reflectionpb.ServerReflectionRequest) error {
|
||||
return s.ServerReflection_ServerReflectionInfoClient.Send(internal.V1ToV1AlphaRequest(request))
|
||||
}
|
||||
|
||||
func (s v1AlphaClientStreamAdapter) Recv() (*v1reflectionpb.ServerReflectionResponse, error) {
|
||||
resp, err := s.ServerReflection_ServerReflectionInfoClient.Recv()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return internal.V1AlphaToV1Response(resp), nil
|
||||
}
|
||||
Reference in New Issue
Block a user