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<()> {