ratelimitv3

package
v1.36.2-20240319200631... Latest Latest
Warning

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

Go to latest
Published: unknown License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	XRateLimitHeadersRFCVersion_name = map[int32]string{
		0: "OFF",
		1: "DRAFT_VERSION_03",
	}
	XRateLimitHeadersRFCVersion_value = map[string]int32{
		"OFF":              0,
		"DRAFT_VERSION_03": 1,
	}
)

Enum value maps for XRateLimitHeadersRFCVersion.

View Source
var (
	VhRateLimitsOptions_name = map[int32]string{
		0: "OVERRIDE",
		1: "INCLUDE",
		2: "IGNORE",
	}
	VhRateLimitsOptions_value = map[string]int32{
		"OVERRIDE": 0,
		"INCLUDE":  1,
		"IGNORE":   2,
	}
)

Enum value maps for VhRateLimitsOptions.

View Source
var File_envoy_extensions_common_ratelimit_v3_ratelimit_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type LocalRateLimitDescriptor

type LocalRateLimitDescriptor struct {

	// Descriptor entries.
	Entries []*RateLimitDescriptor_Entry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"`
	// Token Bucket algorithm for local ratelimiting.
	TokenBucket *v3.TokenBucket `protobuf:"bytes,2,opt,name=token_bucket,json=tokenBucket,proto3" json:"token_bucket,omitempty"`
	// contains filtered or unexported fields
}

func (*LocalRateLimitDescriptor) ClearTokenBucket

func (x *LocalRateLimitDescriptor) ClearTokenBucket()

func (*LocalRateLimitDescriptor) GetEntries

func (*LocalRateLimitDescriptor) GetTokenBucket

func (x *LocalRateLimitDescriptor) GetTokenBucket() *v3.TokenBucket

func (*LocalRateLimitDescriptor) HasTokenBucket

func (x *LocalRateLimitDescriptor) HasTokenBucket() bool

func (*LocalRateLimitDescriptor) ProtoMessage

func (*LocalRateLimitDescriptor) ProtoMessage()

func (*LocalRateLimitDescriptor) ProtoReflect

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

func (*LocalRateLimitDescriptor) Reset

func (x *LocalRateLimitDescriptor) Reset()

func (*LocalRateLimitDescriptor) SetEntries

func (*LocalRateLimitDescriptor) SetTokenBucket

func (x *LocalRateLimitDescriptor) SetTokenBucket(v *v3.TokenBucket)

func (*LocalRateLimitDescriptor) String

func (x *LocalRateLimitDescriptor) String() string

type LocalRateLimitDescriptor_builder

type LocalRateLimitDescriptor_builder struct {

	// Descriptor entries.
	Entries []*RateLimitDescriptor_Entry
	// Token Bucket algorithm for local ratelimiting.
	TokenBucket *v3.TokenBucket
	// contains filtered or unexported fields
}

func (LocalRateLimitDescriptor_builder) Build

type RateLimitDescriptor

type RateLimitDescriptor struct {

	// Descriptor entries.
	Entries []*RateLimitDescriptor_Entry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"`
	// Optional rate limit override to supply to the ratelimit service.
	Limit *RateLimitDescriptor_RateLimitOverride `protobuf:"bytes,2,opt,name=limit,proto3" json:"limit,omitempty"`
	// contains filtered or unexported fields
}

A RateLimitDescriptor is a list of hierarchical entries that are used by the service to determine the final rate limit key and overall allowed limit. Here are some examples of how they might be used for the domain "envoy".

.. code-block:: cpp

["authenticated": "false"], ["remote_address": "10.0.0.1"]

What it does: Limits all unauthenticated traffic for the IP address 10.0.0.1. The configuration supplies a default limit for the *remote_address* key. If there is a desire to raise the limit for 10.0.0.1 or block it entirely it can be specified directly in the configuration.

.. code-block:: cpp

["authenticated": "false"], ["path": "/foo/bar"]

