How to list out all valid Ipv4Addr from current host?


#1

I’ve been trying to write a UDP multicast application, both listening and sending, but I can’t figure out how to get all the valid Ipv4Addrs on the host. The net2 crate will give me the function calls necessary but I don’t know how to get all the valid data values for join_multicast_v4, it requires two Ipv4Addr (which can be found in the std lib). Are there any examples of how I could get a list of all valid Ipv4Addr on a host?

I’m thinking I’ll get a list of all devices which includes lo for loopback, en0 or eth0 (OSX/Linux), then others. Then from those devices I can gather up their Ipv4Addr structs. That sound about right?