mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-03 05:22:09 +08:00
IVerge::patch_config, IProfiles::patch_item and PrfOption::merge each hand-rolled the same copy-Some-overwrite pattern; they now share one patch_opt_field macro (the or-else merge form is field-for-field equivalent for Option fields). The four profiles *_safe wrappers that inlined Config::profiles().with_data_modify boilerplate delegate to a with_profiles_edit helper, and record/forget_selected_node share the current-item lookup prelude via current_item_mut.
30 lines
683 B
Rust
30 lines
683 B
Rust
mod clash;
|
|
#[allow(clippy::module_inception)]
|
|
mod config;
|
|
pub(crate) mod dns;
|
|
mod encrypt;
|
|
mod mixed_port;
|
|
mod port;
|
|
mod prfitem;
|
|
pub mod profiles;
|
|
pub mod runtime;
|
|
pub(crate) mod snapshot;
|
|
mod verge;
|
|
|
|
pub(crate) use self::config::Config;
|
|
pub use self::{clash::*, encrypt::*, mixed_port::*, prfitem::*, profiles::*, verge::*};
|
|
|
|
macro_rules! patch_opt_field {
|
|
($lv:expr, $rv:expr, $key:tt) => {
|
|
if ($rv.$key).is_some() {
|
|
$lv.$key = $rv.$key.clone();
|
|
}
|
|
};
|
|
}
|
|
pub(crate) use patch_opt_field;
|
|
|
|
pub const DEFAULT_PAC: &str = r#"function FindProxyForURL(url, host) {
|
|
return "PROXY 127.0.0.1:%mixed-port%; SOCKS5 127.0.0.1:%mixed-port%; DIRECT;";
|
|
}
|
|
"#;
|