Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RateLimit ¶
type RateLimit struct {
// contains filtered or unexported fields
}
func NewRateLimit ¶
NewRateLimit initializes a new RateLimit instance with the given threshold and window duration.
func (*RateLimit) AllowRequest ¶
AllowRequest increments the counter and checks if the rate limit is exceeded. If the threshold is zero, it allows all requests.
Click to show internal directories.
Click to hide internal directories.