pub struct OverlayHealthChecker { /* private fields */ }Expand description
Overlay health checker
Monitors peer connectivity through overlay handshake times and optional ping tests. Queries the boringtun device via UAPI.
Implementations§
Source§impl OverlayHealthChecker
impl OverlayHealthChecker
Sourcepub fn new(interface: &str, check_interval: Duration) -> Self
pub fn new(interface: &str, check_interval: Duration) -> Self
Create a new health checker for the given interface
Sourcepub fn default_for_interface(interface: &str) -> Self
pub fn default_for_interface(interface: &str) -> Self
Create with default settings
Sourcepub fn with_handshake_timeout(self, timeout: Duration) -> Self
pub fn with_handshake_timeout(self, timeout: Duration) -> Self
Set the handshake timeout threshold
Sourcepub async fn run<F>(&self, on_status_change: F)
pub async fn run<F>(&self, on_status_change: F)
Run continuous health check loop
Calls the provided callback with peer status updates.
Sourcepub async fn check_all(&self) -> Result<OverlayHealth>
pub async fn check_all(&self) -> Result<OverlayHealth>
Sourcepub async fn ping_peer(&self, overlay_ip: IpAddr) -> Result<Duration>
pub async fn ping_peer(&self, overlay_ip: IpAddr) -> Result<Duration>
Ping a specific peer via its overlay IP
Supports both IPv4 and IPv6 overlay addresses. Uses ping for IPv4
and ping6 (macOS) or ping -6 (Linux) for IPv6.
Returns the RTT on success.
§Errors
Returns OverlayError::PeerUnreachable if the ping fails or times out.
Sourcepub async fn tcp_check(&self, overlay_ip: IpAddr, port: u16) -> Result<Duration>
pub async fn tcp_check(&self, overlay_ip: IpAddr, port: u16) -> Result<Duration>
TCP connect test to a specific peer and port
Returns the connection time on success.
§Errors
Returns OverlayError::PeerUnreachable if the connection fails or times out.
Sourcepub async fn get_cached_status(&self, public_key: &str) -> Option<PeerStatus>
pub async fn get_cached_status(&self, public_key: &str) -> Option<PeerStatus>
Get cached peer status
Sourcepub fn check_interval(&self) -> Duration
pub fn check_interval(&self) -> Duration
Get the health check interval