tun2socks transparently sends application traffic through HTTP, SOCKS, Shadowsocks, SSH, and other proxies on major desktop and server OSes.
Overview
tun2socks is a network tool that creates a TUN interface and routes traffic from applications through a proxy you configure. It is built around the gVisor TCP/IP stack and is meant to make proxying feel universal rather than per-app.
It supports several proxy protocols with optional authentication, including HTTP, SOCKS4 and SOCKS5, Shadowsocks, SSH tunnels, and relay-style proxies. Gateway mode can act as a layer-three gateway so other devices on the same network can send traffic through the host running tun2socks.
The authors describe cross-platform support on Linux, macOS, Windows, FreeBSD, and OpenBSD with platform-specific optimizations. IPv6 is supported natively, including tunneling IPv4 over IPv6 and the reverse. Documentation covers install from source, quickstart examples, memory tuning, and benchmark comparisons.
Operators typically run it as a command-line daemon alongside VPN or privacy tooling when they need transparent proxying at the OS level.
Key features
- Transparent application-wide proxying
- Multiple proxy protocols
- Gateway mode for other devices
- gVisor TCP/IP stack
- IPv4 and IPv6 tunneling
- Cross-platform binaries
- Optional proxy authentication
- Benchmark-oriented performance focus
Use cases
- Routing all host traffic through a SOCKS proxy
- Sharing a proxy gateway on a LAN
- Combining tun2socks with VPN clients
- Tunneling over high-latency links with IPv6
- Testing proxy setups across operating systems