xgrpc

package
v0.4.0-alpha2 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2018 License: Apache-2.0 Imports: 17 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(ctx context.Context, addr string, credentials credentials.TransportCredentials, opts ...grpc.DialOption) (*grpc.ClientConn, error)

NewClient creates new gRPC client connection on given addr and wraps it with given credentials (if provided).

The address argument can be optionally used as other peer's verification using ETH authentication. To enable this the argument should be in format "ethAddr@Endpoint".

func NewServer

func NewServer(logger *zap.Logger, extraOpts ...ServerOption) *grpc.Server

func WithConn added in v0.4.1

func WithConn(conn net.Conn) grpc.DialOption

WithConn is a client option that specifies a predefined connection used for a service.

Types

type Handler

type Handler struct{}

func (*Handler) HandleConn

func (h *Handler) HandleConn(ctx context.Context, connStats stats.ConnStats)

HandleConn processes the Conn stats.

func (*Handler) HandleRPC

func (h *Handler) HandleRPC(context.Context, stats.RPCStats)

HandleRPC processes the RPC stats.

func (*Handler) TagConn

func (h *Handler) TagConn(ctx context.Context, connTagInfo *stats.ConnTagInfo) context.Context

func (*Handler) TagRPC

func (h *Handler) TagRPC(ctx context.Context, rpcTagInfo *stats.RPCTagInfo) context.Context

type ServerOption

type ServerOption func(options *options)

func AuthorizationInterceptor

func AuthorizationInterceptor(router *auth.AuthRouter) ServerOption

func Credentials

Credentials activates credentials for server connections.

func DefaultTraceInterceptor

func DefaultTraceInterceptor() ServerOption

func TraceInterceptor

func TraceInterceptor(tracer opentracing.Tracer) ServerOption

func UnaryServerInterceptor

func UnaryServerInterceptor(u grpc.UnaryServerInterceptor) ServerOption

UnaryServerInterceptor adds an unary interceptor to the chain.

func VerifyInterceptor added in v0.4.1

func VerifyInterceptor() ServerOption

VerifyInterceptor is an interceptor that performs server-side validation for both gRPC request and reply if possible.

It automatically checks whether those types has `Validate` method and calls it if so.

Jump to

Keyboard shortcuts

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