clientIp() returns the whole IPv6 address and every limiter keyed on it, so
one host with a /64 had 2^64 budgets: 50 addresses of one /64 against a
limit of 5 all passed (IAWL idea 9, owner's Q4). consumeRateLimit and
checkRateLimit now count an IPv6 key by its /64 (an IPv4-mapped address by
its IPv4); the mail service's per-visitor account-mail key too. A second
counter per /48 at 10x the limit is available and off by default
(setIpv6Grouping({ wide: 48 })); setIpv6Grouping({ prefix: 128 }) counts
per address as before. ipRateKey(ip) is exported for own limiters.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
14 lines
390 B
TypeScript
14 lines
390 B
TypeScript
// Moved to modules/shared/rateLimit.ts (shared with search and MCP routes).
|
|
export {
|
|
checkRateLimit,
|
|
clientIp,
|
|
consumeRateLimit,
|
|
ipRateKey,
|
|
retryAfterSeconds,
|
|
setIpv6Grouping,
|
|
setRateLimitStore,
|
|
setUnknownIpFactor,
|
|
tooManyRequests,
|
|
} from '../shared/rateLimit.js'
|
|
export type { ClientIpOptions, Ipv6Grouping, RateLimitArgs, RateLimitStore } from '../shared/rateLimit.js'
|