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

@@ -1,4 +1,5 @@
use crate::config::Config;
use crate::constants::{network, tun as tun_const};
use crate::utils::dirs::{ipc_path, path_to_str};
use crate::utils::{dirs, help};
use crate::{logging, utils::logging::Type};
@@ -48,8 +49,6 @@ impl IClashTemp {
}
pub fn template() -> Self {
use crate::constants::{network, tun as tun_const};
let mut map = Mapping::new();
let mut tun_config = Mapping::new();
let mut cors_map = Mapping::new();
@@ -215,9 +214,9 @@ impl IClashTemp {
Value::Number(val_num) => val_num.as_u64().map(|u| u as u16),
_ => None,
})
.unwrap_or(7896);
.unwrap_or(network::ports::DEFAULT_TPROXY);
if port == 0 {
port = 7896;
port = network::ports::DEFAULT_TPROXY;
}
port
}