mip 0.4.1

Get local IPv4 address
Documentation
  • Coverage
  • 0%
    0 out of 8 items documented0 out of 4 items with examples
  • Size
  • Source code size: 42.97 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.5 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • KevinGimbel/mip
    2 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • KevinGimbel

mip

Get IPv4 address in rust - with 0 dependencies!

Crate mip gets the local IP address by requesting http://httpbin.org/ip and parsing the returned output.

It has 0 dependencies and only relies on the Rust std lib.

Usage

Add the following to Cargo.toml.

[dependencies]
mip = "0.4.0
use mip::IP;

fn main() {
    println!("My IP is {}", IP::is());
}

Or without use


fn main() {
    println!("My IP is {}", mip::IP::is());
}

Custom Endpoint

Instead of using httpbin.org a custom endpoint can be used. Custom endpoints may not parse properly so test before using in production!

use mip::{IP, Endpoint};

fn main() {
    let ip = IP::with_endpoint(Endpoint {
        path: Some("/"),
        host: "checkip.dyndns.com",
        port: 80,
    });
    println!("{}", ip)
}

Todo

Some things that need to be done

License

See LICENSE file.