Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsInvalidConfig ¶
IsInvalidConfig asserts invalidConfigError.
Types ¶
type Config ¶
type Config struct { Logger micrologger.Logger // DefaultLimit is the default rate limit for all rate limiters. It is // currently not possible to specify a rate limit per endpoint. DefaultLimit int64 // DefaultPeriod is the default period for all rate limiters. It is currently // not possible to specify a period per endpoint. DefaultPeriod time.Duration }
type LookupFunc ¶
LookupFunc is the middleware configuration required to lookup the rate limit key of the user making the current request. This has to be configured independently since the rate limit key is provided differently with each endpoint.
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
func New ¶
func New(config Config) (*Middleware, error)
func (*Middleware) New ¶
func (m *Middleware) New(lookupFunc LookupFunc) kitendpoint.Middleware
New takes a function and returns a middleware, unlike other middlewares, it needs to know how to extract some information from the request which might be in different places depending on the endpoint.
Click to show internal directories.
Click to hide internal directories.