grpcproxy

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: Apache-2.0 Imports: 17 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
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 ProxyCallBack = func(ctx context.Context, method string, reqBody []byte) ([]byte, metadata.MD, error)

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

ServerReflectionInfo implements the bidirectional streaming reflection API. It proxies requests to the upstream gRPC server and returns responses.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL