grpchelper

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2018 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogAsDebug = false

LogAsDebug allows to log gRPC messages as debug level instead of info level

Functions

func DialContext

func DialContext(ctx context.Context, target string, opts ...grpc.DialOption) (*grpc.ClientConn, error)

DialContext creates a client connection to the given target with custom message size

func Listen

func Listen(address string) (net.Listener, error)

Listen is equivalent to standard net.Listen, but taking gRPC URL as input.

func LogConnStatusChanges

func LogConnStatusChanges(ctx context.Context, l log.Logger, conn *grpc.ClientConn)

LogConnStatusChanges logs gRPC connection status changes

func NewServer

func NewServer(opts ...grpc.ServerOption) *grpc.Server

NewServer creates new grpc.Server with custom message size

func SetMaxMessageSize

func SetMaxMessageSize(size int)

SetMaxMessageSize overrides default grpc max. message size to send/receive to/from clients

func StreamClientInterceptor

func StreamClientInterceptor(l log.Logger, asDebug bool) grpc.StreamClientInterceptor

StreamClientInterceptor returns a new striming client interceptor that logs the execution of external gRPC calls.

func StreamServerInterceptor

func StreamServerInterceptor(l log.Logger, asDebug bool) grpc.StreamServerInterceptor

StreamServerInterceptor returns a new streaming server interceptor that logs request/response.

func ToGoGrpcAddress

func ToGoGrpcAddress(address string) (string, error)

ToGoGrpcAddress converts a standard gRPC target name to a one that is supported by grpc-go.

func ToNetListenerAddress

func ToNetListenerAddress(target string) (network, address string, err error)

ToNetListenerAddress converts a gRPC URL to a network+address consumable by net.Listen. For example:

ipv4://127.0.0.1:8080 -> (tcp4, 127.0.0.1:8080)

func UnaryClientInterceptor

func UnaryClientInterceptor(l log.Logger, asDebug bool) grpc.UnaryClientInterceptor

UnaryClientInterceptor returns a new unary client interceptor that logs the execution of external gRPC calls.

func UnaryServerInterceptor

func UnaryServerInterceptor(l log.Logger, asDebug bool) grpc.UnaryServerInterceptor

UnaryServerInterceptor returns a new unary server interceptors that logs request/response.

Types

This section is empty.

Jump to

Keyboard shortcuts

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