ratelimit

package
v0.10.113 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2018 License: Apache-2.0, MIT Imports: 4 Imported by: 4

Documentation

Overview

Package ratelimit provides filters to control the rate limitter settings on the route level.

For detailed documentation of the ratelimit, see https://godoc.org/github.com/zalando/skipper/ratelimit.

Index

Constants

View Source
const RetryAfterKey = "#ratelimitretryafter"

RetryAfterKey is used as key in the context state bag

View Source
const RouteSettingsKey = "#ratelimitsettings"

RouteSettingsKey is used as key in the context state bag

Variables

This section is empty.

Functions

func NewClusterRateLimit added in v0.10.113

func NewClusterRateLimit() filters.Spec

NewClusterServiceRatelimit creates a rate limiting that is aware of the other instances. The value given here should be the combined rate of all instances.

Example:

backendHealthcheck: Path("/healthcheck")
-> clusterRatelimit(200, "1m")
-> "https://foo.backend.net";

The above example behaves like the "ratelimit", i.e. per backend. To create a client limit like in "localRatelimit" a third parameter is mandatory. Currently known parameters are "auth" (limit by "Authorization" header) and "xfwd" (client ip from X-Forwarded-For header)

Example:

backendHealthcheck: Path("/healthcheck")
-> clusterRatelimit(200, "1m", "xfwd")
-> "https://foo.backend.net";

func NewDisableRatelimit

func NewDisableRatelimit() filters.Spec

NewDisableRatelimit disables rate limiting

Example:

backendHealthcheck: Path("/healthcheck")
-> disableRatelimit()
-> "https://foo.backend.net";

func NewLocalRatelimit

func NewLocalRatelimit() filters.Spec

NewLocalRatelimit creates a local measured rate limiting, that is only aware of itself. If you have 5 instances with 20 req/s, then it would allow 100 req/s to the backend from the same user. A third argument can be used to set which part of the request should be used to find the same user. Third argument defaults to XForwardedForLookuper, meaning X-Forwarded-For Header.

Example:

backendHealthcheck: Path("/healthcheck")
-> localRatelimit(20, "1m")
-> "https://foo.backend.net";

Example rate limit per Authorization Header:

login: Path("/login")
-> localRatelimit(3, "1m", "auth")
-> "https://login.backend.net";

func NewRatelimit

func NewRatelimit() filters.Spec

NewRatelimit creates a service rate limiting, that is only aware of itself. If you have 5 instances with 20 req/s, then it would at max allow 100 req/s to the backend.

Example:

backendHealthcheck: Path("/healthcheck")
-> ratelimit(20, "1s")
-> "https://foo.backend.net";

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL