import type { Policy } from '../types.js'; /** Policy options for `rateLimitPolicy`. */ interface RateLimit { /** How often (ms) to check whether `max` has been exceeded. Default: `60000` (1 minute). */ interval?: number; /** Max number of requests within the `interval` until the IP is rate-limited. Default: `10`. */ max?: number; /** List of IP addresses to skip this policy. */ whitelist?: string[]; /** Database connection string. Default: `sqlite:///tmp/strfry-rate-limit-policy.sqlite3` */ databaseUrl?: string; } /** * Rate-limits users by their IP address. * * IPs are stored in an SQLite database. If you are running internal services, it's a good idea to at least whitelist `127.0.0.1` etc. * * @example * ```ts * // Limit to 10 events per second. * rateLimitPolicy(msg, { max: 10, interval: 60000 }); * ``` */ declare const rateLimitPolicy: Policy; export default rateLimitPolicy; export type { RateLimit };