feat: allow using --proxy-forward-by-system together with --enable-exit-node (#957)

This commit is contained in:
Kiva
2025-06-07 22:27:57 +08:00
committed by GitHub
parent 20a6025075
commit ec56c0bc45

View File

@@ -71,7 +71,6 @@ impl IpProxy {
async fn start(&self) -> Result<(), Error> {
if (self.global_ctx.get_proxy_cidrs().is_empty()
|| self.global_ctx.proxy_forward_by_system()
|| self.started.load(Ordering::Relaxed))
&& !self.global_ctx.enable_exit_node()
&& !self.global_ctx.no_tun()
@@ -79,6 +78,13 @@ impl IpProxy {
return Ok(());
}
// Actually, if this node is enabled as an exit node,
// we still can use the system stack to forward packets.
if self.global_ctx.proxy_forward_by_system()
&& !self.global_ctx.no_tun() {
return Ok(());
}
self.started.store(true, Ordering::Relaxed);
self.tcp_proxy.start(true).await?;
if let Err(e) = self.icmp_proxy.start().await {