()
| 511 | const CONNECT_WINDOW_MS = 60000; |
| 512 | |
| 513 | export function checkConnectRateLimit(): boolean { |
| 514 | const now = Date.now(); |
| 515 | connectAttempts = connectAttempts.filter(a => now - a.ts < CONNECT_WINDOW_MS); |
| 516 | if (connectAttempts.length >= CONNECT_RATE_LIMIT) return false; |
| 517 | connectAttempts.push({ ts: now }); |
| 518 | return true; |
| 519 | } |
| 520 | |
| 521 | // Test-only reset. |
| 522 | export function __resetConnectRateLimit(): void { |
no test coverage detected