Documentation ¶
Index ¶
- Constants
- Variables
- func NewLimiter(r float64, b int) limiter.Limiter
- func NewRateLimiter(opts ...Option) limiter.RateLimiter
- type Option
- func FileLoaderOption(fileLoader loader.Loader) Option
- func HTTPLoaderOption(httpLoader loader.Loader) Option
- func LimitsOption(limits ...string) Option
- func LoggerOption(logger logger.Logger) Option
- func RedisLoaderOption(redisLoader loader.Loader) Option
- func ReloadPeriodOption(period time.Duration) Option
- type RateLimitGenerator
Constants ¶
View Source
const ( GlobalLimitKey = "$" IPLimitKey = "$$" )
Variables ¶
View Source
var (
ErrRateLimit = errors.New("rate limit")
)
Functions ¶
func NewRateLimiter ¶
func NewRateLimiter(opts ...Option) limiter.RateLimiter
Types ¶
type Option ¶
type Option func(opts *options)
func FileLoaderOption ¶
func HTTPLoaderOption ¶
func LimitsOption ¶
func LoggerOption ¶
func RedisLoaderOption ¶
func ReloadPeriodOption ¶
type RateLimitGenerator ¶
func NewRateLimitGenerator ¶
func NewRateLimitGenerator(r float64) RateLimitGenerator
func NewRateLimitSingleGenerator ¶
func NewRateLimitSingleGenerator(r float64) RateLimitGenerator
Click to show internal directories.
Click to hide internal directories.