Documentation ¶
Overview ¶
Package router provides several rate-limit routers using the golang.org/x/time/rate lib.
Sample endpoint extra config
... "extra_config": { ... "github.com/devopsfaith/krakend-ratelimit/rate/router": { "maxRate": 2000, "strategy": "header", "clientMaxRate": 100, "key": "X-Private-Token", }, ... }, ...
The ratelimit package provides an efficient token bucket implementation. See https://golang.org/x/time/rate and http://en.wikipedia.org/wiki/Token_bucket for more details.
Index ¶
Constants ¶
View Source
const Namespace = "github.com/devopsfaith/krakend-ratelimit/rate/router"
Namespace is the key to use to store and access the custom config data for the router
Variables ¶
View Source
var ZeroCfg = Config{}
ZeroCfg is the zero value for the Config struct
Functions ¶
func ConfigGetter ¶
func ConfigGetter(e config.ExtraConfig) interface{}
ConfigGetter implements the config.ConfigGetter interface. It parses the extra config for the rate adapter and returns a ZeroCfg if something goes wrong.
Types ¶
Click to show internal directories.
Click to hide internal directories.