limits

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package limits enforces gateway rate and daily usage policies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	PerKey       Policy
	PerWorkspace Policy
}

type GatewayLimiter

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

func NewGatewayLimiter

func NewGatewayLimiter(store trace.TraceStore, cfg Config) *GatewayLimiter

func (*GatewayLimiter) CheckRequest

func (l *GatewayLimiter) CheckRequest(r *http.Request, identity *auth.Identity) (*auth.ProxyLimitResult, error)

func (*GatewayLimiter) Enabled

func (l *GatewayLimiter) Enabled() bool

type Policy

type Policy struct {
	RequestsPerMinute int
	MaxTokensPerDay   int64
	MaxCostUSDPerDay  float64
}

Jump to

Keyboard shortcuts

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