diff --git a/ostp-client/src/tunnel/linux_handler.rs b/ostp-client/src/tunnel/linux_handler.rs index d257b7d..98822d4 100644 --- a/ostp-client/src/tunnel/linux_handler.rs +++ b/ostp-client/src/tunnel/linux_handler.rs @@ -18,7 +18,9 @@ pub async fn run_linux_tunnel( println!("[ostp-client] Starting Linux TUN handler initialization..."); } - // 1. Locate tun2socks binary + // 1. Automatically ensure tun2socks binary is downloaded and present + super::download_tun2socks(debug)?; + let exe = std::env::current_exe()?; let dir = exe.parent().ok_or_else(|| anyhow!("failed to get binary directory"))?; diff --git a/ostp-client/src/tunnel/wintun_handler.rs b/ostp-client/src/tunnel/wintun_handler.rs index 558438b..8c8a510 100644 --- a/ostp-client/src/tunnel/wintun_handler.rs +++ b/ostp-client/src/tunnel/wintun_handler.rs @@ -15,13 +15,16 @@ pub async fn run_wintun_tunnel( println!("[ostp-client] Initializing high-performance TUN tunnel via tun2socks..."); } - // 1. Get executable directory to locate tun2socks.exe and wintun.dll + // 1. Automatically ensure Wintun and tun2socks dependencies are downloaded and present + super::download_wintun_dll(debug)?; + super::download_tun2socks(debug)?; + let exe = std::env::current_exe()?; let dir = exe.parent().ok_or_else(|| anyhow!("failed to get binary directory"))?; let tun2socks_exe = dir.join("tun2socks.exe"); if !tun2socks_exe.exists() { - return Err(anyhow!("tun2socks.exe not found! Please ensure initialization downloaded it successfully.")); + return Err(anyhow!("tun2socks.exe not found! Even after download attempt, binary remains missing.")); } // 2. Resolve Server IP for routing table exclusion