get_local_ip 0.2.1

Get your computer ip address.
Documentation

local_ip

Build Status

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