ratelimitv3

package
v1.36.11-2026011520535... Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

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

Enum value maps for RateLimit_XRateLimitHeadersRFCVersion.

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

Enum value maps for RateLimitPerRoute_VhRateLimitsOptions.

View Source
var (
	RateLimitPerRoute_OverrideOptions_name = map[int32]string{
		0: "DEFAULT",
		1: "OVERRIDE_POLICY",
		2: "INCLUDE_POLICY",
		3: "IGNORE_POLICY",
	}
	RateLimitPerRoute_OverrideOptions_value = map[string]int32{
		"DEFAULT":         0,
		"OVERRIDE_POLICY": 1,
		"INCLUDE_POLICY":  2,
		"IGNORE_POLICY":   3,
	}
)

Enum value maps for RateLimitPerRoute_OverrideOptions.

View Source
var File_envoy_extensions_filters_http_ratelimit_v3_rate_limit_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type RateLimit

type RateLimit struct {

	// The rate limit domain to use when calling the rate limit service.
	Domain string `protobuf:"bytes,1,opt,name=domain,proto3" json:"domain,omitempty"`
	// Specifies the rate limit configurations to be applied with the same
	// stage number. If not set, the default stage number is 0.
	//
	// .. note::
	//
	//	The filter supports a range of 0 - 10 inclusively for stage numbers.
	Stage uint32 `protobuf:"varint,2,opt,name=stage,proto3" json:"stage,omitempty"`
	// The type of requests the filter should apply to. The supported
	// types are “internal“, “external“ or “both“. A request is considered internal if
	// :ref:`x-envoy-internal<config_http_conn_man_headers_x-envoy-internal>` is set to true. If
	// :ref:`x-envoy-internal<config_http_conn_man_headers_x-envoy-internal>` is not set or false, a
	// request is considered external. The filter defaults to “both“, and it will apply to all request
	// types.
	RequestType string `protobuf:"bytes,3,opt,name=request_type,json=requestType,proto3" json:"request_type,omitempty"`
	// The timeout in milliseconds for the rate limit service RPC. If not
	// set, this defaults to 20ms.
	Timeout *durationpb.Duration `protobuf:"bytes,4,opt,name=timeout,proto3" json:"timeout,omitempty"`
	// The filter's behaviour in case the rate limiting service does
	// not respond back. When it is set to true, Envoy will not allow traffic in case of
	// communication failure between rate limiting service and the proxy.
	FailureModeDeny bool `protobuf:"varint,5,opt,name=failure_mode_deny,json=failureModeDeny,proto3" json:"failure_mode_deny,omitempty"`
	// Specifies whether a “RESOURCE_EXHAUSTED“ gRPC code must be returned instead
	// of the default “UNAVAILABLE“ gRPC code for a rate limited gRPC call. The
	// HTTP code will be 200 for a gRPC response.
	RateLimitedAsResourceExhausted bool `` /* 158-byte string literal not displayed */
	// Configuration for an external rate limit service provider. If not
	// specified, any calls to the rate limit service will immediately return
	// success.
	RateLimitService *v3.RateLimitServiceConfig `protobuf:"bytes,7,opt,name=rate_limit_service,json=rateLimitService,proto3" json:"rate_limit_service,omitempty"`
	// Defines the standard version to use for X-RateLimit headers emitted by the filter:
	//
	//   - “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 values are returned by the rate limiting service in
	//     :ref:`current_limit<envoy_v3_api_field_service.ratelimit.v3.RateLimitResponse.DescriptorStatus.current_limit>`
	//     field. Example: “10, 10;w=1;name="per-ip", 1000;w=3600“.
	//   - “X-RateLimit-Remaining“ - indicates the remaining requests in the
	//     current time-window. The values are returned by the rate limiting service
	//     in :ref:`limit_remaining<envoy_v3_api_field_service.ratelimit.v3.RateLimitResponse.DescriptorStatus.limit_remaining>`
	//     field.
	//   - “X-RateLimit-Reset“ - indicates the number of seconds until reset of
	//     the current time-window. The values are returned by the rate limiting service
	//     in :ref:`duration_until_reset<envoy_v3_api_field_service.ratelimit.v3.RateLimitResponse.DescriptorStatus.duration_until_reset>`
	//     field.
	//
	// In case rate limiting policy specifies more than one time window, the values
	// above represent the window that is closest to reaching its limit.
	//
	// For more information about the headers specification see selected version of
	// the `draft RFC <https://tools.ietf.org/id/draft-polli-ratelimit-headers-03.html>`_.
	//
	// Disabled by default.
	//
	// [#next-major-version: unify with local ratelimit, should use common.ratelimit.v3.XRateLimitHeadersRFCVersion instead.]
	EnableXRatelimitHeaders RateLimit_XRateLimitHeadersRFCVersion `` /* 221-byte string literal not displayed */
	// Disables emitting the :ref:`x-envoy-ratelimited<config_http_filters_router_x-envoy-ratelimited>` header
	// in case of rate limiting (i.e. 429 responses).
	// Having this header not present potentially makes the request retriable.
	DisableXEnvoyRatelimitedHeader bool `` /* 158-byte string literal not displayed */
	// This field allows for a custom HTTP response status code to the downstream client when
	// the request has been rate limited.
	// Defaults to 429 (TooManyRequests).
	//
	// .. note::
	//
	//	If this is set to < 400, 429 will be used instead.
	RateLimitedStatus *v31.HttpStatus `protobuf:"bytes,10,opt,name=rate_limited_status,json=rateLimitedStatus,proto3" json:"rate_limited_status,omitempty"`
	// Specifies a list of HTTP headers that should be added to each response for requests that
	// have been rate limited.
	ResponseHeadersToAdd []*v32.HeaderValueOption `` /* 126-byte string literal not displayed */
	// Sets the HTTP status that is returned to the client when the ratelimit server returns an error
	// or cannot be reached. The default status is 500.
	StatusOnError *v31.HttpStatus `protobuf:"bytes,12,opt,name=status_on_error,json=statusOnError,proto3" json:"status_on_error,omitempty"`
	// Optional additional prefix to use when emitting statistics. This allows to distinguish
	// emitted statistics between configured “ratelimit“ filters in an HTTP filter chain.
	StatPrefix string `protobuf:"bytes,13,opt,name=stat_prefix,json=statPrefix,proto3" json:"stat_prefix,omitempty"`
	// If set, this will enable -- but not necessarily enforce -- the rate limit for the given
	// fraction of requests.
	//
	// If not set then “ratelimit.http_filter_enabled“ runtime key will be used to determine
	// the fraction of requests to enforce rate limits on. And the default percentage of the
	// runtime key is 100% for backwards compatibility.
	FilterEnabled *v32.RuntimeFractionalPercent `protobuf:"bytes,14,opt,name=filter_enabled,json=filterEnabled,proto3" json:"filter_enabled,omitempty"`
	// If set, this will enforce the rate limit decisions for the given fraction of requests.
	//
	// Note: this only applies to the fraction of enabled requests.
	//
	// If not set then “ratelimit.http_filter_enforcing“ runtime key will be used to determine
	// the fraction of requests to enforce rate limits on. And the default percentage of the
	// runtime key is 100% for backwards compatibility.
	FilterEnforced *v32.RuntimeFractionalPercent `protobuf:"bytes,15,opt,name=filter_enforced,json=filterEnforced,proto3" json:"filter_enforced,omitempty"`
	// If set, this will override the failure_mode_deny parameter with a runtime fraction.
	// If the runtime key is not specified, the value of failure_mode_deny will be used.
	//
	// Example:
	//
	// .. code-block:: yaml
	//
	//	failure_mode_deny: true
	//	failure_mode_deny_percent:
	//	  default_value:
	//	    numerator: 50
	//	    denominator: HUNDRED
	//	  runtime_key: ratelimit.failure_mode_deny_percent
	//
	// This means that when the rate limit service is unavailable, 50% of requests will be denied
	// (fail closed) and 50% will be allowed (fail open).
	FailureModeDenyPercent *v32.RuntimeFractionalPercent `` /* 132-byte string literal not displayed */
	// Rate limit configuration that is used to generate a list of descriptor entries based on
	// the request context. The generated entries will be sent to the rate limit service.
	// If this is set, then
	// :ref:`VirtualHost.rate_limits<envoy_v3_api_field_config.route.v3.VirtualHost.rate_limits>` or
	// :ref:`RouteAction.rate_limits<envoy_v3_api_field_config.route.v3.RouteAction.rate_limits>` fields
	// will be ignored. However, :ref:`RateLimitPerRoute.rate_limits<envoy_v3_api_field_extensions.filters.http.ratelimit.v3.RateLimitPerRoute.rate_limits>`
	// will take precedence over this field.
	//
	// .. note::
	//
	//	Not all configuration fields of
	//	:ref:`rate limit config <envoy_v3_api_msg_config.route.v3.RateLimit>` is supported at here.
	//	Following fields are not supported:
	//
	//	1. :ref:`rate limit stage <envoy_v3_api_field_config.route.v3.RateLimit.stage>`.
	//	2. :ref:`dynamic metadata <envoy_v3_api_field_config.route.v3.RateLimit.Action.dynamic_metadata>`.
	//	3. :ref:`disable_key <envoy_v3_api_field_config.route.v3.RateLimit.disable_key>`.
	//	4. :ref:`override limit <envoy_v3_api_field_config.route.v3.RateLimit.limit>`.
	RateLimits []*v33.RateLimit `protobuf:"bytes,17,rep,name=rate_limits,json=rateLimits,proto3" json:"rate_limits,omitempty"`
	// contains filtered or unexported fields
}

