localip

Crates.iolocalip
lib.rslocalip
version0.2.1
created_at2024-12-13 07:37:21.271911+00
updated_at2024-12-14 04:20:13.555854+00
descriptionA simple library to find the local IP address of the machine.
homepage
repositoryhttps://github.com/tarunregmi/localip
max_upload_size
id1481958
size3,943
Tarun Regmi (tarunregmi)

documentation

README

localip

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.

Installation

Run this command in your terminal:

cargo add localip

Example:

use localip::get_local_ip;

fn main() {
    match get_local_ip() {
        Ok(ip) => println!("Local IP address: {}", ip),
        Err(e) => eprintln!("Error: {}", e),
    }
}
Commit count: 10

cargo fmt