ratelimit

package
v1.80.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RateLimit

type RateLimit struct{}

func NewRateLimit

func NewRateLimit() *RateLimit

func (RateLimit) Handler

func (RateLimit) Handler(proxyRoute gobis.ProxyRoute, params interface{}, handler http.Handler) (http.Handler, error)

func (RateLimit) Schema

func (RateLimit) Schema() interface{}

type RateLimitConfig

type RateLimitConfig struct {
	RateLimit *RateLimitOptions `mapstructure:"rate_limit" json:"rate_limit" yaml:"rate_limit"`
}

type RateLimitOptions

type RateLimitOptions struct {
	// Enabled enable rate limit
	Enabled bool `mapstructure:"enabled" json:"enabled" yaml:"enabled"`
	// Limit number of requests (default to 5000)
	Limit int64 `mapstructure:"limit" json:"limit" yaml:"limit"`
	// ResetTime Number of seconds when the limit will be reset (default to 1800)
	ResetTime int64 `mapstructure:"reset_time" json:"reset_time" yaml:"reset_time"`
	// SourceIdentifier Identify request source to limit the source
	// possible value are 'client.ip', 'request.host' or 'request.header.X-My-Header-Name'
	// if empty and a username exists in context the source will be set to this content (this allows to rate limit by username from auth middleware)
	// for context see: https://godoc.org/github.com/orange-cloudfoundry/gobis/proxy/ctx#Username
	SourceIdentifier string `mapstructure:"source_identifier" json:"source_identifier" yaml:"source_identifier"`
}

Jump to

Keyboard shortcuts

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