/** * Rate limiting utilities for SSR applications. * * Protects against DoS attacks and abuse. */ export interface RateLimitConfig { /** Maximum requests per window */ max: number; /** Time window in milliseconds */ windowMs: number; /** Key generator function (default: IP address) */ keyGenerator?: (request: any) => string; /** Custom error message */ message?: string; /** HTTP status code for rate limit exceeded */ statusCode?: number; } /** * In-memory rate limiter (use Redis in production for distributed systems). */ export declare class RateLimiter { private config; private requests; private cleanupInterval; constructor(config: RateLimitConfig); /** * Check if request is within rate limit. * @returns { allowed: boolean, remaining: number, resetTime: number } */ check(key: string): { allowed: boolean; remaining: number; resetTime: number; retryAfter?: number; }; /** * Clean up expired entries. */ private cleanup; /** * Destroy the rate limiter and clean up resources. * Call this when shutting down the server. */ destroy(): void; } /** * Fastify plugin for rate limiting. */ export declare function fastifyRateLimit(fastify: any, config: RateLimitConfig): void; //# sourceMappingURL=rate-limiting.d.ts.map