summaryrefslogtreecommitdiffhomepage
path: root/talpid-core
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2017-11-14 05:46:16 +0100
committerLinus Färnstrand <linus@mullvad.net>2017-11-14 06:10:44 +0100
commit8ffc579063547e028dbcffb12007716d1a490de8 (patch)
tree81dced748be2bb01116b1f27d51eca5af8acf2eb /talpid-core
parent3068edb2ecb9d7440dbcd7523434400294b1e8de (diff)
downloadmullvadvpn-8ffc579063547e028dbcffb12007716d1a490de8.tar.xz
mullvadvpn-8ffc579063547e028dbcffb12007716d1a490de8.zip
Change TunnelEndpoint to another design
Diffstat (limited to 'talpid-core')
-rw-r--r--talpid-core/src/tunnel/mod.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/talpid-core/src/tunnel/mod.rs b/talpid-core/src/tunnel/mod.rs
index 0e12d89287..68846402c2 100644
--- a/talpid-core/src/tunnel/mod.rs
+++ b/talpid-core/src/tunnel/mod.rs
@@ -11,7 +11,7 @@ use std::io::{self, Write};
use std::net::Ipv4Addr;
use std::path::{Path, PathBuf};
-use talpid_types::net::{Endpoint, TunnelEndpoint};
+use talpid_types::net::{Endpoint, TunnelEndpoint, TunnelEndpointData};
/// A module for all OpenVPN related tunnel management.
pub mod openvpn;
@@ -38,8 +38,8 @@ mod errors {
description("Running on an unsupported operating system")
}
/// This type of VPN tunnel is not supported.
- UnsupportedTunnelTechnology {
- description("This tunnel technology is not supported")
+ UnsupportedTunnelProtocol {
+ description("This tunnel protocol is not supported")
}
}
}
@@ -111,7 +111,7 @@ impl TunnelMonitor {
/// Creates a new `TunnelMonitor` that connects to the given remote and notifies `on_event`
/// on tunnel state changes.
pub fn new<L>(
- remote: TunnelEndpoint,
+ tunnel_endpoint: TunnelEndpoint,
account_token: &str,
log: Option<&Path>,
resource_dir: &Path,
@@ -120,10 +120,10 @@ impl TunnelMonitor {
where
L: Fn(TunnelEvent) + Send + Sync + 'static,
{
- let remote = match remote {
- TunnelEndpoint::OpenVpn(endpoint) => endpoint,
- _ => bail!(ErrorKind::UnsupportedTunnelTechnology),
- };
+ match tunnel_endpoint.tunnel {
+ TunnelEndpointData::OpenVpn(_) => (),
+ TunnelEndpointData::Wireguard(_) => bail!(ErrorKind::UnsupportedTunnelProtocol),
+ }
let user_pass_file = Self::create_user_pass_file(account_token)
.chain_err(|| ErrorKind::CredentialsWriteError)?;
let cmd = Self::create_openvpn_cmd(