diff --git a/README.md b/README.md index 94c01062f..4050aeba4 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,37 @@ Trojan proxy written in golang. It is compatiable with the original Trojan proto It's still currently in heavy development. -[README_zh_cn(中文)](README_zh_cn.md) +[README_zh_cn.md(中文(简体))](README_zh_cn.md) + +## Usage + +``` +./trojan-go -config your_awesome_config_file.json +``` + +Trojan-Go supports most features of the original trojan, including + +- TLS tunneling + +- Transparent proxy (NAT mode) + +- UDP Relaying + +- Mechanism against passive and active detection of GFW + +- MySQL Database support + +- Traffic statistics, quota limits for each user + +- Authentication by users record in database + +- TCP performance-related options, like TCP fast open, port reusing, etc + +Note that the name of the TLS 1.2 cipher suite is slightly different in golang. Using the original configuration file directly will cause a warning, but it will not affect the running. See wiki for more information. + +... + +The format of the configuration file is compatible, see [here](https://trojan-gfw.github.io/trojan/config). ## Features @@ -14,14 +44,14 @@ It's fully compatible with the Trojan protocol and configuration file, so that y ### Easy to use -Trojan-go's configuration file format is compatible with Trojan's, while it's being simplyfied. You can launch your server and client much more easily. Here's an example: +Trojan-go's configuration file format is compatible with Trojan's, while it's being simplyfied. Unspecified fields will be filled in with a default value. You can launch your server and client much more easily. Here's an example: server.json ``` { "run_type": "server", "local_addr": "0.0.0.0", - "local_port": 4445, + "local_port": 443, "remote_addr": "127.0.0.1", "remote_port": 80, "password": [ @@ -30,6 +60,7 @@ server.json "ssl": { "cert": "your_cert.crt", "key": "your_key.crt", + "sni": "your_awesome_domain_name", } } @@ -106,7 +137,7 @@ You only need to set the client's configuration file, and the server will automa ### Portable -It's written in Golang, and Golang compiles statically by default, which means that you can execute the compiled single executable directly on the target machine without having to consider dependencies. You can easily compile (or cross compile) it and deploy it on your server, PC, Raspberry Pi, or even a router. +It's written in Golang, so it will be statically linked by default, which means that you can execute the compiled single executable directly on the target machine without having to consider dependencies. You can easily compile (or cross compile) it and deploy it on your server, PC, Raspberry Pi, or even a router. ## Build @@ -129,30 +160,3 @@ or ``` GOOS=linux GOARCH=arm go build -o trojan-go ``` - -## Usage - -``` -./trojan-go -config your_awesome_config_file.json -``` - -The format of the configuration file is compatible, see [here](https://trojan-gfw.github.io/trojan/config). - - -## TODOs - -- [x] Server -- [x] Forward -- [x] NAT -- [x] Client -- [x] UDP Tunneling -- [x] Transparent proxy -- [x] Log -- [x] Mux -- [x] TLS Settings -- [x] TLS redirecting -- [X] non-TLS redirecting -- [ ] Cert utils -- [x] Database support -- [x] Traffic stats -- [x] TCP Settings diff --git a/README_zh_cn.md b/README_zh_cn.md index 1a1081a65..3ecd42e4c 100644 --- a/README_zh_cn.md +++ b/README_zh_cn.md @@ -4,6 +4,34 @@ 目前仍然处于开发中。 +## 使用方法 + +``` +./trojan-go -config 你的配置文件.json +``` + +配置文件格式和Trojan相同, 参见[这里](https://trojan-gfw.github.io/trojan/config)。 + +Trojan-Go支持并且兼容原版Trojan的绝大多数功能,包括 + +- TLS隧道传输 + +- 透明代理 (NAT模式) + +- UDP代理 + +- 对抗GFW被动/主动检测的机制 + +- MySQL数据库支持 + +- 流量统计,用户流量配额限制 + +- 从数据库中的用户列表进行认证 + +- TCP性能方面的选项,如TCP Fast Open,端口复用等等 + +注意, TLS 1.2密码学套件的名称在golang中有一些不同,直接使用原版配置文件会引发一个警告,但不影响运行, 更多信息参见Wiki。 + ## 特性 ### 兼容 @@ -12,7 +40,7 @@ ### 易用 -配置文件格式与原版是兼容的,但做了一些简化。你可以更方便地部署你的服务器和客户端。下面是一个例子: +配置文件格式与原版是兼容的,但做了一些简化。未指定的字段会被附上一个初始值。你可以更方便地部署你的服务器和客户端。下面是一个例子,完整的配置文件参见Wiki。 服务器配置文件 @@ -21,7 +49,7 @@ server.json { "run_type": "server", "local_addr": "0.0.0.0", - "local_port": 4445, + "local_port": 443, "remote_addr": "127.0.0.1", "remote_port": 80, "password": [ @@ -30,6 +58,7 @@ server.json "ssl": { "cert": "your_cert.crt", "key": "your_key.crt", + "sni": "your_awesome_domain_name", } } @@ -108,10 +137,10 @@ client-mux.json ### 移植性 -使用Golang编写,而Golang默认进行静态编译,意味着你可以将编译得到的单个可执行文件在目标机器上直接执行而不需要考虑依赖的问题。你可以很方便地编译(或者交叉编译)它,然后在你的服务器,PC,树莓派,甚至路由器上部署。 +使用Golang编写,而Golang默认进行静态编译,不依赖其他组件, 意味着你可以将编译得到的单个可执行文件在目标机器上直接执行而不需要考虑依赖的问题。你可以很方便地编译(或者交叉编译)它,然后在你的服务器,PC,树莓派,甚至路由器上部署。 -## 编译构建 +## 构建 确保你的Golang版本 >= 1.11 @@ -132,12 +161,3 @@ GOOS=windows GOARCH=amd64 go build -o trojan-go.exe ``` GOOS=linux GOARCH=arm go build -o trojan-go ``` - -## 使用方法 - -``` -./trojan-go -config 你的配置文件.json -``` - -配置文件格式和Trojan相同, 参见[这里](https://trojan-gfw.github.io/trojan/config)。 -