diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-12-02 14:16:50 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-12-03 12:30:32 +0000 |
| commit | 50fb75a3d52fc937c9b674cd7b595ad816a85479 (patch) | |
| tree | 128c478c060107fe501f3f606ba7d28a14333cbb | |
| parent | b0628860be5c03af241bbfc308887686ea561bed (diff) | |
| download | mullvadvpn-50fb75a3d52fc937c9b674cd7b595ad816a85479.tar.xz mullvadvpn-50fb75a3d52fc937c9b674cd7b595ad816a85479.zip | |
Group constants and imports
| -rw-r--r-- | talpid-core/src/tunnel/wireguard/wireguard_go.rs | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/talpid-core/src/tunnel/wireguard/wireguard_go.rs b/talpid-core/src/tunnel/wireguard/wireguard_go.rs index 50df570d01..f1570a0a4a 100644 --- a/talpid-core/src/tunnel/wireguard/wireguard_go.rs +++ b/talpid-core/src/tunnel/wireguard/wireguard_go.rs @@ -9,27 +9,33 @@ use { std::{net::IpAddr, os::unix::io::RawFd, ptr}, }; - -#[cfg(target_os = "windows")] -use crate::{ - tunnel::tun_provider::windows::WinTun, - winnet::{self, add_device_ip_addresses}, -}; - #[cfg(target_os = "android")] use talpid_types::BoxedError; -#[cfg(not(target_os = "windows"))] -const MAX_PREPARE_TUN_ATTEMPTS: usize = 4; - #[cfg(target_os = "windows")] use { + crate::{ + tunnel::tun_provider::windows::WinTun, + winnet::{self, add_device_ip_addresses}, + }, chrono, parking_lot::Mutex, std::{collections::HashMap, fs, io::Write}, }; +#[cfg(target_os = "windows")] +lazy_static::lazy_static! { + static ref LOG_MUTEX: Mutex<HashMap<u32, fs::File>> = Mutex::new(HashMap::new()); +} + +#[cfg(target_os = "windows")] +static mut LOG_CONTEXT_NEXT_ORDINAL: u32 = 0; + +#[cfg(not(target_os = "windows"))] +const MAX_PREPARE_TUN_ATTEMPTS: usize = 4; + + pub struct WgGoTunnel { interface_name: String, handle: Option<i32>, @@ -41,14 +47,6 @@ pub struct WgGoTunnel { log_context_ordinal: u32, } -#[cfg(target_os = "windows")] -lazy_static::lazy_static! { - static ref LOG_MUTEX: Mutex<HashMap<u32, fs::File>> = Mutex::new(HashMap::new()); -} - -#[cfg(target_os = "windows")] -static mut LOG_CONTEXT_NEXT_ORDINAL: u32 = 0; - impl WgGoTunnel { #[cfg(not(target_os = "windows"))] pub fn start_tunnel( |
