Versions in this module Expand all Collapse all v1 v1.0.0 Sep 18, 2026 Changes in this version + func FormatMessage(baseMsg string, retryAfter time.Duration) string + func FormatRetryAfter(d time.Duration) string + func FormatRetryAfterSeconds(sec int64) string + func IPKeyFunc(r *http.Request) string + func Middleware(l *Limiter, max int64, period time.Duration, keyFunc KeyFunc) func(http.Handler) http.Handler + type Config struct + Fallback bool + MaxBuckets int + Prefix string + RedisClient *redis.Client + type KeyFunc func(r *http.Request) string + type Limiter struct + func New(cfg Config) *Limiter + func (l *Limiter) Allow(ctx context.Context, identifier string, max int64, period time.Duration) (Result, error) + func (l *Limiter) Memory() *MemoryLimiter + func (l *Limiter) Remove(ctx context.Context, identifier string, member string) error + type MemoryLimiter struct + func NewMemoryLimiter(maxBuckets ...int) *MemoryLimiter + func (m *MemoryLimiter) Allow(key string, max int64, period time.Duration) (allowed bool, remaining int64, retryAfter time.Duration) + func (m *MemoryLimiter) Len() int + func (m *MemoryLimiter) Remove(key string) + type Result struct + Allowed bool + Fallback bool + Member string + Remaining int64 + RetryAfter time.Duration