ratelimit

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const PluginName = "rate_limiter"

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Plugin)

func WithClock

func WithClock(now func() time.Time) Option

func WithIDGenerator

func WithIDGenerator(newID func() string) Option

type Plugin

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

func New

func New(redisClient *redis.Client, opts ...Option) *Plugin

func (*Plugin) Execute

func (p *Plugin) Execute(ctx context.Context, in appplugins.ExecInput) (*appplugins.Result, error)

func (*Plugin) MandatoryStages

func (p *Plugin) MandatoryStages() []policy.Stage

func (*Plugin) MutatesMetadata added in v0.2.3

func (p *Plugin) MutatesMetadata() bool

func (*Plugin) MutatesRequestBody added in v0.2.3

func (p *Plugin) MutatesRequestBody() bool

func (*Plugin) MutatesResponseBody added in v0.2.3

func (p *Plugin) MutatesResponseBody() bool

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) SupportedModes

func (p *Plugin) SupportedModes() []policy.Mode

func (*Plugin) SupportedStages

func (p *Plugin) SupportedStages() []policy.Stage

func (*Plugin) ValidateConfig

func (p *Plugin) ValidateConfig(settings map[string]any) error

type RateLimiterData

type RateLimiterData struct {
	RateLimitExceeded bool   `json:"rate_limit_exceeded"`
	ExceededType      string `json:"exceeded_type,omitempty"`
	RetryAfter        string `json:"retry_after,omitempty"`
	CurrentCount      int64  `json:"current_count"`
	Limit             int    `json:"limit"`
	Window            string `json:"window,omitempty"`
}

RateLimiterData is the per-invocation trace payload describing the evaluated rate-limit window and whether it was exceeded.

Jump to

Keyboard shortcuts

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