Gateway: log rejected connections over the per-IP limit

Rejections at the WebSocket upgrade (429) were silent, so a client
hammering MAX_CONNECTIONS_PER_IP left no trace. Now logged as a
[ratelimit] line like the connect rate limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
MoepchiandClaude Opus 5.5 committed 2026-11-14 11:31:54 +00:00
1 parent 169d32a292
commit 4e04ddb526
1 file changed
+1
+1
View File
@@ -583,6 +583,7 @@ const wss = new WebSocketServer({
}
const ip = clientIp(req);
if (MAX_CONNECTIONS_PER_IP > 0 && (connectionsPerIp.get(ip) ?? 0) >= MAX_CONNECTIONS_PER_IP) {
console.warn(`[ratelimit] too many open connections from one IP (limit ${MAX_CONNECTIONS_PER_IP})`);
return done(false, 429, "Too many connections");
}
done(true);