cargo fmt

This commit is contained in:
eric committed 2026-01-01 16:18:16 +08:00
1 parent f9204266bf
commit e0b5410a97
6 files changed
+22 -10

No files matched your search

+16 -4
View File
@@ -260,7 +260,10 @@ table, th, td {
Path(tag): Path<String>,
State(rm): State<Arc<RuntimeManager>>,
) -> Result<Json<models::OutboundHealthCheck>, Infallible> {
let (tcp_res, udp_res) = rm.health_check_outbound(&tag, None).await.unwrap_or((Err(anyhow::anyhow!("runtime")), Err(anyhow::anyhow!("runtime"))));
let (tcp_res, udp_res) = rm.health_check_outbound(&tag, None).await.unwrap_or((
Err(anyhow::anyhow!("runtime")),
Err(anyhow::anyhow!("runtime")),
));
let tcp_ms = tcp_res.ok().map(|d| d.as_millis());
let udp_ms = udp_res.ok().map(|d| d.as_millis());
Ok(Json(models::OutboundHealthCheck {
@@ -296,9 +299,18 @@ impl ApiServer {
app = app
.route("/api/v1/runtime/stat/html", get(handlers::stat_html))
.route("/api/v1/runtime/stat/json", get(handlers::stat_json))
.route("/api/v1/runtime/outbound/{tag}/last_peer_active", get(handlers::last_peer_active))
.route("/api/v1/runtime/outbound/{tag}/since_last_peer_active", get(handlers::since_last_peer_active))
.route("/api/v1/runtime/outbound/{tag}/health", get(handlers::outbound_health));
.route(
"/api/v1/runtime/outbound/{tag}/last_peer_active",
get(handlers::last_peer_active),
)
.route(
"/api/v1/runtime/outbound/{tag}/since_last_peer_active",
get(handlers::since_last_peer_active),
)
.route(
"/api/v1/runtime/outbound/{tag}/health",
get(handlers::outbound_health),
);
let app = app.with_state(self.runtime_manager.clone());
+1 -1
View File
@@ -4,13 +4,13 @@ use tokio::sync::RwLock;
pub mod dispatcher;
pub mod dns_client;
pub mod healthcheck;
pub mod inbound;
pub mod logger;
pub mod nat_manager;
pub mod outbound;
pub mod router;
pub mod stat_manager;
pub mod healthcheck;
#[cfg(feature = "api")]
pub mod api;
-1
View File
@@ -1,4 +1,3 @@
mod stream;
pub use stream::Handler;
-1
View File
@@ -1,3 +1,2 @@
#[cfg(feature = "inbound-hc")]
pub mod inbound;
+4 -1
View File
@@ -185,7 +185,10 @@ pub async fn health_check_outbound(
.get(tag)
.ok_or_else(|| anyhow!("outbound {} not found", tag))?;
let (tcp_res, udp_res) = futures::future::join(
timeout(to, test_healthcheck_tcp(dns_client.clone(), handler.clone())),
timeout(
to,
test_healthcheck_tcp(dns_client.clone(), handler.clone()),
),
timeout(to, test_healthcheck_udp(dns_client, handler)),
)
.await;
+1 -2
View File
@@ -6,8 +6,7 @@ pub fn get_default_interface_ips() -> String {
Err(_) => return String::new(),
};
let candidate = adapters.iter()
.find(|a| !a.gateways().is_empty());
let candidate = adapters.iter().find(|a| !a.gateways().is_empty());
let adapter = match candidate {
Some(adapter) => adapter,