//go:build dev && !test // No-op rate limiting for pure dev builds (-tags dev): the dev seed performs // more logins/requests than the real limiters allow in a minute, which would // block local development. Tests always build with the `test` tag, so the real // implementation in ratelimit.go is used there. The types, registration, and // Cleanup methods come from tag-free ratelimit_shared.go. package mw import ( "net/http" "time" ) func NewRateLimiter(limit int, window time.Duration) *RateLimiter { return &RateLimiter{} } func NewProgressiveRateLimiter() *ProgressiveRateLimiter { return &ProgressiveRateLimiter{} } func ProgressiveRateLimit(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { next.ServeHTTP(w, r) }) } func RateLimit(limit int, window time.Duration) func(http.Handler) http.Handler { return func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { next.ServeHTTP(w, r) }) } } // RateLimitByUserAndIP is the dev-build no-op twin of the production // user+IP-keyed limiter in ratelimit.go: pure dev builds pass everything // through so the dev seed's bursty traffic is never throttled (tests build // with the `test` tag and get the real implementation). func RateLimitByUserAndIP(limit int, window time.Duration) func(http.Handler) http.Handler { return func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { next.ServeHTTP(w, r) }) } }