tun2socks

tun2socks

WHAT IS IT?

tun2socks creates a TUN interface on your machine and redirects all network traffic through it, forwarding everything to a SOCKS5, HTTP, Shadowsocks, SSH or Relay proxy. It is the low-level networking glue that turns a plain application proxy into a transparent tunnel for the whole system, without touching the applications themselves.

WHY IS IT INTERESTING?

  • Transparent to applications: no per-app config, no proxy support required in the target software. Everything flows through the TUN.
  • Multi-protocol: SOCKS5, HTTP(S), Shadowsocks, SSH and Relay backends, with authentication. Pick the right one for the context.
  • Cross-platform: Linux, macOS, Windows, FreeBSD and OpenBSD, shipped as a single static Go binary.
  • Performance-focused: architected for throughput, with benchmarks favorable against legacy alternatives (badvpn-tun2socks and friends).
  • Native IPv6: bidirectional IPv4/IPv6 tunneling, handy for mixed networks or modern gateways.

USE CASES

  • Force an entire machine through a remote SOCKS proxy (bastion, exit node) without configuring each application.
  • Build a Layer 3 gateway on a Raspberry Pi to route a whole subnet through a proxy.
  • Wrap traffic in an SSH tunnel without juggling ssh -D and iptables rules.
  • Bridge IPv4 and IPv6 for services or clients that only speak one of the two stacks.