diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-05-06 19:15:18 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-05-11 13:15:50 +0000 |
| commit | 6f2d3f4dc6f2058126ab6ecf4ef5e02b9de174f6 (patch) | |
| tree | 25bed23b06ec15f7568dcc2122cf18dce48e32d8 | |
| parent | ca6b51fde35b4625d8484122a20064956a33d2b4 (diff) | |
| download | mullvadvpn-6f2d3f4dc6f2058126ab6ecf4ef5e02b9de174f6.tar.xz mullvadvpn-6f2d3f4dc6f2058126ab6ecf4ef5e02b9de174f6.zip | |
Implement `DaemonInterface::submit_voucher`
| -rw-r--r-- | mullvad-jni/src/daemon_interface.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/mullvad-jni/src/daemon_interface.rs b/mullvad-jni/src/daemon_interface.rs index 45454c2f72..c8294fa744 100644 --- a/mullvad-jni/src/daemon_interface.rs +++ b/mullvad-jni/src/daemon_interface.rs @@ -1,7 +1,7 @@ use futures::{sync::oneshot, Future}; use mullvad_daemon::{DaemonCommand, DaemonCommandSender}; use mullvad_types::{ - account::AccountData, + account::{AccountData, VoucherSubmission}, location::GeoIpLocation, relay_constraints::RelaySettingsUpdate, relay_list::RelayList, @@ -210,6 +210,17 @@ impl DaemonInterface { self.send_command(DaemonCommand::Shutdown) } + pub fn submit_voucher(&self, voucher: String) -> Result<VoucherSubmission> { + let (tx, rx) = oneshot::channel(); + + self.send_command(DaemonCommand::SubmitVoucher(tx, voucher))?; + + rx.wait() + .map_err(|_| Error::NoResponse)? + .wait() + .map_err(Error::RpcError) + } + pub fn update_relay_settings(&self, update: RelaySettingsUpdate) -> Result<()> { let (tx, rx) = oneshot::channel(); |
