ratelimit

package
v1.33.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 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, limiterID LimiterID) grpc.StreamServerInterceptor

StreamServerInterceptor for ratelimit.

func UnaryServerInterceptor

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

UnaryServerInterceptor for ratelimit.

Types

type Config

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

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