feat: Support PAC Mode

This commit is contained in:
MystiPanda
2024-05-26 17:59:39 +08:00
parent fc1675575a
commit b9ec94d835
15 changed files with 311 additions and 85 deletions

View File

@@ -13,3 +13,8 @@ pub use self::prfitem::*;
pub use self::profiles::*;
pub use self::runtime::*;
pub use self::verge::*;
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;"
}
"#;

View File

@@ -1,3 +1,4 @@
use crate::config::DEFAULT_PAC;
use crate::utils::{dirs, help};
use anyhow::Result;
use log::LevelFilter;
@@ -80,6 +81,12 @@ pub struct IVerge {
/// proxy guard duration
pub proxy_guard_duration: Option<u64>,
/// use pac mode
pub proxy_auto_config: Option<bool>,
/// pac script content
pub pac_file_content: Option<String>,
/// theme setting
pub theme_setting: Option<IVergeTheme>,
@@ -211,6 +218,8 @@ impl IVerge {
enable_auto_launch: Some(false),
enable_silent_start: Some(false),
enable_system_proxy: Some(false),
proxy_auto_config: Some(false),
pac_file_content: Some(DEFAULT_PAC.into()),
enable_random_port: Some(false),
#[cfg(not(target_os = "windows"))]
verge_redir_port: Some(7895),
@@ -290,6 +299,8 @@ impl IVerge {
patch!(enable_proxy_guard);
patch!(system_proxy_bypass);
patch!(proxy_guard_duration);
patch!(proxy_auto_config);
patch!(pac_file_content);
patch!(theme_setting);
patch!(web_ui_list);