snoop: show connecting IP in the connect snote, tagged ipv4/ipv6

This commit is contained in:
Jean Chevronnet 2026-08-28 22:56:38 +00:00
parent bf1446a51b
commit 6a8999a1bb
No known key found for this signature in database
GPG key ID: 439666D63A9477E4

View file

@ -40,6 +40,15 @@ impl Module for Snoop {
"Client connecting: {0} ({1}@{2})",
&[nick.as_str(), ident.as_str(), host.as_str()],
);
// the connecting address, tagged by family (an ipv4-mapped v6 shows its ipv4 form)
let (fam, ip_s) = match ip {
std::net::IpAddr::V4(v4) => ("ipv4", v4.to_string()),
std::net::IpAddr::V6(v6) => match v6.to_ipv4_mapped() {
Some(v4) => ("ipv4", v4.to_string()),
None => ("ipv6", v6.to_string()),
},
};
msg.push_str(&srv.trf(", {0}:{1}", &[fam, ip_s.as_str()]));
let port_s = port.to_string();
msg.push_str(&srv.trf(", port: {0}", &[port_s.as_str()]));
// transport + security of this connection (WebSocket clients arrive on the wss