messense / if-addrs

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

Use user-visible adapter name on Windows #34

Closed mon closed 3 months ago

mon commented 3 months ago

Closes #16

Keep the old GUID, but as its own field, as it's still useful in some contexts. I would parse the GUID, but the WinAPI docs don't say anything about the string's format, so we can't trust that my system's values are formatted like anyone else.

Note: this is a BREAKING CHANGE if anyone was relying on the name struct member being the GUID. I think this is a good change to make, but if a release is pushed it'll need a semver bump.

Example interface after this change:

Interface {
    name: "Loopback Pseudo-Interface 1",
    addr: V4(
        Ifv4Addr {
            ip: 127.0.0.1,
            netmask: 255.0.0.0,
            broadcast: Some(
                127.255.255.255,
            ),
        },
    ),
    index: Some(
        1,
    ),
    adapter_name: "{E0EC89D8-2A3A-11EB-BA6E-806E6F6E6963}",
},