mirror of
https://github.com/lightninglabs/aperture.git
synced 2026-01-31 15:14:26 +01:00
Add rate limiting integration to the aperture proxy: - Service struct: Add RateLimits configuration field and rateLimiter instance field - prepareServices(): Validate rate limit config at startup, compile path regexes, and initialize RateLimiter instances per service - ServeHTTP(): Check rate limits after auth level determination but before authentication, applying to all requests including auth-whitelisted paths - sendRateLimitResponse(): Return HTTP 429 with Retry-After header for REST clients, or gRPC ResourceExhausted status for gRPC clients The rate limiter key is extracted from the L402 token ID when present, falling back to the client IP address for unauthenticated requests.