TProxy (TCP/UDP)
TProxy 是 Linux 内核的一个特性,允许用户态程序接收和处理非本地 IP 包。通过 TProxy,Clash 可以透明地代理 TCP 和 UDP 流量,而不需要在应用程序中配置代理设置。
工作原理
TProxy 通过 iptables 或 nftables 将流量重定向到 Clash 的 TProxy 端口。Clash 在透明代理模式下接收这些流量,并根据配置的规则进行处理。
配置方法
TCP 透明代理
Clash 的 TProxy 支持 TCP 透明代理。需要在内核中启用 IP_TRANSPARENT 选项,并在 iptables 中添加相应的规则。
UDP 透明代理
与 TCP 类似,Clash 也支持 UDP 透明代理。UDP 透明代理需要 TProxy v4 或更高版本的内核支持。
TProxy (TCP/UDP)
TProxy is a feature of the Linux kernel that allows user-space programs to receive and process non-local IP packets. Through TProxy, Clash can transparently proxy TCP and UDP traffic without the need to configure proxy settings in the application.
How It Works
TProxy redirects traffic to Clash's TProxy port through iptables or nftables. Clash receives this traffic in transparent proxy mode and processes it according to configured rules.
Configuration
TCP Transparent Proxy
Clash's TProxy supports TCP transparent proxy. The IP_TRANSPARENT option needs to be enabled in the kernel, and corresponding rules need to be added in iptables.
UDP Transparent Proxy
Similar to TCP, Clash also supports UDP transparent proxy. UDP transparent proxy requires TProxy v4 or higher kernel support.