...

Package internal

import "google.golang.org/grpc/reflection/internal"
Overview
Index

Overview ▾

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 depenedency to deprecated package github.com/golang/protobuf.

func V1AlphaToV1Request

func V1AlphaToV1Request(v1alpha *v1alphareflectionpb.ServerReflectionRequest) *v1reflectionpb.ServerReflectionRequest

V1AlphaToV1Request converts a v1alpha ServerReflectionRequest to a v1.

func V1AlphaToV1Response

func V1AlphaToV1Response(v1alpha *v1alphareflectionpb.ServerReflectionResponse) *v1reflectionpb.ServerReflectionResponse

V1AlphaToV1Response converts a v1alpha ServerReflectionResponse to a v1.

func V1ToV1AlphaRequest

func V1ToV1AlphaRequest(v1 *v1reflectionpb.ServerReflectionRequest) *v1alphareflectionpb.ServerReflectionRequest

V1ToV1AlphaRequest converts a v1 ServerReflectionRequest to a v1alpha.

func V1ToV1AlphaResponse

func V1ToV1AlphaResponse(v1 *v1reflectionpb.ServerReflectionResponse) *v1alphareflectionpb.ServerReflectionResponse

V1ToV1AlphaResponse converts a v1 ServerReflectionResponse to a v1alpha.

type ExtensionResolver

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)
}

type ServerReflectionServer

ServerReflectionServer is the server API for ServerReflection service.

type ServerReflectionServer struct {
    v1alphareflectiongrpc.UnimplementedServerReflectionServer
    S            ServiceInfoProvider
    DescResolver protodesc.Resolver
    ExtResolver  ExtensionResolver
}

func (*ServerReflectionServer) AllExtensionNumbersForTypeName

func (s *ServerReflectionServer) AllExtensionNumbersForTypeName(name string) ([]int32, error)

AllExtensionNumbersForTypeName returns all extension numbers for the given type.

func (*ServerReflectionServer) FileDescEncodingContainingExtension

func (s *ServerReflectionServer) FileDescEncodingContainingExtension(typeName string, extNum int32, sentFileDescriptors map[string]bool) ([][]byte, error)

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 (*ServerReflectionServer) FileDescEncodingContainingSymbol

func (s *ServerReflectionServer) FileDescEncodingContainingSymbol(name string, sentFileDescriptors map[string]bool) ([][]byte, error)

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 (*ServerReflectionServer) FileDescWithDependencies

func (s *ServerReflectionServer) FileDescWithDependencies(fd protoreflect.FileDescriptor, sentFileDescriptors map[string]bool) ([][]byte, error)

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 (*ServerReflectionServer) ListServices

func (s *ServerReflectionServer) ListServices() []*v1reflectionpb.ServiceResponse

ListServices returns the names of services this server exposes.

func (*ServerReflectionServer) ServerReflectionInfo

func (s *ServerReflectionServer) ServerReflectionInfo(stream v1reflectiongrpc.ServerReflection_ServerReflectionInfoServer) error

ServerReflectionInfo is the reflection service handler.

type ServiceInfoProvider

ServiceInfoProvider is an interface used to retrieve metadata about the services to expose.

type ServiceInfoProvider interface {
    GetServiceInfo() map[string]grpc.ServiceInfo
}