refactor: replace hardcoded DNS config filename with constant reference (#5280)

* refactor: replace hardcoded DNS config filename with constant reference

* refactor: remove redundant import of constants in IClashTemp template method

* refactor: add conditional compilation for DEFAULT_REDIR based on OS

* refactor: simplify default TPROXY port handling and remove unused trace_err macro

* refactor: simplify default TPROXY port fallback logic
This commit is contained in:
Tunglies
2025-11-01 22:50:19 +08:00
committed by GitHub
parent c0f9920531
commit 4a7859bdae
9 changed files with 22 additions and 59 deletions

View File

@@ -24,7 +24,6 @@ pub static PORTABLE_FLAG: OnceCell<bool> = OnceCell::new();
pub static CLASH_CONFIG: &str = "config.yaml";
pub static VERGE_CONFIG: &str = "verge.yaml";
pub static PROFILE_YAML: &str = "profiles.yaml";
pub static DNS_CONFIG: &str = "dns_config.yaml";
/// init portable flag
pub fn init_portable_flag() -> Result<()> {

View File

@@ -3,6 +3,7 @@
use crate::utils::logging::NoModuleFilter;
use crate::{
config::*,
constants,
core::handle,
logging,
process::AsyncHandler,
@@ -304,7 +305,7 @@ async fn init_dns_config() -> Result<()> {
// 检查DNS配置文件是否存在
let app_dir = dirs::app_home_dir()?;
let dns_path = app_dir.join("dns_config.yaml");
let dns_path = app_dir.join(constants::files::DNS_CONFIG);
if !dns_path.exists() {
logging!(info, Type::Setup, "Creating default DNS config file");

View File

@@ -80,15 +80,6 @@ macro_rules! log_err {
};
}
#[macro_export]
macro_rules! trace_err {
($result: expr, $err_str: expr) => {
if let Err(err) = $result {
log::trace!(target: "app", "{}, err {}", $err_str, err);
}
}
}
/// wrap the anyhow error
/// transform the error to String
#[macro_export]