Use Ipv6::to_ipv4_mapped in mastersrv

Needs Rust 1.63.0, should be old enough at this point.
This commit is contained in:
heinrich5991 2024-08-08 00:00:41 +02:00
parent 75d2b82ccd
commit d42ae75a9e

View file

@ -1009,11 +1009,8 @@ async fn main() {
addr.unwrap().ip()
};
if let IpAddr::V6(v6) = addr {
if let Some(v4) = v6.to_ipv4() {
// TODO: switch to `to_ipv4_mapped` in the future.
if !v6.is_loopback() {
addr = IpAddr::from(v4);
}
if let Some(v4) = v6.to_ipv4_mapped() {
addr = IpAddr::from(v4);
}
}
Ok(addr)