Trojan-rust is a rust implementation for Trojan protocol that is targeted to circumvent GFW. This implementation focus on performance and stability above everything else.
-
Depends on tokio-rs to achieve high performance async io. Tokio io provides better async IO performance by using lightweight threads that is somewhat similar to the runtime environment of Golang.
-
Uses rustls to handle TLS protocol. rustls is an implemention written in native rust, and is considered to be more secure compared and performant compared to Openssl implementation.
-
Performance focused. This implementation only aims at a few mainstream proxy protocols like Trojan protocol, so that we have more capacity to improve the performance and bugfixes rather than keep adding useless features.
-
Easy to use/configure. Make this project beginner friendly, minimize the amount of configurations one needs to write.
Currently there is no existing binary file that you can just download and use, and it is recommanded to compile and build yourself. To do so, first you need to set up the Rust environment, by installing through here https://www.rust-lang.org/. Once you have rust installed, you can simply go to command line and run,
cargo build --release
and it should generate a binary program under ./target/release/trojan-rust.
Alternatively, you can also run it directly through,
cargo run --release
To enable logs, on MacOs or Linux, run,
RUST_LOG=info cargo run --release
On windows powershell, run,
$Env:RUST_LOG = "info"
cargo run --release
Quick short script for your convenience,
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
{
"inbound": {
"protocol": "TROJAN",
"address": "0.0.0.0",
"secret": "123123",
"port": 8081,
"mode": "TCP",
"tls": {
"cert_path": "./cert.pem",
"key_path": "./key.pem"
}
},
"outbound": {
"protocol": "DIRECT"
}
}
{
"inbound": {
"protocol": "SOCKS",
"address": "0.0.0.0",
"port": 8081
},
"outbound": {
"protocol": "TROJAN",
"address": "0.0.0.0",
"port": 8082,
"secret": "123123",
"mode": "TCP",
"tls": {
"host_name": "example.com",
"allow_insecure": true
}
}
}
Just add GRPC to transport under inbound or outbound
"inbound": {
"protocol": "TROJAN",
"address": "0.0.0.0",
"secret": "123123",
"port": 8081,
"tls": {
"cert_path": "./cert.pem",
"key_path": "./key.pem"
},
"mode": "GRPC"
},
"outbound": {
"protocol": "DIRECT"
}
trojan-rust -h
Trojan Rust 0.0.1
Anonymous
Trojan Rust is a rust implementation of the trojan protocol to circumvent GFW
USAGE:
trojan-rust [OPTIONS]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-c, --config <FILE> Sets the config file, readers ./config/config.json by default
Run trojan-rust with specified config file
trojan-rust --config ./config.json
-
Build up the framework for this project and support basic server side SOCKS5 protocol.
-
Support server side Trojan protocol for handling Trojan traffic.
-
Implement UDP over TCP for Trojan protocol on server side.
-
Implement client side Trojan protocol so that trojan-rust and be used as a Trojan client. - Work in progress.
- Implement client side Trojan protocol with TCP
- Implement client side Trojan protocol with TLS
- -[Delayed After Beta] Implement client side Trojan protocol with UDP over TCP.
-
Performance profiling and bottleneck resolving. Will also include benchmarks versus other implementations. (Benchmark report coming up soon)
-
Improve client mode performance.
-
Implement gRPC for transporting data
-
+[Delayed After Beta] Implement client side Trojan protocol with UDP over TCP.
-
Build the package into kernel module release
-
Support other protocols, gRPC, websocket etc.