messense / if-addrs

Retrieve IP addresses for all interfaces. POSIX & Windows
BSD 3-Clause "New" or "Revised" License
23 stars 16 forks source link

add prefixlen to ifaddr #37

Closed nvandamme closed 6 months ago

nvandamme commented 6 months ago

add CIDR notation prefix length as public field prefixlen in IfAddr::V4 and IfAddr::V6 structs

Interface {
    name: "Loopback Pseudo-Interface 1",
    addr: V6(
        Ifv6Addr {
            ip: ::1,
            netmask: ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff,
            prefixlen: 128,
            broadcast: None,
        },
    ),
    index: Some(
        1,
    ),
    adapter_name: "...",
},
Interface {
    name: "Loopback Pseudo-Interface 1",
    addr: V4(
        Ifv4Addr {
            ip: 127.0.0.1,
            netmask: 255.0.0.0,
            prefixlen: 8,
            broadcast: Some(
                127.255.255.255,
            ),
        },
    ),
    index: Some(
        1,
    ),
    adapter_name: "....",
},