summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--mullvad-daemon/src/lib.rs1
-rw-r--r--talpid-core/src/dns/android.rs7
-rw-r--r--talpid-core/src/dns/linux/mod.rs8
-rw-r--r--talpid-core/src/dns/macos.rs3
-rw-r--r--talpid-core/src/dns/mod.rs14
-rw-r--r--talpid-core/src/dns/windows/mod.rs2
-rw-r--r--talpid-core/src/tunnel_state_machine/mod.rs7
7 files changed, 16 insertions, 26 deletions
diff --git a/mullvad-daemon/src/lib.rs b/mullvad-daemon/src/lib.rs
index 21ca9298b8..aa78abbd2a 100644
--- a/mullvad-daemon/src/lib.rs
+++ b/mullvad-daemon/src/lib.rs
@@ -664,7 +664,6 @@ where
tunnel_parameters_generator,
log_dir,
resource_dir.clone(),
- cache_dir.clone(),
internal_event_tx.to_specialized_sender(),
offline_state_tx,
tunnel_state_machine_shutdown_tx,
diff --git a/talpid-core/src/dns/android.rs b/talpid-core/src/dns/android.rs
index 517c311113..3e9e0ef81b 100644
--- a/talpid-core/src/dns/android.rs
+++ b/talpid-core/src/dns/android.rs
@@ -1,4 +1,4 @@
-use std::{net::IpAddr, path::Path};
+use std::net::IpAddr;
/// Stub error type for DNS errors on Android.
#[derive(Debug, err_derive::Error)]
@@ -10,10 +10,7 @@ pub struct DnsMonitor;
impl super::DnsMonitorT for DnsMonitor {
type Error = Error;
- fn new(
- _handle: tokio::runtime::Handle,
- _cache_dir: impl AsRef<Path>,
- ) -> Result<Self, Self::Error> {
+ fn new() -> Result<Self, Self::Error> {
Ok(DnsMonitor)
}
diff --git a/talpid-core/src/dns/linux/mod.rs b/talpid-core/src/dns/linux/mod.rs
index e56ca1c208..7ab5b43d03 100644
--- a/talpid-core/src/dns/linux/mod.rs
+++ b/talpid-core/src/dns/linux/mod.rs
@@ -8,7 +8,7 @@ use self::{
systemd_resolved::SystemdResolved,
};
use crate::routing::RouteManagerHandle;
-use std::{env, fmt, net::IpAddr, path::Path};
+use std::{env, fmt, net::IpAddr};
const RESOLV_CONF_PATH: &str = "/etc/resolv.conf";
@@ -48,11 +48,7 @@ pub struct DnsMonitor {
impl super::DnsMonitorT for DnsMonitor {
type Error = Error;
- fn new(
- handle: tokio::runtime::Handle,
- _cache_dir: impl AsRef<Path>,
- route_manager: RouteManagerHandle,
- ) -> Result<Self> {
+ fn new(handle: tokio::runtime::Handle, route_manager: RouteManagerHandle) -> Result<Self> {
Ok(DnsMonitor {
route_manager,
handle,
diff --git a/talpid-core/src/dns/macos.rs b/talpid-core/src/dns/macos.rs
index 44ba949f59..b58e47eada 100644
--- a/talpid-core/src/dns/macos.rs
+++ b/talpid-core/src/dns/macos.rs
@@ -4,7 +4,6 @@ use std::{
collections::HashMap,
fmt,
net::IpAddr,
- path::Path,
sync::{mpsc, Arc},
thread,
};
@@ -140,7 +139,7 @@ impl super::DnsMonitorT for DnsMonitor {
/// DNS settings for all network interfaces. If any changes occur it will instantly reset
/// the DNS settings for that interface back to the last server list set to this instance
/// with `set_dns`.
- fn new(_handle: tokio::runtime::Handle, _cache_dir: impl AsRef<Path>) -> Result<Self> {
+ fn new() -> Result<Self> {
let state = Arc::new(Mutex::new(None));
Self::spawn(state.clone())?;
Ok(DnsMonitor {
diff --git a/talpid-core/src/dns/mod.rs b/talpid-core/src/dns/mod.rs
index 229896cf98..f60b38a862 100644
--- a/talpid-core/src/dns/mod.rs
+++ b/talpid-core/src/dns/mod.rs
@@ -1,6 +1,6 @@
#[cfg(target_os = "linux")]
use crate::routing::RouteManagerHandle;
-use std::{net::IpAddr, path::Path};
+use std::net::IpAddr;
#[cfg(target_os = "macos")]
#[path = "macos.rs"]
@@ -31,14 +31,13 @@ pub struct DnsMonitor {
impl DnsMonitor {
/// Returns a new `DnsMonitor` that can set and monitor the system DNS.
pub fn new(
- handle: tokio::runtime::Handle,
- cache_dir: impl AsRef<Path>,
+ #[cfg(target_os = "linux")] handle: tokio::runtime::Handle,
#[cfg(target_os = "linux")] route_manager: RouteManagerHandle,
) -> Result<Self, Error> {
Ok(DnsMonitor {
inner: imp::DnsMonitor::new(
+ #[cfg(target_os = "linux")]
handle,
- cache_dir,
#[cfg(target_os = "linux")]
route_manager,
)?,
@@ -69,12 +68,15 @@ impl DnsMonitor {
trait DnsMonitorT: Sized {
type Error: std::error::Error;
+ #[cfg(target_os = "linux")]
fn new(
handle: tokio::runtime::Handle,
- cache_dir: impl AsRef<Path>,
- #[cfg(target_os = "linux")] route_manager: RouteManagerHandle,
+ route_manager: RouteManagerHandle,
) -> Result<Self, Self::Error>;
+ #[cfg(not(target_os = "linux"))]
+ fn new() -> Result<Self, Self::Error>;
+
fn set(&mut self, interface: &str, servers: &[IpAddr]) -> Result<(), Self::Error>;
fn reset(&mut self) -> Result<(), Self::Error>;
diff --git a/talpid-core/src/dns/windows/mod.rs b/talpid-core/src/dns/windows/mod.rs
index 5392ddf9fe..f56b52e924 100644
--- a/talpid-core/src/dns/windows/mod.rs
+++ b/talpid-core/src/dns/windows/mod.rs
@@ -46,7 +46,7 @@ pub struct DnsMonitor {}
impl super::DnsMonitorT for DnsMonitor {
type Error = Error;
- fn new(_handle: tokio::runtime::Handle, _cache_dir: impl AsRef<Path>) -> Result<Self, Error> {
+ fn new() -> Result<Self, Error> {
unsafe { WinDns_Initialize(Some(log_sink), b"WinDns\0".as_ptr()).into_result()? };
let mut monitor = DnsMonitor {};
diff --git a/talpid-core/src/tunnel_state_machine/mod.rs b/talpid-core/src/tunnel_state_machine/mod.rs
index c871998a71..fbc3e05622 100644
--- a/talpid-core/src/tunnel_state_machine/mod.rs
+++ b/talpid-core/src/tunnel_state_machine/mod.rs
@@ -34,7 +34,7 @@ use std::{
collections::HashSet,
io,
net::IpAddr,
- path::{Path, PathBuf},
+ path::PathBuf,
sync::{mpsc as sync_mpsc, Arc},
};
#[cfg(target_os = "android")]
@@ -102,7 +102,6 @@ pub async fn spawn(
tunnel_parameters_generator: impl TunnelParametersGenerator,
log_dir: Option<PathBuf>,
resource_dir: PathBuf,
- cache_dir: impl AsRef<Path> + Send + 'static,
state_change_listener: impl Sender<TunnelStateTransition> + Send + 'static,
offline_state_listener: mpsc::UnboundedSender<bool>,
shutdown_tx: oneshot::Sender<()>,
@@ -134,7 +133,6 @@ pub async fn spawn(
tun_provider,
log_dir,
resource_dir,
- cache_dir,
command_rx,
#[cfg(target_os = "android")]
android_context,
@@ -223,7 +221,6 @@ impl TunnelStateMachine {
tun_provider: TunProvider,
log_dir: Option<PathBuf>,
resource_dir: PathBuf,
- cache_dir: impl AsRef<Path>,
commands_rx: mpsc::UnboundedReceiver<TunnelCommand>,
#[cfg(target_os = "android")] android_context: AndroidContext,
) -> Result<Self, Error> {
@@ -242,8 +239,8 @@ impl TunnelStateMachine {
.await
.map_err(Error::InitRouteManagerError)?;
let dns_monitor = DnsMonitor::new(
+ #[cfg(target_os = "linux")]
runtime.clone(),
- cache_dir,
#[cfg(target_os = "linux")]
route_manager
.handle()