Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Limiter ¶
type Limiter struct { Expiry int // Expressed in minutes. Clients older than this value will be cleaned. Burst int // How much tokens can be consumed by a client in one request. LimitRPS float64 // Expressed in requests per second. // contains filtered or unexported fields }
Limiter leverages the std rate package to limit every client request. It assumes that the not allowed requests are DROPPED ! The alternative, to not drop requests, would be to use `Reserve()` instead of `Allow()`.
func NewLimiter ¶
NewLimiter constructs a new rate limiter with the passed options and returns it.
Click to show internal directories.
Click to hide internal directories.