summaryrefslogtreecommitdiffhomepage
path: root/mullvad-setup
diff options
context:
space:
mode:
authorKalle Lindström <karl.lindstrom@mullvad.net>2025-02-05 13:08:20 +0100
committerLinus Färnstrand <linus@mullvad.net>2025-02-18 19:12:22 +0100
commit35fb1310a4dd348d33e1ed2454b47bb2c2819077 (patch)
treee740d6585e2d5591a9aa2d3106c69845783454c9 /mullvad-setup
parent447ec20b79adbda18d6e954a3d30178ffeb35a67 (diff)
downloadmullvadvpn-35fb1310a4dd348d33e1ed2454b47bb2c2819077.tar.xz
mullvadvpn-35fb1310a4dd348d33e1ed2454b47bb2c2819077.zip
Unify daemon app version types
Previously we had two types in the code base that dealt with version parsing. This commit unifies these types so that we only use the Version struct that is defines in the mullvad-version crate. This also solves a bug where the daemon code would crash on alpha versions, as the previous version parsing code didn't handle them.
Diffstat (limited to 'mullvad-setup')
-rw-r--r--mullvad-setup/src/main.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/mullvad-setup/src/main.rs b/mullvad-setup/src/main.rs
index e525d5cb88..166364cf92 100644
--- a/mullvad-setup/src/main.rs
+++ b/mullvad-setup/src/main.rs
@@ -1,15 +1,14 @@
use clap::Parser;
-use std::{path::PathBuf, process, str::FromStr, sync::LazyLock, time::Duration};
-
use mullvad_api::{proxy::ApiConnectionMode, ApiEndpoint, DEVICE_NOT_FOUND};
use mullvad_management_interface::MullvadProxyClient;
-use mullvad_types::version::ParsedAppVersion;
+use mullvad_version::Version;
+use std::{path::PathBuf, process, str::FromStr, sync::LazyLock, time::Duration};
use talpid_core::firewall::{self, Firewall};
use talpid_future::retry::{retry_future, ConstantInterval};
use talpid_types::ErrorExt;
-static APP_VERSION: LazyLock<ParsedAppVersion> =
- LazyLock::new(|| ParsedAppVersion::from_str(mullvad_version::VERSION).unwrap());
+static APP_VERSION: LazyLock<Version> =
+ LazyLock::new(|| Version::from_str(mullvad_version::VERSION).unwrap());
const DEVICE_REMOVAL_STRATEGY: ConstantInterval = ConstantInterval::new(Duration::ZERO, Some(5));
@@ -114,9 +113,9 @@ async fn main() {
fn is_older_version(old_version: &str) -> Result<ExitStatus, Error> {
let parsed_version =
- ParsedAppVersion::from_str(old_version).map_err(|_| Error::ParseVersionStringError)?;
+ Version::from_str(old_version).map_err(|_| Error::ParseVersionStringError)?;
- Ok(if parsed_version < *APP_VERSION {
+ Ok(if *APP_VERSION > parsed_version {
ExitStatus::Ok
} else {
ExitStatus::VersionNotOlder