Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
Limiter is a token-bucket rate limiter keyed by an arbitrary string (e.g. IP address).
func (*Limiter) Middleware ¶
Middleware returns an http.Handler that enforces the rate limit using the client's IP address as the bucket key. Requests that exceed the limit receive a 429 Too Many Requests response with a Retry-After: 1 header.
Click to show internal directories.
Click to hide internal directories.