summaryrefslogtreecommitdiffhomepage
path: root/talpid-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'talpid-core/src')
-rw-r--r--talpid-core/src/firewall/linux.rs1
-rw-r--r--talpid-core/src/firewall/mod.rs2
-rw-r--r--talpid-core/src/tunnel_state_machine/connected_state.rs8
-rw-r--r--talpid-core/src/tunnel_state_machine/connecting_state.rs2
-rw-r--r--talpid-core/src/tunnel_state_machine/disconnected_state.rs2
-rw-r--r--talpid-core/src/tunnel_state_machine/disconnecting_state.rs6
-rw-r--r--talpid-core/src/tunnel_state_machine/error_state.rs2
-rw-r--r--talpid-core/src/tunnel_state_machine/mod.rs14
8 files changed, 19 insertions, 18 deletions
diff --git a/talpid-core/src/firewall/linux.rs b/talpid-core/src/firewall/linux.rs
index 1ca10784bf..792e0160a5 100644
--- a/talpid-core/src/firewall/linux.rs
+++ b/talpid-core/src/firewall/linux.rs
@@ -471,6 +471,7 @@ impl<'a> PolicyBatch<'a> {
peer_endpoint,
tunnel,
allow_lan,
+ dns_servers,
use_fwmark,
} => {
self.add_allow_endpoint_rules(peer_endpoint, *use_fwmark);
diff --git a/talpid-core/src/firewall/mod.rs b/talpid-core/src/firewall/mod.rs
index b427e459d5..ef2cdd8f80 100644
--- a/talpid-core/src/firewall/mod.rs
+++ b/talpid-core/src/firewall/mod.rs
@@ -112,7 +112,7 @@ pub enum FirewallPolicy {
/// Flag setting if communication with LAN networks should be possible.
allow_lan: bool,
/// Servers that are allowed to respond to DNS requests.
- #[cfg(windows)]
+ #[cfg(any(windows, target_os = "linux"))]
dns_servers: Vec<IpAddr>,
/// A process that is allowed to send packets to the relay.
#[cfg(windows)]
diff --git a/talpid-core/src/tunnel_state_machine/connected_state.rs b/talpid-core/src/tunnel_state_machine/connected_state.rs
index a7fd495c50..2ef41b4a91 100644
--- a/talpid-core/src/tunnel_state_machine/connected_state.rs
+++ b/talpid-core/src/tunnel_state_machine/connected_state.rs
@@ -78,7 +78,7 @@ impl ConnectedState {
#[allow(unused_variables)]
fn get_dns_servers(&self, shared_values: &SharedTunnelStateValues) -> Vec<IpAddr> {
- #[cfg(windows)]
+ #[cfg(any(windows, target_os = "linux"))]
if let Some(ref servers) = shared_values.custom_dns {
servers.clone()
} else {
@@ -89,7 +89,7 @@ impl ConnectedState {
};
dns_ips
}
- #[cfg(not(windows))]
+ #[cfg(not(any(windows, target_os = "linux")))]
{
let mut dns_ips = vec![];
dns_ips.push(self.metadata.ipv4_gateway.into());
@@ -105,7 +105,7 @@ impl ConnectedState {
peer_endpoint: self.tunnel_parameters.get_next_hop_endpoint(),
tunnel: self.metadata.clone(),
allow_lan: shared_values.allow_lan,
- #[cfg(windows)]
+ #[cfg(any(windows, target_os = "linux"))]
dns_servers: self.get_dns_servers(shared_values),
#[cfg(windows)]
relay_client: TunnelMonitor::get_relay_client(
@@ -182,7 +182,7 @@ impl ConnectedState {
}
}
}
- #[cfg(windows)]
+ #[cfg(any(windows, target_os = "linux"))]
Some(TunnelCommand::CustomDns(servers)) => {
if shared_values.custom_dns != servers {
shared_values.custom_dns = servers;
diff --git a/talpid-core/src/tunnel_state_machine/connecting_state.rs b/talpid-core/src/tunnel_state_machine/connecting_state.rs
index 6f081697e5..036e4356cd 100644
--- a/talpid-core/src/tunnel_state_machine/connecting_state.rs
+++ b/talpid-core/src/tunnel_state_machine/connecting_state.rs
@@ -227,7 +227,7 @@ impl ConnectingState {
}
}
}
- #[cfg(windows)]
+ #[cfg(any(windows, target_os = "linux"))]
Some(TunnelCommand::CustomDns(servers)) => {
shared_values.custom_dns = servers;
SameState(self.into())
diff --git a/talpid-core/src/tunnel_state_machine/disconnected_state.rs b/talpid-core/src/tunnel_state_machine/disconnected_state.rs
index 4781f19091..9fc8aa781f 100644
--- a/talpid-core/src/tunnel_state_machine/disconnected_state.rs
+++ b/talpid-core/src/tunnel_state_machine/disconnected_state.rs
@@ -82,7 +82,7 @@ impl TunnelState for DisconnectedState {
}
SameState(self.into())
}
- #[cfg(windows)]
+ #[cfg(any(windows, target_os = "linux"))]
Some(TunnelCommand::CustomDns(servers)) => {
shared_values.custom_dns = servers;
SameState(self.into())
diff --git a/talpid-core/src/tunnel_state_machine/disconnecting_state.rs b/talpid-core/src/tunnel_state_machine/disconnecting_state.rs
index 356df9be53..2ea612e26e 100644
--- a/talpid-core/src/tunnel_state_machine/disconnecting_state.rs
+++ b/talpid-core/src/tunnel_state_machine/disconnecting_state.rs
@@ -32,7 +32,7 @@ impl DisconnectingState {
let _ = shared_values.set_allow_lan(allow_lan);
AfterDisconnect::Nothing
}
- #[cfg(windows)]
+ #[cfg(any(windows, target_os = "linux"))]
Some(TunnelCommand::CustomDns(servers)) => {
shared_values.custom_dns = servers;
AfterDisconnect::Nothing
@@ -54,7 +54,7 @@ impl DisconnectingState {
let _ = shared_values.set_allow_lan(allow_lan);
AfterDisconnect::Block(reason)
}
- #[cfg(windows)]
+ #[cfg(any(windows, target_os = "linux"))]
Some(TunnelCommand::CustomDns(servers)) => {
shared_values.custom_dns = servers;
AfterDisconnect::Block(reason)
@@ -81,7 +81,7 @@ impl DisconnectingState {
let _ = shared_values.set_allow_lan(allow_lan);
AfterDisconnect::Reconnect(retry_attempt)
}
- #[cfg(windows)]
+ #[cfg(any(windows, target_os = "linux"))]
Some(TunnelCommand::CustomDns(servers)) => {
shared_values.custom_dns = servers;
AfterDisconnect::Reconnect(retry_attempt)
diff --git a/talpid-core/src/tunnel_state_machine/error_state.rs b/talpid-core/src/tunnel_state_machine/error_state.rs
index aa53e0b0b5..91abf34688 100644
--- a/talpid-core/src/tunnel_state_machine/error_state.rs
+++ b/talpid-core/src/tunnel_state_machine/error_state.rs
@@ -102,7 +102,7 @@ impl TunnelState for ErrorState {
SameState(self.into())
}
}
- #[cfg(windows)]
+ #[cfg(any(windows, target_os = "linux"))]
Some(TunnelCommand::CustomDns(servers)) => {
shared_values.custom_dns = servers;
SameState(self.into())
diff --git a/talpid-core/src/tunnel_state_machine/mod.rs b/talpid-core/src/tunnel_state_machine/mod.rs
index 90bf9a5d29..d4d337925f 100644
--- a/talpid-core/src/tunnel_state_machine/mod.rs
+++ b/talpid-core/src/tunnel_state_machine/mod.rs
@@ -24,7 +24,7 @@ use futures::{
channel::{mpsc, oneshot},
stream, StreamExt,
};
-#[cfg(windows)]
+#[cfg(any(windows, target_os = "linux"))]
use std::net::IpAddr;
use std::{
collections::HashSet,
@@ -76,7 +76,7 @@ pub enum Error {
pub async fn spawn(
allow_lan: bool,
block_when_disconnected: bool,
- #[cfg(windows)] custom_dns: Option<Vec<IpAddr>>,
+ #[cfg(any(windows, target_os = "linux"))] custom_dns: Option<Vec<IpAddr>>,
tunnel_parameters_generator: impl TunnelParametersGenerator,
log_dir: Option<PathBuf>,
resource_dir: PathBuf,
@@ -112,7 +112,7 @@ pub async fn spawn(
allow_lan,
block_when_disconnected,
is_offline,
- #[cfg(windows)]
+ #[cfg(any(windows, target_os = "linux"))]
custom_dns,
tunnel_parameters_generator,
tun_provider,
@@ -153,7 +153,7 @@ pub enum TunnelCommand {
/// Enable or disable LAN access in the firewall.
AllowLan(bool),
/// Set custom DNS servers to use.
- #[cfg(windows)]
+ #[cfg(any(windows, target_os = "linux"))]
CustomDns(Option<Vec<IpAddr>>),
/// Enable or disable the block_when_disconnected feature.
BlockWhenDisconnected(bool),
@@ -192,7 +192,7 @@ impl TunnelStateMachine {
allow_lan: bool,
block_when_disconnected: bool,
is_offline: bool,
- #[cfg(windows)] custom_dns: Option<Vec<IpAddr>>,
+ #[cfg(any(windows, target_os = "linux"))] custom_dns: Option<Vec<IpAddr>>,
tunnel_parameters_generator: impl TunnelParametersGenerator,
tun_provider: TunProvider,
log_dir: Option<PathBuf>,
@@ -217,7 +217,7 @@ impl TunnelStateMachine {
allow_lan,
block_when_disconnected,
is_offline,
- #[cfg(windows)]
+ #[cfg(any(windows, target_os = "linux"))]
custom_dns,
tunnel_parameters_generator: Box::new(tunnel_parameters_generator),
tun_provider,
@@ -289,7 +289,7 @@ struct SharedTunnelStateValues {
/// True when the computer is known to be offline.
is_offline: bool,
/// Custom DNS servers to use.
- #[cfg(windows)]
+ #[cfg(any(windows, target_os = "linux"))]
custom_dns: Option<Vec<IpAddr>>,
/// The generator of new `TunnelParameter`s
tunnel_parameters_generator: Box<dyn TunnelParametersGenerator>,