Documentation
¶
Index ¶
- func MethodInfo(fullMethod string) *methodInfo
- func NewClient(ctx context.Context, addr string, credentials credentials.TransportCredentials, ...) (*grpc.ClientConn, error)
- func NewServer(logger *zap.Logger, extraOpts ...ServerOption) *grpc.Server
- func Services(server *grpc.Server) []string
- func WithConn(conn net.Conn) grpc.DialOption
- type Handler
- func (h *Handler) HandleConn(ctx context.Context, connStats stats.ConnStats)
- func (h *Handler) HandleRPC(context.Context, stats.RPCStats)
- func (h *Handler) TagConn(ctx context.Context, connTagInfo *stats.ConnTagInfo) context.Context
- func (h *Handler) TagRPC(ctx context.Context, rpcTagInfo *stats.RPCTagInfo) context.Context
- type ServerOption
- func AuthorizationInterceptor(router *auth.AuthRouter) ServerOption
- func Credentials(creds credentials.TransportCredentials) ServerOption
- func DefaultTraceInterceptor() ServerOption
- func RequestLogInterceptor(log *zap.Logger) ServerOption
- func TraceInterceptor(tracer opentracing.Tracer) ServerOption
- func UnaryServerInterceptor(u grpc.UnaryServerInterceptor) ServerOption
- func VerifyInterceptor() ServerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MethodInfo ¶ added in v0.4.6
func MethodInfo(fullMethod string) *methodInfo
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".
Types ¶
type Handler ¶
type Handler struct{}
func (*Handler) HandleConn ¶
HandleConn processes the Conn stats.
type ServerOption ¶
type ServerOption func(options *options)
func AuthorizationInterceptor ¶
func AuthorizationInterceptor(router *auth.AuthRouter) ServerOption
func Credentials ¶
func Credentials(creds credentials.TransportCredentials) ServerOption
Credentials activates credentials for server connections.
func DefaultTraceInterceptor ¶
func DefaultTraceInterceptor() ServerOption
func RequestLogInterceptor ¶ added in v0.4.6
func RequestLogInterceptor(log *zap.Logger) ServerOption
RequestLogInterceptor is an options that activates gRPC service call logging before the real execution begins.
Note, that to enable tracing logging you should specify this option AFTER trace interceptors.
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.