Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
func (*Limiter) Configure ¶
The LimitGenerator function should return the rate limit with corresponding key that should be used for the given path template path.pathTemplate should be the pathtemplate used to route the request
If you give multiple configs for 1 endpoint. The most restrictive one will apply
func (*Limiter) Middleware ¶
func (l *Limiter) Middleware() mux.MiddlewareFunc
Rate limiting middleware, you can configure 1 or many limits for each path template using a limitGenerator The algorithm is inspired from: https://redislabs.com/redis-best-practices/basic-rate-limiting/
The key will be stored in clear text in the cache. If the key contains personal data please consider hashing the key
Click to show internal directories.
Click to hide internal directories.