local_ratelimit

package
v1.18.0-beta21 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_github_com_solo_io_gloo_projects_gloo_api_v1_options_local_ratelimit_local_ratelimit_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Settings

type Settings struct {

	// The token bucket configuration to use for rate limiting requests.
	// These options provide the ability to locally rate limit the connections in envoy. Each request processed by the filter consumes a single token.
	// If the token is available, the request will be allowed. If no tokens are available, the request will receive the configured rate limit status.
	// This default limit can be overridden in the vHost or route options.localRatelimit
	DefaultLimit *TokenBucket `protobuf:"bytes,1,opt,name=default_limit,json=defaultLimit,proto3" json:"default_limit,omitempty"`
	// Specifies the scope of the rate limiter’s token bucket. If set to false, the token bucket is shared across all worker threads, thus the rate limits are applied per Envoy process.
	// If set to true, a token bucket is allocated for each connection, thus the rate limits are applied per connection thereby allowing one to rate limit requests on a per connection basis.
	// This setting applies to all token buckets in the vHost and route as well.
	// Defaults to false
	LocalRateLimitPerDownstreamConnection *wrappers.BoolValue `` /* 180-byte string literal not displayed */
	// Set this to true to return Envoy's X-RateLimit headers to the downstream.
	// reference docs here: https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/common/ratelimit/v3/ratelimit.proto#envoy-v3-api-enum-extensions-common-ratelimit-v3-xratelimitheadersrfcversion
	// This setting applies at the vHost and route local rate limit as well
	// Defaults to false
	EnableXRatelimitHeaders *wrappers.BoolValue `` /* 134-byte string literal not displayed */
	// contains filtered or unexported fields
}

The Local Rate Limit settings define the default local rate limit token bucket to apply as well as other configurations

func (*Settings) Clone

func (m *Settings) Clone() proto.Message

Clone function

func (*Settings) Descriptor deprecated

func (*Settings) Descriptor() ([]byte, []int)

Deprecated: Use Settings.ProtoReflect.Descriptor instead.

func (*Settings) Equal

func (m *Settings) Equal(that interface{}) bool

Equal function

func (*Settings) GetDefaultLimit

func (x *Settings) GetDefaultLimit() *TokenBucket

func (*Settings) GetEnableXRatelimitHeaders

func (x *Settings) GetEnableXRatelimitHeaders() *wrappers.BoolValue

func (*Settings) GetLocalRateLimitPerDownstreamConnection

func (x *Settings) GetLocalRateLimitPerDownstreamConnection() *wrappers.BoolValue

func (*Settings) Hash

func (m *Settings) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*Settings) ProtoMessage

func (*Settings) ProtoMessage()

func (*Settings) ProtoReflect

func (x *Settings) ProtoReflect() protoreflect.Message

func (*Settings) Reset

func (x *Settings) Reset()

func (*Settings) String

func (x *Settings) String() string

type TokenBucket

type TokenBucket struct {

	// The maximum tokens that the bucket can hold. This is also the number of tokens that the bucket initially contains.
	// Must be greater than or equal to one.
	MaxTokens uint32 `protobuf:"varint,1,opt,name=max_tokens,json=maxTokens,proto3" json:"max_tokens,omitempty"`
	// The number of tokens added to the bucket during each fill interval. If not specified, defaults to a single token.
	// Must be greater than zero.
	TokensPerFill *wrappers.UInt32Value `protobuf:"bytes,2,opt,name=tokens_per_fill,json=tokensPerFill,proto3" json:"tokens_per_fill,omitempty"`
	// The fill interval that tokens are added to the bucket. During each fill interval tokens_per_fill are added to the bucket.
	// The bucket will never contain more than max_tokens tokens.
	// The fill_interval must be >= 50ms and defaults to 1 second.
	FillInterval *duration.Duration `protobuf:"bytes,3,opt,name=fill_interval,json=fillInterval,proto3" json:"fill_interval,omitempty"`
	// contains filtered or unexported fields
}

Configures the token bucket, used for rate limiting. Ref. https://www.envoyproxy.io/docs/envoy/latest/configuration/listeners/network_filters/local_rate_limit_filter

func (*TokenBucket) Clone

func (m *TokenBucket) Clone() proto.Message

Clone function

func (*TokenBucket) Descriptor deprecated

func (*TokenBucket) Descriptor() ([]byte, []int)

Deprecated: Use TokenBucket.ProtoReflect.Descriptor instead.

func (*TokenBucket) Equal

func (m *TokenBucket) Equal(that interface{}) bool

Equal function

func (*TokenBucket) GetFillInterval

func (x *TokenBucket) GetFillInterval() *duration.Duration

func (*TokenBucket) GetMaxTokens

func (x *TokenBucket) GetMaxTokens() uint32

func (*TokenBucket) GetTokensPerFill

func (x *TokenBucket) GetTokensPerFill() *wrappers.UInt32Value

func (*TokenBucket) Hash

func (m *TokenBucket) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*TokenBucket) ProtoMessage

func (*TokenBucket) ProtoMessage()

func (*TokenBucket) ProtoReflect

func (x *TokenBucket) ProtoReflect() protoreflect.Message

func (*TokenBucket) Reset

func (x *TokenBucket) Reset()

func (*TokenBucket) String

func (x *TokenBucket) String() string

Jump to

Keyboard shortcuts

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