diff options
| author | David Lönnhager <david.l@mullvad.net> | 2021-05-07 15:37:29 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2021-07-02 09:54:19 +0200 |
| commit | 22aeda50600fda08c86504d4430f7e6ca641d92e (patch) | |
| tree | d4e9534ada9fbd59d8ecc7441bc9e884afaf557c | |
| parent | 993895622fe7d43f6dc1ef564775439e864f562f (diff) | |
| download | mullvadvpn-22aeda50600fda08c86504d4430f7e6ca641d92e.tar.xz mullvadvpn-22aeda50600fda08c86504d4430f7e6ca641d92e.zip | |
Remove redundant GetSplitTunnelApps RPC
| -rw-r--r-- | mullvad-cli/src/cmds/split_tunnel/windows.rs | 11 | ||||
| -rw-r--r-- | mullvad-daemon/src/lib.rs | 14 | ||||
| -rw-r--r-- | mullvad-daemon/src/management_interface.rs | 30 | ||||
| -rw-r--r-- | mullvad-management-interface/proto/management_interface.proto | 1 |
4 files changed, 7 insertions, 49 deletions
diff --git a/mullvad-cli/src/cmds/split_tunnel/windows.rs b/mullvad-cli/src/cmds/split_tunnel/windows.rs index 3d1dd5ee1d..402186a77c 100644 --- a/mullvad-cli/src/cmds/split_tunnel/windows.rs +++ b/mullvad-cli/src/cmds/split_tunnel/windows.rs @@ -59,14 +59,17 @@ impl SplitTunnel { async fn handle_app_subcommand(matches: &clap::ArgMatches<'_>) -> Result<()> { match matches.subcommand() { ("list", Some(_)) => { - let mut paths = new_rpc_client() + let paths = new_rpc_client() .await? - .get_split_tunnel_apps(()) + .get_settings(()) .await? - .into_inner(); + .into_inner() + .split_tunnel + .unwrap() + .apps; println!("Excluded applications:"); - while let Some(path) = paths.message().await? { + for path in &paths { println!(" {}", path); } diff --git a/mullvad-daemon/src/lib.rs b/mullvad-daemon/src/lib.rs index c901d45767..698db84b53 100644 --- a/mullvad-daemon/src/lib.rs +++ b/mullvad-daemon/src/lib.rs @@ -265,9 +265,6 @@ pub enum DaemonCommand { /// Clear list of processes excluded from the tunnel #[cfg(target_os = "linux")] ClearSplitTunnelProcesses(ResponseTx<(), split_tunnel::Error>), - /// Request list of apps to exclude from the tunnel - #[cfg(windows)] - GetSplitTunnelApps(oneshot::Sender<HashSet<PathBuf>>), /// Exclude traffic of an application from the tunnel #[cfg(windows)] AddSplitTunnelApp(ResponseTx<(), Error>, PathBuf), @@ -1217,8 +1214,6 @@ where #[cfg(target_os = "linux")] ClearSplitTunnelProcesses(tx) => self.on_clear_split_tunnel_processes(tx), #[cfg(windows)] - GetSplitTunnelApps(tx) => self.on_get_split_tunnel_apps(tx), - #[cfg(windows)] AddSplitTunnelApp(tx, path) => self.on_add_split_tunnel_app(tx, path).await, #[cfg(windows)] RemoveSplitTunnelApp(tx, path) => self.on_remove_split_tunnel_app(tx, path).await, @@ -1760,15 +1755,6 @@ where Self::oneshot_send(tx, result, "clear_split_tunnel_processes response"); } - #[cfg(windows)] - fn on_get_split_tunnel_apps(&mut self, tx: oneshot::Sender<HashSet<PathBuf>>) { - Self::oneshot_send( - tx, - self.settings.to_settings().split_tunnel.apps, - "get_split_tunnel_apps response", - ); - } - /// Update the split app paths in both the settings and tunnel #[cfg(windows)] async fn set_split_tunnel_paths( diff --git a/mullvad-daemon/src/management_interface.rs b/mullvad-daemon/src/management_interface.rs index 5bf5e3c61c..ed69f84838 100644 --- a/mullvad-daemon/src/management_interface.rs +++ b/mullvad-daemon/src/management_interface.rs @@ -54,7 +54,6 @@ impl ManagementService for ManagementServiceImpl { type GetRelayLocationsStream = tokio::sync::mpsc::Receiver<Result<types::RelayListCountry, Status>>; type GetSplitTunnelProcessesStream = tokio::sync::mpsc::UnboundedReceiver<Result<i32, Status>>; - type GetSplitTunnelAppsStream = tokio::sync::mpsc::UnboundedReceiver<Result<String, Status>>; type EventsListenStream = EventsListenerReceiver; // Control and get the tunnel state @@ -645,35 +644,6 @@ impl ManagementService for ManagementServiceImpl { } } - async fn get_split_tunnel_apps( - &self, - _: Request<()>, - ) -> ServiceResult<Self::GetSplitTunnelAppsStream> { - #[cfg(windows)] - { - log::debug!("get_split_tunnel_apps"); - let (tx, rx) = oneshot::channel(); - self.send_command_to_daemon(DaemonCommand::GetSplitTunnelApps(tx))?; - let paths = rx.await.map_err(|_| Status::internal("internal error"))?; - - let (tx, rx) = tokio::sync::mpsc::unbounded_channel(); - tokio::spawn(async move { - for path in paths { - let _ = tx.send(path.into_os_string().into_string().map_err(|os_path| { - Status::internal(format!("failed to convert OS string: {:?}", os_path)) - })); - } - }); - - Ok(Response::new(rx)) - } - #[cfg(not(windows))] - { - let (_, rx) = tokio::sync::mpsc::unbounded_channel(); - Ok(Response::new(rx)) - } - } - #[cfg(windows)] async fn add_split_tunnel_app(&self, request: Request<String>) -> ServiceResult<()> { log::debug!("add_split_tunnel_app"); diff --git a/mullvad-management-interface/proto/management_interface.proto b/mullvad-management-interface/proto/management_interface.proto index 617a5ab827..33c4294db7 100644 --- a/mullvad-management-interface/proto/management_interface.proto +++ b/mullvad-management-interface/proto/management_interface.proto @@ -65,7 +65,6 @@ service ManagementService { rpc ClearSplitTunnelProcesses(google.protobuf.Empty) returns (google.protobuf.Empty) {} // Split tunneling (Windows) - rpc GetSplitTunnelApps(google.protobuf.Empty) returns (stream google.protobuf.StringValue) {} rpc AddSplitTunnelApp(google.protobuf.StringValue) returns (google.protobuf.Empty) {} rpc RemoveSplitTunnelApp(google.protobuf.StringValue) returns (google.protobuf.Empty) {} rpc ClearSplitTunnelApps(google.protobuf.Empty) returns (google.protobuf.Empty) {} |
