diff options
| author | Markus Pettersson <markus.pettersson@mullvad.net> | 2024-09-23 11:03:37 +0200 |
|---|---|---|
| committer | Markus Pettersson <markus.pettersson@mullvad.net> | 2024-09-23 11:03:37 +0200 |
| commit | 160fbbd3971d2321a7717f44dbeec1cc0bcd19b3 (patch) | |
| tree | 88209097ed2c705ef489d2df11542625195b1b2c | |
| parent | 88315ff25f55eb6e22e4859b4b822c471365850c (diff) | |
| parent | 0f7f525b33adc99e7169f3f66cb537c0b0a9e637 (diff) | |
| download | mullvadvpn-160fbbd3971d2321a7717f44dbeec1cc0bcd19b3.tar.xz mullvadvpn-160fbbd3971d2321a7717f44dbeec1cc0bcd19b3.zip | |
Merge branch 'generalize-ephemeral-peer-error'
| -rw-r--r-- | talpid-wireguard/src/lib.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/talpid-wireguard/src/lib.rs b/talpid-wireguard/src/lib.rs index e26f558c69..ea258a456b 100644 --- a/talpid-wireguard/src/lib.rs +++ b/talpid-wireguard/src/lib.rs @@ -83,9 +83,9 @@ pub enum Error { #[error("Connectivity monitor failed")] ConnectivityMonitorError(#[source] connectivity_check::Error), - /// Failed to negotiate PQ PSK - #[error("Failed to negotiate PQ PSK")] - PskNegotiationError(#[source] talpid_tunnel_config_client::Error), + /// Failed while negotiating ephemeral peer + #[error("Failed while negotiating ephemeral peer")] + EphemeralPeerNegotiationError(#[source] talpid_tunnel_config_client::Error), /// Failed to set up IP interfaces. #[cfg(windows)] @@ -103,7 +103,7 @@ impl Error { pub fn is_recoverable(&self) -> bool { match self { Error::ObfuscationError(_) => true, - Error::PskNegotiationError(_) => true, + Error::EphemeralPeerNegotiationError(_) => true, Error::TunnelError(TunnelError::RecoverableStartWireguardError(..)) => true, Error::SetupRoutingError(error) => error.is_recoverable(), @@ -780,9 +780,9 @@ impl WireguardMonitor { .await .map_err(|_timeout_err| { log::warn!("Timeout while negotiating ephemeral peer"); - CloseMsg::PskNegotiationTimeout + CloseMsg::EphemeralPeerNegotiationTimeout })? - .map_err(Error::PskNegotiationError) + .map_err(Error::EphemeralPeerNegotiationError) .map_err(CloseMsg::SetupError)?; Ok(ephemeral.psk) @@ -901,7 +901,9 @@ impl WireguardMonitor { /// Blocks the current thread until tunnel disconnects pub fn wait(mut self) -> Result<()> { let wait_result = match self.close_msg_receiver.recv() { - Ok(CloseMsg::PskNegotiationTimeout) | Ok(CloseMsg::PingErr) => Err(Error::TimeoutError), + Ok(CloseMsg::EphemeralPeerNegotiationTimeout) | Ok(CloseMsg::PingErr) => { + Err(Error::TimeoutError) + } Ok(CloseMsg::Stop) | Ok(CloseMsg::ObfuscatorExpired) => Ok(()), Ok(CloseMsg::SetupError(error)) => Err(error), Ok(CloseMsg::ObfuscatorFailed(error)) => Err(error), @@ -1099,7 +1101,7 @@ impl WireguardMonitor { #[derive(Debug)] enum CloseMsg { Stop, - PskNegotiationTimeout, + EphemeralPeerNegotiationTimeout, PingErr, SetupError(Error), ObfuscatorExpired, |
