Documentation
¶
Index ¶
- func NewClient(ctx context.Context, addr string, credentials credentials.TransportCredentials, ...) (*grpc.ClientConn, error)
- func NewQUICClient(ctx context.Context, addr string, tlsConfig *tls.Config, ...) (*grpc.ClientConn, error)
- func NewServer(logger *zap.Logger, extraOpts ...ServerOption) *grpc.Server
- func OpenTracingZapUnaryInterceptor() grpc.UnaryServerInterceptor
- func RequestLogUnaryInterceptor(truncatedMethods map[string]bool) grpc.UnaryServerInterceptor
- func Services(server *grpc.Server) []string
- func VerifyUnaryInterceptor() grpc.UnaryServerInterceptor
- 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 MethodInfo
- type ServerOption
- func AuthorizationInterceptor(router *auth.AuthRouter) ServerOption
- func Credentials(creds credentials.TransportCredentials) ServerOption
- func DefaultTraceInterceptor() ServerOption
- func GRPCServerOptions(opts ...grpc.ServerOption) ServerOption
- func RateLimitInterceptor(ctx context.Context, defaultLimit float64, preciseLimits map[string]float64) ServerOption
- func RequestLogInterceptor(truncatedMethods []string) ServerOption
- func StreamServerInterceptor(s grpc.StreamServerInterceptor) ServerOption
- func TraceInterceptor(tracer opentracing.Tracer) ServerOption
- func UnaryServerInterceptor(u grpc.UnaryServerInterceptor) ServerOption
- func VerifyInterceptor() ServerOption
- type TransportCredentials
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 NewQUICClient ¶ added in v0.4.17
func NewQUICClient(ctx context.Context, addr string, tlsConfig *tls.Config, credentials credentials.TransportCredentials, opts ...grpc.DialOption) (*grpc.ClientConn, error)
func OpenTracingZapUnaryInterceptor ¶ added in v0.4.13
func OpenTracingZapUnaryInterceptor() grpc.UnaryServerInterceptor
func RequestLogUnaryInterceptor ¶ added in v0.4.13
func RequestLogUnaryInterceptor(truncatedMethods map[string]bool) grpc.UnaryServerInterceptor
func VerifyUnaryInterceptor ¶ added in v0.4.13
func VerifyUnaryInterceptor() grpc.UnaryServerInterceptor
Types ¶
type Handler ¶
type Handler struct{}
func (*Handler) HandleConn ¶
HandleConn processes the Conn stats.
type MethodInfo ¶ added in v0.4.6
func ParseMethodInfo ¶ added in v0.4.13
func ParseMethodInfo(fullMethod string) *MethodInfo
func (*MethodInfo) IntoTuple ¶ added in v0.4.13
func (m *MethodInfo) IntoTuple() (string, string)
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 GRPCServerOptions ¶ added in v0.4.17
func GRPCServerOptions(opts ...grpc.ServerOption) ServerOption
func RateLimitInterceptor ¶ added in v0.4.12
func RateLimitInterceptor(ctx context.Context, defaultLimit float64, preciseLimits map[string]float64) ServerOption
RateLimitInterceptor is an option that enables requests rate limit for specified methods.
The context is required, because internally a garbage collector is run to periodically collect records for addresses that are inactive for a long time.
Rates are counted as exponentially-weighted averaged at one-minutes.
Methods that are not listed in the "preciseLimits" argument will have no rate limitations.
func RequestLogInterceptor ¶ added in v0.4.6
func RequestLogInterceptor(truncatedMethods []string) 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 StreamServerInterceptor ¶ added in v0.4.13
func StreamServerInterceptor(s grpc.StreamServerInterceptor) ServerOption
UnaryServerInterceptor adds an unary interceptor to the chain.
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.
type TransportCredentials ¶ added in v0.4.17
type TransportCredentials struct { credentials.TransportCredentials TLSConfig *tls.Config }
TransportCredentials wraps the standard transport credentials, adding an ability to obtain the TLS config used.
func NewTransportCredentials ¶ added in v0.4.17
func NewTransportCredentials(cfg *tls.Config) *TransportCredentials