Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReqRateLimiterMiddleware ¶
func ReqRateLimiterMiddleware(rl *RateLimiter) func(rt http.RoundTripper) req.HttpRoundTripFunc
ReqRateLimiterMiddleware implements the Middleware interface for the req library and blocks requests based on the RateLimiter configuration. The Host of the request is used as the key for the RateLimiter.
Types ¶
type RateLimiter ¶
RateLimiter allows you to defaultDelay operations on a per-key basis. I.e. only one operation for a given key can be done within the defaultDelay time
func NewRateLimiter ¶
func NewRateLimiter(defaultDelay time.Duration) *RateLimiter
NewRateLimiter returns a new *RateLimiter for the provided defaultDelay
func (*RateLimiter) Block ¶
func (r *RateLimiter) Block(key string)
Block blocks until an operation for key is allowed to proceed
Click to show internal directories.
Click to hide internal directories.