geoip: native maxmind .mmdb reader, G: geoban extban, GEOIP command, whois country

This commit is contained in:
Jean Chevronnet 2026-08-09 21:43:57 +00:00
parent aa384d56f2
commit 7a99f49ca4
7 changed files with 406 additions and 2 deletions

View file

@ -921,6 +921,7 @@ impl Server {
Some(b'r') => crate::modules::realnameban::matches(self, uid, &b.mask[2..]),
Some(b'j') => crate::modules::channelban::matches(self, uid, &b.mask[2..]),
Some(b's') => crate::modules::serverban::matches(self, uid, &b.mask[2..]),
Some(b'G') => crate::modules::geoip::geoban_match(self, uid, &b.mask[2..]),
_ => false,
}
} else {
@ -1132,7 +1133,7 @@ pub fn normalize_ban_mask(m: &str) -> String {
// These extbans carry a name / spec / channel / server, not a host mask,
// so they must not be host-normalised: g: (security group), y: (reputation
// score), r: (realname), j: (channel), s: (server name).
if matches!(b[0], b'g' | b'y' | b'r' | b'j' | b's') {
if matches!(b[0], b'g' | b'y' | b'r' | b'j' | b's' | b'G') {
return m.to_string();
}
return format!("{}:{}", &m[..1], normalize_mask(&m[2..]));