connectban: never flood-ban loopback (127.0.0.1/::1) and add a connectban_exempt glob/cidr list

This commit is contained in:
Jean Chevronnet 2026-08-15 23:25:16 +00:00
parent 59b0439b79
commit 7d57e4ed34
3 changed files with 19 additions and 0 deletions

View file

@ -24,6 +24,10 @@ fn cfg(s: &Server) -> Option<(u32, u64)> {
/// Record a connection from `ip`; returns true when it exceeds the limit (the
/// caller should refuse it). No-op → false when connflood is unconfigured.
pub fn over_limit(s: &mut Server, ip: IpAddr) -> bool {
// loopback (local services / bridges / admin) is never connection-throttled
if ip.is_loopback() {
return false;
}
let Some((max, secs)) = cfg(s) else {
return false;
};