func NewServer(opts ServerOptions) v1alphareflectiongrpc.ServerReflectionServer
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.
Notice: This function is EXPERIMENTAL and may be changed or removed in a later release.
func NewServerV1(opts ServerOptions) v1reflectiongrpc.ServerReflectionServer
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.
Notice: This function is EXPERIMENTAL and may be changed or removed in a later release.
func Register(s GRPCServer)
Register registers the server reflection service on the given gRPC server. Both the v1 and v1alpha versions are registered.
func RegisterV1(s GRPCServer)
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.
ExtensionResolver is the interface used to query details about extensions. This interface is satisfied by protoregistry.GlobalTypes.
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) }
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 }
ServerOptions represents the options used to construct a reflection server.
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 }
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.
Notice: This type is EXPERIMENTAL and may be changed or removed in a later release.
type ServiceInfoProvider interface { GetServiceInfo() map[string]grpc.ServiceInfo }
Name | Synopsis |
---|---|
.. | |
grpc_reflection_v1 | |
grpc_reflection_v1alpha | |
grpc_testing |