summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock12
-rw-r--r--Cargo.toml4
-rw-r--r--android/translations-converter/Cargo.toml1
-rw-r--r--android/translations-converter/src/android/string_value.rs7
-rw-r--r--android/translations-converter/src/normalize.rs14
-rw-r--r--mullvad-api/Cargo.toml1
-rw-r--r--mullvad-api/src/tls_stream.rs4
-rw-r--r--mullvad-daemon/Cargo.toml1
-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
-rw-r--r--mullvad-management-interface/Cargo.toml1
-rw-r--r--mullvad-management-interface/src/lib.rs6
-rw-r--r--mullvad-problem-report/Cargo.toml1
-rw-r--r--mullvad-problem-report/src/lib.rs8
-rw-r--r--mullvad-relay-selector/Cargo.toml1
-rw-r--r--mullvad-relay-selector/src/relay_selector/mod.rs5
-rw-r--r--mullvad-relay-selector/tests/relay_selector.rs10
-rw-r--r--mullvad-setup/Cargo.toml1
-rw-r--r--mullvad-setup/src/main.rs7
-rw-r--r--mullvad-types/Cargo.toml1
-rw-r--r--mullvad-types/src/auth_failed.rs4
-rw-r--r--mullvad-types/src/version.rs11
-rw-r--r--talpid-core/Cargo.toml2
-rw-r--r--talpid-core/src/firewall/linux.rs51
-rw-r--r--talpid-core/src/firewall/mod.rs19
-rw-r--r--talpid-core/src/offline/mod.rs4
-rw-r--r--talpid-core/src/resolver.rs4
-rw-r--r--talpid-core/src/split_tunnel/macos/process.rs7
-rw-r--r--talpid-dbus/Cargo.toml1
-rw-r--r--talpid-dbus/src/lib.rs6
-rw-r--r--talpid-dbus/src/systemd_resolved.rs11
-rw-r--r--talpid-openvpn/Cargo.toml2
-rw-r--r--talpid-openvpn/src/lib.rs11
-rw-r--r--talpid-routing/Cargo.toml1
-rw-r--r--talpid-routing/src/unix/linux.rs6
-rw-r--r--talpid-tunnel/Cargo.toml1
-rw-r--r--talpid-tunnel/src/tun_provider/mod.rs14
-rw-r--r--talpid-types/Cargo.toml1
-rw-r--r--talpid-types/src/net/mod.rs7
-rw-r--r--talpid-wireguard/src/lib.rs8
-rw-r--r--talpid-wireguard/src/logging.rs5
-rw-r--r--talpid-wireguard/src/wireguard_nt/mod.rs24
-rw-r--r--test/Cargo.lock6
-rw-r--r--test/Cargo.toml2
-rw-r--r--test/test-manager/src/logging.rs2
-rw-r--r--test/test-manager/src/package.rs10
-rw-r--r--test/test-manager/src/vm/network/linux.rs6
-rw-r--r--test/test-rpc/Cargo.toml1
-rw-r--r--test/test-rpc/src/net.rs5
-rw-r--r--test/test-runner/src/forward.rs7
-rw-r--r--test/test-runner/src/logging.rs4
56 files changed, 170 insertions, 199 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 26f0e8ac3d..9e5b30d1af 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2147,7 +2147,6 @@ dependencies = [
"log",
"mullvad-fs",
"mullvad-types",
- "once_cell",
"rustls-pemfile",
"serde",
"serde_json",
@@ -2208,7 +2207,6 @@ dependencies = [
"mullvad-version",
"nix 0.23.2",
"objc",
- "once_cell",
"regex",
"serde",
"serde_json",
@@ -2296,7 +2294,6 @@ dependencies = [
"mullvad-paths",
"mullvad-types",
"nix 0.23.2",
- "once_cell",
"parity-tokio-ipc",
"prost",
"prost-types",
@@ -2340,7 +2337,6 @@ dependencies = [
"mullvad-api",
"mullvad-paths",
"mullvad-version",
- "once_cell",
"regex",
"talpid-platform-metadata",
"talpid-types",
@@ -2361,7 +2357,6 @@ dependencies = [
"itertools 0.12.1",
"log",
"mullvad-types",
- "once_cell",
"proptest",
"rand 0.8.5",
"serde_json",
@@ -2381,7 +2376,6 @@ dependencies = [
"mullvad-paths",
"mullvad-types",
"mullvad-version",
- "once_cell",
"talpid-core",
"talpid-future",
"talpid-types",
@@ -2399,7 +2393,6 @@ dependencies = [
"intersection-derive",
"ipnetwork",
"log",
- "once_cell",
"regex",
"serde",
"talpid-types",
@@ -3931,7 +3924,6 @@ dependencies = [
"dbus",
"libc",
"log",
- "once_cell",
"thiserror",
"tokio",
]
@@ -4025,7 +4017,6 @@ dependencies = [
"netlink-packet-route",
"netlink-sys",
"nix 0.28.0",
- "once_cell",
"rtnetlink",
"system-configuration",
"talpid-types",
@@ -4055,7 +4046,6 @@ dependencies = [
"jnix",
"log",
"nix 0.23.2",
- "once_cell",
"talpid-routing",
"talpid-types",
"talpid-windows",
@@ -4093,7 +4083,6 @@ dependencies = [
"ipnetwork",
"jnix",
"log",
- "once_cell",
"serde",
"thiserror",
"x25519-dalek",
@@ -4466,7 +4455,6 @@ name = "translations-converter"
version = "0.0.0"
dependencies = [
"htmlize",
- "once_cell",
"quick-xml",
"regex",
"serde",
diff --git a/Cargo.toml b/Cargo.toml
index 1317951f65..9ff2ac2784 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,7 +3,7 @@ authors = ["Mullvad VPN"]
repository = "https://github.com/mullvad/mullvadvpn-app/"
license = "GPL-3.0"
edition = "2021"
-rust-version = "1.77.0"
+rust-version = "1.80.0"
[workspace]
resolver = "2"
@@ -83,7 +83,7 @@ windows-sys = "0.52.0"
chrono = { version = "0.4.26", default-features = false }
clap = { version = "4.4.18", features = ["cargo", "derive"] }
-once_cell = "1.13"
+once_cell = "1.16"
serde = "1.0.204"
serde_json = "1.0.122"
diff --git a/android/translations-converter/Cargo.toml b/android/translations-converter/Cargo.toml
index 9bf902b172..67704daf2c 100644
--- a/android/translations-converter/Cargo.toml
+++ b/android/translations-converter/Cargo.toml
@@ -13,7 +13,6 @@ workspace = true
[dependencies]
thiserror = { workspace = true }
htmlize = { version = "1.0.2", features = ["unescape"] }
-once_cell = { workspace = true }
regex = "1"
serde = { workspace = true, features = ["derive"] }
quick-xml = { version = "0.27.1", features = ["serialize"] }
diff --git a/android/translations-converter/src/android/string_value.rs b/android/translations-converter/src/android/string_value.rs
index 9513f3e096..9a01e9df86 100644
--- a/android/translations-converter/src/android/string_value.rs
+++ b/android/translations-converter/src/android/string_value.rs
@@ -1,9 +1,9 @@
-use once_cell::sync::Lazy;
use regex::Regex;
use serde::{Deserialize, Deserializer, Serialize};
use std::{
fmt::{self, Display, Formatter, Write},
ops::Deref,
+ sync::LazyLock,
};
/// An Android string value
@@ -32,7 +32,7 @@ impl StringValue {
/// The input XML file might have line breaks inside the string, and they should be collapsed
/// into a single whitespace character.
fn collapse_line_breaks(original: String) -> String {
- static LINE_BREAKS: Lazy<Regex> = Lazy::new(|| Regex::new(r"\s*\n\s*").unwrap());
+ static LINE_BREAKS: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"\s*\n\s*").unwrap());
LINE_BREAKS.replace_all(&original, " ").into_owned()
}
@@ -43,7 +43,8 @@ impl StringValue {
/// would update the string so that all parameters have indices: `Things are %1$d, %3$s and
/// %4$s`.
fn ensure_parameters_are_indexed(original: String) -> String {
- static PARAMETER_INDEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"^(\d+)\$").unwrap());
+ static PARAMETER_INDEX: LazyLock<Regex> =
+ LazyLock::new(|| Regex::new(r"^(\d+)\$").unwrap());
let mut parts = original.split('%');
let mut output = parts.next().unwrap().to_owned();
diff --git a/android/translations-converter/src/normalize.rs b/android/translations-converter/src/normalize.rs
index 1ea0ae9440..ace645570e 100644
--- a/android/translations-converter/src/normalize.rs
+++ b/android/translations-converter/src/normalize.rs
@@ -1,5 +1,5 @@
-use once_cell::sync::Lazy;
use regex::Regex;
+use std::sync::LazyLock;
pub trait Normalize {
/// Normalize the string value into a common format.
@@ -12,9 +12,9 @@ mod android {
use super::*;
use crate::android::StringValue;
- static APOSTROPHES: Lazy<Regex> = Lazy::new(|| Regex::new(r"\\'").unwrap());
- static DOUBLE_QUOTES: Lazy<Regex> = Lazy::new(|| Regex::new(r#"\\""#).unwrap());
- static PARAMETERS: Lazy<Regex> = Lazy::new(|| Regex::new(r"%[0-9]*\$").unwrap());
+ static APOSTROPHES: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"\\'").unwrap());
+ static DOUBLE_QUOTES: LazyLock<Regex> = LazyLock::new(|| Regex::new(r#"\\""#).unwrap());
+ static PARAMETERS: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"%[0-9]*\$").unwrap());
impl Normalize for StringValue {
fn normalize(&self) -> String {
@@ -35,9 +35,9 @@ mod gettext {
use super::*;
use crate::gettext::MsgString;
- static ESCAPED_SINGLE_QUOTES: Lazy<Regex> = Lazy::new(|| Regex::new(r"\\'").unwrap());
- static ESCAPED_DOUBLE_QUOTES: Lazy<Regex> = Lazy::new(|| Regex::new(r#"\\""#).unwrap());
- static PARAMETERS: Lazy<Regex> = Lazy::new(|| Regex::new(r"%\([^)]*\)").unwrap());
+ static ESCAPED_SINGLE_QUOTES: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"\\'").unwrap());
+ static ESCAPED_DOUBLE_QUOTES: LazyLock<Regex> = LazyLock::new(|| Regex::new(r#"\\""#).unwrap());
+ static PARAMETERS: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"%\([^)]*\)").unwrap());
impl Normalize for MsgString {
fn normalize(&self) -> String {
diff --git a/mullvad-api/Cargo.toml b/mullvad-api/Cargo.toml
index 10b1cddce1..dacb6a7978 100644
--- a/mullvad-api/Cargo.toml
+++ b/mullvad-api/Cargo.toml
@@ -29,7 +29,6 @@ tokio = { workspace = true, features = ["macros", "time", "rt-multi-thread", "ne
tokio-rustls = "0.24.1"
tokio-socks = "0.5.1"
rustls-pemfile = "1.0.3"
-once_cell = { workspace = true }
mullvad-fs = { path = "../mullvad-fs" }
mullvad-types = { path = "../mullvad-types" }
diff --git a/mullvad-api/src/tls_stream.rs b/mullvad-api/src/tls_stream.rs
index 74b6e9b27d..bf4ff336f5 100644
--- a/mullvad-api/src/tls_stream.rs
+++ b/mullvad-api/src/tls_stream.rs
@@ -7,7 +7,7 @@ use std::{
};
use hyper::client::connect::{Connected, Connection};
-use once_cell::sync::Lazy;
+use std::sync::LazyLock;
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
use tokio_rustls::{
rustls::{self, ClientConfig, ServerName},
@@ -25,7 +25,7 @@ where
S: AsyncRead + AsyncWrite + Unpin,
{
pub async fn connect_https(stream: S, domain: &str) -> io::Result<TlsStream<S>> {
- static TLS_CONFIG: Lazy<Arc<ClientConfig>> = Lazy::new(|| {
+ static TLS_CONFIG: LazyLock<Arc<ClientConfig>> = LazyLock::new(|| {
let config = ClientConfig::builder()
.with_safe_default_cipher_suites()
.with_safe_default_kx_groups()
diff --git a/mullvad-daemon/Cargo.toml b/mullvad-daemon/Cargo.toml
index 0aaa6565ee..7a231ff69e 100644
--- a/mullvad-daemon/Cargo.toml
+++ b/mullvad-daemon/Cargo.toml
@@ -20,7 +20,6 @@ thiserror = { workspace = true }
either = "1.11"
fern = { version = "0.6", features = ["colored"] }
futures = "0.3"
-once_cell = { workspace = true }
libc = "0.2"
log = { workspace = true }
regex = "1.0"
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);
diff --git a/mullvad-management-interface/Cargo.toml b/mullvad-management-interface/Cargo.toml
index 352b1e631c..75c6f1b0ad 100644
--- a/mullvad-management-interface/Cargo.toml
+++ b/mullvad-management-interface/Cargo.toml
@@ -27,7 +27,6 @@ log = { workspace = true }
[target.'cfg(unix)'.dependencies]
nix = "0.23"
-once_cell = { workspace = true }
[build-dependencies]
tonic-build = { workspace = true, default-features = false, features = ["transport", "prost"] }
diff --git a/mullvad-management-interface/src/lib.rs b/mullvad-management-interface/src/lib.rs
index 76564ff3db..7abe9f761c 100644
--- a/mullvad-management-interface/src/lib.rs
+++ b/mullvad-management-interface/src/lib.rs
@@ -24,10 +24,10 @@ pub type ManagementServiceClient =
pub use types::management_service_server::{ManagementService, ManagementServiceServer};
#[cfg(unix)]
-use once_cell::sync::Lazy;
+use std::sync::LazyLock;
#[cfg(unix)]
-static MULLVAD_MANAGEMENT_SOCKET_GROUP: Lazy<Option<String>> =
- Lazy::new(|| env::var("MULLVAD_MANAGEMENT_SOCKET_GROUP").ok());
+static MULLVAD_MANAGEMENT_SOCKET_GROUP: LazyLock<Option<String>> =
+ LazyLock::new(|| env::var("MULLVAD_MANAGEMENT_SOCKET_GROUP").ok());
pub const CUSTOM_LIST_LIST_NOT_FOUND_DETAILS: &[u8] = b"custom_list_list_not_found";
pub const CUSTOM_LIST_LIST_EXISTS_DETAILS: &[u8] = b"custom_list_list_exists";
diff --git a/mullvad-problem-report/Cargo.toml b/mullvad-problem-report/Cargo.toml
index 53cc7a9d51..75360267b5 100644
--- a/mullvad-problem-report/Cargo.toml
+++ b/mullvad-problem-report/Cargo.toml
@@ -13,7 +13,6 @@ workspace = true
[dependencies]
dirs = "5.0.1"
thiserror = { workspace = true }
-once_cell = { workspace = true }
log = { workspace = true }
regex = "1.0"
uuid = { version = "1.4.1", features = ["v4"] }
diff --git a/mullvad-problem-report/src/lib.rs b/mullvad-problem-report/src/lib.rs
index 74076a8b5a..270de55f95 100644
--- a/mullvad-problem-report/src/lib.rs
+++ b/mullvad-problem-report/src/lib.rs
@@ -1,5 +1,4 @@
use mullvad_api::proxy::ApiConnectionMode;
-use once_cell::sync::Lazy;
use regex::Regex;
use std::{
borrow::Cow,
@@ -9,6 +8,7 @@ use std::{
fs::{self, File},
io::{self, BufWriter, Read, Seek, SeekFrom, Write},
path::{Path, PathBuf},
+ sync::LazyLock,
};
use talpid_types::ErrorExt;
@@ -406,7 +406,7 @@ impl ProblemReport {
}
fn redact_account_number(input: &str) -> Cow<'_, str> {
- static RE: Lazy<Regex> = Lazy::new(|| Regex::new("\\d{16}").unwrap());
+ static RE: LazyLock<Regex> = LazyLock::new(|| Regex::new("\\d{16}").unwrap());
RE.replace_all(input, "[REDACTED ACCOUNT NUMBER]")
}
@@ -415,7 +415,7 @@ impl ProblemReport {
}
fn redact_network_info(input: &str) -> Cow<'_, str> {
- static RE: Lazy<Regex> = Lazy::new(|| {
+ static RE: LazyLock<Regex> = LazyLock::new(|| {
let boundary = "[^0-9a-zA-Z.:]";
let combined_pattern = format!(
"(?P<start>^|{})(?:{}|{}|{})",
@@ -430,7 +430,7 @@ impl ProblemReport {
}
fn redact_guids(input: &str) -> Cow<'_, str> {
- static RE: Lazy<Regex> = Lazy::new(|| {
+ static RE: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(r"(?i)\{?[A-F0-9]{8}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{12}\}?")
.unwrap()
});
diff --git a/mullvad-relay-selector/Cargo.toml b/mullvad-relay-selector/Cargo.toml
index 7f8436bacb..c113d401ba 100644
--- a/mullvad-relay-selector/Cargo.toml
+++ b/mullvad-relay-selector/Cargo.toml
@@ -16,7 +16,6 @@ thiserror = { workspace = true }
ipnetwork = { workspace = true }
itertools = "0.12"
log = { workspace = true }
-once_cell = { workspace = true }
rand = "0.8.5"
serde_json = { workspace = true }
diff --git a/mullvad-relay-selector/src/relay_selector/mod.rs b/mullvad-relay-selector/src/relay_selector/mod.rs
index 7ee4d7bcd5..6e82252f14 100644
--- a/mullvad-relay-selector/src/relay_selector/mod.rs
+++ b/mullvad-relay-selector/src/relay_selector/mod.rs
@@ -8,12 +8,11 @@ pub mod query;
use chrono::{DateTime, Local};
use itertools::Itertools;
-use once_cell::sync::Lazy;
use query::ObfuscationQuery;
use rand::{seq::IteratorRandom, thread_rng};
use std::{
path::Path,
- sync::{Arc, Mutex},
+ sync::{Arc, LazyLock, Mutex},
time::SystemTime,
};
@@ -52,7 +51,7 @@ use self::{
/// preferences. See [the documentation on `RelayQuery`][RelayQuery] for further details.
///
/// This list should be kept in sync with the expected behavior defined in `docs/relay-selector.md`
-pub static RETRY_ORDER: Lazy<Vec<RelayQuery>> = Lazy::new(|| {
+pub static RETRY_ORDER: LazyLock<Vec<RelayQuery>> = LazyLock::new(|| {
use query::builder::{IpVersion, RelayQueryBuilder};
vec![
// 1
diff --git a/mullvad-relay-selector/tests/relay_selector.rs b/mullvad-relay-selector/tests/relay_selector.rs
index 9ee9e7371d..9e7eb9c31c 100644
--- a/mullvad-relay-selector/tests/relay_selector.rs
+++ b/mullvad-relay-selector/tests/relay_selector.rs
@@ -1,9 +1,9 @@
//! Tests for verifying that the relay selector works as expected.
-use once_cell::sync::Lazy;
use std::{
collections::HashSet,
net::{IpAddr, Ipv4Addr, Ipv6Addr},
+ sync::LazyLock,
};
use talpid_types::net::{
obfuscation::ObfuscatorConfig,
@@ -32,7 +32,7 @@ use mullvad_types::{
},
};
-static RELAYS: Lazy<RelayList> = Lazy::new(|| RelayList {
+static RELAYS: LazyLock<RelayList> = LazyLock::new(|| RelayList {
etag: None,
countries: vec![RelayListCountry {
name: "Sweden".to_string(),
@@ -185,7 +185,7 @@ static RELAYS: Lazy<RelayList> = Lazy::new(|| RelayList {
});
/// A Shadowsocks relay with additional addresses
-static SHADOWSOCKS_RELAY: Lazy<Relay> = Lazy::new(|| Relay {
+static SHADOWSOCKS_RELAY: LazyLock<Relay> = LazyLock::new(|| Relay {
hostname: SHADOWSOCKS_RELAY_LOCATION
.get_hostname()
.unwrap()
@@ -212,8 +212,8 @@ const SHADOWSOCKS_RELAY_EXTRA_ADDRS: &[IpAddr; 2] = &[
IpAddr::V4(Ipv4Addr::new(123, 123, 123, 2)),
IpAddr::V6(Ipv6Addr::new(0x123, 0, 0, 0, 0, 0, 0, 2)),
];
-static SHADOWSOCKS_RELAY_LOCATION: Lazy<GeographicLocationConstraint> =
- Lazy::new(|| GeographicLocationConstraint::hostname("se", "got", "se1337-wireguard"));
+static SHADOWSOCKS_RELAY_LOCATION: LazyLock<GeographicLocationConstraint> =
+ LazyLock::new(|| GeographicLocationConstraint::hostname("se", "got", "se1337-wireguard"));
// Helper functions
fn unwrap_relay(get_result: GetRelay) -> Relay {
diff --git a/mullvad-setup/Cargo.toml b/mullvad-setup/Cargo.toml
index f8a8239f43..0b526b8ff6 100644
--- a/mullvad-setup/Cargo.toml
+++ b/mullvad-setup/Cargo.toml
@@ -18,7 +18,6 @@ path = "src/main.rs"
clap = { workspace = true }
env_logger = { workspace = true }
thiserror = { workspace = true }
-once_cell = { workspace = true }
mullvad-management-interface = { path = "../mullvad-management-interface" }
diff --git a/mullvad-setup/src/main.rs b/mullvad-setup/src/main.rs
index 34155fbb71..f937f04e7e 100644
--- a/mullvad-setup/src/main.rs
+++ b/mullvad-setup/src/main.rs
@@ -1,6 +1,5 @@
use clap::Parser;
-use once_cell::sync::Lazy;
-use std::{path::PathBuf, process, str::FromStr, time::Duration};
+use std::{path::PathBuf, process, str::FromStr, sync::LazyLock, time::Duration};
use mullvad_api::{proxy::ApiConnectionMode, DEVICE_NOT_FOUND};
use mullvad_management_interface::MullvadProxyClient;
@@ -9,8 +8,8 @@ use talpid_core::firewall::{self, Firewall};
use talpid_future::retry::{retry_future, ConstantInterval};
use talpid_types::ErrorExt;
-static APP_VERSION: Lazy<ParsedAppVersion> =
- Lazy::new(|| ParsedAppVersion::from_str(mullvad_version::VERSION).unwrap());
+static APP_VERSION: LazyLock<ParsedAppVersion> =
+ LazyLock::new(|| ParsedAppVersion::from_str(mullvad_version::VERSION).unwrap());
const DEVICE_REMOVAL_STRATEGY: ConstantInterval = ConstantInterval::new(Duration::ZERO, Some(5));
diff --git a/mullvad-types/Cargo.toml b/mullvad-types/Cargo.toml
index 4e53931b30..adddfef0f5 100644
--- a/mullvad-types/Cargo.toml
+++ b/mullvad-types/Cargo.toml
@@ -15,7 +15,6 @@ either = "1.11"
chrono = { workspace = true, features = ["clock", "serde"] }
thiserror = { workspace = true }
ipnetwork = { workspace = true }
-once_cell = { workspace = true }
log = { workspace = true }
regex = "1"
serde = { workspace = true, features = ["derive"] }
diff --git a/mullvad-types/src/auth_failed.rs b/mullvad-types/src/auth_failed.rs
index 6c118ff0eb..335f8463f3 100644
--- a/mullvad-types/src/auth_failed.rs
+++ b/mullvad-types/src/auth_failed.rs
@@ -1,5 +1,5 @@
-use once_cell::sync::Lazy;
use regex::Regex;
+use std::sync::LazyLock;
use talpid_types::tunnel::ErrorStateCause;
/// Used to parse [`talpid_types::tunnel::ErrorStateCause::AuthFailed`], which may be returned
@@ -68,7 +68,7 @@ impl TryFrom<&ErrorStateCause> for AuthFailed {
// * "This is not a valid Mullvad account" - human-readable message (ignored).
// In the case that the message has preceding whitespace, it will be trimmed.
fn parse_string(reason: &str) -> Option<&str> {
- static REASON_REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"^\[(\w+)\]\s*").unwrap());
+ static REASON_REGEX: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"^\[(\w+)\]\s*").unwrap());
let captures = REASON_REGEX.captures(reason)?;
captures.get(1).map(|m| m.as_str())
}
diff --git a/mullvad-types/src/version.rs b/mullvad-types/src/version.rs
index 682070735a..1ca5785147 100644
--- a/mullvad-types/src/version.rs
+++ b/mullvad-types/src/version.rs
@@ -1,16 +1,17 @@
-use once_cell::sync::Lazy;
use regex::Regex;
use serde::{Deserialize, Serialize};
use std::{
cmp::Ordering,
fmt::{self, Formatter},
str::FromStr,
+ sync::LazyLock,
};
-static STABLE_REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"^(\d{4})\.(\d+)$").unwrap());
-static BETA_REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"^(\d{4})\.(\d+)-beta(\d+)$").unwrap());
-static DEV_REGEX: Lazy<Regex> =
- Lazy::new(|| Regex::new(r"^(\d{4})\.(\d+)(\.\d+)?(-beta(\d+))?-dev-(\w+)$").unwrap());
+static STABLE_REGEX: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"^(\d{4})\.(\d+)$").unwrap());
+static BETA_REGEX: LazyLock<Regex> =
+ LazyLock::new(|| Regex::new(r"^(\d{4})\.(\d+)-beta(\d+)$").unwrap());
+static DEV_REGEX: LazyLock<Regex> =
+ LazyLock::new(|| Regex::new(r"^(\d{4})\.(\d+)(\.\d+)?(-beta(\d+))?-dev-(\w+)$").unwrap());
/// AppVersionInfo represents the current stable and the current latest release versions of the
/// Mullvad VPN app.
diff --git a/talpid-core/Cargo.toml b/talpid-core/Cargo.toml
index 20b69e8afc..be8d6ca39b 100644
--- a/talpid-core/Cargo.toml
+++ b/talpid-core/Cargo.toml
@@ -17,7 +17,6 @@ futures = "0.3.15"
ipnetwork = { workspace = true }
libc = "0.2"
log = { workspace = true }
-once_cell = { workspace = true }
parking_lot = "0.12.0"
rand = "0.8.5"
talpid-routing = { path = "../talpid-routing" }
@@ -67,6 +66,7 @@ bitflags = "1.2"
widestring = "1.0"
winreg = { version = "0.51", features = ["transactions"] }
memoffset = "0.6"
+once_cell = { workspace = true }
windows-service = "0.6.0"
talpid-windows = { path = "../talpid-windows" }
diff --git a/talpid-core/src/firewall/linux.rs b/talpid-core/src/firewall/linux.rs
index accac083c3..5f3489649a 100644
--- a/talpid-core/src/firewall/linux.rs
+++ b/talpid-core/src/firewall/linux.rs
@@ -5,12 +5,12 @@ use nftnl::{
expr::{self, IcmpCode, Payload, RejectionType, Verdict},
nft_expr, table, Batch, Chain, FinalizedBatch, ProtoFamily, Rule, Table,
};
-use once_cell::sync::Lazy;
use std::{
env,
- ffi::{CStr, CString},
+ ffi::CStr,
fs, io,
net::{IpAddr, Ipv4Addr},
+ sync::LazyLock,
};
use talpid_types::net::{
AllowedEndpoint, AllowedTunnelTraffic, Endpoint, TransportProtocol, ALLOWED_LAN_MULTICAST_NETS,
@@ -55,23 +55,23 @@ pub enum Error {
/// TODO(linus): This crate is not supposed to be Mullvad-aware. So at some point this should be
/// replaced by allowing the table name to be configured from the public API of this crate.
-static TABLE_NAME: Lazy<CString> = Lazy::new(|| CString::new("mullvad").unwrap());
-static IN_CHAIN_NAME: Lazy<CString> = Lazy::new(|| CString::new("input").unwrap());
-static OUT_CHAIN_NAME: Lazy<CString> = Lazy::new(|| CString::new("output").unwrap());
-static FORWARD_CHAIN_NAME: Lazy<CString> = Lazy::new(|| CString::new("forward").unwrap());
-static PREROUTING_CHAIN_NAME: Lazy<CString> = Lazy::new(|| CString::new("prerouting").unwrap());
-static MANGLE_CHAIN_NAME: Lazy<CString> = Lazy::new(|| CString::new("mangle").unwrap());
-static NAT_CHAIN_NAME: Lazy<CString> = Lazy::new(|| CString::new("nat").unwrap());
+const TABLE_NAME: &CStr = c"mullvad";
+const IN_CHAIN_NAME: &CStr = c"input";
+const OUT_CHAIN_NAME: &CStr = c"output";
+const FORWARD_CHAIN_NAME: &CStr = c"forward";
+const PREROUTING_CHAIN_NAME: &CStr = c"prerouting";
+const MANGLE_CHAIN_NAME: &CStr = c"mangle";
+const NAT_CHAIN_NAME: &CStr = c"nat";
/// Allows controlling whether firewall rules should have packet counters or not from an env
/// variable. Useful for debugging the rules.
-static ADD_COUNTERS: Lazy<bool> = Lazy::new(|| {
+static ADD_COUNTERS: LazyLock<bool> = LazyLock::new(|| {
env::var("TALPID_FIREWALL_DEBUG")
.map(|v| v != "0")
.unwrap_or(false)
});
-static DONT_SET_SRC_VALID_MARK: Lazy<bool> = Lazy::new(|| {
+static DONT_SET_SRC_VALID_MARK: LazyLock<bool> = LazyLock::new(|| {
env::var("TALPID_FIREWALL_DONT_SET_SRC_VALID_MARK")
.map(|v| v != "0")
.unwrap_or(false)
@@ -104,15 +104,15 @@ impl Firewall {
}
pub fn apply_policy(&mut self, policy: FirewallPolicy) -> Result<()> {
- let table = Table::new(&*TABLE_NAME, ProtoFamily::Inet);
+ let table = Table::new(&TABLE_NAME, ProtoFamily::Inet);
let batch = PolicyBatch::new(&table).finalize(&policy, self.fwmark)?;
Self::send_and_process(&batch)?;
Self::apply_kernel_config(&policy);
- self.verify_tables(&[&TABLE_NAME])
+ self.verify_tables(&[TABLE_NAME])
}
pub fn reset_policy(&mut self) -> Result<()> {
- let table = Table::new(&*TABLE_NAME, ProtoFamily::Inet);
+ let table = Table::new(&TABLE_NAME, ProtoFamily::Inet);
let mut batch = Batch::new();
// Our batch will add and remove the table even though the goal is just to remove
@@ -235,33 +235,33 @@ impl<'a> PolicyBatch<'a> {
batch.add(table, nftnl::MsgType::Del);
batch.add(table, nftnl::MsgType::Add);
- let mut prerouting_chain = Chain::new(&*PREROUTING_CHAIN_NAME, table);
+ let mut prerouting_chain = Chain::new(&PREROUTING_CHAIN_NAME, table);
prerouting_chain.set_hook(nftnl::Hook::PreRouting, PREROUTING_CHAIN_PRIORITY);
prerouting_chain.set_type(nftnl::ChainType::Filter);
batch.add(&prerouting_chain, nftnl::MsgType::Add);
- let mut out_chain = Chain::new(&*OUT_CHAIN_NAME, table);
+ let mut out_chain = Chain::new(&OUT_CHAIN_NAME, table);
out_chain.set_hook(nftnl::Hook::Out, 0);
out_chain.set_policy(nftnl::Policy::Drop);
batch.add(&out_chain, nftnl::MsgType::Add);
- let mut in_chain = Chain::new(&*IN_CHAIN_NAME, table);
+ let mut in_chain = Chain::new(&IN_CHAIN_NAME, table);
in_chain.set_hook(nftnl::Hook::In, 0);
in_chain.set_policy(nftnl::Policy::Drop);
batch.add(&in_chain, nftnl::MsgType::Add);
- let mut forward_chain = Chain::new(&*FORWARD_CHAIN_NAME, table);
+ let mut forward_chain = Chain::new(&FORWARD_CHAIN_NAME, table);
forward_chain.set_hook(nftnl::Hook::Forward, 0);
forward_chain.set_policy(nftnl::Policy::Drop);
batch.add(&forward_chain, nftnl::MsgType::Add);
- let mut mangle_chain = Chain::new(&*MANGLE_CHAIN_NAME, table);
+ let mut mangle_chain = Chain::new(&MANGLE_CHAIN_NAME, table);
mangle_chain.set_hook(nftnl::Hook::Out, MANGLE_CHAIN_PRIORITY);
mangle_chain.set_type(nftnl::ChainType::Route);
mangle_chain.set_policy(nftnl::Policy::Accept);
batch.add(&mangle_chain, nftnl::MsgType::Add);
- let mut nat_chain = Chain::new(&*NAT_CHAIN_NAME, table);
+ let mut nat_chain = Chain::new(&NAT_CHAIN_NAME, table);
nat_chain.set_hook(nftnl::Hook::PostRouting, libc::NF_IP_PRI_NAT_SRC);
nat_chain.set_type(nftnl::ChainType::Nat);
nat_chain.set_policy(nftnl::Policy::Accept);
@@ -1066,13 +1066,12 @@ fn set_src_valid_mark_sysctl() -> io::Result<()> {
/// Tables that are no longer used but need to be deleted due to upgrades.
/// This can be removed when upgrades from 2023.3 are no longer supported.
fn batch_deprecated_tables(batch: &mut Batch) {
- static MANGLE_TABLE_NAME_V4: Lazy<CString> =
- Lazy::new(|| CString::new("mullvadmangle4").unwrap());
- static MANGLE_TABLE_NAME_V6: Lazy<CString> =
- Lazy::new(|| CString::new("mullvadmangle6").unwrap());
+ const MANGLE_TABLE_NAME_V4: &CStr = c"mullvadmangle4";
+ const MANGLE_TABLE_NAME_V6: &CStr = c"mullvadmangle6";
+
let tables = [
- Table::new(&*MANGLE_TABLE_NAME_V4, ProtoFamily::Ipv4),
- Table::new(&*MANGLE_TABLE_NAME_V6, ProtoFamily::Ipv6),
+ Table::new(&MANGLE_TABLE_NAME_V4, ProtoFamily::Ipv4),
+ Table::new(&MANGLE_TABLE_NAME_V6, ProtoFamily::Ipv6),
];
for table in &tables {
batch.add(table, nftnl::MsgType::Add);
diff --git a/talpid-core/src/firewall/mod.rs b/talpid-core/src/firewall/mod.rs
index 1ef8fd7af7..c9c351bb59 100644
--- a/talpid-core/src/firewall/mod.rs
+++ b/talpid-core/src/firewall/mod.rs
@@ -1,8 +1,8 @@
use ipnetwork::{IpNetwork, Ipv4Network, Ipv6Network};
-use once_cell::sync::Lazy;
use std::{
fmt,
net::{IpAddr, Ipv4Addr, Ipv6Addr},
+ sync::LazyLock,
};
use talpid_types::net::{AllowedEndpoint, AllowedTunnelTraffic, ALLOWED_LAN_NETS};
@@ -25,23 +25,24 @@ mod imp;
pub use self::imp::Error;
#[cfg(any(target_os = "linux", target_os = "macos"))]
-static IPV6_LINK_LOCAL: Lazy<Ipv6Network> =
- Lazy::new(|| Ipv6Network::new(Ipv6Addr::new(0xfe80, 0, 0, 0, 0, 0, 0, 0), 10).unwrap());
+static IPV6_LINK_LOCAL: LazyLock<Ipv6Network> =
+ LazyLock::new(|| Ipv6Network::new(Ipv6Addr::new(0xfe80, 0, 0, 0, 0, 0, 0, 0), 10).unwrap());
/// The allowed target addresses of outbound DHCPv6 requests
#[cfg(any(target_os = "linux", target_os = "macos"))]
-static DHCPV6_SERVER_ADDRS: Lazy<[Ipv6Addr; 2]> = Lazy::new(|| {
+static DHCPV6_SERVER_ADDRS: LazyLock<[Ipv6Addr; 2]> = LazyLock::new(|| {
[
Ipv6Addr::new(0xff02, 0, 0, 0, 0, 0, 1, 2),
Ipv6Addr::new(0xff05, 0, 0, 0, 0, 0, 1, 3),
]
});
#[cfg(any(target_os = "linux", target_os = "macos"))]
-static ROUTER_SOLICITATION_OUT_DST_ADDR: Lazy<Ipv6Addr> =
- Lazy::new(|| Ipv6Addr::new(0xff02, 0, 0, 0, 0, 0, 0, 2));
+static ROUTER_SOLICITATION_OUT_DST_ADDR: LazyLock<Ipv6Addr> =
+ LazyLock::new(|| Ipv6Addr::new(0xff02, 0, 0, 0, 0, 0, 0, 2));
#[cfg(any(target_os = "linux", target_os = "macos"))]
-static SOLICITED_NODE_MULTICAST: Lazy<Ipv6Network> =
- Lazy::new(|| Ipv6Network::new(Ipv6Addr::new(0xff02, 0, 0, 0, 0, 1, 0xFF00, 0), 104).unwrap());
-static LOOPBACK_NETS: Lazy<[IpNetwork; 2]> = Lazy::new(|| {
+static SOLICITED_NODE_MULTICAST: LazyLock<Ipv6Network> = LazyLock::new(|| {
+ Ipv6Network::new(Ipv6Addr::new(0xff02, 0, 0, 0, 0, 1, 0xFF00, 0), 104).unwrap()
+});
+static LOOPBACK_NETS: LazyLock<[IpNetwork; 2]> = LazyLock::new(|| {
[
IpNetwork::V4(Ipv4Network::new(Ipv4Addr::new(127, 0, 0, 0), 8).unwrap()),
IpNetwork::V6(Ipv6Network::new(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1), 128).unwrap()),
diff --git a/talpid-core/src/offline/mod.rs b/talpid-core/src/offline/mod.rs
index cb3d1d8b29..0e1d55c273 100644
--- a/talpid-core/src/offline/mod.rs
+++ b/talpid-core/src/offline/mod.rs
@@ -1,5 +1,5 @@
use futures::channel::mpsc::UnboundedSender;
-use once_cell::sync::Lazy;
+use std::sync::LazyLock;
#[cfg(not(target_os = "android"))]
use talpid_routing::RouteManagerHandle;
#[cfg(target_os = "android")]
@@ -23,7 +23,7 @@ mod imp;
mod imp;
/// Disables offline monitor
-static FORCE_DISABLE_OFFLINE_MONITOR: Lazy<bool> = Lazy::new(|| {
+static FORCE_DISABLE_OFFLINE_MONITOR: LazyLock<bool> = LazyLock::new(|| {
std::env::var("TALPID_DISABLE_OFFLINE_MONITOR")
.map(|v| v != "0")
.unwrap_or(false)
diff --git a/talpid-core/src/resolver.rs b/talpid-core/src/resolver.rs
index 30942d34fe..97f1f4b79c 100644
--- a/talpid-core/src/resolver.rs
+++ b/talpid-core/src/resolver.rs
@@ -28,12 +28,12 @@ use hickory_server::{
server::{Request, RequestHandler, ResponseHandler, ResponseInfo},
ServerFuture,
};
-use once_cell::sync::Lazy;
+use std::sync::LazyLock;
const ALLOWED_RECORD_TYPES: &[RecordType] = &[RecordType::A, RecordType::CNAME];
const CAPTIVE_PORTAL_DOMAINS: &[&str] = &["captive.apple.com", "netcts.cdn-apple.com"];
-static ALLOWED_DOMAINS: Lazy<Vec<LowerName>> = Lazy::new(|| {
+static ALLOWED_DOMAINS: LazyLock<Vec<LowerName>> = LazyLock::new(|| {
CAPTIVE_PORTAL_DOMAINS
.iter()
.map(|domain| LowerName::from(Name::from_str(domain).unwrap()))
diff --git a/talpid-core/src/split_tunnel/macos/process.rs b/talpid-core/src/split_tunnel/macos/process.rs
index b5db9ac708..52e0fb1862 100644
--- a/talpid-core/src/split_tunnel/macos/process.rs
+++ b/talpid-core/src/split_tunnel/macos/process.rs
@@ -7,7 +7,6 @@
use futures::channel::oneshot;
use libc::{proc_listallpids, proc_pidpath};
-use once_cell::sync::Lazy;
use serde::Deserialize;
use std::{
collections::{HashMap, HashSet},
@@ -16,7 +15,7 @@ use std::{
path::PathBuf,
process::Stdio,
ptr,
- sync::{Arc, Mutex},
+ sync::{Arc, LazyLock, Mutex},
time::Duration,
};
use talpid_platform_metadata::MacosVersion;
@@ -26,8 +25,8 @@ use tokio::io::{AsyncBufReadExt, BufReader};
const SHUTDOWN_TIMEOUT: Duration = Duration::from_secs(3);
const EARLY_FAIL_TIMEOUT: Duration = Duration::from_millis(500);
-static MIN_OS_VERSION: Lazy<MacosVersion> =
- Lazy::new(|| MacosVersion::from_raw_version("13.0.0").unwrap());
+static MIN_OS_VERSION: LazyLock<MacosVersion> =
+ LazyLock::new(|| MacosVersion::from_raw_version("13.0.0").unwrap());
#[derive(thiserror::Error, Debug)]
pub enum Error {
diff --git a/talpid-dbus/Cargo.toml b/talpid-dbus/Cargo.toml
index b81af13602..4e5880bdb8 100644
--- a/talpid-dbus/Cargo.toml
+++ b/talpid-dbus/Cargo.toml
@@ -12,7 +12,6 @@ workspace = true
[target.'cfg(target_os = "linux")'.dependencies]
dbus = "0.9"
thiserror = { workspace = true }
-once_cell = { workspace = true }
log = { workspace = true }
libc = "0.2"
tokio = { workspace = true, features = ["rt"] }
diff --git a/talpid-dbus/src/lib.rs b/talpid-dbus/src/lib.rs
index d077c245e5..e2c8a64d70 100644
--- a/talpid-dbus/src/lib.rs
+++ b/talpid-dbus/src/lib.rs
@@ -2,13 +2,13 @@
//! DBus system connection
pub use dbus;
use dbus::blocking::SyncConnection;
-use once_cell::sync::Lazy;
-use std::sync::{Arc, Mutex};
+use std::sync::{Arc, LazyLock, Mutex};
pub mod network_manager;
pub mod systemd;
pub mod systemd_resolved;
-static DBUS_CONNECTION: Lazy<Mutex<Option<Arc<SyncConnection>>>> = Lazy::new(|| Mutex::new(None));
+static DBUS_CONNECTION: LazyLock<Mutex<Option<Arc<SyncConnection>>>> =
+ LazyLock::new(|| Mutex::new(None));
/// Reuse or create a system DBus connection.
pub fn get_connection() -> Result<Arc<SyncConnection>, dbus::Error> {
diff --git a/talpid-dbus/src/systemd_resolved.rs b/talpid-dbus/src/systemd_resolved.rs
index 31e24008df..b678d5bf20 100644
--- a/talpid-dbus/src/systemd_resolved.rs
+++ b/talpid-dbus/src/systemd_resolved.rs
@@ -7,8 +7,13 @@ use dbus::{
message::{MatchRule, SignalArgs},
};
use libc::{AF_INET, AF_INET6};
-use once_cell::sync::Lazy;
-use std::{fs, io, net::IpAddr, path::Path, sync::Arc, time::Duration};
+use std::{
+ fs, io,
+ net::IpAddr,
+ path::Path,
+ sync::{Arc, LazyLock},
+ time::Duration,
+};
pub type Result<T> = std::result::Result<T, Error>;
@@ -57,7 +62,7 @@ pub enum Error {
AsyncTaskError(#[source] tokio::task::JoinError),
}
-static RESOLVED_STUB_PATHS: Lazy<Vec<&'static Path>> = Lazy::new(|| {
+static RESOLVED_STUB_PATHS: LazyLock<Vec<&'static Path>> = LazyLock::new(|| {
vec![
Path::new("/run/systemd/resolve/stub-resolv.conf"),
Path::new("/run/systemd/resolve/resolv.conf"),
diff --git a/talpid-openvpn/Cargo.toml b/talpid-openvpn/Cargo.toml
index dcdbfafdac..4450d56a03 100644
--- a/talpid-openvpn/Cargo.toml
+++ b/talpid-openvpn/Cargo.toml
@@ -14,7 +14,6 @@ workspace = true
async-trait = "0.1"
thiserror = { workspace = true }
futures = "0.3.15"
-once_cell = { workspace = true }
log = { workspace = true }
shell-escape = "0.1"
talpid-routing = { path = "../talpid-routing" }
@@ -34,6 +33,7 @@ prost = { workspace = true }
widestring = "1.0"
winreg = { version = "0.51", features = ["transactions"] }
talpid-windows = { path = "../talpid-windows" }
+once_cell = { workspace = true }
[target.'cfg(windows)'.dependencies.windows-sys]
workspace = true
diff --git a/talpid-openvpn/src/lib.rs b/talpid-openvpn/src/lib.rs
index d665c54c5d..f9d9393994 100644
--- a/talpid-openvpn/src/lib.rs
+++ b/talpid-openvpn/src/lib.rs
@@ -3,11 +3,11 @@
#![deny(missing_docs)]
use crate::proxy::ProxyMonitor;
-#[cfg(windows)]
-use once_cell::sync::Lazy;
use process::openvpn::{OpenVpnCommand, OpenVpnProcHandle};
#[cfg(target_os = "linux")]
use std::collections::{HashMap, HashSet};
+#[cfg(windows)]
+use std::sync::LazyLock;
#[cfg(target_os = "windows")]
use std::{ffi::OsString, sync::Arc};
use std::{
@@ -39,10 +39,11 @@ mod process;
mod proxy;
#[cfg(windows)]
-static ADAPTER_ALIAS: Lazy<U16CString> = Lazy::new(|| U16CString::from_str("Mullvad").unwrap());
+static ADAPTER_ALIAS: LazyLock<U16CString> =
+ LazyLock::new(|| U16CString::from_str("Mullvad").unwrap());
#[cfg(windows)]
-static ADAPTER_TUNNEL_TYPE: Lazy<U16CString> =
- Lazy::new(|| U16CString::from_str("Mullvad").unwrap());
+static ADAPTER_TUNNEL_TYPE: LazyLock<U16CString> =
+ LazyLock::new(|| U16CString::from_str("Mullvad").unwrap());
#[cfg(windows)]
const ADAPTER_GUID: GUID = GUID {
diff --git a/talpid-routing/Cargo.toml b/talpid-routing/Cargo.toml
index 94e9b3cc8f..2c8b99a00b 100644
--- a/talpid-routing/Cargo.toml
+++ b/talpid-routing/Cargo.toml
@@ -22,7 +22,6 @@ talpid-types = { path = "../talpid-types" }
[target.'cfg(target_os = "linux")'.dependencies]
libc = "0.2"
-once_cell = { workspace = true }
rtnetlink = "0.11"
netlink-packet-route = { version = "0.13", features = ["rich_nlas"] }
netlink-sys = "0.8.3"
diff --git a/talpid-routing/src/unix/linux.rs b/talpid-routing/src/unix/linux.rs
index 785105ad56..92b4513301 100644
--- a/talpid-routing/src/unix/linux.rs
+++ b/talpid-routing/src/unix/linux.rs
@@ -31,14 +31,14 @@ use netlink_packet_route::{
rule::{nlas::Nla as RuleNla, RuleHeader, RuleMessage},
NetlinkMessage, NetlinkPayload, RtnlMessage,
};
-use once_cell::sync::Lazy;
use rtnetlink::{
constants::{RTMGRP_IPV4_ROUTE, RTMGRP_IPV6_ROUTE, RTMGRP_LINK, RTMGRP_NOTIFY},
sys::SocketAddr,
Handle, IpVersion,
};
+use std::sync::LazyLock;
-static SUPPRESS_RULE_V4: Lazy<RuleMessage> = Lazy::new(|| RuleMessage {
+static SUPPRESS_RULE_V4: LazyLock<RuleMessage> = LazyLock::new(|| RuleMessage {
header: RuleHeader {
family: AF_INET as u8,
action: FR_ACT_TO_TBL,
@@ -49,7 +49,7 @@ static SUPPRESS_RULE_V4: Lazy<RuleMessage> = Lazy::new(|| RuleMessage {
RuleNla::Table(RT_TABLE_MAIN as u32),
],
});
-static SUPPRESS_RULE_V6: Lazy<RuleMessage> = Lazy::new(|| {
+static SUPPRESS_RULE_V6: LazyLock<RuleMessage> = LazyLock::new(|| {
let mut v6_rule = SUPPRESS_RULE_V4.clone();
v6_rule.header.family = AF_INET6 as u8;
v6_rule
diff --git a/talpid-tunnel/Cargo.toml b/talpid-tunnel/Cargo.toml
index d452b2c20f..21312912f4 100644
--- a/talpid-tunnel/Cargo.toml
+++ b/talpid-tunnel/Cargo.toml
@@ -11,7 +11,6 @@ rust-version.workspace = true
workspace = true
[dependencies]
-once_cell = { workspace = true }
thiserror = { workspace = true }
cfg-if = "1.0"
ipnetwork = { workspace = true }
diff --git a/talpid-tunnel/src/tun_provider/mod.rs b/talpid-tunnel/src/tun_provider/mod.rs
index 20497ab1bb..4eca1c3245 100644
--- a/talpid-tunnel/src/tun_provider/mod.rs
+++ b/talpid-tunnel/src/tun_provider/mod.rs
@@ -1,7 +1,9 @@
use cfg_if::cfg_if;
use ipnetwork::IpNetwork;
-use once_cell::sync::Lazy;
-use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
+use std::{
+ net::{IpAddr, Ipv4Addr, Ipv6Addr},
+ sync::LazyLock,
+};
cfg_if! {
if #[cfg(target_os = "android")] {
@@ -85,13 +87,13 @@ pub fn blocking_config() -> TunConfig {
}
}
-static DEFAULT_ROUTES: Lazy<Vec<IpNetwork>> =
- Lazy::new(|| vec![*IPV4_DEFAULT_ROUTE, *IPV6_DEFAULT_ROUTE]);
-static IPV4_DEFAULT_ROUTE: Lazy<IpNetwork> = Lazy::new(|| {
+static DEFAULT_ROUTES: LazyLock<Vec<IpNetwork>> =
+ LazyLock::new(|| vec![*IPV4_DEFAULT_ROUTE, *IPV6_DEFAULT_ROUTE]);
+static IPV4_DEFAULT_ROUTE: LazyLock<IpNetwork> = LazyLock::new(|| {
IpNetwork::new(IpAddr::V4(Ipv4Addr::UNSPECIFIED), 0)
.expect("Invalid IP network prefix for IPv4 address")
});
-static IPV6_DEFAULT_ROUTE: Lazy<IpNetwork> = Lazy::new(|| {
+static IPV6_DEFAULT_ROUTE: LazyLock<IpNetwork> = LazyLock::new(|| {
IpNetwork::new(IpAddr::V6(Ipv6Addr::UNSPECIFIED), 0)
.expect("Invalid IP network prefix for IPv6 address")
});
diff --git a/talpid-types/Cargo.toml b/talpid-types/Cargo.toml
index ffca93f1a8..d6e9ddc69f 100644
--- a/talpid-types/Cargo.toml
+++ b/talpid-types/Cargo.toml
@@ -12,7 +12,6 @@ workspace = true
[dependencies]
serde = { workspace = true, features = ["derive"] }
-once_cell = { workspace = true }
ipnetwork = { workspace = true }
base64 = "0.22.0"
x25519-dalek = { version = "2.0.1", features = ["static_secrets", "zeroize", "getrandom"] }
diff --git a/talpid-types/src/net/mod.rs b/talpid-types/src/net/mod.rs
index 5875f33482..1ec8ba46c5 100644
--- a/talpid-types/src/net/mod.rs
+++ b/talpid-types/src/net/mod.rs
@@ -1,6 +1,5 @@
use ipnetwork::{IpNetwork, Ipv4Network, Ipv6Network};
use obfuscation::ObfuscatorConfig;
-use once_cell::sync::Lazy;
use serde::{Deserialize, Serialize};
#[cfg(windows)]
use std::path::PathBuf;
@@ -8,6 +7,7 @@ use std::{
fmt,
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr},
str::FromStr,
+ sync::LazyLock,
};
use self::proxy::{CustomProxy, Socks5Local};
@@ -18,7 +18,7 @@ pub mod proxy;
pub mod wireguard;
/// When "allow local network" is enabled the app will allow traffic to and from these networks.
-pub static ALLOWED_LAN_NETS: Lazy<[IpNetwork; 6]> = Lazy::new(|| {
+pub static ALLOWED_LAN_NETS: LazyLock<[IpNetwork; 6]> = LazyLock::new(|| {
[
IpNetwork::V4(Ipv4Network::new(Ipv4Addr::new(10, 0, 0, 0), 8).unwrap()),
IpNetwork::V4(Ipv4Network::new(Ipv4Addr::new(172, 16, 0, 0), 12).unwrap()),
@@ -28,9 +28,8 @@ pub static ALLOWED_LAN_NETS: Lazy<[IpNetwork; 6]> = Lazy::new(|| {
IpNetwork::V6(Ipv6Network::new(Ipv6Addr::new(0xfc00, 0, 0, 0, 0, 0, 0, 0), 7).unwrap()),
]
});
-
/// When "allow local network" is enabled the app will allow traffic to these networks.
-pub static ALLOWED_LAN_MULTICAST_NETS: Lazy<[IpNetwork; 8]> = Lazy::new(|| {
+pub static ALLOWED_LAN_MULTICAST_NETS: LazyLock<[IpNetwork; 8]> = LazyLock::new(|| {
[
// Local network broadcast. Not routable
IpNetwork::V4(Ipv4Network::new(Ipv4Addr::new(255, 255, 255, 255), 32).unwrap()),
diff --git a/talpid-wireguard/src/lib.rs b/talpid-wireguard/src/lib.rs
index ca59e014ff..0ab83b3262 100644
--- a/talpid-wireguard/src/lib.rs
+++ b/talpid-wireguard/src/lib.rs
@@ -6,12 +6,8 @@ use self::config::Config;
#[cfg(windows)]
use futures::channel::mpsc;
use futures::future::{BoxFuture, Future};
-#[cfg(target_os = "linux")]
-use once_cell::sync::Lazy;
#[cfg(target_os = "android")]
use std::borrow::Cow;
-#[cfg(target_os = "linux")]
-use std::env;
#[cfg(windows)]
use std::io;
use std::{
@@ -22,6 +18,8 @@ use std::{
sync::{mpsc as sync_mpsc, Arc, Mutex},
time::Duration,
};
+#[cfg(target_os = "linux")]
+use std::{env, sync::LazyLock};
use talpid_routing as routing;
use talpid_routing::{self, RequiredRoute};
#[cfg(not(windows))]
@@ -192,7 +190,7 @@ impl Drop for ObfuscatorHandle {
#[cfg(target_os = "linux")]
/// Overrides the preference for the kernel module for WireGuard.
-static FORCE_USERSPACE_WIREGUARD: Lazy<bool> = Lazy::new(|| {
+static FORCE_USERSPACE_WIREGUARD: LazyLock<bool> = LazyLock::new(|| {
env::var("TALPID_FORCE_USERSPACE_WIREGUARD")
.map(|v| v != "0")
.unwrap_or(false)
diff --git a/talpid-wireguard/src/logging.rs b/talpid-wireguard/src/logging.rs
index a4d8c7f240..dcb33b11e3 100644
--- a/talpid-wireguard/src/logging.rs
+++ b/talpid-wireguard/src/logging.rs
@@ -1,8 +1,7 @@
-use once_cell::sync::Lazy;
use parking_lot::Mutex;
-use std::{collections::HashMap, fmt, fs, io::Write, path::Path};
+use std::{collections::HashMap, fmt, fs, io::Write, path::Path, sync::LazyLock};
-static LOG_MUTEX: Lazy<Mutex<LogState>> = Lazy::new(|| Mutex::new(LogState::default()));
+static LOG_MUTEX: LazyLock<Mutex<LogState>> = LazyLock::new(|| Mutex::new(LogState::default()));
#[derive(Default)]
struct LogState {
diff --git a/talpid-wireguard/src/wireguard_nt/mod.rs b/talpid-wireguard/src/wireguard_nt/mod.rs
index 254c503dcf..35937bcb8c 100644
--- a/talpid-wireguard/src/wireguard_nt/mod.rs
+++ b/talpid-wireguard/src/wireguard_nt/mod.rs
@@ -7,7 +7,7 @@ use super::{
use bitflags::bitflags;
use futures::SinkExt;
use ipnetwork::IpNetwork;
-use once_cell::sync::{Lazy, OnceCell};
+use once_cell::sync::OnceCell;
#[cfg(daita)]
use std::{ffi::c_uchar, path::PathBuf};
use std::{
@@ -21,7 +21,7 @@ use std::{
path::Path,
pin::Pin,
ptr,
- sync::{Arc, Mutex},
+ sync::{Arc, LazyLock, Mutex},
};
use talpid_types::{BoxedError, ErrorExt};
use talpid_windows::net;
@@ -42,8 +42,10 @@ use windows_sys::{
mod daita;
static WG_NT_DLL: OnceCell<WgNtDll> = OnceCell::new();
-static ADAPTER_TYPE: Lazy<U16CString> = Lazy::new(|| U16CString::from_str("Mullvad").unwrap());
-static ADAPTER_ALIAS: Lazy<U16CString> = Lazy::new(|| U16CString::from_str("Mullvad").unwrap());
+static ADAPTER_TYPE: LazyLock<U16CString> =
+ LazyLock::new(|| U16CString::from_str("Mullvad").unwrap());
+static ADAPTER_ALIAS: LazyLock<U16CString> =
+ LazyLock::new(|| U16CString::from_str("Mullvad").unwrap());
const ADAPTER_GUID: GUID = GUID {
data1: 0x514a3988,
@@ -553,7 +555,7 @@ impl Drop for WgNtTunnel {
}
}
-static LOG_CONTEXT: Lazy<Mutex<Option<u64>>> = Lazy::new(|| Mutex::new(None));
+static LOG_CONTEXT: LazyLock<Mutex<Option<u64>>> = LazyLock::new(|| Mutex::new(None));
struct LoggerHandle {
dll: &'static WgNtDll,
@@ -1159,11 +1161,11 @@ mod tests {
p0_allowed_ip_0: WgAllowedIp,
}
- static WG_PRIVATE_KEY: Lazy<wireguard::PrivateKey> =
- Lazy::new(wireguard::PrivateKey::new_from_random);
- static WG_PUBLIC_KEY: Lazy<wireguard::PublicKey> =
- Lazy::new(|| wireguard::PrivateKey::new_from_random().public_key());
- static WG_CONFIG: Lazy<Config> = Lazy::new(|| Config {
+ static WG_PRIVATE_KEY: LazyLock<wireguard::PrivateKey> =
+ LazyLock::new(wireguard::PrivateKey::new_from_random);
+ static WG_PUBLIC_KEY: LazyLock<wireguard::PublicKey> =
+ LazyLock::new(|| wireguard::PrivateKey::new_from_random().public_key());
+ static WG_CONFIG: LazyLock<Config> = LazyLock::new(|| Config {
tunnel: wireguard::TunnelConfig {
private_key: WG_PRIVATE_KEY.clone(),
addresses: vec![],
@@ -1185,7 +1187,7 @@ mod tests {
quantum_resistant: false,
});
- static WG_STRUCT_CONFIG: Lazy<Interface> = Lazy::new(|| Interface {
+ static WG_STRUCT_CONFIG: LazyLock<Interface> = LazyLock::new(|| Interface {
interface: WgInterface {
flags: WgInterfaceFlag::HAS_PRIVATE_KEY | WgInterfaceFlag::REPLACE_PEERS,
listen_port: 0,
diff --git a/test/Cargo.lock b/test/Cargo.lock
index 998176ab5a..66b1924b74 100644
--- a/test/Cargo.lock
+++ b/test/Cargo.lock
@@ -1838,7 +1838,6 @@ dependencies = [
"log",
"mullvad-fs",
"mullvad-types",
- "once_cell",
"rustls-pemfile 1.0.4",
"serde",
"serde_json",
@@ -1872,7 +1871,6 @@ dependencies = [
"mullvad-paths",
"mullvad-types",
"nix 0.23.2",
- "once_cell",
"parity-tokio-ipc",
"prost",
"prost-types",
@@ -1905,7 +1903,6 @@ dependencies = [
"itertools 0.12.1",
"log",
"mullvad-types",
- "once_cell",
"rand 0.8.5",
"serde_json",
"talpid-types",
@@ -1921,7 +1918,6 @@ dependencies = [
"intersection-derive",
"ipnetwork",
"log",
- "once_cell",
"regex",
"serde",
"talpid-types",
@@ -3222,7 +3218,6 @@ dependencies = [
"ipnetwork",
"jnix",
"log",
- "once_cell",
"serde",
"thiserror",
"x25519-dalek",
@@ -3349,7 +3344,6 @@ dependencies = [
"hyper",
"hyper-rustls",
"log",
- "once_cell",
"rustls-pemfile 0.2.1",
"serde",
"serde_json",
diff --git a/test/Cargo.toml b/test/Cargo.toml
index 4f8b1931be..d0c734620c 100644
--- a/test/Cargo.toml
+++ b/test/Cargo.toml
@@ -3,7 +3,7 @@ authors = ["Mullvad VPN"]
repository = "https://github.com/mullvad/mullvadvpn-app/"
license = "GPL-3.0"
edition = "2021"
-rust-version = "1.77.0"
+rust-version = "1.80.0"
[workspace]
resolver = "2"
diff --git a/test/test-manager/src/logging.rs b/test/test-manager/src/logging.rs
index 7484c7833d..ce7477cd69 100644
--- a/test/test-manager/src/logging.rs
+++ b/test/test-manager/src/logging.rs
@@ -26,7 +26,7 @@ struct StoredRecord {
impl Logger {
pub fn get_or_init() -> Self {
- static LOGGER: once_cell::sync::Lazy<Logger> = once_cell::sync::Lazy::new(|| {
+ static LOGGER: std::sync::LazyLock<Logger> = std::sync::LazyLock::new(|| {
let mut logger = env_logger::Builder::new();
logger.filter_module("h2", log::LevelFilter::Info);
logger.filter_module("tower", log::LevelFilter::Info);
diff --git a/test/test-manager/src/package.rs b/test/test-manager/src/package.rs
index c644d60b72..295557907e 100644
--- a/test/test-manager/src/package.rs
+++ b/test/test-manager/src/package.rs
@@ -1,9 +1,11 @@
use crate::config::{Architecture, OsType, PackageType, VmConfig};
use anyhow::{Context, Result};
use itertools::Itertools;
-use once_cell::sync::Lazy;
use regex::Regex;
-use std::path::{Path, PathBuf};
+use std::{
+ path::{Path, PathBuf},
+ sync::LazyLock,
+};
#[derive(Debug, Clone)]
pub struct Manifest {
@@ -70,8 +72,8 @@ pub fn get_app_manifest(
}
pub fn get_version_from_path(app_package_path: &Path) -> Result<String, anyhow::Error> {
- static VERSION_REGEX: Lazy<Regex> =
- Lazy::new(|| Regex::new(r"\d{4}\.\d+((-beta\d+)?(-dev)?-([0-9a-z])+)?").unwrap());
+ static VERSION_REGEX: LazyLock<Regex> =
+ LazyLock::new(|| Regex::new(r"\d{4}\.\d+((-beta\d+)?(-dev)?-([0-9a-z])+)?").unwrap());
VERSION_REGEX
.captures(app_package_path.to_str().unwrap())
diff --git a/test/test-manager/src/vm/network/linux.rs b/test/test-manager/src/vm/network/linux.rs
index 34e8438b92..f81131119c 100644
--- a/test/test-manager/src/vm/network/linux.rs
+++ b/test/test-manager/src/vm/network/linux.rs
@@ -1,11 +1,11 @@
use ipnetwork::Ipv4Network;
-use once_cell::sync::Lazy;
use std::{
ffi::OsStr,
io,
net::{IpAddr, Ipv4Addr},
process::Stdio,
str::FromStr,
+ sync::LazyLock,
};
use tokio::{
io::{AsyncBufReadExt, AsyncWriteExt, BufReader},
@@ -13,8 +13,8 @@ use tokio::{
};
/// (Contained) test subnet for the test runner: 172.29.1.1/24
-pub static TEST_SUBNET: Lazy<Ipv4Network> =
- Lazy::new(|| Ipv4Network::new(Ipv4Addr::new(172, 29, 1, 1), 24).unwrap());
+pub static TEST_SUBNET: LazyLock<Ipv4Network> =
+ LazyLock::new(|| Ipv4Network::new(Ipv4Addr::new(172, 29, 1, 1), 24).unwrap());
/// Range of IPs returned by the DNS server: TEST_SUBNET_DHCP_FIRST to TEST_SUBNET_DHCP_LAST
pub const TEST_SUBNET_DHCP_FIRST: Ipv4Addr = Ipv4Addr::new(172, 29, 1, 2);
/// Range of IPs returned by the DNS server: TEST_SUBNET_DHCP_FIRST to TEST_SUBNET_DHCP_LAST
diff --git a/test/test-rpc/Cargo.toml b/test/test-rpc/Cargo.toml
index 24596a09af..c39a2a1975 100644
--- a/test/test-rpc/Cargo.toml
+++ b/test/test-rpc/Cargo.toml
@@ -17,7 +17,6 @@ tokio-serde = { workspace = true }
tarpc = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
-once_cell = { workspace = true }
bytes = { workspace = true }
thiserror = { workspace = true }
log = { workspace = true }
diff --git a/test/test-rpc/src/net.rs b/test/test-rpc/src/net.rs
index 124b4f9ad3..c867ccf0d0 100644
--- a/test/test-rpc/src/net.rs
+++ b/test/test-rpc/src/net.rs
@@ -1,15 +1,14 @@
use futures::channel::oneshot;
use hyper::{Client, Uri};
-use once_cell::sync::Lazy;
use serde::{de::DeserializeOwned, Deserialize, Serialize};
-use std::{net::SocketAddr, time::Duration};
+use std::{net::SocketAddr, sync::LazyLock, time::Duration};
use tokio_rustls::rustls::ClientConfig;
use crate::{AmIMullvad, Error};
const LE_ROOT_CERT: &[u8] = include_bytes!("../../../mullvad-api/le_root_cert.pem");
-static CLIENT_CONFIG: Lazy<ClientConfig> = Lazy::new(|| {
+static CLIENT_CONFIG: LazyLock<ClientConfig> = LazyLock::new(|| {
ClientConfig::builder()
.with_safe_default_cipher_suites()
.with_safe_default_kx_groups()
diff --git a/test/test-runner/src/forward.rs b/test/test-runner/src/forward.rs
index a4c80ae189..01b48e647a 100644
--- a/test/test-runner/src/forward.rs
+++ b/test/test-runner/src/forward.rs
@@ -1,17 +1,16 @@
-use once_cell::sync::Lazy;
use std::{
collections::HashMap,
net::SocketAddr,
sync::{
atomic::{AtomicUsize, Ordering},
- Arc, Mutex,
+ Arc, LazyLock, Mutex,
},
};
use test_rpc::net::SockHandleId;
use tokio::net::{TcpListener, TcpStream};
-static SERVERS: Lazy<Mutex<HashMap<SockHandleId, Handle>>> =
- Lazy::new(|| Mutex::new(HashMap::new()));
+static SERVERS: LazyLock<Mutex<HashMap<SockHandleId, Handle>>> =
+ LazyLock::new(|| Mutex::new(HashMap::new()));
/// Spawn a TCP forwarder that sends TCP via `via_addr`
pub async fn start_server(
diff --git a/test/test-runner/src/logging.rs b/test/test-runner/src/logging.rs
index ffe21de985..2fb8939002 100644
--- a/test/test-runner/src/logging.rs
+++ b/test/test-runner/src/logging.rs
@@ -1,8 +1,8 @@
use log::{Level, LevelFilter, Metadata, Record, SetLoggerError};
-use once_cell::sync::Lazy;
use std::{
ffi::OsStr,
path::{Path, PathBuf},
+ sync::LazyLock,
};
use test_rpc::logging::{Error, LogFile, LogOutput, Output};
use tokio::{
@@ -22,7 +22,7 @@ const EXCLUDE_LOG_FILE_CONTAIN: &str = ".old";
/// Maximum number of lines that each log file may contain
const TRUNCATE_LOG_FILE_LINES: usize = 100;
-pub static LOGGER: Lazy<StdOutBuffer> = Lazy::new(|| {
+pub static LOGGER: LazyLock<StdOutBuffer> = LazyLock::new(|| {
let (sender, listener) = channel(MAX_OUTPUT_BUFFER);
StdOutBuffer(Mutex::new(listener), sender)
});