Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GlobalLimiter ¶
GlobalLimiter creates a global rate limiter middleware.
Types ¶
type Config ¶
type Config struct {
// Global rate limiting (across all users)
GlobalEnabled bool
GlobalLimit int // requests per window
GlobalWindow time.Duration // time window
GlobalBurst int // burst capacity
// Per-wallet rate limiting (identified by wallet address)
PerWalletEnabled bool
PerWalletLimit int
PerWalletWindow time.Duration
PerWalletBurst int
// Per-IP rate limiting (fallback when wallet not identified)
PerIPEnabled bool
PerIPLimit int
PerIPWindow time.Duration
PerIPBurst int
// Metrics collector (optional)
Metrics *metrics.Metrics
}
Config holds rate limiting configuration.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns sensible default rate limits. These are generous limits designed to stop obvious spam while not restricting legitimate use.
Click to show internal directories.
Click to hide internal directories.