Documentation
¶
Index ¶
Constants ¶
View Source
const Type = "ratelimit"
Variables ¶
This section is empty.
Functions ¶
func FromCli ¶
func FromCli(c *cli.Context) (plugin.Middleware, error)
Constructs the middleware from the command line
func GetSpec ¶
func GetSpec() *plugin.MiddlewareSpec
Spec is an entry point of a plugin and will be called to register this middleware plugin withing vulcand
Types ¶
type RateLimit ¶
type RateLimit struct {
PeriodSeconds int // Period in seconds, e.g. 3600 to set up hourly rates
Burst int64 // Burst count, allowes some extra variance for requests exceeding the average rate
Variable string // Variable defines how the limiting should be done. e.g. 'client.ip' or 'request.header.X-My-Header'
Requests int // Allowed average requests
}
Rate controls how many requests per period of time is allowed for a location. Existing implementation is based on the token bucket algorightm http://en.wikipedia.org/wiki/Token_bucket
func NewRateLimit ¶
func (*RateLimit) NewMiddleware ¶
func (r *RateLimit) NewMiddleware() (middleware.Middleware, error)
Returns vulcan library compatible middleware
Click to show internal directories.
Click to hide internal directories.