This commit is contained in:
Alexey
2026-06-12 01:28:41 +03:00
parent 9a3ff726b2
commit 9904da737a
+7 -5
View File
@@ -221,7 +221,12 @@ async fn apply_iptables_synlimit_rules_for_binary(
run_command(binary, &accept_refs, None).await?; run_command(binary, &accept_refs, None).await?;
run_command(binary, &drop_refs, None).await?; run_command(binary, &drop_refs, None).await?;
} }
run_command(binary, &["-t", "filter", "-A", IPTABLES_CHAIN, "-j", "RETURN"], None).await?; run_command(
binary,
&["-t", "filter", "-A", IPTABLES_CHAIN, "-j", "RETURN"],
None,
)
.await?;
Ok(()) Ok(())
} }
@@ -306,10 +311,7 @@ fn synlimit_rate_arg(seconds: u32, hitcount: u32) -> String {
return format!("{}/{}", amount / seconds, unit_name); return format!("{}/{}", amount / seconds, unit_name);
} }
} }
let amount = hitcount let amount = hitcount.saturating_mul(86_400).saturating_add(seconds - 1) / seconds;
.saturating_mul(86_400)
.saturating_add(seconds - 1)
/ seconds;
format!("{}/day", amount.max(1)) format!("{}/day", amount.max(1))
} }