From 9d76377053ed18412719878b9ec74f3347e8fa06 Mon Sep 17 00:00:00 2001 From: AB-UK Date: Fri, 26 Dec 2025 03:48:57 +0000 Subject: [PATCH] Hide Xray console. Added lib.rs --- src/lib.rs | 4 ++++ src/xray_runner.rs | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 src/lib.rs diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..5cde58a --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,4 @@ +pub mod config_models; +pub mod parser; +pub mod utils; +pub mod xray_runner; diff --git a/src/xray_runner.rs b/src/xray_runner.rs index 1c6abf4..1d474b6 100644 --- a/src/xray_runner.rs +++ b/src/xray_runner.rs @@ -33,8 +33,17 @@ impl XrayRunner { cmd.arg("-config") .arg(&config_path) .stdin(Stdio::null()) - .stdout(Stdio::inherit()) - .stderr(Stdio::inherit()); + .stdout(Stdio::null()) + .stderr(Stdio::null()); + + // Hide console window on Windows + #[cfg(windows)] + { + const CREATE_NO_WINDOW: u32 = 0x08000000; + #[allow(unused_imports)] + use std::os::windows::process::CommandExt; + cmd.creation_flags(CREATE_NO_WINDOW); + } let child = cmd.spawn()?;