diff options
| author | David Lönnhager <david.l@mullvad.net> | 2022-03-28 12:40:11 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2022-03-28 12:40:11 +0200 |
| commit | 9c4e41d29c4419ac8381c8e343f7e32eb00880aa (patch) | |
| tree | 951d9bfb229de75f9363244dce4db1b9b1f1d9d2 | |
| parent | b3d825f04725a2074ca3d63e643c5bf6526e0898 (diff) | |
| parent | c1c2a163a70d4827df3cc3f65772a4325220a4a9 (diff) | |
| download | mullvadvpn-9c4e41d29c4419ac8381c8e343f7e32eb00880aa.tar.xz mullvadvpn-9c4e41d29c4419ac8381c8e343f7e32eb00880aa.zip | |
Merge remote-tracking branch 'origin/android-fix-cond-compilation'
| -rw-r--r-- | mullvad-daemon/src/lib.rs | 15 | ||||
| -rw-r--r-- | mullvad-daemon/src/relays/mod.rs | 7 |
2 files changed, 16 insertions, 6 deletions
diff --git a/mullvad-daemon/src/lib.rs b/mullvad-daemon/src/lib.rs index 2170c49566..f004ddae21 100644 --- a/mullvad-daemon/src/lib.rs +++ b/mullvad-daemon/src/lib.rs @@ -74,10 +74,12 @@ use talpid_core::{ }; #[cfg(target_os = "android")] use talpid_types::android::AndroidContext; +#[cfg(not(target_os = "android"))] +use talpid_types::net::openvpn; use talpid_types::{ net::{ - openvpn::{self, ProxySettings}, - wireguard, TransportProtocol, TunnelEndpoint, TunnelParameters, TunnelType, + openvpn::ProxySettings, wireguard, TransportProtocol, TunnelEndpoint, TunnelParameters, + TunnelType, }, tunnel::{ErrorStateCause, ParameterGenerationError, TunnelStateTransition}, ErrorExt, @@ -1078,6 +1080,8 @@ where log::error!("No account token configured"); } } + + #[cfg_attr(target_os = "android", allow(unused_variables))] async fn create_tunnel_parameters( &mut self, relay: &Relay, @@ -1089,6 +1093,7 @@ where let tunnel_options = self.settings.tunnel_options.clone(); let location = relay.location.as_ref().expect("Relay has no location set"); match endpoint { + #[cfg(not(target_os = "android"))] MullvadEndpoint::OpenVpn(endpoint) => { let (bridge_settings, bridge_relay) = self.generate_bridge_parameters(&location, retry_attempt)?; @@ -1110,6 +1115,10 @@ where } .into()) } + #[cfg(target_os = "android")] + MullvadEndpoint::OpenVpn(endpoint) => { + unreachable!("OpenVPN is not supported on Android"); + } MullvadEndpoint::Wireguard(endpoint) => { let wg_data = self .account_manager @@ -1580,6 +1589,7 @@ where bridge_hostname = None; location = exit.location.as_ref().cloned().unwrap(); } + #[cfg(not(target_os = "android"))] LastSelectedRelays::OpenVpn { relay, bridge } => { hostname = relay.hostname.clone(); bridge_hostname = take_hostname(bridge); @@ -2722,6 +2732,7 @@ impl LastSelectedRelays { let first_hop = obfuscator.as_ref().or(entry.as_ref()).unwrap_or(exit); first_hop.location.clone() } + #[cfg(not(target_os = "android"))] Self::OpenVpn { relay, bridge } => { let first_hop = bridge.as_ref().unwrap_or(relay); first_hop.location.clone() diff --git a/mullvad-daemon/src/relays/mod.rs b/mullvad-daemon/src/relays/mod.rs index ceaea8e135..b0a14d7ea3 100644 --- a/mullvad-daemon/src/relays/mod.rs +++ b/mullvad-daemon/src/relays/mod.rs @@ -650,6 +650,7 @@ impl RelaySelector { entry_endpoint.exit_peer = Some(exit_peer.clone()); } + #[cfg(not(target_os = "android"))] pub fn get_auto_proxy_settings<T: Into<Coordinates>>( &self, bridge_constraints: &InternalBridgeConstraints, @@ -668,6 +669,7 @@ impl RelaySelector { self.get_proxy_settings(bridge_constraints, location) } + #[cfg(not(target_os = "android"))] pub fn should_use_bridge(&self, retry_attempt: u32) -> bool { // shouldn't use a bridge for the first 3 times retry_attempt > 3 && @@ -1597,10 +1599,7 @@ mod test { ) .unwrap(); - assert!(matches!( - obfs_config, - ObfuscatorConfig::Udp2Tcp { .. } - )); + assert!(matches!(obfs_config, ObfuscatorConfig::Udp2Tcp { .. })); } #[test] |
