Refacto structures definition

This commit is contained in:
2023-12-28 19:29:26 +01:00
parent f7777fe085
commit 9d4f19822d
20 changed files with 1860 additions and 1839 deletions

View File

@ -0,0 +1,19 @@
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
pub fn extract_ipv4(ip: IpAddr) -> Ipv4Addr {
match ip {
IpAddr::V4(i) => i,
IpAddr::V6(_) => {
panic!("IPv6 found in IPv4 definition!")
}
}
}
pub fn extract_ipv6(ip: IpAddr) -> Ipv6Addr {
match ip {
IpAddr::V4(_) => {
panic!("IPv4 found in IPv6 definition!")
}
IpAddr::V6(i) => i,
}
}