Crates.io | get_local_ip |
lib.rs | get_local_ip |
version | 0.2.1 |
source | src |
created_at | 2019-10-19 17:41:16.787592 |
updated_at | 2019-12-28 16:09:41.830684 |
description | Get your computer ip address. |
homepage | |
repository | https://github.com/adiatma/local_ip.git |
max_upload_size | |
id | 174006 |
size | 7,323 |
This library to get your computer ip using command ifconfig
and combine with UdpSocket.
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
}
windows
operating system.MIT