Optimize HTTP calls

This commit is contained in:
yuluo
2024-04-18 22:19:30 +08:00
Unverified
parent 9588c3280f
commit bf57a504b7
5 changed files with 90 additions and 11 deletions

View File

@@ -801,6 +801,10 @@ pub fn main_set_socks(proxy: String, username: String, password: String) {
set_socks(proxy, username, password)
}
pub fn main_get_proxy_status() -> bool {
get_proxy_status()
}
pub fn main_get_socks() -> Vec<String> {
get_socks()
}

View File

@@ -895,6 +895,9 @@ pub async fn set_socks(value: config::Socks5Server) -> ResultType<()> {
Ok(())
}
pub fn get_proxy_status() -> bool {
Config::get_socks().is_some()
}
#[tokio::main(flavor = "current_thread")]
pub async fn test_rendezvous_server() -> ResultType<()> {
let mut c = connect(1000, "").await?;

View File

@@ -421,6 +421,14 @@ pub fn set_socks(proxy: String, username: String, password: String) {
.ok();
}
#[inline]
pub fn get_proxy_status() -> bool {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
return ipc::get_proxy_status();
#[cfg(any(target_os = "android", target_os = "ios"))]
return false;
}
#[cfg(any(target_os = "android", target_os = "ios"))]
pub fn set_socks(_: String, _: String, _: String) {}