protoreflect: github.com/jhump/protoreflect/grpcreflect Index | Files

package grpcreflect

import "github.com/jhump/protoreflect/grpcreflect"

Package grpcreflect provides GRPC-specific extensions to protobuf reflection. This includes a way to access rich service descriptors for all services that a GRPC server exports.

Also included is an easy-to-use client for the GRPC reflection service (https://goo.gl/2ILAHf). This client makes it easy to ask a server (that supports the reflection service) for metadata on its exported services, which could be used to construct a dynamic client. (See the grpcdynamic package in this same repo for more on that.)

Index

Package Files

client.go doc.go server.go

func IsElementNotFoundError Uses

func IsElementNotFoundError(err error) bool

IsElementNotFoundError determines if the given error indicates that a file name, symbol name, or extension field was could not be found by the server.

func LoadServiceDescriptor Uses

func LoadServiceDescriptor(svc *grpc.ServiceDesc) (*desc.ServiceDescriptor, error)

LoadServiceDescriptor loads a rich descriptor for a given service description generated by protoc-gen-go. Generated code contains an unexported symbol with a name like "_<Service>_serviceDesc" which is the service's description. It is used internally to register a service implementation with a GRPC server. But it can also be used by this package to retrieve the rich descriptor for the service.

func LoadServiceDescriptors Uses

func LoadServiceDescriptors(s *grpc.Server) (map[string]*desc.ServiceDescriptor, error)

LoadServiceDescriptors loads the service descriptors for all services exposed by the given GRPC server.

type Client Uses

type Client struct {
    // contains filtered or unexported fields
}

Client is a client connection to a server for performing reflection calls and resolving remote symbols.

func NewClient Uses

func NewClient(ctx context.Context, stub rpb.ServerReflectionClient) *Client

NewClient creates a new Client with the given root context and using the given RPC stub for talking to the server.

func (*Client) AllExtensionNumbersForType Uses

func (cr *Client) AllExtensionNumbersForType(extendedMessageName string) ([]int32, error)

AllExtensionNumbersForType asks the server for all known extension numbers for the given fully-qualified message name.

func (*Client) FileByFilename Uses

func (cr *Client) FileByFilename(filename string) (*desc.FileDescriptor, error)

FileByFilename asks the server for a file descriptor for the proto file with the given name.

func (*Client) FileContainingExtension Uses

func (cr *Client) FileContainingExtension(extendedMessageName string, extensionNumber int32) (*desc.FileDescriptor, error)

FileContainingExtension asks the server for a file descriptor for the proto file that declares an extension with the given number for the given fully-qualified message name.

func (*Client) FileContainingSymbol Uses

func (cr *Client) FileContainingSymbol(symbol string) (*desc.FileDescriptor, error)

FileContainingSymbol asks the server for a file descriptor for the proto file that declares the given fully-qualified symbol.

func (*Client) ListServices Uses

func (cr *Client) ListServices() ([]string, error)

ListServices asks the server for the fully-qualified names of all exposed services.

func (*Client) Reset Uses

func (cr *Client) Reset()

Reset ensures that any active stream with the server is closed, releasing any resources.

func (*Client) ResolveEnum Uses

func (cr *Client) ResolveEnum(enumName string) (*desc.EnumDescriptor, error)

ResolveEnum asks the server to resolve the given fully-qualified enum name into an enum descriptor.

func (*Client) ResolveEnumValues Uses

func (cr *Client) ResolveEnumValues(enumName string) (map[string]int32, error)

ResolveEnumValues asks the server to resolve the given fully-qualified enum name into a map of names to numbers that represents the enum's values.

func (*Client) ResolveExtension Uses

func (cr *Client) ResolveExtension(extendedType string, extensionNumber int32) (*desc.FieldDescriptor, error)

ResolveExtension asks the server to resolve the given extension number and fully-qualified message name into a field descriptor.

func (*Client) ResolveMessage Uses

func (cr *Client) ResolveMessage(messageName string) (*desc.MessageDescriptor, error)

ResolveMessage asks the server to resolve the given fully-qualified message name into a message descriptor.

func (*Client) ResolveService Uses

func (cr *Client) ResolveService(serviceName string) (*desc.ServiceDescriptor, error)

ResolveService asks the server to resolve the given fully-qualified service name into a service descriptor.

type ProtocolError Uses

type ProtocolError struct {
    // contains filtered or unexported fields
}

ProtocolError is an error returned when the server sends a response of the wrong type.

func (ProtocolError) Error Uses

func (p ProtocolError) Error() string

Package grpcreflect imports 15 packages (graph) and is imported by 31 packages. Updated 2020-11-23. Refresh now. Tools for package owners.