summaryrefslogtreecommitdiffhomepage
path: root/mullvad-daemon/src
diff options
context:
space:
mode:
authorLinus Färnstrand <faern@faern.net>2021-11-26 13:54:58 +0100
committerLinus Färnstrand <linus@mullvad.net>2021-11-29 13:09:35 +0100
commitbc55e8482e45fa1a42a16078a80400cafb1a4258 (patch)
tree16465e852163a01f8ef713321e1a629daed28764 /mullvad-daemon/src
parent0954877ceaa0ae9d63bc572b6a10088de1273fa7 (diff)
downloadmullvadvpn-bc55e8482e45fa1a42a16078a80400cafb1a4258.tar.xz
mullvadvpn-bc55e8482e45fa1a42a16078a80400cafb1a4258.zip
Reformat code without blank_lines_upper_bound = 2
Diffstat (limited to 'mullvad-daemon/src')
-rw-r--r--mullvad-daemon/src/account.rs1
-rw-r--r--mullvad-daemon/src/account_history.rs1
-rw-r--r--mullvad-daemon/src/lib.rs7
-rw-r--r--mullvad-daemon/src/migrations/account_history.rs3
-rw-r--r--mullvad-daemon/src/migrations/mod.rs1
-rw-r--r--mullvad-daemon/src/migrations/v1.rs1
-rw-r--r--mullvad-daemon/src/migrations/v2.rs2
-rw-r--r--mullvad-daemon/src/migrations/v3.rs2
-rw-r--r--mullvad-daemon/src/migrations/v4.rs3
-rw-r--r--mullvad-daemon/src/relays.rs7
-rw-r--r--mullvad-daemon/src/settings.rs3
-rw-r--r--mullvad-daemon/src/system_service.rs1
-rw-r--r--mullvad-daemon/src/version_check.rs2
-rw-r--r--mullvad-daemon/src/wireguard.rs5
14 files changed, 0 insertions, 39 deletions
diff --git a/mullvad-daemon/src/account.rs b/mullvad-daemon/src/account.rs
index 26795072ab..f5655c9d1f 100644
--- a/mullvad-daemon/src/account.rs
+++ b/mullvad-daemon/src/account.rs
@@ -18,7 +18,6 @@ const RETRY_EXPIRY_CHECK_INTERVAL_INITIAL: Duration = Duration::from_secs(4);
const RETRY_EXPIRY_CHECK_INTERVAL_FACTOR: u32 = 5;
const RETRY_EXPIRY_CHECK_INTERVAL_MAX: Duration = Duration::from_secs(24 * 60 * 60);
-
pub struct Account(());
#[derive(Clone)]
diff --git a/mullvad-daemon/src/account_history.rs b/mullvad-daemon/src/account_history.rs
index da8d86570e..ee3d9932e6 100644
--- a/mullvad-daemon/src/account_history.rs
+++ b/mullvad-daemon/src/account_history.rs
@@ -36,7 +36,6 @@ lazy_static::lazy_static! {
static ref ACCOUNT_REGEX: Regex = Regex::new(r"^[0-9]+$").unwrap();
}
-
impl AccountHistory {
pub async fn new(
settings_dir: &Path,
diff --git a/mullvad-daemon/src/lib.rs b/mullvad-daemon/src/lib.rs
index 80a8061fc8..4442db220e 100644
--- a/mullvad-daemon/src/lib.rs
+++ b/mullvad-daemon/src/lib.rs
@@ -4,7 +4,6 @@
#[macro_use]
extern crate serde;
-
mod account;
pub mod account_history;
pub mod exception_logging;
@@ -602,7 +601,6 @@ where
tx: internal_event_tx.clone(),
};
-
let initial_target_state = if settings.get_account_token().is_some() {
if settings.auto_connect {
// Note: Auto-connect overrides the cached target state
@@ -891,7 +889,6 @@ where
)
}
-
async fn handle_event(&mut self, event: InternalDaemonEvent) {
use self::InternalDaemonEvent::*;
match event {
@@ -938,7 +935,6 @@ where
TunnelStateTransition::Error(error_state) => TunnelState::Error(error_state),
};
-
self.unschedule_reconnect();
debug!("New tunnel state: {:?}", tunnel_state);
@@ -1177,7 +1173,6 @@ where
}
}
-
async fn handle_command(&mut self, command: DaemonCommand) {
use self::DaemonCommand::*;
if !self.state.is_running() {
@@ -2165,7 +2160,6 @@ where
Self::oneshot_send(tx, result, "on_set_bridge_state response");
}
-
async fn on_set_enable_ipv6(&mut self, tx: ResponseTx<(), settings::Error>, enable_ipv6: bool) {
let save_result = self.settings.set_enable_ipv6(enable_ipv6).await;
match save_result {
@@ -2595,7 +2589,6 @@ where
}
}
-
pub fn shutdown_handle(&self) -> DaemonShutdownHandle {
DaemonShutdownHandle {
tx: self.tx.clone(),
diff --git a/mullvad-daemon/src/migrations/account_history.rs b/mullvad-daemon/src/migrations/account_history.rs
index 4dceceb9fd..e2c0f37c3f 100644
--- a/mullvad-daemon/src/migrations/account_history.rs
+++ b/mullvad-daemon/src/migrations/account_history.rs
@@ -8,14 +8,12 @@ use tokio::{
io::{self, AsyncReadExt, AsyncSeekExt, AsyncWriteExt},
};
-
const ACCOUNT_HISTORY_FILE: &str = "account-history.json";
lazy_static::lazy_static! {
static ref ACCOUNT_REGEX: Regex = 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);
let new_path = new_dir.join(ACCOUNT_HISTORY_FILE);
@@ -313,7 +311,6 @@ mod test {
}
"#;
-
// Test whether the current format is parsed correctly
#[test]
fn test_v3() {
diff --git a/mullvad-daemon/src/migrations/mod.rs b/mullvad-daemon/src/migrations/mod.rs
index 28eaa1c83a..6e0bc2c61e 100644
--- a/mullvad-daemon/src/migrations/mod.rs
+++ b/mullvad-daemon/src/migrations/mod.rs
@@ -46,7 +46,6 @@ pub enum Error {
pub type Result<T> = std::result::Result<T, Error>;
-
pub async fn migrate_all(cache_dir: &Path, settings_dir: &Path) -> Result<()> {
#[cfg(windows)]
windows::migrate_after_windows_update(settings_dir)
diff --git a/mullvad-daemon/src/migrations/v1.rs b/mullvad-daemon/src/migrations/v1.rs
index d04812cd00..82b6df3935 100644
--- a/mullvad-daemon/src/migrations/v1.rs
+++ b/mullvad-daemon/src/migrations/v1.rs
@@ -2,7 +2,6 @@ use super::Result;
use mullvad_types::{relay_constraints::Constraint, settings::SettingsVersion};
use talpid_types::net::TunnelType;
-
pub fn migrate(settings: &mut serde_json::Value) -> Result<()> {
if !version_matches(settings) {
return Ok(());
diff --git a/mullvad-daemon/src/migrations/v2.rs b/mullvad-daemon/src/migrations/v2.rs
index 5b0900ca13..46973f06b7 100644
--- a/mullvad-daemon/src/migrations/v2.rs
+++ b/mullvad-daemon/src/migrations/v2.rs
@@ -3,7 +3,6 @@ use crate::wireguard::{MAX_ROTATION_INTERVAL, MIN_ROTATION_INTERVAL};
use mullvad_types::settings::SettingsVersion;
use std::time::Duration;
-
pub fn migrate(settings: &mut serde_json::Value) -> Result<()> {
if !version_matches(settings) {
return Ok(());
@@ -170,7 +169,6 @@ mod test {
}
"#;
-
#[test]
fn test_v2_migration() {
let mut old_settings = serde_json::from_str(V2_SETTINGS).unwrap();
diff --git a/mullvad-daemon/src/migrations/v3.rs b/mullvad-daemon/src/migrations/v3.rs
index 76b3522a96..b7f12f6714 100644
--- a/mullvad-daemon/src/migrations/v3.rs
+++ b/mullvad-daemon/src/migrations/v3.rs
@@ -3,7 +3,6 @@ use mullvad_types::settings::{
CustomDnsOptions, DefaultDnsOptions, DnsOptions, DnsState, SettingsVersion,
};
-
pub fn migrate(settings: &mut serde_json::Value) -> Result<()> {
if !version_matches(settings) {
return Ok(());
@@ -180,7 +179,6 @@ mod test {
}
"#;
-
#[test]
fn test_v3_migration() {
let mut old_settings = serde_json::from_str(V3_SETTINGS).unwrap();
diff --git a/mullvad-daemon/src/migrations/v4.rs b/mullvad-daemon/src/migrations/v4.rs
index 76b88ce987..865b4bbfa6 100644
--- a/mullvad-daemon/src/migrations/v4.rs
+++ b/mullvad-daemon/src/migrations/v4.rs
@@ -5,11 +5,9 @@ use mullvad_types::{
};
use talpid_types::net::TransportProtocol;
-
const WIREGUARD_TCP_PORTS: [u16; 3] = [80, 443, 5001];
const OPENVPN_TCP_PORTS: [u16; 2] = [80, 443];
-
pub fn migrate(settings: &mut serde_json::Value) -> Result<()> {
if !version_matches(settings) {
return Ok(());
@@ -266,7 +264,6 @@ mod test {
}
"#;
-
#[test]
fn test_v4_migration() {
let mut old_settings = serde_json::from_str(V4_SETTINGS).unwrap();
diff --git a/mullvad-daemon/src/relays.rs b/mullvad-daemon/src/relays.rs
index 45541069f3..94b751ddb4 100644
--- a/mullvad-daemon/src/relays.rs
+++ b/mullvad-daemon/src/relays.rs
@@ -62,7 +62,6 @@ const WIREGUARD_EXIT_CONSTRAINTS: WireguardConstraints = WireguardConstraints {
};
const WIREGUARD_TCP_PORTS: [(u16, u16); 3] = [(80, 80), (443, 443), (5001, 5001)];
-
#[derive(err_derive::Error, Debug)]
#[error(no_from)]
pub enum Error {
@@ -215,7 +214,6 @@ impl RelaySelector {
api_availability,
);
-
RelaySelector {
parsed_relays,
rng: rand::thread_rng(),
@@ -377,7 +375,6 @@ impl RelaySelector {
(Constraint::Any, TransportProtocol::Tcp, TunnelType::OpenVpn)
};
-
let mut relay_constraints = original_constraints.clone();
relay_constraints.openvpn_constraints = Default::default();
@@ -625,7 +622,6 @@ impl RelaySelector {
}
}
-
/// Returns a random relay endpoint if any is matching the given constraints.
fn get_tunnel_endpoint_internal(
&mut self,
@@ -723,7 +719,6 @@ impl RelaySelector {
}
};
-
let relay_matches = match constraints.tunnel_protocol {
Constraint::Any => {
!relay.tunnels.openvpn.is_empty() || !relay.tunnels.wireguard.is_empty()
@@ -1166,7 +1161,6 @@ impl RelayListUpdater {
}
}
-
#[cfg(test)]
mod test {
use super::*;
@@ -1443,7 +1437,6 @@ mod test {
assert_ne!(exit_relay.hostname, specific_hostname);
-
relay_constraints.location = Constraint::Only(location_specific);
relay_constraints.wireguard_constraints.entry_location =
Some(Constraint::Only(location_general));
diff --git a/mullvad-daemon/src/settings.rs b/mullvad-daemon/src/settings.rs
index 1715a92594..455b1775ed 100644
--- a/mullvad-daemon/src/settings.rs
+++ b/mullvad-daemon/src/settings.rs
@@ -17,10 +17,8 @@ use tokio::{
io::{self, AsyncWriteExt},
};
-
const SETTINGS_FILE: &str = "settings.json";
-
#[derive(err_derive::Error, Debug)]
#[error(no_from)]
pub enum Error {
@@ -44,7 +42,6 @@ pub enum Error {
SetPermissions(#[error(source)] io::Error),
}
-
#[derive(Debug)]
pub struct SettingsPersister {
settings: Settings,
diff --git a/mullvad-daemon/src/system_service.rs b/mullvad-daemon/src/system_service.rs
index 34580e93e0..0e0e7aedf1 100644
--- a/mullvad-daemon/src/system_service.rs
+++ b/mullvad-daemon/src/system_service.rs
@@ -197,7 +197,6 @@ fn start_event_monitor(
})
}
-
/// Service status helper with persistent checkpoint counter.
#[derive(Debug, Clone)]
struct PersistentServiceStatus {
diff --git a/mullvad-daemon/src/version_check.rs b/mullvad-daemon/src/version_check.rs
index a97e6a7478..92e50c9edb 100644
--- a/mullvad-daemon/src/version_check.rs
+++ b/mullvad-daemon/src/version_check.rs
@@ -50,7 +50,6 @@ const PLATFORM: &str = "windows";
#[cfg(target_os = "android")]
const PLATFORM: &str = "android";
-
#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)]
struct CachedAppVersionInfo {
#[serde(flatten)]
@@ -98,7 +97,6 @@ pub enum Error {
UpdateAborted,
}
-
pub(crate) struct VersionUpdater {
version_proxy: AppVersionProxy,
cache_path: PathBuf,
diff --git a/mullvad-daemon/src/wireguard.rs b/mullvad-daemon/src/wireguard.rs
index da6490cb5d..e363a2d3dc 100644
--- a/mullvad-daemon/src/wireguard.rs
+++ b/mullvad-daemon/src/wireguard.rs
@@ -111,7 +111,6 @@ impl KeyManager {
.map_err(Self::map_rpc_error)
}
-
/// Replace a key for an account synchronously
pub async fn replace_key(
&mut self,
@@ -210,7 +209,6 @@ impl KeyManager {
}
}
-
/// Generate a new private key asynchronously. The new keys will be sent to the daemon channel.
pub async fn spawn_key_generation_task(
&mut self,
@@ -271,7 +269,6 @@ impl KeyManager {
let upload_future = retry_future(future_generator, should_retry, retry_strategy);
-
let (cancellable_upload, abort_handle) = abortable(Box::pin(upload_future));
let daemon_tx = self.daemon_tx.clone();
let future = async move {
@@ -289,12 +286,10 @@ impl KeyManager {
}
};
-
tokio::spawn(Box::pin(future));
self.current_job = Some(abort_handle);
}
-
fn push_future_generator(
&self,
account: AccountToken,