| Crates.io | localip |
| lib.rs | localip |
| version | 0.2.1 |
| created_at | 2024-12-13 07:37:21.271911+00 |
| updated_at | 2024-12-14 04:20:13.555854+00 |
| description | A simple library to find the local IP address of the machine. |
| homepage | |
| repository | https://github.com/tarunregmi/localip |
| max_upload_size | |
| id | 1481958 |
| size | 3,943 |
A lightweight Rust library for discovering the local IP address of your machine. It uses a simple, connectionless UDP-based approach to reliably determine the local IP address without requiring internet connectivity or third-party dependencies.
Run this command in your terminal:
cargo add localip
use localip::get_local_ip;
fn main() {
match get_local_ip() {
Ok(ip) => println!("Local IP address: {}", ip),
Err(e) => eprintln!("Error: {}", e),
}
}