https://github.com/ivanceras/machine-ip
Get local ip address in rust, equivalent to `hostname -I` in linux
https://github.com/ivanceras/machine-ip
Last synced: 3 months ago
JSON representation
Get local ip address in rust, equivalent to `hostname -I` in linux
- Host: GitHub
- URL: https://github.com/ivanceras/machine-ip
- Owner: ivanceras
- License: mit
- Created: 2017-11-10T13:21:59.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-12-20T09:46:02.000Z (about 7 years ago)
- Last Synced: 2024-05-23T01:31:34.162Z (over 1 year ago)
- Language: Rust
- Size: 5.86 KB
- Stars: 7
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
# machine-ip
Get your local ip address in Rust, using `hostname -I`
under the hood, may not work in older versions of windows
```toml
machine-ip = "0.1"
```
then
```rust
extern crate machine_ip;
let ip = machine_ip::get().unwrap();
println!("local ip address: {:?}", ip.to_string());
```
## Warning
This crate just wraps the `hostname` command, so it only works on unix based OS, and this doesn't work on windows.
## License
MIT