My Internet IP Rust Crate
"My Internet IP" is a small rust crate for retrieving the public IP of the device this code is executed on.
Example
extern crate my_internet_ip;
Note: The call to my_internet_ip::get() blocks until the public IP
was retrieved or an error occurred.
Cargo.toml
= "0.0.1"
How it works
This crate uses the curl crate to access http://www.myip.ch and parse the result.
Ideas for contributions
- Support async retrieval of the IP
- Use other sites to retrieve the IP (maybe STUN server?) and select one randomly
- Clear up the code (it is quite convoluted, but it works)
License
MIT