middleware

package
v1.0.0-alpha.11 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AllowedConnections      int           = 256
	BacklogConnectionsLimit int           = 256
	BacklogWindow           time.Duration = 1 * time.Second
)

Variables

View Source
var (
	DefaultTimeout = 5 * time.Second
	MaximumTimeout = 300 * time.Second
)

Functions

func AuthFromMD

func AuthFromMD(ctx context.Context, expectedScheme string) (string, error)

func AuthFunction

func AuthFunction(ctx context.Context, jwtValidator *validator.Validator, config *config.Config) (ctxResult context.Context, err error)

func GetJWTValidator

func GetJWTValidator(config *config.Config) *validator.Validator

func PprofUnaryServerInterceptor

func PprofUnaryServerInterceptor() grpc.UnaryServerInterceptor

func TimeoutUnaryServerInterceptor

func TimeoutUnaryServerInterceptor(timeout time.Duration) grpc.UnaryServerInterceptor

TimeoutUnaryServerInterceptor returns a new unary server interceptor that sets request timeout if it's not set in the context

func TxCtxUnaryServerInterceptor

func TxCtxUnaryServerInterceptor(timeout time.Duration) grpc.UnaryServerInterceptor

Types

type CustomClaim

type CustomClaim struct {
	Roles []string     `json:"https://tigris-db-api/r"`
	Org   Organization `json:"https://tigris-db-api/o"`
	User  User         `json:"https://tigris-db-api/u"`
}

func (CustomClaim) Validate

func (c CustomClaim) Validate(ctx context.Context) error

type Organization

type Organization struct {
	Code string `json:"code"`
}

type RateLimiter

type RateLimiter struct {
}

func (*RateLimiter) Limit

func (r *RateLimiter) Limit(_ context.Context) error

type User

type User struct {
	Email string `json:"email"`
}

Jump to

Keyboard shortcuts

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