Registry / networking / default-net

default-net

JSON →
library0.22.0rscratesunverified

Cross-platform library for network interface and gateway information.

# Cargo.toml [dependencies] default-net = "0.22.0"
INSTALL
IMPORT
SIG · DEFAULT-NET
D
default-net
networkingrustv0.22.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

get_default_gateway
use default_net::get_default_gateway;

Retrieve the default network gateway.

use default_net::get_default_gateway; fn main() { match get_default_gateway() { Ok(gateway) => println!("Default gateway: {}", gateway.ip_addr), Err(e) => eprintln!("Error: {}", e), } }
Debug
Known issues
gotchaOn Linux, requires root or CAP_NET_ADMIN to access some network information.
fix
Run with sudo or set capabilities: `sudo setcap cap_net_admin+ep your_binary`.
affects: >=0.1.0
Upgrade
Version history
0.22.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
2
Resources
default-net — cargo add default-net · libregistry