messense / if-addrs

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

Wired interface names on windows `{C685FC7C-553A-11EC-8BBC-806E6F6E6963}` #16

Closed mjarkk closed 3 months ago

mjarkk commented 2 years ago

First of all thanks for forking the original project and continue working on it!

On windows all the network interfaces have an UUID like name format but i would suspect it returning the name of the network device as shown in the configuration panel > network connections.

What is returned by this package:

Interface {
    name: "{59837432-A818-4A26-934C-95AA7E3B38B8}",
    addr: V6(
        Ifv6Addr {
            ip: 2001:1c01:3b03:bc00:893d:d764:d21b:e1d0,
            netmask: ffff:ffff:ffff:ffff::,
            broadcast: None,
        },
    ),
}
Interface {
    name: "{59837432-A818-4A26-934C-95AA7E3B38B8}",
    addr: V6(
        Ifv6Addr {
            ip: 2001:1c01:3b03:bc00:e00f:77c8:6e1e:9d2a,
            netmask: ffff:ffff:ffff:ffff::,
            broadcast: None,
        },
    ),
}
Interface {
    name: "{59837432-A818-4A26-934C-95AA7E3B38B8}",
    addr: V4(
        Ifv4Addr {
            ip: 192.168.178.21,
            netmask: 255.255.255.0,
            broadcast: Some(
                192.168.178.255,
            ),
        },
    ),
}
Interface {
    name: "{C685FC7C-553A-11EC-8BBC-806E6F6E6963}",
    addr: V6(
        Ifv6Addr {
            ip: ::1,
            netmask: ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff,
            broadcast: None,
        },
    ),
}
Interface {
    name: "{C685FC7C-553A-11EC-8BBC-806E6F6E6963}",
    addr: V4(
        Ifv4Addr {
            ip: 127.0.0.1,
            netmask: 255.0.0.0,
            broadcast: Some(
                127.255.255.255,
            ),
        },
    ),
}
Interface {
    name: "{EE4F5BC4-EBAD-46B5-B1CD-745513792416}",
    addr: V4(
        Ifv4Addr {
            ip: 172.28.48.1,
            netmask: 255.255.31.0,
            broadcast: Some(
                172.28.240.255,
            ),
        },
    ),
}

The names i suspected:

image

messense commented 2 years ago

I don't know much about Windows so I'm unable to help. Feel free to open a PR if you find a way to do that.

DoumanAsh commented 2 years ago

You need friendlyName for that, which require to not set flag GAA_FLAG_SKIP_FRIENDLY_NAME https://github.com/messense/if-addrs/blob/master/src/windows.rs#L50

HuakunShen commented 11 months ago

any update on this?

mon commented 3 months ago

I'd like to pick this up, but some questions before I start: