Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromCli ¶
func FromCli(c *cli.Context) (plugin.Middleware, error)
FromCli constructs a middleware instance from the command line parameters.
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 { // Period in seconds, e.g. 3600 to set up hourly rates PeriodSeconds int64 // Allowed average requests Requests int64 // Burst count, allowes some extra variance for requests exceeding the average rate Burst int64 // Variable defines how the limiting should be done. e.g. 'client.ip' or 'request.header.X-My-Header' Variable string // RateVar defines the source of rates configuration that should be used to // process a particular request. E.g. 'request.header.X-Rates' RateVar string // contains filtered or unexported fields }
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 (*RateLimit) NewMiddleware ¶
func (r *RateLimit) NewMiddleware() (middleware.Middleware, error)
Returns vulcan library compatible middleware
Click to show internal directories.
Click to hide internal directories.