What it does: Limits all unauthenticated traffic globally for a specific path (or prefix if configured that way in the service).

.. code-block:: cpp

["authenticated": "false"], ["path": "/foo/bar"], ["remote_address": "10.0.0.1"]

What it does: Limits unauthenticated traffic to a specific path for a specific IP address. Like (1) we can raise/block specific IP addresses if we want with an override configuration.

.. code-block:: cpp

["authenticated": "true"], ["client_id": "foo"]

What it does: Limits all traffic for an authenticated client "foo"

.. code-block:: cpp

["authenticated": "true"], ["client_id": "foo"], ["path": "/foo/bar"]

What it does: Limits traffic to a specific path for an authenticated client "foo"

The idea behind the API is that (1)/(2)/(3) and (4)/(5) can be sent in 1 request if desired. This enables building complex application scenarios with a generic backend.

Optionally the descriptor can contain a limit override under a "limit" key, that specifies the number of requests per unit to use instead of the number configured in the rate limiting service.

func (*RateLimitDescriptor) ClearLimit

func (x *RateLimitDescriptor) ClearLimit()

func (*RateLimitDescriptor) GetEntries

func (*RateLimitDescriptor) GetLimit

func (*RateLimitDescriptor) HasLimit

func (x *RateLimitDescriptor) HasLimit() bool

func (*RateLimitDescriptor) ProtoMessage

func (*RateLimitDescriptor) ProtoMessage()

func (*RateLimitDescriptor) ProtoReflect

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

func (*RateLimitDescriptor) Reset

func (x *RateLimitDescriptor) Reset()

func (*RateLimitDescriptor) SetEntries

func (x *RateLimitDescriptor) SetEntries(v []*RateLimitDescriptor_Entry)

func (*RateLimitDescriptor) SetLimit

func (*RateLimitDescriptor) String

func (x *RateLimitDescriptor) String() string

type RateLimitDescriptor_Entry

type RateLimitDescriptor_Entry struct {

	// Descriptor key.
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// Descriptor value.
	Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*RateLimitDescriptor_Entry) GetKey

func (x *RateLimitDescriptor_Entry) GetKey() string

func (*RateLimitDescriptor_Entry) GetValue

func (x *RateLimitDescriptor_Entry) GetValue() string

func (*RateLimitDescriptor_Entry) ProtoMessage

func (*RateLimitDescriptor_Entry) ProtoMessage()

func (*RateLimitDescriptor_Entry) ProtoReflect

func (*RateLimitDescriptor_Entry) Reset

func (x *RateLimitDescriptor_Entry) Reset()

func (*RateLimitDescriptor_Entry) SetKey

func (x *RateLimitDescriptor_Entry) SetKey(v string)

func (*RateLimitDescriptor_Entry) SetValue

func (x *RateLimitDescriptor_Entry) SetValue(v string)

func (*RateLimitDescriptor_Entry) String

func (x *RateLimitDescriptor_Entry) String() string

type RateLimitDescriptor_Entry_builder

type RateLimitDescriptor_Entry_builder struct {

	// Descriptor key.
	Key string
	// Descriptor value.
	Value string
	// contains filtered or unexported fields
}

func (RateLimitDescriptor_Entry_builder) Build

type RateLimitDescriptor_RateLimitOverride

type RateLimitDescriptor_RateLimitOverride struct {

	// The number of requests per unit of time.
	RequestsPerUnit uint32 `protobuf:"varint,1,opt,name=requests_per_unit,json=requestsPerUnit,proto3" json:"requests_per_unit,omitempty"`
	// The unit of time.
	Unit v3.RateLimitUnit `protobuf:"varint,2,opt,name=unit,proto3,enum=envoy.type.v3.RateLimitUnit" json:"unit,omitempty"`
	// contains filtered or unexported fields
}

Override rate limit to apply to this descriptor instead of the limit configured in the rate limit service. See :ref:`rate limit override <config_http_filters_rate_limit_rate_limit_override>` for more information.

