ratelimitv1

package
v0.1.39 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_middleware_ratelimit_v1_ratelimiter_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type RateLimiter

type RateLimiter struct {
	Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
	// rate limiter name, supported: bbr, memory, redis.
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	// The number of seconds in a rate limit window
	Period int32 `protobuf:"varint,3,opt,name=period,proto3" json:"period,omitempty"`
	// The number of requests allowed in a window of time
	XRatelimitLimit int32 `protobuf:"varint,5,opt,name=x_ratelimit_limit,proto3" json:"x_ratelimit_limit,omitempty"`
	// The number of requests that can still be made in the current window of time
	XRatelimitRemaining int32 `protobuf:"varint,6,opt,name=x_ratelimit_remaining,proto3" json:"x_ratelimit_remaining,omitempty"`
	// The number of seconds until the current rate limit window completely resets
	XRatelimitReset int32 `protobuf:"varint,7,opt,name=x_ratelimit_reset,proto3" json:"x_ratelimit_reset,omitempty"`
	// When rate limited, the number of seconds to wait before another request will be accepted
	RetryAfter int32               `protobuf:"varint,8,opt,name=retry_after,proto3" json:"retry_after,omitempty"`
	Memory     *RateLimiter_Memory `protobuf:"bytes,101,opt,name=memory,proto3" json:"memory,omitempty"`
	Redis      *RateLimiter_Redis  `protobuf:"bytes,102,opt,name=redis,proto3" json:"redis,omitempty"`
	// contains filtered or unexported fields
}

Rate limiter

func (*RateLimiter) Descriptor deprecated

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

Deprecated: Use RateLimiter.ProtoReflect.Descriptor instead.

func (*RateLimiter) GetEnabled

func (x *RateLimiter) GetEnabled() bool

func (*RateLimiter) GetMemory

func (x *RateLimiter) GetMemory() *RateLimiter_Memory

func (*RateLimiter) GetName

func (x *RateLimiter) GetName() string

func (*RateLimiter) GetPeriod

func (x *RateLimiter) GetPeriod() int32

func (*RateLimiter) GetRedis

func (x *RateLimiter) GetRedis() *RateLimiter_Redis

func (*RateLimiter) GetRetryAfter

func (x *RateLimiter) GetRetryAfter() int32

func (*RateLimiter) GetXRatelimitLimit

func (x *RateLimiter) GetXRatelimitLimit() int32

func (*RateLimiter) GetXRatelimitRemaining

func (x *RateLimiter) GetXRatelimitRemaining() int32

func (*RateLimiter) GetXRatelimitReset

func (x *RateLimiter) GetXRatelimitReset() int32

func (*RateLimiter) ProtoMessage

func (*RateLimiter) ProtoMessage()

func (*RateLimiter) ProtoReflect

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

func (*RateLimiter) Reset

func (x *RateLimiter) Reset()

func (*RateLimiter) String

func (x *RateLimiter) String() string

func (*RateLimiter) Validate

func (m *RateLimiter) Validate() error

Validate checks the field values on RateLimiter with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*RateLimiter) ValidateAll

func (m *RateLimiter) ValidateAll() error

ValidateAll checks the field values on RateLimiter with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in RateLimiterMultiError, or nil if none found.

type RateLimiterMultiError

type RateLimiterMultiError []error

RateLimiterMultiError is an error wrapping multiple validation errors returned by RateLimiter.ValidateAll() if the designated constraints aren't met.

func (RateLimiterMultiError) AllErrors

