caddy fiilailuu
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user