phantomsocks implements a proxy client and server for Linux, Windows, and macOS. It can use Pcap, raw sockets, or WinDivert depending on platform and build.
Overview
phantomsocks is a cross-platform proxy with both client and server roles on Linux, Windows, and macOS. Traffic handling can use Pcap, raw sockets, or WinDivert, with platform-specific build options.
Configuration is driven by a config.json file. Supported modes described in the documentation include Socks, Redirect, TProxy, local redirect, and port mapping, with rule-based control over how traffic is handled.
On Linux, TProxy setup expects transparent routing so UDP sessions are tracked in userspace; documentation warns against certain UDP divert iptables rules that would bypass the TProxy listener, and notes matching IPv6 ip6tables rules when using IPv6.
You install the Go module from its GitHub path and compile with go build in the source tree. Separate build paths exist for the Pcap variant (including static linking notes), a raw socket build limited to Linux, and a WinDivert build limited to Windows. Cross-compilation instructions target building the Pcap version statically on Ubuntu with bundled libpcap and a downloaded toolchain.
Key features
- Socks, Redirect, and TProxy modes
- Pcap, raw socket, or WinDivert backends
- JSON configuration file
- Linux userspace UDP session tracking
- Port mapping and traffic rules
- Go-based build from source
Use cases
- Transparent proxy on Linux
- SOCKS proxy deployment
- Windows traffic capture with WinDivert
- Port redirection with custom rules