grpcx

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SetupBufconnListener = SetupBufconnListenerFactory("bufconn-listener")

Functions

func LoggingUnaryClientInterceptor

func LoggingUnaryClientInterceptor(opts ...logging.Option) grpc.UnaryClientInterceptor

func LoggingUnaryClientInterceptorFactory

func LoggingUnaryClientInterceptorFactory(logger *slog.Logger) func(opts ...logging.Option) grpc.UnaryClientInterceptor

func LoggingUnaryServerInterceptor

func LoggingUnaryServerInterceptor(opts ...logging.Option) grpc.UnaryServerInterceptor

func LoggingUnaryServerInterceptorFactory

func LoggingUnaryServerInterceptorFactory(logger *slog.Logger) func(opts ...logging.Option) grpc.UnaryServerInterceptor

func MetadataFromHeader

func MetadataFromHeader(header http.Header, remoteAddr string) metadata.MD

func SetupBufconnFactory

func SetupBufconnFactory(name string, dialOpts ...grpc.DialOption) func(lc *lifecycle.Lifecycle, listener Listener) (*grpc.ClientConn, error)

func SetupBufconnListenerFactory

func SetupBufconnListenerFactory(name string) func(lc *lifecycle.Lifecycle) (Listener, error)

func SetupConnFactory

func SetupConnFactory(name string, dialOpts ...grpc.DialOption) func(lc *lifecycle.Lifecycle, conf *ConnConfig) (*grpc.ClientConn, error)

func SetupServerFactory

func SetupServerFactory(name string, opts ...grpc.ServerOption) func(ctx context.Context, lc *lifecycle.Lifecycle, listener Listener, conf *ServerConfig) (*grpc.Server, error)

Types

type ConnConfig

type ConnConfig struct {
	Address             string              `confx:"address" validate:"required" usage:"gRPC server address"`
	LoadBalancingPolicy LoadBalancingPolicy `` /* 129-byte string literal not displayed */
}

type Listener

type Listener net.Listener

func SetupListener

func SetupListener(lc *lifecycle.Lifecycle, conf *ServerConfig) (Listener, error)

type LoadBalancingPolicy

type LoadBalancingPolicy string
const (
	// pick-first is the default load balancing policy
	LoadBalancingPolicyPickFirst LoadBalancingPolicy = "pick-first"
	// round-robin should be used with dns:///address and the target address should be a k8s headless service
	LoadBalancingPolicyRoundRobin LoadBalancingPolicy = "round-robin"
)

type ServerConfig

type ServerConfig struct {
	Address            string `confx:"address" usage:"gRPC server address" validate:"required"`
	RegisterReflection bool   `confx:"registerReflection" usage:"register the server reflection service"`
}

Jump to

Keyboard shortcuts

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