diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2018-09-07 15:40:36 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2018-09-13 12:46:20 +0300 |
| commit | ba3e0602815369f0e7f0843b95e2931c712f3258 (patch) | |
| tree | 208be73e8964c328962ac3b59a2346e7c3b48096 | |
| parent | 2a428d8e3b02d08d1192280ba0e6cd5f7b0aa4b4 (diff) | |
| download | mullvadvpn-ba3e0602815369f0e7f0843b95e2931c712f3258.tar.xz mullvadvpn-ba3e0602815369f0e7f0843b95e2931c712f3258.zip | |
Remove obsolete management interface get calls
| -rw-r--r-- | mullvad-daemon/src/main.rs | 32 | ||||
| -rw-r--r-- | mullvad-daemon/src/management_interface.rs | 81 |
2 files changed, 2 insertions, 111 deletions
diff --git a/mullvad-daemon/src/main.rs b/mullvad-daemon/src/main.rs index 83d0e962af..8eb1a0348a 100644 --- a/mullvad-daemon/src/main.rs +++ b/mullvad-daemon/src/main.rs @@ -79,7 +79,7 @@ use std::{mem, thread}; use talpid_core::mpsc::IntoSender; use talpid_core::tunnel_state_machine::{self, TunnelCommand, TunnelParameters}; -use talpid_types::net::{TunnelEndpoint, TunnelOptions}; +use talpid_types::net::TunnelEndpoint; use talpid_types::tunnel::{BlockReason, TunnelStateTransition}; @@ -350,17 +350,12 @@ impl Daemon { GetAccountData(tx, account_token) => self.on_get_account_data(tx, account_token), GetRelayLocations(tx) => self.on_get_relay_locations(tx), SetAccount(tx, account_token) => self.on_set_account(tx, account_token), - GetAccount(tx) => self.on_get_account(tx), UpdateRelaySettings(tx, update) => self.on_update_relay_settings(tx, update), SetAllowLan(tx, allow_lan) => self.on_set_allow_lan(tx, allow_lan), - GetAllowLan(tx) => self.on_get_allow_lan(tx), SetAutoConnect(tx, auto_connect) => self.on_set_auto_connect(tx, auto_connect), - GetAutoConnect(tx) => self.on_get_auto_connect(tx), SetOpenVpnMssfix(tx, mssfix_arg) => self.on_set_openvpn_mssfix(tx, mssfix_arg), SetEnableIpv6(tx, enable_ipv6) => self.on_set_enable_ipv6(tx, enable_ipv6), - GetTunnelOptions(tx) => self.on_get_tunnel_options(tx), GetSettings(tx) => self.on_get_settings(tx), - GetRelaySettings(tx) => self.on_get_relay_settings(tx), GetVersionInfo(tx) => self.on_get_version_info(tx), GetCurrentVersion(tx) => self.on_get_current_version(tx), Shutdown => self.handle_trigger_shutdown_event(), @@ -471,10 +466,6 @@ impl Daemon { Self::oneshot_send(tx, current_version, "get_current_version response"); } - fn on_get_account(&self, tx: OneshotSender<Option<String>>) { - Self::oneshot_send(tx, self.settings.get_account_token(), "current account") - } - fn on_update_relay_settings(&mut self, tx: OneshotSender<()>, update: RelaySettingsUpdate) { let save_result = self.settings.update_relay_settings(update); match save_result.chain_err(|| "Unable to save settings") { @@ -491,10 +482,6 @@ impl Daemon { } } - fn on_get_relay_settings(&self, tx: OneshotSender<RelaySettings>) { - Self::oneshot_send(tx, self.settings.get_relay_settings(), "relay settings") - } - fn on_set_allow_lan(&mut self, tx: OneshotSender<()>, allow_lan: bool) { let save_result = self.settings.set_allow_lan(allow_lan); match save_result.chain_err(|| "Unable to save settings") { @@ -510,10 +497,6 @@ impl Daemon { } } - fn on_get_allow_lan(&self, tx: OneshotSender<bool>) { - Self::oneshot_send(tx, self.settings.get_allow_lan(), "allow lan") - } - fn on_set_auto_connect(&mut self, tx: OneshotSender<()>, auto_connect: bool) { let save_result = self.settings.set_auto_connect(auto_connect); match save_result.chain_err(|| "Unable to save settings") { @@ -528,14 +511,6 @@ impl Daemon { } } - fn on_get_auto_connect(&self, tx: OneshotSender<bool>) { - Self::oneshot_send( - tx, - self.settings.get_auto_connect(), - "get auto-connect response", - ) - } - fn on_set_openvpn_mssfix(&mut self, tx: OneshotSender<()>, mssfix_arg: Option<u16>) { let save_result = self.settings.set_openvpn_mssfix(mssfix_arg); match save_result.chain_err(|| "Unable to save settings") { @@ -566,11 +541,6 @@ impl Daemon { } } - fn on_get_tunnel_options(&self, tx: OneshotSender<TunnelOptions>) { - let tunnel_options = self.settings.get_tunnel_options().clone(); - Self::oneshot_send(tx, tunnel_options, "get_tunnel_options response"); - } - fn on_get_settings(&self, tx: OneshotSender<Settings>) { Self::oneshot_send(tx, self.settings.clone(), "get_settings response"); } diff --git a/mullvad-daemon/src/management_interface.rs b/mullvad-daemon/src/management_interface.rs index 2e534baf52..db5c3fedc1 100644 --- a/mullvad-daemon/src/management_interface.rs +++ b/mullvad-daemon/src/management_interface.rs @@ -10,7 +10,7 @@ use mullvad_types::account::{AccountData, AccountToken}; use mullvad_types::location::GeoIpLocation; use mullvad_paths; -use mullvad_types::relay_constraints::{RelaySettings, RelaySettingsUpdate}; +use mullvad_types::relay_constraints::RelaySettingsUpdate; use mullvad_types::relay_list::RelayList; use mullvad_types::settings::Settings; use mullvad_types::states::TargetState; @@ -25,7 +25,6 @@ use std::sync::{Arc, Mutex, RwLock}; use talpid_core::mpsc::IntoSender; use talpid_ipc; -use talpid_types::net::TunnelOptions; use talpid_types::tunnel::TunnelStateTransition; use uuid; @@ -53,10 +52,6 @@ build_rpc_trait! { #[rpc(meta, name = "set_account")] fn set_account(&self, Self::Metadata, Option<AccountToken>) -> BoxFuture<(), Error>; - /// Get which account is configured. - #[rpc(meta, name = "get_account")] - fn get_account(&self, Self::Metadata) -> BoxFuture<Option<AccountToken>, Error>; - /// Update constraints put on the type of tunnel connection to use #[rpc(meta, name = "update_relay_settings")] fn update_relay_settings( @@ -64,29 +59,14 @@ build_rpc_trait! { Self::Metadata, RelaySettingsUpdate ) -> BoxFuture<(), Error>; - /// Update constraints put on the type of tunnel connection to use - #[rpc(meta, name = "get_relay_settings")] - fn get_relay_settings( - &self, - Self::Metadata - ) -> BoxFuture<RelaySettings, Error>; - /// Set if the client should allow communication with the LAN while in secured state. #[rpc(meta, name = "set_allow_lan")] fn set_allow_lan(&self, Self::Metadata, bool) -> BoxFuture<(), Error>; - /// Get if the client should allow communication with the LAN while in secured state. - #[rpc(meta, name = "get_allow_lan")] - fn get_allow_lan(&self, Self::Metadata) -> BoxFuture<bool, Error>; - /// Set if the daemon should automatically establish a tunnel on start or not. #[rpc(meta, name = "set_auto_connect")] fn set_auto_connect(&self, Self::Metadata, bool) -> BoxFuture<(), Error>; - /// Get if the daemon should automatically establish a tunnel on start or not. - #[rpc(meta, name = "get_auto_connect")] - fn get_auto_connect(&self, Self::Metadata) -> BoxFuture<bool, Error>; - /// Try to connect if disconnected, or do nothing if already connecting/connected. #[rpc(meta, name = "connect")] fn connect(&self, Self::Metadata) -> BoxFuture<(), Error>; @@ -126,10 +106,6 @@ build_rpc_trait! { #[rpc(meta, name = "set_enable_ipv6")] fn set_enable_ipv6(&self, Self::Metadata, bool) -> BoxFuture<(), Error>; - /// Gets tunnel specific options - #[rpc(meta, name = "get_tunnel_options")] - fn get_tunnel_options(&self, Self::Metadata) -> BoxFuture<TunnelOptions, Error>; - /// Returns the current daemon settings #[rpc(meta, name = "get_settings")] fn get_settings(&self, Self::Metadata) -> BoxFuture<Settings, Error>; @@ -187,26 +163,16 @@ pub enum ManagementCommand { GetRelayLocations(OneshotSender<RelayList>), /// Set which account token to use for subsequent connection attempts. SetAccount(OneshotSender<()>, Option<AccountToken>), - /// Request the current account token being used. - GetAccount(OneshotSender<Option<AccountToken>>), /// Place constraints on the type of tunnel and relay UpdateRelaySettings(OneshotSender<()>, RelaySettingsUpdate), - /// Read the constraints put on the tunnel and relay - GetRelaySettings(OneshotSender<RelaySettings>), /// Set the allow LAN setting. SetAllowLan(OneshotSender<()>, bool), - /// Get the current allow LAN setting. - GetAllowLan(OneshotSender<bool>), /// Set the auto-connect setting. SetAutoConnect(OneshotSender<()>, bool), - /// Get the current auto-connect setting. - GetAutoConnect(OneshotSender<bool>), /// Set the mssfix argument for OpenVPN SetOpenVpnMssfix(OneshotSender<()>, Option<u16>), /// Set if IPv6 should be enabled in the tunnel SetEnableIpv6(OneshotSender<()>, bool), - /// Get the tunnel options - GetTunnelOptions(OneshotSender<TunnelOptions>), /// Get the daemon settings GetSettings(OneshotSender<Settings>), /// Get information about the currently running and latest app versions @@ -446,15 +412,6 @@ impl<T: From<ManagementCommand> + 'static + Send> ManagementInterfaceApi Box::new(future) } - fn get_account(&self, _: Self::Metadata) -> BoxFuture<Option<AccountToken>, Error> { - debug!("get_account"); - let (tx, rx) = sync::oneshot::channel(); - let future = self - .send_command_to_daemon(ManagementCommand::GetAccount(tx)) - .and_then(|_| rx.map_err(|_| Error::internal_error())); - Box::new(future) - } - fn update_relay_settings( &self, _: Self::Metadata, @@ -470,15 +427,6 @@ impl<T: From<ManagementCommand> + 'static + Send> ManagementInterfaceApi Box::new(future) } - fn get_relay_settings(&self, _: Self::Metadata) -> BoxFuture<RelaySettings, Error> { - debug!("get_relay_settings"); - let (tx, rx) = sync::oneshot::channel(); - let future = self - .send_command_to_daemon(ManagementCommand::GetRelaySettings(tx)) - .and_then(|_| rx.map_err(|_| Error::internal_error())); - Box::new(future) - } - fn set_allow_lan(&self, _: Self::Metadata, allow_lan: bool) -> BoxFuture<(), Error> { debug!("set_allow_lan({})", allow_lan); let (tx, rx) = sync::oneshot::channel(); @@ -488,15 +436,6 @@ impl<T: From<ManagementCommand> + 'static + Send> ManagementInterfaceApi Box::new(future) } - fn get_allow_lan(&self, _: Self::Metadata) -> BoxFuture<bool, Error> { - debug!("get_allow_lan"); - let (tx, rx) = sync::oneshot::channel(); - let future = self - .send_command_to_daemon(ManagementCommand::GetAllowLan(tx)) - .and_then(|_| rx.map_err(|_| Error::internal_error())); - Box::new(future) - } - fn set_auto_connect(&self, _: Self::Metadata, auto_connect: bool) -> BoxFuture<(), Error> { debug!("set_auto_connect({})", auto_connect); let (tx, rx) = sync::oneshot::channel(); @@ -506,15 +445,6 @@ impl<T: From<ManagementCommand> + 'static + Send> ManagementInterfaceApi Box::new(future) } - fn get_auto_connect(&self, _: Self::Metadata) -> BoxFuture<bool, Error> { - debug!("get_auto_connect"); - let (tx, rx) = sync::oneshot::channel(); - let future = self - .send_command_to_daemon(ManagementCommand::GetAutoConnect(tx)) - .and_then(|_| rx.map_err(|_| Error::internal_error())); - Box::new(future) - } - fn connect(&self, _: Self::Metadata) -> BoxFuture<(), Error> { debug!("connect"); let (tx, rx) = sync::oneshot::channel(); @@ -617,15 +547,6 @@ impl<T: From<ManagementCommand> + 'static + Send> ManagementInterfaceApi Box::new(future) } - fn get_tunnel_options(&self, _: Self::Metadata) -> BoxFuture<TunnelOptions, Error> { - debug!("get_tunnel_options"); - let (tx, rx) = sync::oneshot::channel(); - let future = self - .send_command_to_daemon(ManagementCommand::GetTunnelOptions(tx)) - .and_then(|_| rx.map_err(|_| Error::internal_error())); - Box::new(future) - } - fn get_settings(&self, _: Self::Metadata) -> BoxFuture<Settings, Error> { debug!("get_settings"); let (tx, rx) = sync::oneshot::channel(); |
