From 05d6677f1cc9c2d0a38389ae3a9f7b08a98f8a15 Mon Sep 17 00:00:00 2001 From: dev0 Date: Mon, 30 Sep 2024 22:57:22 +1000 Subject: [PATCH] temp --- clash_lib/src/app/inbound/manager.rs | 18 ++++++++++++++++-- clash_lib/src/proxy/tproxy/mod.rs | 5 ++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/clash_lib/src/app/inbound/manager.rs b/clash_lib/src/app/inbound/manager.rs index ab9e785f0..215712f3c 100644 --- a/clash_lib/src/app/inbound/manager.rs +++ b/clash_lib/src/app/inbound/manager.rs @@ -6,7 +6,7 @@ use crate::{ dispatcher::Dispatcher, inbound::network_listener::{ListenerType, NetworkInboundListener}, }, - common::auth::ThreadSafeAuthenticator, + common::{auth::ThreadSafeAuthenticator, errors::new_io_error}, config::internal::config::{BindAddress, Inbound}, Error, Runner, }; @@ -68,7 +68,21 @@ impl InboundManager { } Ok(Box::pin(async move { - futures::future::select_all(runners).await.0 + let mut errors = Vec::new(); + let _ = futures::future::join_all(runners) + .await + .into_iter() + .filter_map(|r| r.map_err(|e| errors.push(e)).ok()) + .collect::>(); + if errors.is_empty() { + Ok(()) + } else { + Err(new_io_error(format!( + "failed to start inbound listeners: {:?}", + errors + )) + .into()) + } })) } diff --git a/clash_lib/src/proxy/tproxy/mod.rs b/clash_lib/src/proxy/tproxy/mod.rs index 60b19bda6..777207767 100644 --- a/clash_lib/src/proxy/tproxy/mod.rs +++ b/clash_lib/src/proxy/tproxy/mod.rs @@ -81,9 +81,8 @@ impl InboundListener for Listener { #[cfg(not(target_os = "linux"))] async fn listen_tcp(&self) -> std::io::Result<()> { - use crate::common::errors::new_io_error; - - Err(new_io_error("transparent proxy only support linux")) + warn!("tproxy not supported on non Linux"); + Ok(()) } async fn listen_udp(&self) -> std::io::Result<()> {