Versions in this module Expand all Collapse all v0 v0.10.0 Dec 16, 2023 Changes in this version + type Counter interface + Get func(key string, window time.Time) (count int, err error) + Increment func(key string, currWindow time.Time) error v0.9.1 Dec 15, 2023 Changes in this version + var ErrRateLimitExceeded error = errors.New("rate limit exceeded") + func New(limiters ...Limiter) func(next http.Handler) http.Handler + type Context struct + Err error + Key string + Limiter Limiter + Next http.Handler + RateLimitRemaining int + RateLimitReset int + RequestLimit int + StatusCode int + WindowLen time.Duration + func (e *Context) Error() string + type Limiter interface + Get func(key string, window time.Time) (count int, err error) + Increment func(key string, currWindow time.Time) error + Name func() string + OnRequestLimit func(*Context) http.HandlerFunc + Rule func(r *http.Request) (rule *Rule, err error) + ShouldSetXRateLimitHeaders func(*Context) bool + type Rule struct + IgnoreAfter bool + Key string + ReqLimit int + WindowLen time.Duration