[#next-free-field: 18]

func (*RateLimit) ClearFailureModeDenyPercent

func (x *RateLimit) ClearFailureModeDenyPercent()

func (*RateLimit) ClearFilterEnabled

func (x *RateLimit) ClearFilterEnabled()

func (*RateLimit) ClearFilterEnforced

func (x *RateLimit) ClearFilterEnforced()

func (*RateLimit) ClearRateLimitService

func (x *RateLimit) ClearRateLimitService()

func (*RateLimit) ClearRateLimitedStatus

func (x *RateLimit) ClearRateLimitedStatus()

func (*RateLimit) ClearStatusOnError

func (x *RateLimit) ClearStatusOnError()

func (*RateLimit) ClearTimeout

func (x *RateLimit) ClearTimeout()

func (*RateLimit) GetDisableXEnvoyRatelimitedHeader

func (x *RateLimit) GetDisableXEnvoyRatelimitedHeader() bool

func (*RateLimit) GetDomain

func (x *RateLimit) GetDomain() string

func (*RateLimit) GetEnableXRatelimitHeaders

func (x *RateLimit) GetEnableXRatelimitHeaders() RateLimit_XRateLimitHeadersRFCVersion

func (*RateLimit) GetFailureModeDeny

func (x *RateLimit) GetFailureModeDeny() bool

func (*RateLimit) GetFailureModeDenyPercent

func (x *RateLimit) GetFailureModeDenyPercent() *v32.RuntimeFractionalPercent

func (*RateLimit) GetFilterEnabled

func (x *RateLimit) GetFilterEnabled() *v32.RuntimeFractionalPercent

func (*RateLimit) GetFilterEnforced

func (x *RateLimit) GetFilterEnforced() *v32.RuntimeFractionalPercent

func (*RateLimit) GetRateLimitService

func (x *RateLimit) GetRateLimitService() *v3.RateLimitServiceConfig

func (*RateLimit) GetRateLimitedAsResourceExhausted

func (x *RateLimit) GetRateLimitedAsResourceExhausted() bool

func (*RateLimit) GetRateLimitedStatus

func (x *RateLimit) GetRateLimitedStatus() *v31.HttpStatus

func (*RateLimit) GetRateLimits

func (x *RateLimit) GetRateLimits() []*v33.RateLimit

func (*RateLimit) GetRequestType

func (x *RateLimit) GetRequestType() string

func (*RateLimit) GetResponseHeadersToAdd

func (x *RateLimit) GetResponseHeadersToAdd() []*v32.HeaderValueOption

func (*RateLimit) GetStage

func (x *RateLimit) GetStage() uint32

func (*RateLimit) GetStatPrefix

func (x *RateLimit) GetStatPrefix() string

func (*RateLimit) GetStatusOnError

func (x *RateLimit) GetStatusOnError() *v31.HttpStatus

func (*RateLimit) GetTimeout

func (x *RateLimit) GetTimeout() *durationpb.Duration

func (*RateLimit) HasFailureModeDenyPercent

func (x *RateLimit) HasFailureModeDenyPercent() bool

func (*RateLimit) HasFilterEnabled

func (x *RateLimit) HasFilterEnabled() bool

func (*RateLimit) HasFilterEnforced

func (x *RateLimit) HasFilterEnforced() bool

func (*RateLimit) HasRateLimitService

func (x *RateLimit) HasRateLimitService() bool

func (*RateLimit) HasRateLimitedStatus

func (x *RateLimit) HasRateLimitedStatus() bool

func (*RateLimit) HasStatusOnError

func (x *RateLimit) HasStatusOnError() bool

func (*RateLimit) HasTimeout

func (x *RateLimit) HasTimeout() bool

func (*RateLimit) ProtoMessage

func (*RateLimit) ProtoMessage()

func (*RateLimit) ProtoReflect

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

func (*RateLimit) Reset

func (x *RateLimit) Reset()

func (*RateLimit) SetDisableXEnvoyRatelimitedHeader

func (x *RateLimit) SetDisableXEnvoyRatelimitedHeader(v bool)

func (*RateLimit) SetDomain

func (x *RateLimit) SetDomain(v string)

func (*RateLimit) SetEnableXRatelimitHeaders

func (x *RateLimit) SetEnableXRatelimitHeaders(v RateLimit_XRateLimitHeadersRFCVersion)

func (*RateLimit) SetFailureModeDeny

func (x *RateLimit) SetFailureModeDeny(v bool)

func (*RateLimit) SetFailureModeDenyPercent

func (x *RateLimit) SetFailureModeDenyPercent(v *v32.RuntimeFractionalPercent)

func (*RateLimit) SetFilterEnabled

func (x *RateLimit) SetFilterEnabled(v *v32.RuntimeFractionalPercent)

func (*RateLimit) SetFilterEnforced

func (x *RateLimit) SetFilterEnforced(v *v32.RuntimeFractionalPercent)

func (*RateLimit) SetRateLimitService

func (x *RateLimit) SetRateLimitService(v *v3.RateLimitServiceConfig)

func (*RateLimit) SetRateLimitedAsResourceExhausted

func (x *RateLimit) SetRateLimitedAsResourceExhausted(v bool)

func (*RateLimit) SetRateLimitedStatus

func (x *RateLimit) SetRateLimitedStatus(v *v31.HttpStatus)

func (*RateLimit) SetRateLimits

func (x *RateLimit) SetRateLimits(v []*v33.RateLimit)

func (*RateLimit) SetRequestType

func (x *RateLimit) SetRequestType(v string)

func (*RateLimit) SetResponseHeadersToAdd

func (x *RateLimit) SetResponseHeadersToAdd(v []*v32.HeaderValueOption)

func (*RateLimit) SetStage

func (x *RateLimit) SetStage(v uint32)

func (*RateLimit) SetStatPrefix

func (x *RateLimit) SetStatPrefix(v string)

func (*RateLimit) SetStatusOnError

func (x *RateLimit) SetStatusOnError(v *v31.HttpStatus)

func (*RateLimit) SetTimeout

func (x *RateLimit) SetTimeout(v *durationpb.Duration)

func (*RateLimit) String

func (x *RateLimit) String() string

type RateLimitPerRoute

type RateLimitPerRoute struct {

	// Specifies if the rate limit filter should include the virtual host rate limits.
	// [#next-major-version: unify with local ratelimit, should use common.ratelimit.v3.VhRateLimitsOptions instead.]
	VhRateLimits RateLimitPerRoute_VhRateLimitsOptions `` /* 186-byte string literal not displayed */
	// Specifies if the rate limit filter should include the lower levels (route level, virtual host level or cluster weight level) rate limits override options.
	// [#not-implemented-hide:]
	OverrideOption RateLimitPerRoute_OverrideOptions `` /* 186-byte string literal not displayed */
	// Rate limit configuration that is used to generate a list of descriptor entries based on
	// the request context. The generated entries will be used to find one or multiple matched rate
	// limit rule from the “descriptors“.
	// If this is set, then
	// :ref:`VirtualHost.rate_limits<envoy_v3_api_field_config.route.v3.VirtualHost.rate_limits>`,
	// :ref:`RouteAction.rate_limits<envoy_v3_api_field_config.route.v3.RouteAction.rate_limits>` and
	// :ref:`RateLimit.rate_limits<envoy_v3_api_field_extensions.filters.http.ratelimit.v3.RateLimit.rate_limits>` fields
	// will be ignored.
	//
	// .. note::
	//
	//	Not all configuration fields of
	//	:ref:`rate limit config <envoy_v3_api_msg_config.route.v3.RateLimit>` is supported at here.
	//	Following fields are not supported:
	//
	//	1. :ref:`rate limit stage <envoy_v3_api_field_config.route.v3.RateLimit.stage>`.
	//	2. :ref:`dynamic metadata <envoy_v3_api_field_config.route.v3.RateLimit.Action.dynamic_metadata>`.
	//	3. :ref:`disable_key <envoy_v3_api_field_config.route.v3.RateLimit.disable_key>`.
	//	4. :ref:`override limit <envoy_v3_api_field_config.route.v3.RateLimit.limit>`.
	RateLimits []*v33.RateLimit `protobuf:"bytes,3,rep,name=rate_limits,json=rateLimits,proto3" json:"rate_limits,omitempty"`
	// Overrides the domain. If not set, uses the filter-level domain instead.
	Domain string `protobuf:"bytes,4,opt,name=domain,proto3" json:"domain,omitempty"`
	// contains filtered or unexported fields
}

func (*RateLimitPerRoute) GetDomain

func (x *RateLimitPerRoute) GetDomain() string

func (*RateLimitPerRoute) GetOverrideOption

func (*RateLimitPerRoute) GetRateLimits

func (x *RateLimitPerRoute) GetRateLimits() []*v33.RateLimit

func (*RateLimitPerRoute) GetVhRateLimits

func (*RateLimitPerRoute) ProtoMessage

func (*RateLimitPerRoute) ProtoMessage()

func (*RateLimitPerRoute) ProtoReflect

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

func (*RateLimitPerRoute) Reset

func (x *RateLimitPerRoute) Reset()

func (*RateLimitPerRoute) SetDomain

func (x *RateLimitPerRoute) SetDomain(v string)

func (*RateLimitPerRoute) SetOverrideOption

func (x *RateLimitPerRoute) SetOverrideOption(v RateLimitPerRoute_OverrideOptions)

func (*RateLimitPerRoute) SetRateLimits

func (x *RateLimitPerRoute) SetRateLimits(v []*v33.RateLimit)

func (*RateLimitPerRoute) SetVhRateLimits

func (*RateLimitPerRoute) String

func (x *RateLimitPerRoute) String() string

type RateLimitPerRoute_OverrideOptions

type RateLimitPerRoute_OverrideOptions int32

The override option determines how the filter handles the cases where there is an override config at a more specific level than this one (from least to most specific: virtual host, route, cluster weight). [#not-implemented-hide:]

const (
	// Client-defined default, typically OVERRIDE_POLICY. If VhRateLimitsOptions is set, that will be used instead.
	RateLimitPerRoute_DEFAULT RateLimitPerRoute_OverrideOptions = 0
	// If there is an override config at a more specific level, use that instead of this one.
	RateLimitPerRoute_OVERRIDE_POLICY RateLimitPerRoute_OverrideOptions = 1
	// If there is an override config at a more specific level, use data from both.
	RateLimitPerRoute_INCLUDE_POLICY RateLimitPerRoute_OverrideOptions = 2
	// If there is an override config at a more specific level, ignore it and use only this one.
	RateLimitPerRoute_IGNORE_POLICY RateLimitPerRoute_OverrideOptions = 3
)

func (RateLimitPerRoute_OverrideOptions) Descriptor

func (RateLimitPerRoute_OverrideOptions) Enum

func (RateLimitPerRoute_OverrideOptions) Number

func (RateLimitPerRoute_OverrideOptions) String

func (RateLimitPerRoute_OverrideOptions) Type

type RateLimitPerRoute_VhRateLimitsOptions

type RateLimitPerRoute_VhRateLimitsOptions int32

[#next-major-version: unify with local ratelimit, should use common.ratelimit.v3.VhRateLimitsOptions instead.]

const (
	// Use the virtual host rate limits unless the route has a rate limit policy.
	RateLimitPerRoute_OVERRIDE RateLimitPerRoute_VhRateLimitsOptions = 0
	// Use the virtual host rate limits even if the route has a rate limit policy.
	RateLimitPerRoute_INCLUDE RateLimitPerRoute_VhRateLimitsOptions = 1
	// Ignore the virtual host rate limits even if the route does not have a rate limit policy.
	RateLimitPerRoute_IGNORE RateLimitPerRoute_VhRateLimitsOptions = 2
)

func (RateLimitPerRoute_VhRateLimitsOptions) Descriptor

func (RateLimitPerRoute_VhRateLimitsOptions) Enum

func (RateLimitPerRoute_VhRateLimitsOptions) Number

func (RateLimitPerRoute_VhRateLimitsOptions) String

func (RateLimitPerRoute_VhRateLimitsOptions) Type

type RateLimitPerRoute_builder

type RateLimitPerRoute_builder struct {

	// Specifies if the rate limit filter should include the virtual host rate limits.
	// [#next-major-version: unify with local ratelimit, should use common.ratelimit.v3.VhRateLimitsOptions instead.]
	VhRateLimits RateLimitPerRoute_VhRateLimitsOptions
	// Specifies if the rate limit filter should include the lower levels (route level, virtual host level or cluster weight level) rate limits override options.
	// [#not-implemented-hide:]
	OverrideOption RateLimitPerRoute_OverrideOptions
	// Rate limit configuration that is used to generate a list of descriptor entries based on
	// the request context. The generated entries will be used to find one or multiple matched rate
	// limit rule from the “descriptors“.
	// If this is set, then
	// :ref:`VirtualHost.rate_limits<envoy_v3_api_field_config.route.v3.VirtualHost.rate_limits>`,
	// :ref:`RouteAction.rate_limits<envoy_v3_api_field_config.route.v3.RouteAction.rate_limits>` and
	// :ref:`RateLimit.rate_limits<envoy_v3_api_field_extensions.filters.http.ratelimit.v3.RateLimit.rate_limits>` fields
	// will be ignored.
	//
	// .. note::
	//
	//	Not all configuration fields of
	//	:ref:`rate limit config <envoy_v3_api_msg_config.route.v3.RateLimit>` is supported at here.
	//	Following fields are not supported:
	//
	//	1. :ref:`rate limit stage <envoy_v3_api_field_config.route.v3.RateLimit.stage>`.
	//	2. :ref:`dynamic metadata <envoy_v3_api_field_config.route.v3.RateLimit.Action.dynamic_metadata>`.
	//	3. :ref:`disable_key <envoy_v3_api_field_config.route.v3.RateLimit.disable_key>`.
	//	4. :ref:`override limit <envoy_v3_api_field_config.route.v3.RateLimit.limit>`.
	RateLimits []*v33.RateLimit
	// Overrides the domain. If not set, uses the filter-level domain instead.
	Domain string
	// contains filtered or unexported fields
}

func (RateLimitPerRoute_builder) Build

type RateLimit_XRateLimitHeadersRFCVersion

type RateLimit_XRateLimitHeadersRFCVersion int32

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

[#next-major-version: unify with local ratelimit, should use common.ratelimit.v3.XRateLimitHeadersRFCVersion instead.]

const (
	// X-RateLimit headers disabled.
	RateLimit_OFF RateLimit_XRateLimitHeadersRFCVersion = 0
	// Use `draft RFC Version 03 <https://tools.ietf.org/id/draft-polli-ratelimit-headers-03.html>`_.
	RateLimit_DRAFT_VERSION_03 RateLimit_XRateLimitHeadersRFCVersion = 1
)

func (RateLimit_XRateLimitHeadersRFCVersion) Descriptor

func (RateLimit_XRateLimitHeadersRFCVersion) Enum

func (RateLimit_XRateLimitHeadersRFCVersion) Number

func (RateLimit_XRateLimitHeadersRFCVersion) String

func (RateLimit_XRateLimitHeadersRFCVersion) Type

type RateLimit_builder

type RateLimit_builder struct {

	// The rate limit domain to use when calling the rate limit service.
	Domain string
	// Specifies the rate limit configurations to be applied with the same
	// stage number. If not set, the default stage number is 0.
	//
	// .. note::
	//
	//	The filter supports a range of 0 - 10 inclusively for stage numbers.
	Stage uint32
	// The type of requests the filter should apply to. The supported
	// types are “internal“, “external“ or “both“. A request is considered internal if
	// :ref:`x-envoy-internal<config_http_conn_man_headers_x-envoy-internal>` is set to true. If
	// :ref:`x-envoy-internal<config_http_conn_man_headers_x-envoy-internal>` is not set or false, a
	// request is considered external. The filter defaults to “both“, and it will apply to all request
	// types.
	RequestType string
	// The timeout in milliseconds for the rate limit service RPC. If not
	// set, this defaults to 20ms.
	Timeout *durationpb.Duration
	// The filter's behaviour in case the rate limiting service does
	// not respond back. When it is set to true, Envoy will not allow traffic in case of
	// communication failure between rate limiting service and the proxy.
	FailureModeDeny bool
	// Specifies whether a “RESOURCE_EXHAUSTED“ gRPC code must be returned instead
	// of the default “UNAVAILABLE“ gRPC code for a rate limited gRPC call. The
	// HTTP code will be 200 for a gRPC response.
	RateLimitedAsResourceExhausted bool
	// Configuration for an external rate limit service provider. If not
	// specified, any calls to the rate limit service will immediately return
	// success.
	RateLimitService *v3.RateLimitServiceConfig
	// Defines the standard version to use for X-RateLimit headers emitted by the filter:
	//
	//   - “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 values are returned by the rate limiting service in
	//     :ref:`current_limit<envoy_v3_api_field_service.ratelimit.v3.RateLimitResponse.DescriptorStatus.current_limit>`
	//     field. Example: “10, 10;w=1;name="per-ip", 1000;w=3600“.
	//   - “X-RateLimit-Remaining“ - indicates the remaining requests in the
	//     current time-window. The values are returned by the rate limiting service
	//     in :ref:`limit_remaining<envoy_v3_api_field_service.ratelimit.v3.RateLimitResponse.DescriptorStatus.limit_remaining>`
	//     field.
	//   - “X-RateLimit-Reset“ - indicates the number of seconds until reset of
	//     the current time-window. The values are returned by the rate limiting service
	//     in :ref:`duration_until_reset<envoy_v3_api_field_service.ratelimit.v3.RateLimitResponse.DescriptorStatus.duration_until_reset>`
	//     field.
	//
	// In case rate limiting policy specifies more than one time window, the values
	// above represent the window that is closest to reaching its limit.
	//
	// For more information about the headers specification see selected version of
	// the `draft RFC <https://tools.ietf.org/id/draft-polli-ratelimit-headers-03.html>`_.
	//
	// Disabled by default.
	//
	// [#next-major-version: unify with local ratelimit, should use common.ratelimit.v3.XRateLimitHeadersRFCVersion instead.]
	EnableXRatelimitHeaders RateLimit_XRateLimitHeadersRFCVersion
	// Disables emitting the :ref:`x-envoy-ratelimited<config_http_filters_router_x-envoy-ratelimited>` header
	// in case of rate limiting (i.e. 429 responses).
	// Having this header not present potentially makes the request retriable.
	DisableXEnvoyRatelimitedHeader bool
	// This field allows for a custom HTTP response status code to the downstream client when
	// the request has been rate limited.
	// Defaults to 429 (TooManyRequests).
	//
	// .. note::
	//
	//	If this is set to < 400, 429 will be used instead.
	RateLimitedStatus *v31.HttpStatus
	// Specifies a list of HTTP headers that should be added to each response for requests that
	// have been rate limited.
	ResponseHeadersToAdd []*v32.HeaderValueOption
	// Sets the HTTP status that is returned to the client when the ratelimit server returns an error
	// or cannot be reached. The default status is 500.
	StatusOnError *v31.HttpStatus
	// Optional additional prefix to use when emitting statistics. This allows to distinguish
	// emitted statistics between configured “ratelimit“ filters in an HTTP filter chain.
	StatPrefix string
	// If set, this will enable -- but not necessarily enforce -- the rate limit for the given
	// fraction of requests.
	//
	// If not set then “ratelimit.http_filter_enabled“ runtime key will be used to determine
	// the fraction of requests to enforce rate limits on. And the default percentage of the
	// runtime key is 100% for backwards compatibility.
	FilterEnabled *v32.RuntimeFractionalPercent
	// If set, this will enforce the rate limit decisions for the given fraction of requests.
	//
	// Note: this only applies to the fraction of enabled requests.
	//
	// If not set then “ratelimit.http_filter_enforcing“ runtime key will be used to determine
	// the fraction of requests to enforce rate limits on. And the default percentage of the
	// runtime key is 100% for backwards compatibility.
	FilterEnforced *v32.RuntimeFractionalPercent
	// If set, this will override the failure_mode_deny parameter with a runtime fraction.
	// If the runtime key is not specified, the value of failure_mode_deny will be used.
	//
	// Example:
	//
	// .. code-block:: yaml
	//
	//	failure_mode_deny: true
	//	failure_mode_deny_percent:
	//	  default_value:
	//	    numerator: 50
	//	    denominator: HUNDRED
	//	  runtime_key: ratelimit.failure_mode_deny_percent
	//
	// This means that when the rate limit service is unavailable, 50% of requests will be denied
	// (fail closed) and 50% will be allowed (fail open).
	FailureModeDenyPercent *v32.RuntimeFractionalPercent
	// Rate limit configuration that is used to generate a list of descriptor entries based on
	// the request context. The generated entries will be sent to the rate limit service.
	// If this is set, then
	// :ref:`VirtualHost.rate_limits<envoy_v3_api_field_config.route.v3.VirtualHost.rate_limits>` or
	// :ref:`RouteAction.rate_limits<envoy_v3_api_field_config.route.v3.RouteAction.rate_limits>` fields
	// will be ignored. However, :ref:`RateLimitPerRoute.rate_limits<envoy_v3_api_field_extensions.filters.http.ratelimit.v3.RateLimitPerRoute.rate_limits>`
	// will take precedence over this field.
	//
	// .. note::
	//
	//	Not all configuration fields of
	//	:ref:`rate limit config <envoy_v3_api_msg_config.route.v3.RateLimit>` is supported at here.
	//	Following fields are not supported:
	//
	//	1. :ref:`rate limit stage <envoy_v3_api_field_config.route.v3.RateLimit.stage>`.
	//	2. :ref:`dynamic metadata <envoy_v3_api_field_config.route.v3.RateLimit.Action.dynamic_metadata>`.
	//	3. :ref:`disable_key <envoy_v3_api_field_config.route.v3.RateLimit.disable_key>`.
	//	4. :ref:`override limit <envoy_v3_api_field_config.route.v3.RateLimit.limit>`.
	RateLimits []*v33.RateLimit
	// contains filtered or unexported fields
}

func (RateLimit_builder) Build

func (b0 RateLimit_builder) Build() *RateLimit

Source Files

  • rate_limit.pb.go

Jump to

Keyboard shortcuts

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