fix: standardize logging type naming from IPC to Ipc for consistency
This commit is contained in:
@@ -20,7 +20,7 @@ pub fn toggle_system_proxy() {
|
||||
// 如果当前系统代理即将关闭,且自动关闭连接设置为true,则关闭所有连接
|
||||
if enable && auto_close_connection {
|
||||
if let Err(err) = IpcManager::global().close_all_connections().await {
|
||||
log::error!(target: "app", "Failed to close all connections: {}", err);
|
||||
log::error!(target: "app", "Failed to close all connections: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ impl IpcManager {
|
||||
);
|
||||
logging!(
|
||||
info,
|
||||
Type::IPC,
|
||||
Type::Ipc,
|
||||
true,
|
||||
"IpcManager initialized with IPC path: {}",
|
||||
instance.ipc_path
|
||||
@@ -49,7 +49,7 @@ impl IpcManager {
|
||||
body: Option<&serde_json::Value>,
|
||||
) -> AnyResult<Response> {
|
||||
let client = IpcHttpClient::new(&self.ipc_path);
|
||||
Ok(client.request(method, path, body).await?)
|
||||
client.request(method, path, body).await
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,8 +141,7 @@ impl IpcManager {
|
||||
let test_url =
|
||||
test_url.unwrap_or_else(|| "https://cp.cloudflare.com/generate_204".to_string());
|
||||
let url = format!(
|
||||
"/proxies/{}/delay?url={}&timeout={}",
|
||||
name, test_url, timeout
|
||||
"/proxies/{name}/delay?url={test_url}&timeout={timeout}"
|
||||
);
|
||||
let response = self.send_request("GET", &url, None).await?;
|
||||
Ok(response)
|
||||
@@ -155,7 +154,7 @@ impl IpcManager {
|
||||
}
|
||||
|
||||
pub async fn delete_connection(&self, id: &str) -> Result<(), AnyError> {
|
||||
let url = format!("/connections/{}", id);
|
||||
let url = format!("/connections/{id}");
|
||||
let response = self.send_request("DELETE", &url, None).await?;
|
||||
if response["code"] == 204 {
|
||||
Ok(())
|
||||
|
||||
@@ -17,7 +17,7 @@ pub enum Type {
|
||||
Lightweight,
|
||||
Network,
|
||||
ProxyMode,
|
||||
IPC,
|
||||
Ipc,
|
||||
}
|
||||
|
||||
impl fmt::Display for Type {
|
||||
@@ -38,7 +38,7 @@ impl fmt::Display for Type {
|
||||
Type::Lightweight => write!(f, "[Lightweight]"),
|
||||
Type::Network => write!(f, "[Network]"),
|
||||
Type::ProxyMode => write!(f, "[ProxMode]"),
|
||||
Type::IPC => write!(f, "[IPC]"),
|
||||
Type::Ipc => write!(f, "[IPC]"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user