mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-12-01 02:20:07 +08:00
* docs(backend): define background task ownership * refactor(backend): give background operations single task owners * test(backend): remove actor migration regression cases * docs(changelog): drop backend actor migration entry * refactor(backend): extract workspace task drivers * fix(timer): omit profile identifier from panic log * docs(backend): define workspace crate boundaries * refactor(lightweight): use the task countdown driver * refactor(lightweight): name countdown callbacks * refactor(task): simplify driver startup and coalescing requests * refactor(core): bind service handoff to the sidecar generation * refactor(tun): coalesce background run state reconciliation * refactor(core): own sidecar exit resources in one session * refactor(core): remove automatic Windows service handoff * refactor(task): simplify coalescing job signals * refactor(runstate): keep operation status with service state * refactor(dns): coalesce background override synchronization * refactor(sysproxy): own the local guard under its operation lock * fix(tray): read menu settings at publication * fix(dns): retain script lock across caller cancellation * refactor(profiles): own selected node restoration in one task * refactor(timer): own subscription schedules in the scheduler * test(timer): remove the added application test * fix(service): renew provider sync retry budget on refresh
86 lines
2.9 KiB
Rust
86 lines
2.9 KiB
Rust
use std::time::Duration;
|
|
|
|
pub mod network {
|
|
pub const DEFAULT_EXTERNAL_CONTROLLER: &str = "127.0.0.1:9097";
|
|
|
|
pub mod ports {
|
|
#[cfg(not(target_os = "windows"))]
|
|
pub const DEFAULT_REDIR: u16 = 7895;
|
|
#[cfg(target_os = "linux")]
|
|
pub const DEFAULT_TPROXY: u16 = 7896;
|
|
pub const DEFAULT_MIXED: u16 = 7897;
|
|
pub const DEFAULT_SOCKS: u16 = 7898;
|
|
pub const DEFAULT_HTTP: u16 = 7899;
|
|
}
|
|
}
|
|
|
|
pub mod sysproxy {
|
|
/// Single source of the macOS default bypass list; both proxy backends compose from it.
|
|
#[cfg(target_os = "macos")]
|
|
pub const MACOS_DEFAULT_BYPASS: &str =
|
|
"127.0.0.1,192.168.0.0/16,10.0.0.0/8,172.16.0.0/12,localhost,*.local,*.crashlytics.com,<local>";
|
|
}
|
|
|
|
pub mod timing {
|
|
use super::Duration;
|
|
|
|
pub const CONFIG_UPDATE_DEBOUNCE: Duration = Duration::from_millis(300);
|
|
pub const STARTUP_ERROR_DELAY: Duration = Duration::from_secs(2);
|
|
|
|
// How long a re-asked staging request is worth waiting for. One that already landed answers in
|
|
// milliseconds; anything slower means the Service is still working, so ReplaceCore beats waiting.
|
|
pub const STAGE_CONFIRM_TIMEOUT: Duration = Duration::from_secs(5);
|
|
|
|
pub const RUNTIME_PROVIDER_SYNC_DELAY: Duration = Duration::from_secs(15);
|
|
pub const RUNTIME_PROVIDER_SYNC_RETRY_DELAY: Duration = Duration::from_secs(15);
|
|
// mihomo rewrites provider caches in place.
|
|
pub const RUNTIME_PROVIDER_SETTLE: Duration = Duration::from_secs(2);
|
|
|
|
// Windows 服务冷启动较慢,避免过早回退 sidecar。
|
|
#[cfg(target_os = "windows")]
|
|
pub const SERVICE_WAIT_MAX: Duration = Duration::from_millis(30000);
|
|
#[cfg(target_os = "windows")]
|
|
pub const SERVICE_WAIT_INTERVAL: Duration = Duration::from_millis(200);
|
|
|
|
// 交接时等待 sidecar 释放 ext-controller 通道。
|
|
#[cfg(target_os = "windows")]
|
|
pub const SERVICE_START_RETRIES: usize = 5;
|
|
#[cfg(target_os = "windows")]
|
|
pub const SERVICE_START_RETRY_DELAY: Duration = Duration::from_millis(300);
|
|
}
|
|
|
|
pub mod profile {
|
|
/// Floor, in minutes, for how often a profile may auto-update (24 hours).
|
|
pub const MIN_UPDATE_INTERVAL: u64 = 1440;
|
|
}
|
|
|
|
pub mod files {
|
|
pub const RUNTIME_CONFIG: &str = "clash-verge.yaml";
|
|
pub const CHECK_CONFIG: &str = "clash-verge-check.yaml";
|
|
pub const DNS_CONFIG: &str = "dns_config.yaml";
|
|
pub const WINDOW_STATE: &str = "window_state.json";
|
|
}
|
|
|
|
pub mod tun {
|
|
pub const DEFAULT_STACK: &str = "mips";
|
|
|
|
pub const DEFAULT_MTU: u16 = 1500;
|
|
|
|
pub const DNS_HIJACK: &[&str] = &["any:53"];
|
|
|
|
/// Saved dialog fields; `enable` belongs to the verge switch.
|
|
pub const GUI_KEYS: &[&str] = &[
|
|
"stack",
|
|
"device",
|
|
"auto-route",
|
|
"route-exclude-address",
|
|
#[cfg(target_os = "linux")]
|
|
"auto-redirect",
|
|
"auto-detect-interface",
|
|
"dns-hijack",
|
|
"dns-mode",
|
|
"strict-route",
|
|
"mtu",
|
|
];
|
|
}
|