summaryrefslogtreecommitdiffhomepage
path: root/mullvad-daemon/src
diff options
context:
space:
mode:
Diffstat (limited to 'mullvad-daemon/src')
-rw-r--r--mullvad-daemon/src/account_history.rs5
-rw-r--r--mullvad-daemon/src/cli.rs6
-rw-r--r--mullvad-daemon/src/geoip.rs4
-rw-r--r--mullvad-daemon/src/migrations/account_history.rs5
-rw-r--r--mullvad-daemon/src/system_service.rs5
-rw-r--r--mullvad-daemon/src/tunnel.rs8
-rw-r--r--mullvad-daemon/src/version_check.rs8
7 files changed, 19 insertions, 22 deletions
diff --git a/mullvad-daemon/src/account_history.rs b/mullvad-daemon/src/account_history.rs
index c03a84f0cc..09e0f47a38 100644
--- a/mullvad-daemon/src/account_history.rs
+++ b/mullvad-daemon/src/account_history.rs
@@ -1,7 +1,6 @@
use mullvad_types::account::AccountToken;
-use once_cell::sync::Lazy;
use regex::Regex;
-use std::path::Path;
+use std::{path::Path, sync::LazyLock};
use talpid_types::ErrorExt;
use tokio::{
fs,
@@ -32,7 +31,7 @@ pub struct AccountHistory {
token: Option<AccountToken>,
}
-static ACCOUNT_REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"^[0-9]+$").unwrap());
+static ACCOUNT_REGEX: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"^[0-9]+$").unwrap());
impl AccountHistory {
pub async fn new(
diff --git a/mullvad-daemon/src/cli.rs b/mullvad-daemon/src/cli.rs
index 4e9824aada..d702c443c5 100644
--- a/mullvad-daemon/src/cli.rs
+++ b/mullvad-daemon/src/cli.rs
@@ -1,7 +1,7 @@
use clap::{Args, Parser};
-use once_cell::sync::Lazy;
+use std::sync::LazyLock;
-static ENV_DESC: Lazy<String> = Lazy::new(|| {
+static ENV_DESC: LazyLock<String> = LazyLock::new(|| {
format!(
"ENV:
@@ -119,7 +119,7 @@ impl From<CommandFlags> for Command {
}
pub fn get_config() -> &'static Config {
- static CONFIG: Lazy<Config> = Lazy::new(create_config);
+ static CONFIG: LazyLock<Config> = LazyLock::new(create_config);
&CONFIG
}
diff --git a/mullvad-daemon/src/geoip.rs b/mullvad-daemon/src/geoip.rs
index af7db0cb2b..da2fb3e8db 100644
--- a/mullvad-daemon/src/geoip.rs
+++ b/mullvad-daemon/src/geoip.rs
@@ -3,7 +3,7 @@ use std::time::Duration;
use futures::join;
use mullvad_api::rest::{Error, RequestServiceHandle};
use mullvad_types::location::{AmIMullvad, GeoIpLocation, LocationEventData};
-use once_cell::sync::Lazy;
+use std::sync::LazyLock;
use talpid_core::mpsc::Sender;
use talpid_future::retry::{retry_future, ExponentialBackoff, Jittered};
use talpid_types::ErrorExt;
@@ -19,7 +19,7 @@ use crate::{DaemonEventSender, InternalDaemonEvent};
// production build, a warning will be logged and the env variable *won´t* have
// any effect on the api call. The default host name `am.i.mullvad.net` will
// always be used in release mode.
-static MULLVAD_CONNCHECK_HOST: Lazy<String> = Lazy::new(|| {
+static MULLVAD_CONNCHECK_HOST: LazyLock<String> = LazyLock::new(|| {
const DEFAULT_CONNCHECK_HOST: &str = "am.i.mullvad.net";
let conncheck_host_var = std::env::var("MULLVAD_CONNCHECK_HOST").ok();
let host = if cfg!(feature = "api-override") {
diff --git a/mullvad-daemon/src/migrations/account_history.rs b/mullvad-daemon/src/migrations/account_history.rs
index fb1691fb75..e367ffdce4 100644
--- a/mullvad-daemon/src/migrations/account_history.rs
+++ b/mullvad-daemon/src/migrations/account_history.rs
@@ -1,9 +1,8 @@
use super::{Error, Result};
use mullvad_types::account::AccountToken;
-use once_cell::sync::Lazy;
use regex::Regex;
use serde::Deserialize;
-use std::path::Path;
+use std::{path::Path, sync::LazyLock};
use talpid_types::ErrorExt;
use tokio::{
fs::{self, File},
@@ -17,7 +16,7 @@ use tokio::{
const ACCOUNT_HISTORY_FILE: &str = "account-history.json";
-static ACCOUNT_REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"^[0-9]+$").unwrap());
+static ACCOUNT_REGEX: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"^[0-9]+$").unwrap());
pub async fn migrate_location(old_dir: &Path, new_dir: &Path) {
let old_path = old_dir.join(ACCOUNT_HISTORY_FILE);
diff --git a/mullvad-daemon/src/system_service.rs b/mullvad-daemon/src/system_service.rs
index a5a76e72b4..ccec49486b 100644
--- a/mullvad-daemon/src/system_service.rs
+++ b/mullvad-daemon/src/system_service.rs
@@ -1,13 +1,12 @@
use crate::cli;
use mullvad_daemon::{runtime::new_multi_thread, DaemonShutdownHandle};
-use once_cell::sync::Lazy;
use std::{
env,
ffi::{c_void, OsString},
ptr, slice,
sync::{
atomic::{AtomicBool, AtomicUsize, Ordering},
- mpsc, Arc,
+ mpsc, Arc, LazyLock,
},
thread,
time::{Duration, Instant},
@@ -39,7 +38,7 @@ static SERVICE_TYPE: ServiceType = ServiceType::OWN_PROCESS;
const SERVICE_RECOVERY_LAST_RESTART_DELAY: Duration = Duration::from_secs(60 * 10);
const SERVICE_FAILURE_RESET_PERIOD: Duration = Duration::from_secs(60 * 15);
-static SERVICE_ACCESS: Lazy<ServiceAccess> = Lazy::new(|| {
+static SERVICE_ACCESS: LazyLock<ServiceAccess> = LazyLock::new(|| {
ServiceAccess::QUERY_CONFIG
| ServiceAccess::CHANGE_CONFIG
| ServiceAccess::START
diff --git a/mullvad-daemon/src/tunnel.rs b/mullvad-daemon/src/tunnel.rs
index 54bee64e7b..72ec5087fc 100644
--- a/mullvad-daemon/src/tunnel.rs
+++ b/mullvad-daemon/src/tunnel.rs
@@ -13,7 +13,7 @@ use mullvad_types::{
endpoint::MullvadWireguardEndpoint, location::GeoIpLocation, relay_list::Relay,
settings::TunnelOptions,
};
-use once_cell::sync::Lazy;
+use std::sync::LazyLock;
use talpid_core::tunnel_state_machine::TunnelParametersGenerator;
#[cfg(not(target_os = "android"))]
use talpid_types::net::{
@@ -31,9 +31,9 @@ use crate::device::{AccountManagerHandle, Error as DeviceError, PrivateAccountAn
/// "Same IP" functionality. This means all clients have the same in-tunnel IP on these
/// servers. This improves anonymity since the in-tunnel IP will not be unique to a specific
/// peer.
-static SAME_IP_V4: Lazy<IpAddr> =
- Lazy::new(|| Ipv4Addr::from_str("10.127.255.254").unwrap().into());
-static SAME_IP_V6: Lazy<IpAddr> = Lazy::new(|| {
+static SAME_IP_V4: LazyLock<IpAddr> =
+ LazyLock::new(|| Ipv4Addr::from_str("10.127.255.254").unwrap().into());
+static SAME_IP_V6: LazyLock<IpAddr> = LazyLock::new(|| {
Ipv6Addr::from_str("fc00:bbbb:bbbb:bb01:ffff:ffff:ffff:ffff")
.unwrap()
.into()
diff --git a/mullvad-daemon/src/version_check.rs b/mullvad-daemon/src/version_check.rs
index d4274ec10d..4aae30f574 100644
--- a/mullvad-daemon/src/version_check.rs
+++ b/mullvad-daemon/src/version_check.rs
@@ -6,7 +6,6 @@ use futures::{
};
use mullvad_api::{availability::ApiAvailabilityHandle, rest::MullvadRestHandle, AppVersionProxy};
use mullvad_types::version::{AppVersionInfo, ParsedAppVersion};
-use once_cell::sync::Lazy;
use serde::{Deserialize, Serialize};
use std::{
cmp::max,
@@ -15,6 +14,7 @@ use std::{
path::{Path, PathBuf},
pin::Pin,
str::FromStr,
+ sync::LazyLock,
time::{Duration, SystemTime},
};
use talpid_core::mpsc::Sender;
@@ -24,9 +24,9 @@ use tokio::{fs::File, io::AsyncReadExt};
const VERSION_INFO_FILENAME: &str = "version-info.json";
-static APP_VERSION: Lazy<ParsedAppVersion> =
- Lazy::new(|| ParsedAppVersion::from_str(mullvad_version::VERSION).unwrap());
-static IS_DEV_BUILD: Lazy<bool> = Lazy::new(|| APP_VERSION.is_dev());
+static APP_VERSION: LazyLock<ParsedAppVersion> =
+ LazyLock::new(|| ParsedAppVersion::from_str(mullvad_version::VERSION).unwrap());
+static IS_DEV_BUILD: LazyLock<bool> = LazyLock::new(|| APP_VERSION.is_dev());
const DOWNLOAD_TIMEOUT: Duration = Duration::from_secs(15);