summaryrefslogtreecommitdiffhomepage
path: root/talpid-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'talpid-core/src')
-rw-r--r--talpid-core/src/dns/linux/mod.rs8
-rw-r--r--talpid-core/src/dns/linux/network_manager.rs2
-rw-r--r--talpid-core/src/dns/linux/systemd_resolved.rs2
-rw-r--r--talpid-core/src/dns/mod.rs8
4 files changed, 18 insertions, 2 deletions
diff --git a/talpid-core/src/dns/linux/mod.rs b/talpid-core/src/dns/linux/mod.rs
index 9eef807b71..132627da06 100644
--- a/talpid-core/src/dns/linux/mod.rs
+++ b/talpid-core/src/dns/linux/mod.rs
@@ -64,6 +64,14 @@ impl super::DnsMonitorT for DnsMonitor {
}
Ok(())
}
+
+ fn dbus_connection(&self) -> Option<&dbus::ffidisp::Connection> {
+ match &self.inner {
+ Some(DnsMonitorHolder::NetworkManager(nm)) => Some(&nm.dbus_connection),
+ Some(DnsMonitorHolder::SystemdResolved(sdr)) => Some(&sdr.dbus_connection),
+ _ => None,
+ }
+ }
}
pub enum DnsMonitorHolder {
diff --git a/talpid-core/src/dns/linux/network_manager.rs b/talpid-core/src/dns/linux/network_manager.rs
index 9bfac830eb..1e170bed11 100644
--- a/talpid-core/src/dns/linux/network_manager.rs
+++ b/talpid-core/src/dns/linux/network_manager.rs
@@ -77,7 +77,7 @@ lazy_static! {
}
pub struct NetworkManager {
- dbus_connection: Connection,
+ pub dbus_connection: Connection,
device: Option<String>,
settings_backup: Option<HashMap<String, HashMap<String, Variant<Box<dyn RefArg>>>>>,
}
diff --git a/talpid-core/src/dns/linux/systemd_resolved.rs b/talpid-core/src/dns/linux/systemd_resolved.rs
index 037c0830dc..981d4fb2ee 100644
--- a/talpid-core/src/dns/linux/systemd_resolved.rs
+++ b/talpid-core/src/dns/linux/systemd_resolved.rs
@@ -79,7 +79,7 @@ lazy_static! {
}
pub struct SystemdResolved {
- dbus_connection: Connection,
+ pub dbus_connection: Connection,
interface_link: Option<(String, dbus::Path<'static>)>,
}
diff --git a/talpid-core/src/dns/mod.rs b/talpid-core/src/dns/mod.rs
index 987f3f1092..3426622ce1 100644
--- a/talpid-core/src/dns/mod.rs
+++ b/talpid-core/src/dns/mod.rs
@@ -53,6 +53,11 @@ impl DnsMonitor {
log::info!("Resetting DNS");
self.inner.reset()
}
+
+ #[cfg(target_os="linux")]
+ fn dbus_connection(&self) -> Option<&dbus::ffidisp::Connection> {
+ self.inner.dbus_connection()
+ }
}
trait DnsMonitorT: Sized {
@@ -63,4 +68,7 @@ trait DnsMonitorT: Sized {
fn set(&mut self, interface: &str, servers: &[IpAddr]) -> Result<(), Self::Error>;
fn reset(&mut self) -> Result<(), Self::Error>;
+
+ #[cfg(target_os="linux")]
+ fn dbus_connection(&self) -> Option<&dbus::ffidisp::Connection>;
}