EstebanBorai / network-interface

Retrieve system's Network Interfaces on Linux, macOS and Windows on a standardized manner
https://crates.io/crates/network-interface
Apache License 2.0
62 stars 27 forks source link

windows.rs: Try to get IPv4 broadcast address for interface #3

Closed njeisecke closed 2 years ago

njeisecke commented 2 years ago

Windows also reports a broadcast address for localhost. Not sure if that actually makes sense. AFAIK you cannot broadcast to localhost (on macOS and Linux).

njeisecke commented 2 years ago

Thanks for this lighweight cross-platform interface enumeration library.

njeisecke commented 2 years ago

fixed the clippy hint.

EstebanBorai commented 2 years ago

Hi @njeisecke thanks for opening this PR!

I think you are working on retrieving the local IP address, am I correct?. If that's the case perhaps you could visit this crate https://github.com/EstebanBorai/local-ip-address where the main goal is to retrieve the local IP address. So perhaps your improvements belong to such crate instead?

If I'm not accurate to your proposal, please let me know perhaps I'm just confused!

njeisecke commented 2 years ago

Hi @EstebanBorai,

I think you are working on retrieving the local IP address, am I correct?.

No, I want to get the interface's IPv4 broadcast address. This is implemented for both linux and macos but was missing for Windows. It's the fourth argument to NetworkInterface::new_afinet.

Nils

EstebanBorai commented 2 years ago

Hi @EstebanBorai,

I think you are working on retrieving the local IP address, am I correct?.

No, I want to get the interface's IPv4 broadcast address. This is implemented for both linux and macos but was missing for Windows. It's the fourth argument to NetworkInterface::new_afinet.

Nils

You are right! Thanks for clarifying!

njeisecke commented 2 years ago

@EstebanBorai, thank you for accepting the patch! Kindly awaiting a new release ;-)

EstebanBorai commented 2 years ago

@EstebanBorai, thank you for accepting the patch! Kindly awaiting a new release ;-)

To you! Release is now available here: https://crates.io/crates/network-interface! Please let me know any issues you find!

njeisecke commented 2 years ago

Thanks!