+0
Daily
5,580
stars
649
forks
35
watchers
147
prs
255
issues
36
releases
README
!tun2socks
[![Go Build][1]](https://github.com/xjasonlyu/tun2socks/actions/workflows/docker.yml)
[![Go Linter][2]](https://github.com/xjasonlyu/tun2socks/actions/workflows/linter.yml)
[![Go Version][3]](https://github.com/xjasonlyu/tun2socks/blob/main/go.mod)
[![Maintainability][4]](https://qlty.sh/gh/xjasonlyu/projects/tun2socks)
[![GitHub License][5]](https://github.com/xjasonlyu/tun2socks/blob/main/LICENSE)
[![Docker Pulls][6]](https://hub.docker.com/r/xjasonlyu/tun2socks)
[![Releases][7]](https://github.com/xjasonlyu/tun2socks/releases)
Features
- Universal Proxying: Transparently routes all network traffic from any application through a proxy.
- Multi-Protocol: Supports HTTP/SOCKS/Shadowsocks/SSH/Relay proxies with optional authentication.
- Cross-Platform: Runs on Linux/macOS/Windows/FreeBSD/OpenBSD with platform-specific optimizations.
- Gateway Mode: Acts as a Layer 3 gateway to route traffic from other devices on the same network.
- Full IPv6 Compatibility: Natively supports IPv6; seamlessly tunnels IPv4 over IPv6 and vice versa.
- User-Space Networking: Leverages the gVisor network stack for enhanced
performance and flexibility.
Benchmarks
!benchmark
For all scenarios of usage, tun2socks performs best.
See benchmarks for more details.
Documentation
- Install from Source
- Quickstart Examples
- Memory Optimization
Full documentation and technical guides can be found at Wiki.
Community
Welcome and feel free to ask any questions at Discussions.
Credits
- google/gvisor - Application Kernel for Containers
- wireguard-go - Go Implementation of WireGuard
- wintun - Layer 3 TUN Driver for Windows
License
Star History
[1]: https://img.shields.io/github/actions/workflow/status/xjasonlyu/tun2socks/docker.yml?branch=main&logo=github
[2]: https://img.shields.io/github/actions/workflow/status/xjasonlyu/tun2socks/linter.yml?branch=main&logo=githubactions&label=golangci-lint
[3]: https://img.shields.io/github/go-mod/go-version/xjasonlyu/tun2socks?logo=go
[4]: https://qlty.sh/gh/xjasonlyu/projects/tun2socks/maintainability.svg
[5]: https://img.shields.io/github/license/xjasonlyu/tun2socks
[6]: https://img.shields.io/docker/pulls/xjasonlyu/tun2socks?logo=docker
[7]: https://img.shields.io/github/v/release/xjasonlyu/tun2socks?logo=smartthingsTop issues
#262[Bug] UDP requests mapping from tun0 to eth033 comments · 2023-06-05#252[Feature] Guide to use tunsocks on linux host as a gateway to other hosts ex: LXC containers and VMs14 comments · 2023-05-11#177[Feature] ConeNAT support7 comments · 2022-10-21#86[Feature Request] ACL support3 comments · 2021-12-14#451[Feature] Add Support for HTTPS/TLS Proxy in tun2socks2 comments · 2025-02-16#357[Feature] missing "--tun-post-down" option2 comments · 2024-04-17#83[Feature] Support dual stack fallback2 comments · 2021-12-09#556[Bug] device flag and -proxy string get first character(s) stripped in logs and actual interface name1 comments · 2026-09-28
Discussions
#548how remove the suffixes on windows tun1 comments · 2026-08-03#547about used by0 comments · 2026-08-01#534Enabling specific IP addresses to connect by the local internet.0 comments · 2026-05-07#523Windows 创建同名TUN会一直+13 comments · 2026-01-27#506要是支持icmp就好了1 comments · 2025-11-28#492tun2socks v2.6 proxy authentication issue in windows0 comments · 2025-09-05#484SSL error0 comments · 2025-07-12#482proxy server and tun2socks in the same host use mac os0 comments · 2025-07-04
Latest release
v2.7.0 v2.7.0 2026-07-12What's Changed Features Feature: use pflag as drop-in replacement by @xjasonlyu in https://github.com/xjasonlyu/tun2socks/pull/513 Feature(proxy): support ssh proxy protocol by @xjasonlyu in https://github.com/xjasonlyu/tun2socks/pull/519 Feature: support custom ICMP message handling by @nange in https://github.com/xjasonlyu/tun2socks/pull/521 Fixes Fix: update gVisor dependency and modify UDP handler to return a boolean by @SuzukiHonoka in https://github.com/xjasonlyu/tun2socks/pull/487 Fix: crash on multiple start/stop due to FD being closed twice by @vecljox in https:/