refactor: copy_clash_env

This commit is contained in:
keiko233 2023-11-09 10:52:52 +08:00
parent 26fd90dfa3
commit 71a23a4e02

View File

@ -334,10 +334,12 @@ async fn update_core_config() -> Result<()> {
/// copy env variable
pub fn copy_clash_env(option: &str) {
let port = { Config::clash().data().get_client_info().port };
let http_proxy = format!("http://127.0.0.1:{}", port);
let socks5_proxy = format!("socks5://127.0.0.1:{}", port);
let sh = format!("export https_proxy=http://127.0.0.1:{port} http_proxy=http://127.0.0.1:{port} all_proxy=socks5://127.0.0.1:{port}");
let cmd: String = format!("set http_proxy=http://127.0.0.1:{port} \n set https_proxy=http://127.0.0.1:{port}");
let ps: String = format!("$env:HTTP_PROXY=\"http://127.0.0.1:{port}\"; $env:HTTPS_PROXY=\"http://127.0.0.1:{port}\"");
let sh = format!("export https_proxy={http_proxy} http_proxy={http_proxy} all_proxy={socks5_proxy}");
let cmd: String = format!("set http_proxy={http_proxy} \n set https_proxy={http_proxy}");
let ps: String = format!("$env:HTTP_PROXY=\"{http_proxy}\"; $env:HTTPS_PROXY=\"{http_proxy}\"");
let mut cliboard = Clipboard::new();