Change order of operations to support auto setup

This commit is contained in:
B. Blechschmidt 2024-02-25 00:45:42 +01:00
parent 498a43b471
commit a5db99b03b

View file

@ -113,16 +113,17 @@ pub async fn desktop_run_async(args: Args, shutdown_token: tokio_util::sync::Can
#[allow(unused_mut, unused_assignments, unused_variables)] #[allow(unused_mut, unused_assignments, unused_variables)]
let mut setup = true; let mut setup = true;
let device = tun2::create_as_async(&config)?;
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
{ {
setup = args.setup; setup = args.setup;
if setup { if setup {
log::trace!("Entering route setup");
tproxy_config::tproxy_setup(&tproxy_args)?; tproxy_config::tproxy_setup(&tproxy_args)?;
} }
} }
let device = tun2::create_as_async(&config)?;
#[cfg(any(target_os = "windows", target_os = "macos"))] #[cfg(any(target_os = "windows", target_os = "macos"))]
if setup { if setup {
tproxy_config::tproxy_setup(&tproxy_args)?; tproxy_config::tproxy_setup(&tproxy_args)?;