pub struct LocalStack { /* private fields */ }Expand description
The address families THIS host can originate connections on.
Detection uses the “connect a UDP socket to a documentation address” trick: connecting a UDP
socket forces the OS to pick the local source address it would route from WITHOUT sending a
packet, so a family with no route (no default route, no address) fails at connect and is
recorded as absent. Construct it with LocalStack::detect in production, LocalStack::cached
on the hot path, or LocalStack::from_flags deterministically in tests.
Implementations§
Source§impl LocalStack
impl LocalStack
Sourcepub fn detect() -> LocalStack
pub fn detect() -> LocalStack
Probe the host’s real IPv6 + IPv4 capability (no packets sent).
Sourcepub fn cached() -> LocalStack
pub fn cached() -> LocalStack
The process-wide cached detection, re-probed at most once per [CACHE_TTL].
The dial hot path calls this on every connect; caching keeps the UDP-probe syscalls off it while still refreshing within a bounded window if the host’s stack changes.
Sourcepub const fn from_flags(has_v6: bool, has_v4: bool) -> LocalStack
pub const fn from_flags(has_v6: bool, has_v4: bool) -> LocalStack
A deterministic stack with the given capabilities — the test constructor for the intersection matrix (no sockets, no host dependency).
Trait Implementations§
Source§impl Clone for LocalStack
impl Clone for LocalStack
Source§fn clone(&self) -> LocalStack
fn clone(&self) -> LocalStack
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more