12 releases
0.2.1 | Dec 28, 2019 |
---|---|
0.2.0 | Dec 28, 2019 |
0.1.9 | Dec 28, 2019 |
0.1.3 | Nov 3, 2019 |
0.1.1 | Oct 27, 2019 |
#3 in #ifconfig
5KB
82 lines
local_ip
About
This library to get your computer ip using command ifconfig
and combine with UdpSocket.
Usage
Please see the example
extern crate get_local_ip;
use get_local_ip::{local, network};
fn main() {
// ip with port.
println!("{:?}", network().unwrap().get()); // "192.168.43.134:49187"
println!("{:?}", local().unwrap().get()); // "127.0.0.1:60234"
// ip without port.
println!("{:?}", network().unwrap().ip); // 192.168.43.134
println!("{:?}", local().unwrap().ip); // 127.0.0.1
// port without ip.
println!("{:?}", network().unwrap().port); // 58096
}
Support
- ⚠️ Coming soon to support for
windows
operating system.
License
MIT
Dependencies
~2.2–3MB
~54K SLoC