caddy fiilailuu

This commit is contained in:
2026-04-01 18:27:29 +03:00
parent cd1dd9a363
commit 29b4524027
4 changed files with 34 additions and 5 deletions

View File

@@ -142,11 +142,11 @@ async fn ws_handler(
{
let conns = state.ip_connections.lock().unwrap();
let count = conns.get(&ip).copied().unwrap_or(0);
if count >= 2 {
tracing::warn!("IP {} ylitti yhteysrajan ({}/2) — estetty", ip, count);
if count >= 4 {
tracing::warn!("IP {} ylitti yhteysrajan ({}/4) — estetty", ip, count);
return (
axum::http::StatusCode::TOO_MANY_REQUESTS,
"Max 2 yhteyttä per IP",
"Max 4 yhteyttä per IP",
).into_response();
}
}