2020-03-19 16:34:40 +08:00
2020-03-19 04:46:48 +08:00
mux
2020-03-19 15:33:04 +08:00
2020-03-19 16:34:40 +08:00
2020-03-19 16:34:40 +08:00
2020-03-19 03:45:19 +08:00
mux
2020-03-19 15:33:04 +08:00
mux
2020-03-19 15:33:04 +08:00
2020-03-18 00:56:36 +08:00
2020-03-18 11:53:06 +08:00
2020-03-19 16:34:40 +08:00

Trojan-Go

Trojan proxy written in golang. It is compatiable with the original Trojan protocol and config file.

It's still currently in heavy development.

Features

Compatible

It's fully compatible with the Trojan protocol, so that you can safely replace your client and server program with trojan-go, or even just replace one of them, without changing the config file.

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:

server.json

{
	"run_type": "server",
	"local_addr": "0.0.0.0",
	"local_port": 4445,
	"remote_addr": "127.0.0.1",
	"remote_port": 80,
	"password": [
		"your_awesome_password"
	],
	"ssl": {
		"cert": "your_cert.crt",
		"key": "your_key.crt",
	}
}

client.json

{
    "run_type": "client",
    "local_addr": "127.0.0.1",
    "local_port": 1080,
    "remote_addr": "your_awesome_server",
    "remote_port": 443,
    "password": [
	    "your_awesome_password"
    ],
    "ssl": {
        "cert": "your_cert.crt",
        "sni": "your_awesome_domain_name",
    }
}

run_type supported by Trojan-Go (the same as Trojan):

  • Client

  • Server

  • NAT (transparent proxy, see here)

  • Forward

For more infomation, see Trojan's docs about the configuration file.

Multiplexing

TLS handshaking may takes much time in a poor network condition. Trojan-go supports multiplexing(smux), which imporves the performance in the high-concurrency scenario by forcing one single TLS tunnel connection carries mutiple TCP connections.

It's NOT compatible with the original trojan protocol, so it's disabled by default. You can enable it by setting up the "mux" field, in the tcp options.

"tcp": {
    "mux": true
}

for example

client.json

{
    "run_type": "client",
    "local_addr": "127.0.0.1",
    "local_port": 1080,
    "remote_addr": "your_awesome_server",
    "remote_port": 443,
    "password": [
	    "your_awesome_password"
    ],
    "ssl": {
        "cert": "server.crt",
        "sni": "your_awesome_domain_name",
    },
    "tcp": {
        "mux": true
    }
}

You will only need to set up the client's config file, and the server will automatically detect it.

Portable

It's written in golang, so it's static compiled by default. You can easily build and deploy it to your server, pc, raspberry pi, and router.

Build

Just make sure your golang version >= 1.11

git clone https://github.com/p4gefau1t/trojan-go.git
cd trojan-go
go build

You can cross-compile it by setting up the environment vars, for example

GOOS=windows GOARCH=amd64 go build -o trojan-go.exe

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.

TODOs

  • Server
  • Forward
  • NAT
  • Client
  • UDP Tunneling
  • Transparent proxy
  • Log
  • Mux
  • TLS Settings
  • TLS redirecting
  • non-TLS redirecting
  • Cert utils
  • Database support
  • Traffic stats
  • TCP Settings
S
Description
No description provided
Readme
7.6 MiB
Languages
Go 98.2%
Makefile 1.3%
Dockerfile 0.3%
Shell 0.2%