diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-05-30 19:05:14 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-06-13 19:29:21 +0000 |
| commit | 4400c3d238ff07da5cfe6dcd23668a35b39bb179 (patch) | |
| tree | 3680e2c4e8410c43bb945f0e05262875becd9fba | |
| parent | 4d0fa7af9d679e9e6118d411ef39f92cb238e233 (diff) | |
| download | mullvadvpn-4400c3d238ff07da5cfe6dcd23668a35b39bb179.tar.xz mullvadvpn-4400c3d238ff07da5cfe6dcd23668a35b39bb179.zip | |
Implement `DaemonInterface::get_current_location`
| -rw-r--r-- | mullvad-jni/src/daemon_interface.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/mullvad-jni/src/daemon_interface.rs b/mullvad-jni/src/daemon_interface.rs index fb398c5461..1565a9fd0d 100644 --- a/mullvad-jni/src/daemon_interface.rs +++ b/mullvad-jni/src/daemon_interface.rs @@ -1,8 +1,8 @@ use futures::{sync::oneshot, Future}; use mullvad_daemon::{DaemonCommandSender, ManagementCommand}; use mullvad_types::{ - account::AccountData, relay_constraints::RelaySettingsUpdate, relay_list::RelayList, - settings::Settings, states::TargetState, + account::AccountData, location::GeoIpLocation, relay_constraints::RelaySettingsUpdate, + relay_list::RelayList, settings::Settings, states::TargetState, }; use talpid_types::{net::wireguard, tunnel::TunnelStateTransition}; @@ -82,6 +82,14 @@ impl DaemonInterface { .map_err(Error::RpcError) } + pub fn get_current_location(&self) -> Result<Option<GeoIpLocation>> { + let (tx, rx) = oneshot::channel(); + + self.send_command(ManagementCommand::GetCurrentLocation(tx))?; + + Ok(rx.wait().map_err(|_| Error::NoResponse)?) + } + pub fn get_relay_locations(&self) -> Result<RelayList> { let (tx, rx) = oneshot::channel(); |
