3 Commits

Author SHA1 Message Date
Slyghtning
dcbadf87a5 ratelimiter: narrow down mutex access 2026-01-23 10:12:13 -05:00
Slyghtning
c289dd6f90 proxy: apply ip4/ip6 filtering for unauthenticated requests 2026-01-23 09:22:47 -05:00
Slyghtning
a3ee1e0d17 proxy: implement a token-bucket rate limiter for aperture
Implement a token-bucket rate limiter for aperture that limits requests
per service endpoint. The rate limiter uses golang.org/x/time/rate and
provides per-key limiting with L402 token ID extraction (falling back
to IP address for unauthenticated requests).

Key components:
- RateLimitConfig: Configuration struct with path regex, requests/per/burst
- RateLimiter: Manages per-key rate.Limiter instances with LRU eviction
  to prevent memory exhaustion (default 10,000 entries)
- Prometheus metrics: allowed/denied counters, cache size, evictions

This addresses GitHub issue #200 for DoS protection on authenticated
endpoints that are free of charge after L402 payment.
2026-01-23 09:05:55 -05:00