| 1 | # local_ipaddress |
| 2 | |
| 3 | Get your local ip address in Rust, using `UdpSocket` to get local ip address(not `network interface` or `ifconfig`), and won't `panic`. |
| 4 | |
| 5 | API Docs: [https://docs.rs/local_ipaddress](https://docs.rs/local_ipaddress) |
| 6 | |
| 7 | ### Usage |
| 8 | |
| 9 | Add this to your Cargo.toml: |
| 10 | |
| 11 | |
| 12 | ``` |
| 13 | [dependencies] |
| 14 | local_ipaddress = "0.1.3" |
| 15 | ``` |
| 16 | |
| 17 | ### Getting Started |
| 18 | |
| 19 | ```rust |
| 20 | use local_ipaddress; |
| 21 | |
| 22 | fn main() { |
| 23 | println!("{}", local_ipaddress::get().unwrap()); |
| 24 | } |
| 25 | ``` |
| 26 | |
| 27 | It works fine with both `Windows` and `Linux`. |
| 28 | |
| 29 | ### License |
| 30 | |
| 31 | MIT |