summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2022-09-21 10:58:29 +0200
committerDavid Lönnhager <david.l@mullvad.net>2022-11-29 19:06:36 +0100
commitefb49034ab60a27d341a1f03dcda5418363202ed (patch)
tree40c6dfe3f82333d6884da8cc81308317e49e9a48
parent9fffb1e6636508dcb0878970349aa2eb699c2212 (diff)
downloadmullvadvpn-efb49034ab60a27d341a1f03dcda5418363202ed.tar.xz
mullvadvpn-efb49034ab60a27d341a1f03dcda5418363202ed.zip
Output '[EXPIRED_ACCOUNT]' for WireGuard when the account is out of time
-rw-r--r--mullvad-daemon/src/lib.rs3
-rw-r--r--mullvad-types/src/auth_failed.rs12
2 files changed, 14 insertions, 1 deletions
diff --git a/mullvad-daemon/src/lib.rs b/mullvad-daemon/src/lib.rs
index c6875d3401..3ea3cdbd27 100644
--- a/mullvad-daemon/src/lib.rs
+++ b/mullvad-daemon/src/lib.rs
@@ -41,6 +41,7 @@ use mullvad_relay_selector::{
};
use mullvad_types::{
account::{AccountData, AccountToken, VoucherSubmission},
+ auth_failed::AuthFailed,
device::{Device, DeviceEvent, DeviceEventCause, DeviceId, DeviceState, RemoveDeviceEvent},
location::GeoIpLocation,
relay_constraints::{BridgeSettings, BridgeState, ObfuscationSettings, RelaySettingsUpdate},
@@ -1099,7 +1100,7 @@ where
} else if self.get_target_tunnel_type() == Some(TunnelType::Wireguard) {
log::debug!("Entering blocking state since the account is out of time");
self.send_tunnel_command(TunnelCommand::Block(ErrorStateCause::AuthFailed(
- None,
+ Some(AuthFailed::ExpiredAccount.as_str().to_string()),
)))
}
}
diff --git a/mullvad-types/src/auth_failed.rs b/mullvad-types/src/auth_failed.rs
index 43b991da72..795bbc24e3 100644
--- a/mullvad-types/src/auth_failed.rs
+++ b/mullvad-types/src/auth_failed.rs
@@ -35,6 +35,18 @@ impl<'a> From<&'a str> for AuthFailed {
}
}
+impl AuthFailed {
+ pub fn as_str(&self) -> &'static str {
+ use AuthFailed::*;
+ match self {
+ InvalidAccount => "[INVALID_ACCOUNT]",
+ ExpiredAccount => "[EXPIRED_ACCOUNT]",
+ TooManyConnections => "[TOO_MANY_CONNECTIONS]",
+ Unknown => "[Unknown]",
+ }
+ }
+}
+
#[derive(Debug)]
pub struct UnexpectedErrorStateCause(());