summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2019-03-05 15:29:19 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2019-04-03 16:46:17 +0000
commit9b726d845ce3a7a3d18b250d3193ce436be6d92d (patch)
tree2b12b4cb2a984e8d877092cc5a991435359ea675
parentb76af88963d6260645b2e12da363a7790fdf1a16 (diff)
downloadmullvadvpn-9b726d845ce3a7a3d18b250d3193ce436be6d92d.tar.xz
mullvadvpn-9b726d845ce3a7a3d18b250d3193ce436be6d92d.zip
Disable Wireguard on Android
-rw-r--r--talpid-core/src/tunnel/mod.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/talpid-core/src/tunnel/mod.rs b/talpid-core/src/tunnel/mod.rs
index 228f4a2fd7..04332908c4 100644
--- a/talpid-core/src/tunnel/mod.rs
+++ b/talpid-core/src/tunnel/mod.rs
@@ -6,14 +6,14 @@ use std::{
net::{IpAddr, Ipv4Addr, Ipv6Addr},
path::{Path, PathBuf},
};
-#[cfg(unix)]
+#[cfg(any(target_os = "linux", target_os = "macos"))]
use talpid_types::net::wireguard as wireguard_types;
use talpid_types::net::{openvpn as openvpn_types, GenericTunnelOptions, TunnelParameters};
/// A module for all OpenVPN related tunnel management.
pub mod openvpn;
-#[cfg(unix)]
+#[cfg(any(target_os = "linux", target_os = "macos"))]
pub mod wireguard;
const OPENVPN_LOG_FILENAME: &str = "openvpn.log";
@@ -46,7 +46,7 @@ error_chain! {
;
WirguardTunnelMonitoringError(wireguard::Error, wireguard::ErrorKind)
/// There was an error listening for events from the OpenVPN tunnel
- #[cfg(unix)]
+ #[cfg(any(target_os = "linux", target_os = "macos"))]
;
}
}
@@ -146,16 +146,16 @@ impl TunnelMonitor {
TunnelParameters::OpenVpn(config) => {
Self::start_openvpn_tunnel(&config, tunnel_alias, log_file, resource_dir, on_event)
}
- #[cfg(unix)]
+ #[cfg(any(target_os = "linux", target_os = "macos"))]
TunnelParameters::Wireguard(config) => {
Self::start_wireguard_tunnel(&config, log_file, on_event)
}
- #[cfg(windows)]
+ #[cfg(any(windows, target_os = "android"))]
TunnelParameters::Wireguard(_) => bail!(ErrorKind::UnsupportedPlatform),
}
}
- #[cfg(unix)]
+ #[cfg(any(target_os = "linux", target_os = "macos"))]
fn start_wireguard_tunnel<L>(
params: &wireguard_types::TunnelParameters,
log: Option<PathBuf>,
@@ -237,7 +237,7 @@ impl TunnelMonitor {
pub enum CloseHandle {
/// OpenVpn close handle
OpenVpn(openvpn::OpenVpnCloseHandle),
- #[cfg(unix)]
+ #[cfg(any(target_os = "linux", target_os = "macos"))]
/// Wireguard close handle
Wireguard(wireguard::CloseHandle),
}
@@ -247,7 +247,7 @@ impl CloseHandle {
pub fn close(self) -> io::Result<()> {
match self {
CloseHandle::OpenVpn(handle) => handle.close(),
- #[cfg(unix)]
+ #[cfg(any(target_os = "linux", target_os = "macos"))]
CloseHandle::Wireguard(mut handle) => {
handle.close();
Ok(())
@@ -258,7 +258,7 @@ impl CloseHandle {
enum InternalTunnelMonitor {
OpenVpn(openvpn::OpenVpnMonitor),
- #[cfg(unix)]
+ #[cfg(any(target_os = "linux", target_os = "macos"))]
Wireguard(wireguard::WireguardMonitor),
}
@@ -266,7 +266,7 @@ impl InternalTunnelMonitor {
fn close_handle(&self) -> CloseHandle {
match self {
InternalTunnelMonitor::OpenVpn(tun) => CloseHandle::OpenVpn(tun.close_handle()),
- #[cfg(unix)]
+ #[cfg(any(target_os = "linux", target_os = "macos"))]
InternalTunnelMonitor::Wireguard(tun) => CloseHandle::Wireguard(tun.close_handle()),
}
}
@@ -274,7 +274,7 @@ impl InternalTunnelMonitor {
fn wait(self) -> Result<()> {
match self {
InternalTunnelMonitor::OpenVpn(tun) => tun.wait()?,
- #[cfg(unix)]
+ #[cfg(any(target_os = "linux", target_os = "macos"))]
InternalTunnelMonitor::Wireguard(tun) => tun.wait()?,
}