Skip to main content

Crate iprobe

Crate iprobe 

Source
Expand description

iprobe

Probe if the host system supports IPv4, IPv6 and IPv4-mapped-IPv6.

github LoC Build codecov

docs.rs crates.io crates.io license

iprobe runs its local socket probes once per process and returns the same cached snapshot from probe() and the convenience functions thereafter.

The probes perform these operations:

  • IPv4: create an IPv4 TCP socket.
  • IPv6: create an IPv6 TCP socket and bind it to ::1.
  • IPv4-mapped IPv6: create a dual-stack IPv6 TCP socket and bind it to ::ffff:127.0.0.1.

These are local operation checks. They do not test routing, interface availability, remote hosts, or Internet connectivity. A false result is best effort and may reflect unsupported functionality, policy restrictions, resource exhaustion, or a transient failure.

§Installation

[dependencies]
iprobe = "1"

§Example

use iprobe::{ipv4, ipv6, ipv4_mapped_ipv6};

println!("IPv4 enabled: {}", ipv4());
println!("IPv6 enabled: {}", ipv6());
println!("IPv4-mapped IPv6 enabled: {}", ipv4_mapped_ipv6());
§License

iprobe is under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE, LICENSE-MIT for details.

Copyright (c) 2025 Al Liu.

Structs§

Probe
A cached, best-effort snapshot of local IP socket operation support.

Functions§

ipv4
Returns true if the host can create an IPv4 TCP socket.
ipv6
Returns true if the host can create an IPv6 TCP socket and bind it to the IPv6 loopback address (::1).
ipv4_mapped_ipv6
Returns true if the host can create a dual-stack IPv6 TCP socket and bind it to the IPv4-mapped loopback address (::ffff:127.0.0.1).
probe
Probes local IPv4, IPv6, and IPv4-mapped IPv6 socket operations once per process and returns the cached snapshot on subsequent calls.