Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is an in-memory, per-IP two-tier rate limiter. Each IP gets a short-term (per-second) and a long-term (per-minute) token bucket. A request must pass both to be allowed. Entries are evicted by Cleanup after being idle for a configurable duration.
func NewStore ¶
NewStore creates a Store with a per-second and per-minute limit. Pass rps <= 0 to disable rate limiting entirely (Allow always returns true).
Click to show internal directories.
Click to hide internal directories.