Movatterモバイル変換


[0]ホーム

URL:


reflection

package
v1.77.0Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2025 License:Apache-2.0Imports:7Imported by:11,931

Details

Repository

github.com/grpc/grpc-go

Links

README

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:

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)

Documentation

Overview

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)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcNewServeradded inv1.45.0

NewServer returns a reflection server implementation using the given options.This can be used to customize behavior of the reflection service. Most usagesshould prefer to use Register instead. For backwards compatibility reasons,this returns the v1alpha version of the reflection server. For a v1 versionof the reflection server, see NewServerV1.

Experimental

Notice: This function is EXPERIMENTAL and may be changed or removed in alater release.

funcNewServerV1added inv1.57.0

NewServerV1 returns a reflection server implementation using the given options.This can be used to customize behavior of the reflection service. Most usagesshould prefer to use Register instead.

Experimental

Notice: This function is EXPERIMENTAL and may be changed or removed in alater release.

funcRegister

func Register(sGRPCServer)

Register registers the server reflection service on the given gRPC server.Both the v1 and v1alpha versions are registered.

funcRegisterV1added inv1.57.0

func RegisterV1(sGRPCServer)

RegisterV1 registers only the v1 version of the server reflection serviceon the given gRPC server. Many clients may only support v1alpha so mostusers should use Register instead, at least until clients have upgraded.

Types

typeExtensionResolveradded inv1.45.0

type ExtensionResolver interface {protoregistry.ExtensionTypeResolverRangeExtensionsByMessage(messageprotoreflect.FullName, f func(protoreflect.ExtensionType)bool)}

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 alater release.

typeGRPCServeradded inv1.38.0

type GRPCServer interface {grpc.ServiceRegistrarServiceInfoProvider}

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 actsas a registry, for accumulating the services exposed by the server.

typeServerOptionsadded inv1.45.0

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.ServicesServiceInfoProvider// Optional resolver used to load descriptors. If not specified,// protoregistry.GlobalFiles will be used.DescriptorResolverprotodesc.Resolver// Optional resolver used to query for known extensions. If not specified,// protoregistry.GlobalTypes will be used.ExtensionResolverExtensionResolver}

ServerOptions represents the options used to construct a reflection server.

Experimental

Notice: This type is EXPERIMENTAL and may be changed or removed in alater release.

typeServiceInfoProvideradded inv1.45.0

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

ServiceInfoProvider is an interface used to retrieve metadata about theservices to expose.

The reflection service is only interested in the service names, but thesignature is this way so that *grpc.Server implements it. So it is okayfor a custom implementation to return zero values for thegrpc.ServiceInfo values in the map.

Experimental

Notice: This type is EXPERIMENTAL and may be changed or removed in alater release.

Source Files

View all Source files

Directories

PathSynopsis
Package internal contains code that is shared by both reflection package and the test package.
Package internal contains code that is shared by both reflection package and the test package.
testmodule

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp