diff options
| author | David Lönnhager <david.l@mullvad.net> | 2023-10-17 11:51:18 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2023-10-20 18:17:19 +0200 |
| commit | 5cee95d43bb0cc3654e5558ba02919dbf32d52aa (patch) | |
| tree | bda93278bf708769adc4fec3f4f526b84f5cf15b /talpid-core | |
| parent | b3cc38c2bea1869e495206ec1febc6a92bb300bc (diff) | |
| download | mullvadvpn-5cee95d43bb0cc3654e5558ba02919dbf32d52aa.tar.xz mullvadvpn-5cee95d43bb0cc3654e5558ba02919dbf32d52aa.zip | |
Move talpid-windows-net into talpid-windows
Diffstat (limited to 'talpid-core')
| -rw-r--r-- | talpid-core/Cargo.toml | 1 | ||||
| -rw-r--r-- | talpid-core/src/dns/windows/iphlpapi.rs | 2 | ||||
| -rw-r--r-- | talpid-core/src/dns/windows/netsh.rs | 2 | ||||
| -rw-r--r-- | talpid-core/src/dns/windows/tcpip.rs | 2 | ||||
| -rw-r--r-- | talpid-core/src/offline/windows.rs | 2 | ||||
| -rw-r--r-- | talpid-core/src/split_tunnel/windows/mod.rs | 30 |
6 files changed, 17 insertions, 22 deletions
diff --git a/talpid-core/Cargo.toml b/talpid-core/Cargo.toml index 40dae6b27b..eecc07e388 100644 --- a/talpid-core/Cargo.toml +++ b/talpid-core/Cargo.toml @@ -60,7 +60,6 @@ widestring = "1.0" winreg = { version = "0.51", features = ["transactions"] } memoffset = "0.6" windows-service = "0.6.0" -talpid-windows-net = { path = "../talpid-windows-net" } talpid-windows = { path = "../talpid-windows" } [target.'cfg(windows)'.dependencies.windows-sys] diff --git a/talpid-core/src/dns/windows/iphlpapi.rs b/talpid-core/src/dns/windows/iphlpapi.rs index 2d62e1860e..f9aba70065 100644 --- a/talpid-core/src/dns/windows/iphlpapi.rs +++ b/talpid-core/src/dns/windows/iphlpapi.rs @@ -13,7 +13,7 @@ use std::{ ptr, }; use talpid_types::win32_err; -use talpid_windows_net::{guid_from_luid, luid_from_alias}; +use talpid_windows::net::{guid_from_luid, luid_from_alias}; use windows_sys::{ core::GUID, s, w, diff --git a/talpid-core/src/dns/windows/netsh.rs b/talpid-core/src/dns/windows/netsh.rs index 17cf551b1f..7de3fe7900 100644 --- a/talpid-core/src/dns/windows/netsh.rs +++ b/talpid-core/src/dns/windows/netsh.rs @@ -9,7 +9,7 @@ use std::{ time::Duration, }; use talpid_types::{net::IpVersion, ErrorExt}; -use talpid_windows_net::{index_from_luid, luid_from_alias}; +use talpid_windows::net::{index_from_luid, luid_from_alias}; use windows_sys::Win32::{ Foundation::{MAX_PATH, WAIT_OBJECT_0, WAIT_TIMEOUT}, System::{ diff --git a/talpid-core/src/dns/windows/tcpip.rs b/talpid-core/src/dns/windows/tcpip.rs index c1d577f5fe..244417e119 100644 --- a/talpid-core/src/dns/windows/tcpip.rs +++ b/talpid-core/src/dns/windows/tcpip.rs @@ -1,7 +1,7 @@ use crate::dns::DnsMonitorT; use std::{io, net::IpAddr}; use talpid_types::ErrorExt; -use talpid_windows_net::{guid_from_luid, luid_from_alias}; +use talpid_windows::net::{guid_from_luid, luid_from_alias}; use windows_sys::{core::GUID, Win32::System::Com::StringFromGUID2}; use winreg::{ enums::{HKEY_LOCAL_MACHINE, KEY_SET_VALUE}, diff --git a/talpid-core/src/offline/windows.rs b/talpid-core/src/offline/windows.rs index 2756f9c690..6539e6e256 100644 --- a/talpid-core/src/offline/windows.rs +++ b/talpid-core/src/offline/windows.rs @@ -9,7 +9,7 @@ use std::{ time::Duration, }; use talpid_types::ErrorExt; -use talpid_windows_net::AddressFamily; +use talpid_windows::net::AddressFamily; #[derive(err_derive::Error, Debug)] pub enum Error { diff --git a/talpid-core/src/split_tunnel/windows/mod.rs b/talpid-core/src/split_tunnel/windows/mod.rs index dcabda7c8e..e168ad38ae 100644 --- a/talpid-core/src/split_tunnel/windows/mod.rs +++ b/talpid-core/src/split_tunnel/windows/mod.rs @@ -21,7 +21,11 @@ use std::{ }; use talpid_routing::{get_best_default_route, CallbackHandle, EventType, RouteManagerHandle}; use talpid_types::{split_tunnel::ExcludedProcess, tunnel::ErrorStateCause, ErrorExt}; -use talpid_windows_net::{get_ip_address_for_interface, AddressFamily}; +use talpid_windows::{ + io::Overlapped, + net::{get_ip_address_for_interface, AddressFamily}, + sync::Event, +}; use windows_sys::Win32::Foundation::ERROR_OPERATION_ABORTED; const DRIVER_EVENT_BUFFER_SIZE: usize = 2048; @@ -69,7 +73,7 @@ pub enum Error { /// Failed to obtain an IP address given a network interface LUID #[error(display = "Failed to obtain IP address for interface LUID")] - LuidToIp(#[error(source)] talpid_windows_net::Error), + LuidToIp(#[error(source)] talpid_windows::net::Error), /// Failed to set up callback for monitoring default route changes #[error(display = "Failed to register default route change callback")] @@ -105,7 +109,7 @@ pub struct SplitTunnel { runtime: tokio::runtime::Handle, request_tx: RequestTx, event_thread: Option<std::thread::JoinHandle<()>>, - quit_event: Arc<talpid_windows::sync::Event>, + quit_event: Arc<Event>, excluded_processes: Arc<RwLock<HashMap<usize, ExcludedProcess>>>, _route_change_callback: Option<CallbackHandle>, daemon_tx: Weak<mpsc::UnboundedSender<TunnelCommand>>, @@ -191,21 +195,13 @@ impl SplitTunnel { fn spawn_event_listener( handle: Arc<driver::DeviceHandle>, excluded_processes: Arc<RwLock<HashMap<usize, ExcludedProcess>>>, - ) -> Result< - ( - std::thread::JoinHandle<()>, - Arc<talpid_windows::sync::Event>, - ), - Error, - > { - let mut event_overlapped = talpid_windows::io::Overlapped::new(Some( - talpid_windows::sync::Event::new(true, false).map_err(Error::EventThreadError)?, + ) -> Result<(std::thread::JoinHandle<()>, Arc<Event>), Error> { + let mut event_overlapped = Overlapped::new(Some( + Event::new(true, false).map_err(Error::EventThreadError)?, )) .map_err(Error::EventThreadError)?; - let quit_event = Arc::new( - talpid_windows::sync::Event::new(true, false).map_err(Error::EventThreadError)?, - ); + let quit_event = Arc::new(Event::new(true, false).map_err(Error::EventThreadError)?); let quit_event_copy = quit_event.clone(); let event_thread = std::thread::spawn(move || { @@ -244,8 +240,8 @@ impl SplitTunnel { fn fetch_next_event( device: &Arc<driver::DeviceHandle>, - quit_event: &talpid_windows::sync::Event, - overlapped: &mut talpid_windows::io::Overlapped, + quit_event: &Event, + overlapped: &mut Overlapped, data_buffer: &mut Vec<u8>, ) -> io::Result<EventResult> { if unsafe { driver::wait_for_single_object(quit_event.as_raw(), Some(Duration::ZERO)) } |