func (*RateLimitDescriptor_RateLimitOverride) GetRequestsPerUnit

func (x *RateLimitDescriptor_RateLimitOverride) GetRequestsPerUnit() uint32

func (*RateLimitDescriptor_RateLimitOverride) GetUnit

func (*RateLimitDescriptor_RateLimitOverride) ProtoMessage

func (*RateLimitDescriptor_RateLimitOverride) ProtoMessage()

func (*RateLimitDescriptor_RateLimitOverride) ProtoReflect

func (*RateLimitDescriptor_RateLimitOverride) Reset

func (*RateLimitDescriptor_RateLimitOverride) SetRequestsPerUnit

func (x *RateLimitDescriptor_RateLimitOverride) SetRequestsPerUnit(v uint32)

func (*RateLimitDescriptor_RateLimitOverride) SetUnit

func (*RateLimitDescriptor_RateLimitOverride) String

type RateLimitDescriptor_RateLimitOverride_builder

type RateLimitDescriptor_RateLimitOverride_builder struct {

	// The number of requests per unit of time.
	RequestsPerUnit uint32
	// The unit of time.
	Unit v3.RateLimitUnit
	// contains filtered or unexported fields
}

func (RateLimitDescriptor_RateLimitOverride_builder) Build

type RateLimitDescriptor_builder

type RateLimitDescriptor_builder struct {

	// Descriptor entries.
	Entries []*RateLimitDescriptor_Entry
	// Optional rate limit override to supply to the ratelimit service.
	Limit *RateLimitDescriptor_RateLimitOverride
	// contains filtered or unexported fields
}

func (RateLimitDescriptor_builder) Build

type VhRateLimitsOptions

type VhRateLimitsOptions int32
const (
	// Use the virtual host rate limits unless the route has a rate limit policy.
	VhRateLimitsOptions_OVERRIDE VhRateLimitsOptions = 0
	// Use the virtual host rate limits even if the route has a rate limit policy.
	VhRateLimitsOptions_INCLUDE VhRateLimitsOptions = 1
	// Ignore the virtual host rate limits even if the route does not have a rate limit policy.
	VhRateLimitsOptions_IGNORE VhRateLimitsOptions = 2
)

func (VhRateLimitsOptions) Descriptor

func (VhRateLimitsOptions) Enum

func (VhRateLimitsOptions) Number

func (VhRateLimitsOptions) String

func (x VhRateLimitsOptions) String() string

func (VhRateLimitsOptions) Type

type XRateLimitHeadersRFCVersion

type XRateLimitHeadersRFCVersion int32

Defines the version of the standard to use for X-RateLimit headers.

const (
	// X-RateLimit headers disabled.
	XRateLimitHeadersRFCVersion_OFF XRateLimitHeadersRFCVersion = 0
	// Use `draft RFC Version 03 <https://tools.ietf.org/id/draft-polli-ratelimit-headers-03.html>`_ where 3 headers will be added:
	//
	//   - “X-RateLimit-Limit“ - indicates the request-quota associated to the
	//     client in the current time-window followed by the description of the
	//     quota policy. The value is returned by the maximum tokens of the token bucket.
	//   - “X-RateLimit-Remaining“ - indicates the remaining requests in the
	//     current time-window. The value is returned by the remaining tokens in the token bucket.
	//   - “X-RateLimit-Reset“ - indicates the number of seconds until reset of
	//     the current time-window. The value is returned by the remaining fill interval of the token bucket.
	XRateLimitHeadersRFCVersion_DRAFT_VERSION_03 XRateLimitHeadersRFCVersion = 1
)

func (XRateLimitHeadersRFCVersion) Descriptor

func (XRateLimitHeadersRFCVersion) Enum

func (XRateLimitHeadersRFCVersion) Number

func (XRateLimitHeadersRFCVersion) String

func (XRateLimitHeadersRFCVersion) Type

Jump to

Keyboard shortcuts

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