ratelimit

package
v1.45.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2022 License: Unlicense Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StreamServerInterceptor

func StreamServerInterceptor(cfg *Config, cache *ristretto.Cache, limiterID LimiterID) grpc.StreamServerInterceptor

StreamServerInterceptor for ratelimit.

func UnaryServerInterceptor

func UnaryServerInterceptor(cfg *Config, cache *ristretto.Cache, limiterID LimiterID) grpc.UnaryServerInterceptor

UnaryServerInterceptor for ratelimit.

Types

type Config

type Config struct {
	Every time.Duration `yaml:"every"`
	Burst uint          `yaml:"burst"`
	TTL   time.Duration `yaml:"ttl"`
}

Config for ratelimit.

type LimiterID

type LimiterID func(ctx context.Context) string

LimiterID to find the correct limiter. This way we can segment limiters by different ids.

Jump to

Keyboard shortcuts

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