diff --git a/talpid-wireguard/src/lib.rs b/talpid-wireguard/src/lib.rs index 7c93b39f18b7..06726f9c69c0 100644 --- a/talpid-wireguard/src/lib.rs +++ b/talpid-wireguard/src/lib.rs @@ -1087,15 +1087,6 @@ pub enum TunnelError { #[cfg(daita)] #[error("Failed to start DAITA - tunnel implemenation does not support DAITA")] DaitaNotSupported, - - /// [connectivity] error. - #[error(transparent)] - Connectivity(#[from] Box), - - /// Tunnel seemingly does not serve any traffic - #[cfg(target_os = "android")] - #[error("Tunnel seemingly does not serve any traffic")] - TunnelUp, } #[cfg(target_os = "linux")] diff --git a/talpid-wireguard/src/wireguard_go/mod.rs b/talpid-wireguard/src/wireguard_go/mod.rs index d283758f3bc4..e2072c291ed9 100644 --- a/talpid-wireguard/src/wireguard_go/mod.rs +++ b/talpid-wireguard/src/wireguard_go/mod.rs @@ -1,5 +1,7 @@ #[cfg(target_os = "android")] use super::config; +#[cfg(target_os = "android")] +use super::Error; use super::{ stats::{Stats, StatsMap}, Config, Tunnel, TunnelError, @@ -434,14 +436,15 @@ impl WgGoTunnel { &self, checker: &mut connectivity::Check, ) -> Result<()> { - let connectivity_err = |e| TunnelError::Connectivity(Box::new(e)); let connection_established = checker .establish_connectivity(self) - .map_err(connectivity_err)?; + .map_err(|e| TunnelError::RecoverableStartWireguardError(Box::new(e)))?; // Timed out if !connection_established { - return Err(TunnelError::TunnelUp); + return Err(TunnelError::RecoverableStartWireguardError(Box::new( + Error::TimeoutError, + ))); } Ok(()) }