Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrLimited = errors.New("rate limit exceeded")
ErrLimited is returned in the request path when the rate limiter is triggered and the request is rejected.
Functions ¶
func NewTokenBucketLimiter ¶
func NewTokenBucketLimiter(tb *ratelimit.Bucket) endpoint.Middleware
NewTokenBucketLimiter returns an endpoint.Middleware that acts as a rate limiter based on a token-bucket algorithm. Requests that would exceed the maximum request rate are simply rejected with an error.
func NewTokenBucketThrottler ¶
NewTokenBucketThrottler returns an endpoint.Middleware that acts as a request throttler based on a token-bucket algorithm. Requests that would exceed the maximum request rate are delayed via the parameterized sleep function. By default you may pass time.Sleep.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.