func (m RateLimiterMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (RateLimiterMultiError) Error

func (m RateLimiterMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type RateLimiterValidationError

type RateLimiterValidationError struct {
	// contains filtered or unexported fields
}

RateLimiterValidationError is the validation error returned by RateLimiter.Validate if the designated constraints aren't met.

func (RateLimiterValidationError) Cause

Cause function returns cause value.

func (RateLimiterValidationError) Error

Error satisfies the builtin error interface

func (RateLimiterValidationError) ErrorName

func (e RateLimiterValidationError) ErrorName() string

ErrorName returns error name.

func (RateLimiterValidationError) Field

Field function returns field value.

func (RateLimiterValidationError) Key

Key function returns key value.

func (RateLimiterValidationError) Reason

Reason function returns reason value.

type RateLimiter_Memory

type RateLimiter_Memory struct {
	Expiration      int64 `protobuf:"varint,1,opt,name=expiration,proto3" json:"expiration,omitempty"`
	CleanupInterval int64 `protobuf:"varint,2,opt,name=cleanup_interval,proto3" json:"cleanup_interval,omitempty"`
	// contains filtered or unexported fields
}

func (*RateLimiter_Memory) Descriptor deprecated

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

Deprecated: Use RateLimiter_Memory.ProtoReflect.Descriptor instead.

func (*RateLimiter_Memory) GetCleanupInterval

func (x *RateLimiter_Memory) GetCleanupInterval() int64

func (*RateLimiter_Memory) GetExpiration

func (x *RateLimiter_Memory) GetExpiration() int64

func (*RateLimiter_Memory) ProtoMessage

func (*RateLimiter_Memory) ProtoMessage()

func (*RateLimiter_Memory) ProtoReflect

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

func (*RateLimiter_Memory) Reset

func (x *RateLimiter_Memory) Reset()

func (*RateLimiter_Memory) String

func (x *RateLimiter_Memory) String() string

func (*RateLimiter_Memory) Validate

func (m *RateLimiter_Memory) Validate() error

Validate checks the field values on RateLimiter_Memory with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*RateLimiter_Memory) ValidateAll

func (m *RateLimiter_Memory) ValidateAll() error

ValidateAll checks the field values on RateLimiter_Memory with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in RateLimiter_MemoryMultiError, or nil if none found.

type RateLimiter_MemoryMultiError

type RateLimiter_MemoryMultiError []error

RateLimiter_MemoryMultiError is an error wrapping multiple validation errors returned by RateLimiter_Memory.ValidateAll() if the designated constraints aren't met.

func (RateLimiter_MemoryMultiError) AllErrors

func (m RateLimiter_MemoryMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (RateLimiter_MemoryMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type RateLimiter_MemoryValidationError

type RateLimiter_MemoryValidationError struct {
	// contains filtered or unexported fields
}

RateLimiter_MemoryValidationError is the validation error returned by RateLimiter_Memory.Validate if the designated constraints aren't met.

func (RateLimiter_MemoryValidationError) Cause

Cause function returns cause value.

func (RateLimiter_MemoryValidationError) Error

Error satisfies the builtin error interface

func (RateLimiter_MemoryValidationError) ErrorName

ErrorName returns error name.

func (RateLimiter_MemoryValidationError) Field

Field function returns field value.

func (RateLimiter_MemoryValidationError) Key

Key function returns key value.

func (RateLimiter_MemoryValidationError) Reason

Reason function returns reason value.

type RateLimiter_Redis

type RateLimiter_Redis struct {
	Addr     string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"`
	Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
	Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"`
	Db       int32  `protobuf:"varint,4,opt,name=db,proto3" json:"db,omitempty"`
	// contains filtered or unexported fields
}

func (*RateLimiter_Redis) Descriptor deprecated

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

Deprecated: Use RateLimiter_Redis.ProtoReflect.Descriptor instead.

func (*RateLimiter_Redis) GetAddr

func (x *RateLimiter_Redis) GetAddr() string

func (*RateLimiter_Redis) GetDb

func (x *RateLimiter_Redis) GetDb() int32

func (*RateLimiter_Redis) GetPassword

func (x *RateLimiter_Redis) GetPassword() string

func (*RateLimiter_Redis) GetUsername

func (x *RateLimiter_Redis) GetUsername() string

func (*RateLimiter_Redis) ProtoMessage

func (*RateLimiter_Redis) ProtoMessage()

func (*RateLimiter_Redis) ProtoReflect

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

func (*RateLimiter_Redis) Reset

func (x *RateLimiter_Redis) Reset()

func (*RateLimiter_Redis) String

func (x *RateLimiter_Redis) String() string

func (*RateLimiter_Redis) Validate

func (m *RateLimiter_Redis) Validate() error

Validate checks the field values on RateLimiter_Redis with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*RateLimiter_Redis) ValidateAll

func (m *RateLimiter_Redis) ValidateAll() error

ValidateAll checks the field values on RateLimiter_Redis with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in RateLimiter_RedisMultiError, or nil if none found.

type RateLimiter_RedisMultiError

type RateLimiter_RedisMultiError []error

RateLimiter_RedisMultiError is an error wrapping multiple validation errors returned by RateLimiter_Redis.ValidateAll() if the designated constraints aren't met.

func (RateLimiter_RedisMultiError) AllErrors

func (m RateLimiter_RedisMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (RateLimiter_RedisMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type RateLimiter_RedisValidationError

type RateLimiter_RedisValidationError struct {
	// contains filtered or unexported fields
}

RateLimiter_RedisValidationError is the validation error returned by RateLimiter_Redis.Validate if the designated constraints aren't met.

func (RateLimiter_RedisValidationError) Cause

Cause function returns cause value.

func (RateLimiter_RedisValidationError) Error

Error satisfies the builtin error interface

func (RateLimiter_RedisValidationError) ErrorName

ErrorName returns error name.

func (RateLimiter_RedisValidationError) Field

Field function returns field value.

func (RateLimiter_RedisValidationError) Key

Key function returns key value.

func (RateLimiter_RedisValidationError) Reason

Reason function returns reason value.

Jump to

Keyboard shortcuts

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