Documentation
¶
Index ¶
- Constants
- func NewGRPCProxy(cb ProxyCallBack, healthCheckPath string, cmdFlags common.ConsumerCmdFlags, ...) (*grpc.Server, *http.Server, error)
- func NewGRPCProxyWithReflection(cb ProxyCallBack, healthCheckPath string, cmdFlags common.ConsumerCmdFlags, ...) (*grpc.Server, *http.Server, error)
- func RegisterReflectionProxy(server *grpc.Server, getConnection ReflectionProxyCallback)
- type HealthReporter
- type ProxyCallBack
- type RawBytesCodec
- type ReflectionProxyCallback
- type ReflectionProxyService
Constants ¶
const MaxCallRecvMsgSize = 1024 * 1024 * 512 // 512MB for large debug responses
Variables ¶
This section is empty.
Functions ¶
func NewGRPCProxy ¶
func NewGRPCProxy(cb ProxyCallBack, healthCheckPath string, cmdFlags common.ConsumerCmdFlags, healthReporter HealthReporter) (*grpc.Server, *http.Server, error)
func NewGRPCProxyWithReflection ¶
func NewGRPCProxyWithReflection(cb ProxyCallBack, healthCheckPath string, cmdFlags common.ConsumerCmdFlags, healthReporter HealthReporter, reflectionCallback ReflectionProxyCallback) (*grpc.Server, *http.Server, error)
NewGRPCProxyWithReflection creates a gRPC proxy with optional reflection support. If reflectionCallback is provided, a separate gRPC server is created for reflection that uses standard protobuf codec (not RawBytesCodec), allowing proper serialization. This enables tools like grpcurl to work with the smart router.
func RegisterReflectionProxy ¶
func RegisterReflectionProxy(server *grpc.Server, getConnection ReflectionProxyCallback)
RegisterReflectionProxy registers the reflection proxy service on a gRPC server. This should be called before the server starts serving.
Types ¶
type HealthReporter ¶
type HealthReporter interface {
IsHealthy() bool
}
type ProxyCallBack ¶
type RawBytesCodec ¶
type RawBytesCodec struct{}
func (RawBytesCodec) Marshal ¶
func (RawBytesCodec) Marshal(v interface{}) ([]byte, error)
func (RawBytesCodec) Name ¶
func (RawBytesCodec) Name() string
func (RawBytesCodec) String ¶
func (RawBytesCodec) String() string
func (RawBytesCodec) Unmarshal ¶
func (RawBytesCodec) Unmarshal(data []byte, v interface{}) error
type ReflectionProxyCallback ¶
type ReflectionProxyCallback func(ctx context.Context) (*grpc.ClientConn, func(), error)
ReflectionProxyCallback is a function that creates a reflection client for proxying. It should return a grpc.ClientConn that can be used to create a ServerReflectionClient. The caller is responsible for returning the connection when done (via the cleanup function).
type ReflectionProxyService ¶
type ReflectionProxyService struct {
reflectionpb.UnimplementedServerReflectionServer
// contains filtered or unexported fields
}
ReflectionProxyService implements the gRPC reflection service by proxying requests to an upstream gRPC server. This enables tools like grpcurl to work with the smart router in Direct RPC mode.
func NewReflectionProxyService ¶
func NewReflectionProxyService(getConnection ReflectionProxyCallback) *ReflectionProxyService
NewReflectionProxyService creates a new reflection proxy service. The callback should return a gRPC connection to the upstream server.
func (*ReflectionProxyService) ServerReflectionInfo ¶
func (s *ReflectionProxyService) ServerReflectionInfo(stream reflectionpb.ServerReflection_ServerReflectionInfoServer) error
ServerReflectionInfo implements the bidirectional streaming reflection API. It proxies requests to the upstream gRPC server and returns responses.