summaryrefslogtreecommitdiffhomepage
path: root/mullvad-daemon
diff options
context:
space:
mode:
Diffstat (limited to 'mullvad-daemon')
-rw-r--r--mullvad-daemon/src/account_history.rs3
-rw-r--r--mullvad-daemon/src/main.rs12
-rw-r--r--mullvad-daemon/src/management_interface.rs45
-rw-r--r--mullvad-daemon/src/relays.rs6
4 files changed, 43 insertions, 23 deletions
diff --git a/mullvad-daemon/src/account_history.rs b/mullvad-daemon/src/account_history.rs
index 16834854cd..3d7fe209c9 100644
--- a/mullvad-daemon/src/account_history.rs
+++ b/mullvad-daemon/src/account_history.rs
@@ -70,7 +70,8 @@ impl AccountHistory {
let num_accounts = self.accounts.len();
if num_accounts > ACCOUNT_HISTORY_LIMIT {
- self.accounts = self.accounts
+ self.accounts = self
+ .accounts
.split_off(num_accounts - ACCOUNT_HISTORY_LIMIT);
}
diff --git a/mullvad-daemon/src/main.rs b/mullvad-daemon/src/main.rs
index 12136d0f29..cdda2aa0bf 100644
--- a/mullvad-daemon/src/main.rs
+++ b/mullvad-daemon/src/main.rs
@@ -459,7 +459,8 @@ impl Daemon {
tx: OneshotSender<BoxFuture<AccountData, mullvad_rpc::Error>>,
account_token: AccountToken,
) {
- let rpc_call = self.accounts_proxy
+ let rpc_call = self
+ .accounts_proxy
.get_expiry(account_token)
.map(|expiry| AccountData { expiry });
Self::oneshot_send(tx, Box::new(rpc_call), "account data")
@@ -501,7 +502,8 @@ impl Daemon {
tx: OneshotSender<BoxFuture<AppVersionInfo, mullvad_rpc::Error>>,
) {
let current_version = version::current().to_owned();
- let fut = self.version_proxy
+ let fut = self
+ .version_proxy
.latest_app_version()
.join(
self.version_proxy
@@ -698,7 +700,8 @@ impl Daemon {
self.tunnel_endpoint = Some(tunnel_endpoint);
}
RelaySettings::Normal(constraints) => {
- let (relay, tunnel_endpoint) = self.relay_selector
+ let (relay, tunnel_endpoint) = self
+ .relay_selector
.get_tunnel_endpoint(&constraints)
.chain_err(|| ErrorKind::NoRelay)?;
self.tunnel_endpoint = Some(tunnel_endpoint);
@@ -706,7 +709,8 @@ impl Daemon {
}
}
- let account_token = self.settings
+ let account_token = self
+ .settings
.get_account_token()
.ok_or(ErrorKind::InvalidSettings("No account token"))?;
diff --git a/mullvad-daemon/src/management_interface.rs b/mullvad-daemon/src/management_interface.rs
index a0f8ece9e2..cd8f8f82e9 100644
--- a/mullvad-daemon/src/management_interface.rs
+++ b/mullvad-daemon/src/management_interface.rs
@@ -406,7 +406,8 @@ impl<T: From<TunnelCommand> + 'static + Send> ManagementInterfaceApi for Managem
trace!("get_account_data");
try_future!(self.check_auth(&meta));
let (tx, rx) = sync::oneshot::channel();
- let future = self.send_command_to_daemon(TunnelCommand::GetAccountData(tx, account_token))
+ let future = self
+ .send_command_to_daemon(TunnelCommand::GetAccountData(tx, account_token))
.and_then(|_| rx.map_err(|_| Error::internal_error()))
.and_then(|rpc_future| {
rpc_future.map_err(|error: mullvad_rpc::Error| {
@@ -424,7 +425,8 @@ impl<T: From<TunnelCommand> + 'static + Send> ManagementInterfaceApi for Managem
trace!("get_relay_locations");
try_future!(self.check_auth(&meta));
let (tx, rx) = sync::oneshot::channel();
- let future = self.send_command_to_daemon(TunnelCommand::GetRelayLocations(tx))
+ let future = self
+ .send_command_to_daemon(TunnelCommand::GetRelayLocations(tx))
.and_then(|_| rx.map_err(|_| Error::internal_error()));
Box::new(future)
}
@@ -437,9 +439,9 @@ impl<T: From<TunnelCommand> + 'static + Send> ManagementInterfaceApi for Managem
trace!("set_account");
try_future!(self.check_auth(&meta));
let (tx, rx) = sync::oneshot::channel();
- let future =
- self.send_command_to_daemon(TunnelCommand::SetAccount(tx, account_token.clone()))
- .and_then(|_| rx.map_err(|_| Error::internal_error()));
+ let future = self
+ .send_command_to_daemon(TunnelCommand::SetAccount(tx, account_token.clone()))
+ .and_then(|_| rx.map_err(|_| Error::internal_error()));
if let Some(new_account_token) = account_token {
if let Err(e) = AccountHistory::load().and_then(|mut account_history| {
@@ -459,7 +461,8 @@ impl<T: From<TunnelCommand> + 'static + Send> ManagementInterfaceApi for Managem
trace!("get_account");
try_future!(self.check_auth(&meta));
let (tx, rx) = sync::oneshot::channel();
- let future = self.send_command_to_daemon(TunnelCommand::GetAccount(tx))
+ let future = self
+ .send_command_to_daemon(TunnelCommand::GetAccount(tx))
.and_then(|_| rx.map_err(|_| Error::internal_error()));
Box::new(future)
}
@@ -474,7 +477,8 @@ impl<T: From<TunnelCommand> + 'static + Send> ManagementInterfaceApi for Managem
let (tx, rx) = sync::oneshot::channel();
let message = TunnelCommand::UpdateRelaySettings(tx, constraints_update);
- let future = self.send_command_to_daemon(message)
+ let future = self
+ .send_command_to_daemon(message)
.and_then(|_| rx.map_err(|_| Error::internal_error()));
Box::new(future)
}
@@ -483,7 +487,8 @@ impl<T: From<TunnelCommand> + 'static + Send> ManagementInterfaceApi for Managem
trace!("get_relay_settings");
try_future!(self.check_auth(&meta));
let (tx, rx) = sync::oneshot::channel();
- let future = self.send_command_to_daemon(TunnelCommand::GetRelaySettings(tx))
+ let future = self
+ .send_command_to_daemon(TunnelCommand::GetRelaySettings(tx))
.and_then(|_| rx.map_err(|_| Error::internal_error()));
Box::new(future)
}
@@ -492,7 +497,8 @@ impl<T: From<TunnelCommand> + 'static + Send> ManagementInterfaceApi for Managem
trace!("allow_lan");
try_future!(self.check_auth(&meta));
let (tx, rx) = sync::oneshot::channel();
- let future = self.send_command_to_daemon(TunnelCommand::SetAllowLan(tx, allow_lan))
+ let future = self
+ .send_command_to_daemon(TunnelCommand::SetAllowLan(tx, allow_lan))
.and_then(|_| rx.map_err(|_| Error::internal_error()));
Box::new(future)
}
@@ -501,7 +507,8 @@ impl<T: From<TunnelCommand> + 'static + Send> ManagementInterfaceApi for Managem
trace!("get_allow_lan");
try_future!(self.check_auth(&meta));
let (tx, rx) = sync::oneshot::channel();
- let future = self.send_command_to_daemon(TunnelCommand::GetAllowLan(tx))
+ let future = self
+ .send_command_to_daemon(TunnelCommand::GetAllowLan(tx))
.and_then(|_| rx.map_err(|_| Error::internal_error()));
Box::new(future)
}
@@ -528,7 +535,8 @@ impl<T: From<TunnelCommand> + 'static + Send> ManagementInterfaceApi for Managem
trace!("get_state");
try_future!(self.check_auth(&meta));
let (state_tx, state_rx) = sync::oneshot::channel();
- let future = self.send_command_to_daemon(TunnelCommand::GetState(state_tx))
+ let future = self
+ .send_command_to_daemon(TunnelCommand::GetState(state_tx))
.and_then(|_| state_rx.map_err(|_| Error::internal_error()));
Box::new(future)
}
@@ -537,7 +545,8 @@ impl<T: From<TunnelCommand> + 'static + Send> ManagementInterfaceApi for Managem
trace!("get_current_location");
try_future!(self.check_auth(&meta));
let (tx, rx) = sync::oneshot::channel();
- let future = self.send_command_to_daemon(TunnelCommand::GetCurrentLocation(tx))
+ let future = self
+ .send_command_to_daemon(TunnelCommand::GetCurrentLocation(tx))
.and_then(|_| rx.map_err(|_| Error::internal_error()));
Box::new(future)
}
@@ -589,7 +598,8 @@ impl<T: From<TunnelCommand> + 'static + Send> ManagementInterfaceApi for Managem
trace!("set_openvpn_mssfix");
try_future!(self.check_auth(&meta));
let (tx, rx) = sync::oneshot::channel();
- let future = self.send_command_to_daemon(TunnelCommand::SetOpenVpnMssfix(tx, mssfix))
+ let future = self
+ .send_command_to_daemon(TunnelCommand::SetOpenVpnMssfix(tx, mssfix))
.and_then(|_| rx.map_err(|_| Error::internal_error()));
Box::new(future)
@@ -599,7 +609,8 @@ impl<T: From<TunnelCommand> + 'static + Send> ManagementInterfaceApi for Managem
trace!("get_tunnel_options");
try_future!(self.check_auth(&meta));
let (tx, rx) = sync::oneshot::channel();
- let future = self.send_command_to_daemon(TunnelCommand::GetTunnelOptions(tx))
+ let future = self
+ .send_command_to_daemon(TunnelCommand::GetTunnelOptions(tx))
.and_then(|_| rx.map_err(|_| Error::internal_error()));
Box::new(future)
}
@@ -607,7 +618,8 @@ impl<T: From<TunnelCommand> + 'static + Send> ManagementInterfaceApi for Managem
fn get_current_version(&self, meta: Self::Metadata) -> BoxFuture<String, Error> {
try_future!(self.check_auth(&meta));
let (tx, rx) = sync::oneshot::channel();
- let future = self.send_command_to_daemon(TunnelCommand::GetCurrentVersion(tx))
+ let future = self
+ .send_command_to_daemon(TunnelCommand::GetCurrentVersion(tx))
.and_then(|_| rx.map_err(|_| Error::internal_error()));
Box::new(future)
@@ -616,7 +628,8 @@ impl<T: From<TunnelCommand> + 'static + Send> ManagementInterfaceApi for Managem
fn get_version_info(&self, meta: Self::Metadata) -> BoxFuture<version::AppVersionInfo, Error> {
try_future!(self.check_auth(&meta));
let (tx, rx) = sync::oneshot::channel();
- let future = self.send_command_to_daemon(TunnelCommand::GetVersionInfo(tx))
+ let future = self
+ .send_command_to_daemon(TunnelCommand::GetVersionInfo(tx))
.and_then(|_| rx.map_err(|_| Error::internal_error()))
.and_then(|version_future| {
version_future.map_err(|error| {
diff --git a/mullvad-daemon/src/relays.rs b/mullvad-daemon/src/relays.rs
index 778886163f..e13b1ebc3f 100644
--- a/mullvad-daemon/src/relays.rs
+++ b/mullvad-daemon/src/relays.rs
@@ -135,7 +135,8 @@ impl RelaySelector {
&mut self,
constraints: &RelayConstraints,
) -> Option<(Relay, TunnelEndpoint)> {
- let matching_relays: Vec<Relay> = self.relays
+ let matching_relays: Vec<Relay> = self
+ .relays
.iter()
.filter_map(|relay| Self::matching_relay(relay, constraints))
.collect();
@@ -252,7 +253,8 @@ impl RelaySelector {
/// Downloads the latest relay list and caches it. This operation is blocking.
pub fn update(&mut self, timeout: Duration) -> Result<()> {
info!("Downloading list of relays...");
- let download_future = self.rpc_client
+ let download_future = self
+ .rpc_client
.relay_list()
.map_err(|e| Error::with_chain(e, ErrorKind::DownloadError));
let relay_list = Timer::default().timeout(download_future, timeout).wait()?;