grpcutil

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

DefaultUnaryMiddleware is a recommended set of middleware that should each gracefully no-op if the middleware is not applicable.

Functions

func EnableDebug

func EnableDebug(s *grpc.Server)

func EnableHealth

func EnableHealth(srv string, s *grpc.Server)

func EnableReflection

func EnableReflection(s *grpc.Server)

func NewAuthlessReflectionInterceptor

func NewAuthlessReflectionInterceptor(srv reflection.GRPCServer) reflection.GRPCServer

NewAuthlessReflectionInterceptor creates a proxy GRPCServer which automatically converts ServerReflectionServer instances to onces that skip grpc auth middleware.

change: reflection.Register(srv) to: reflection.Register(grpcutil.NewAuthlessReflectionInterceptor(srv))

func NoopUnaryInterceptor

func NoopUnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)

NoopUnaryInterceptor is a gRPC middleware that does not do anything.

func WithCustomCerts

func WithCustomCerts(certPath string, insecureSkipVerify bool) grpc.DialOption

WithCustomCerts is a dial option for requiring TLS from a specified path. If the path is a directory, all certs are loaded. If it is an individual file only the directly specified cert is loaded.

This function panics if custom certificate pool cannot be instantiated.

func WithSystemCerts

func WithSystemCerts(insecureSkipVerify bool) grpc.DialOption

WithSystemCerts is a dial option for requiring TLS with the system certificate pool.

This function panics if the system pool cannot be loaded.

func WrapMethods

func WrapMethods(svcDesc grpc.ServiceDesc, interceptors ...grpc.UnaryServerInterceptor) (wrapped *grpc.ServiceDesc)

WrapMethods wraps all non-streaming endpoints with the given list of interceptors. It returns a copy of the ServiceDesc with the new wrapped methods.

func WrapStreams

func WrapStreams(svcDesc grpc.ServiceDesc, interceptors ...grpc.StreamServerInterceptor) (wrapped *grpc.ServiceDesc)

WrapStreams wraps all streaming endpoints with the given list of interceptors. It returns a copy of the ServiceDesc with the new wrapped methods.

Types

This section is empty.

Jump to

Keyboard shortcuts

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