How to get a list of IP addresses of a machine from Rust?

In particular, I'm interested in a programmatic way to get a list of IP addresses, such as those returned by ifconfig .

Preferably, the solution will be cross-platform.

+5
source share
1 answer

Take a look at the pnet box :

 extern crate pnet; use pnet::datalink; fn main() { for iface in datalink::interfaces() { println!("{:?}", iface.ips); } } 
+3
source

All Articles