docs.rs failed to build ip-tools-0.2.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
ip-tools
A small CLI tool to list network interfaces and retrieve the local IP address.
Installation
Cargo
- Install the rust toolchain in order to have cargo installed by following this guide.
- run
cargo install ip-tools
Usage
Get the local IP address
ip-tools get
Example output:
192.168.1.100
List all network interfaces
ip-tools list
Example output:
lo: 127.0.0.1
eth0: 192.168.1.100
wlan0: 10.0.0.5
JSON output
Pass --json for machine-readable output (useful for scripting and automation):
ip-tools get --json
ip-tools list --json
Example output for get --json:
Example output for list --json:
Show help
ip-tools --help
Library usage
ip-tools is also published as a library crate (ip_tools). See the
API documentation for details.
use ;
// Retrieve the local IP address
if let Ok = get_local_ip
// List all network interfaces
if let Ok = list_net_ifs
A runnable example is provided in examples/ip_info.rs:
cargo run --example ip_info
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
See CONTRIBUTING.md.