middleware

package
v0.51.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttachServerNameInterceptor added in v0.51.0

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

func InterceptorLogger added in v0.17.0

func InterceptorLogger(l *zerolog.Logger) logging.Logger

InterceptorLogger adapts zerolog logger to interceptor logger. This code is simple enough to be copied and not imported.

func ServerNameStreamingInterceptor added in v0.51.0

func ServerNameStreamingInterceptor(
	srv interface{},
	ss grpc.ServerStream,
	info *grpc.StreamServerInfo,
	handler grpc.StreamHandler,
) error

Types

type ErrorInterceptor added in v0.20.0

type ErrorInterceptor struct {
	// contains filtered or unexported fields
}

func NewErrorInterceptor added in v0.20.0

func NewErrorInterceptor(a errors.Alerter,
	l *zerolog.Logger) *ErrorInterceptor

func (*ErrorInterceptor) ErrorStreamServerInterceptor added in v0.20.0

func (e *ErrorInterceptor) ErrorStreamServerInterceptor() grpc.StreamServerInterceptor

StreamServerInterceptor returns a new streaming server interceptor for panic recovery.

func (*ErrorInterceptor) ErrorUnaryServerInterceptor added in v0.20.0

func (e *ErrorInterceptor) ErrorUnaryServerInterceptor() grpc.UnaryServerInterceptor

UnaryServerInterceptor returns a new unary server interceptor for panic recovery.

type GRPCAuthN

type GRPCAuthN struct {
	// contains filtered or unexported fields
}

func NewAuthN

func NewAuthN(config *server.ServerConfig) *GRPCAuthN

func (*GRPCAuthN) Middleware

func (a *GRPCAuthN) Middleware(ctx context.Context) (context.Context, error)

type HatchetApiTokenRateLimiter added in v0.51.0

type HatchetApiTokenRateLimiter struct {
	// contains filtered or unexported fields
}

type HatchetRateLimiter added in v0.51.0

type HatchetRateLimiter struct {
	// contains filtered or unexported fields
}

func NewHatchetRateLimiter added in v0.51.0

func NewHatchetRateLimiter(r rate.Limit, b int, l *zerolog.Logger) *HatchetRateLimiter

func (*HatchetRateLimiter) GetOrCreateTenantRateLimiter added in v0.51.0

func (rl *HatchetRateLimiter) GetOrCreateTenantRateLimiter(rateLimitToken string) *HatchetApiTokenRateLimiter

func (*HatchetRateLimiter) Limit added in v0.51.0

func (r *HatchetRateLimiter) Limit(ctx context.Context) error

Limit is called before each request is processed. It should return an error if rate-limited.

Jump to

Keyboard shortcuts

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