Skip to content

Commit

Permalink
Chore: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
xjasonlyu committed Feb 12, 2021
1 parent 88e9402 commit 3e3990e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 96 deletions.
60 changes: 17 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,72 +4,46 @@
[![Go Version][2]](https://github.com/xjasonlyu/tun2socks/blob/main/go.mod)
[![Go Report][3]](https://goreportcard.com/badge/github.com/xjasonlyu/tun2socks)
[![GitHub License][4]](https://github.com/xjasonlyu/tun2socks/blob/main/LICENSE)
[![Total Lines][5]](https://img.shields.io/tokei/lines/github/xjasonlyu/tun2socks?style=flat-square)
[![Releases][6]](https://github.com/xjasonlyu/tun2socks/releases)
[![Releases][5]](https://github.com/xjasonlyu/tun2socks/releases)

[1]: https://img.shields.io/github/workflow/status/xjasonlyu/tun2socks/Go?style=flat-square
[2]: https://img.shields.io/github/go-mod/go-version/xjasonlyu/tun2socks/main?style=flat-square
[3]: https://goreportcard.com/badge/github.com/xjasonlyu/tun2socks?style=flat-square
[4]: https://img.shields.io/github/license/xjasonlyu/tun2socks?style=flat-square
[5]: https://img.shields.io/tokei/lines/github/xjasonlyu/tun2socks?style=flat-square
[6]: https://img.shields.io/github/v/release/xjasonlyu/tun2socks?include_prereleases&style=flat-square
[5]: https://img.shields.io/github/v/release/xjasonlyu/tun2socks?include_prereleases&style=flat-square

English | [简体中文](README_ZH.md)

# What is tun2socks?

`tun2socks` is an application used to "socksify" TCP/UDP (IPv4 and IPv6) traffic at the network layer. It implements a TUN virtual network interface which accepts all incoming TCP/UDP packets and forwards them through a SOCKS server.

## Features

- ICMP echoing / IPv6 support / Socks5 & SS proxy
- `SO_BINDTODEVICE` & `SO_MARK` option support
- Optimized UDP transmission for game acceleration
- Pure Go implementation, no more CGO required
- Router mode, routing all the traffic in LAN
- TCP/IP stack powered by *[gVisor](https://github.com/google/gvisor)*
- More than *2.5Gbps* throughput (10x faster than [v1](https://github.com/xjasonlyu/tun2socks/tree/v1))
- **Fully support:** IPv4/IPv6/ICMP/TCP/UDP
- **Proxy protocol:** Socks5/Shadowsocks
- **Game ready:** optimized UDP transmission
- **Pure Go:** no CGO required, stability improved
- **Router mode:** forwarding packets in LAN
- **TCP/IP stack:** powered by **[gVisor](https://github.com/google/gvisor)**
- **High performance:** >2.5Gbps throughput

## Requirements

| Target | Minimum | Recommended |
| :----- | :-----: | :---------: |
| System | Linux MacOS Freebsd OpenBSD Windows | Linux or MacOS |
| Memory | >20MB | >128MB |
| CPU | AMD64(x86_64) ARM64 | AMD64 with AES-NI & AVX2 |
| CPU | AMD64 ARM64 | AMD64 with AES-NI & AVX2 |

## Documentation

Documentations and quick start guides can be found at [Github Wiki](https://github.com/xjasonlyu/tun2socks/wiki).

## Building from source

Due to the limitation of gVisor, tun2socks only supports x86_64 and ARM64 for now. Other architectures may become available in the future.

### Environments

Make sure the following dependencies are installed:

- Go 1.15+

### Building

Build and install the `tun2socks` binary:

```shell
make tun2socks
sudo cp ./bin/tun2socks /usr/local/bin
```
## Credits

Build for all architectures:
- [Dreamacro/clash](https://github.com/Dreamacro/clash) - A rule-based tunnel in Go
- [google/gvisor](https://github.com/google/gvisor) - Application Kernel for Containers
- [wireguard-go](https://git.zx2c4.com/wireguard-go) - Go Implementation of WireGuard

```shell
make all-arch
```
## License

## Credits
[GPL-3.0](https://github.com/xjasonlyu/tun2socks/blob/main/LICENSE)

- [Dreamacro/clash](https://github.com/Dreamacro/clash)
- [google/gvisor](https://github.com/google/gvisor)
- [majek/slirpnetstack](https://github.com/majek/slirpnetstack)
- [WireGuard/wireguard-go](https://git.zx2c4.com/wireguard-go)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fxjasonlyu%2Ftun2socks.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fxjasonlyu%2Ftun2socks?ref=badge_large)
73 changes: 20 additions & 53 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,16 @@
[![Go Version][2]](https://github.com/xjasonlyu/tun2socks/blob/main/go.mod)
[![Go Report][3]](https://goreportcard.com/badge/github.com/xjasonlyu/tun2socks)
[![GitHub License][4]](https://github.com/xjasonlyu/tun2socks/blob/main/LICENSE)
[![Total Lines][5]](https://img.shields.io/tokei/lines/github/xjasonlyu/tun2socks?style=flat-square)
[![Releases][6]](https://github.com/xjasonlyu/tun2socks/releases)
[![Releases][5]](https://github.com/xjasonlyu/tun2socks/releases)

[1]: https://img.shields.io/github/workflow/status/xjasonlyu/tun2socks/Go?style=flat-square
[2]: https://img.shields.io/github/go-mod/go-version/xjasonlyu/tun2socks/main?style=flat-square
[3]: https://goreportcard.com/badge/github.com/xjasonlyu/tun2socks?style=flat-square
[4]: https://img.shields.io/github/license/xjasonlyu/tun2socks?style=flat-square
[5]: https://img.shields.io/tokei/lines/github/xjasonlyu/tun2socks?style=flat-square
[6]: https://img.shields.io/github/v/release/xjasonlyu/tun2socks?include_prereleases&style=flat-square
[5]: https://img.shields.io/github/v/release/xjasonlyu/tun2socks?include_prereleases&style=flat-square

[English](README.md) | 简体中文

## 什么是 tun2socks ?

`tun2socks`是一个用来将网络层的`TCP/UDP`(包括`IPv4``IPv6`)流量套接字化的应用。它实现了一个`TUN`虚拟网卡接口,可以把所有到来的`TCP/UDP`包处理并转发给SOCKS服务器。

## 为什么使用 tun2socks ?

通过在主机上运行`tun2socks`,可以轻松地接管所有的`TCP/UDP`流量,同时提供诸多专业的功能特性,这包括:
Expand All @@ -31,67 +25,40 @@

## 特性介绍

- ICMP 回应 / IPv6 支持 / Socks5 和 SS 代理支持
- `SO_BINDTODEVICE` & `SO_MARK` 套接字选项支持
- 适用于游戏加速,针对UDP流量传输的专门优化
- 纯 Go 实现,不再需要 CGO,提升了稳定性
- 路由模式,可以用来转发及代理局域网内所有流量
- 核心由 *[gVisor](https://github.com/google/gvisor)* 强力驱动的 TCP/IP 网络栈
- 超过 *2.5Gbps* 的带宽吞吐量[v1](https://github.com/xjasonlyu/tun2socks/tree/v1) 版本的10x倍以上)
- **全面支持:** IPv4/IPv6/ICMP/TCP/UDP
- **代理协议:** Socks5/Shadowsocks
- **游戏加速:** 针对UDP传输的优化
- **纯Go实现:** 无需CGO,稳定性提升
- **路由模式** 转发代理局域网内所有流量
- **TCP/IP栈:****[gVisor](https://github.com/google/gvisor)** 强力驱动
- **高性能:** >2.5Gbps 的带宽吞吐量

## 硬件需求

| 目标 | 最小 | 建议 |
| :--- | :---: | :---: |
| 系统 | Linux MacOS Freebsd OpenBSD Windows | Linux or MacOS |
| 内存 | >20MB | >128MB |
| 架构 | AMD64(x86_64) ARM64 | AMD64 with AES-NI & AVX2 |
| 架构 | AMD64 ARM64 | AMD64 with AES-NI & AVX2 |

## 使用文档

文档以及使用方式,请看 [Github Wiki](https://github.com/xjasonlyu/tun2socks/wiki)

## 源码编译

由于 tun2socks 是基于 gVisor 的 TCP/IP 栈,所以目前只支持 x86_64 和 ARM64 架构。以后其他的架构的支持取决于 gVisor。

### 环境依赖

确保安装了以下环境:

- Go 1.15+

### 开始编译

编译以及安装 `tun2socks` 二进制文件:

```shell
make tun2socks
sudo cp ./bin/tun2socks /usr/local/bin
```

编译所有架构的二进制文件:

```shell
make all-arch
```

## 特别感谢

- [Dreamacro/clash](https://github.com/Dreamacro/clash)
- [google/gvisor](https://github.com/google/gvisor)
- [majek/slirpnetstack](https://github.com/majek/slirpnetstack)
- [WireGuard/wireguard-go](https://git.zx2c4.com/wireguard-go)

## 注意事项

1. 由于采用了纯Go实现,所以这一版本的`tun2socks`在有大量连接时内存消耗通常较多。如果您的需求对内存消耗极为敏感,请继续使用 [v1](https://github.com/xjasonlyu/tun2socks/tree/v1) 版本。
2. `tun2socks`只应该专注于将网络层的TCP/UDP流量转发给SOCKS服务器,其他的如DNS(DoH)、DHCP等模块功能应该交由第三方应用实现,所以弃用了DNS模块。
3. 因为是通过用户空间的网络栈接管所有流量并处理转发,在高吞吐时CPU的使用量会剧增,所以CPU的性能直接与可以达到的最大带宽挂钩。

## TODO
## 特别感谢

- [Dreamacro/clash](https://github.com/Dreamacro/clash) - A rule-based tunnel in Go
- [google/gvisor](https://github.com/google/gvisor) - Application Kernel for Containers
- [wireguard-go](https://git.zx2c4.com/wireguard-go) - Go Implementation of WireGuard

## License

[GPL-3.0](https://github.com/xjasonlyu/tun2socks/blob/main/LICENSE)

- [x] Windows 支持
- [x] FreeBSD 支持
- [x] OpenBSD 支持
- [ ] ~~自动路由模式~~
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fxjasonlyu%2Ftun2socks.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fxjasonlyu%2Ftun2socks?ref=badge_large)
Binary file modified docs/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3e3990e

Please sign in to comment.