Trojan-rust is a rust implementation for Trojan protocol that is targeted to circumvent GFW

Trojan protocol that is targeted to circumvent tokio-rs to achieve high performance async io

trojan-rust

中文zh-CN

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.

Why trojan-rust

  • 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.

How to compile

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

Examples

Create Certificate

Quick short script for your convenience,

openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes

Sample config file

{
    "inbound": {
        "protocol": "SOCKS" || "TROJAN",
        "address": "0.0.0.0",
        "port": 8081,
        "tls": true,
        "cert_path": "/path/to/file/cert.pem",
        "key_path": "/path/to/file/key.pem"
    },
    "outbound": {
        "protocol": "DIRECT"
    }
}

Run the program

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

Roadmap

Beta stage 0.0.1 - 1.0.0(For developers)

  • 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.

Official release 1.0.0 and above(For general users)

  • +[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.

Versions

Find the latest versions by id

0.3.6 - Sep 19, 2021

v0.3.6 - Sep 19, 2021

v0.3.5 - Sep 18, 2021

v0.3.4a - Sep 17, 2021

v0.3.3 - Aug 29, 2021

v0.3.1 - Aug 23, 2021

v0.3.0 - Aug 22, 2021

v0.2.4 - Aug 08, 2021

v0.2.3 - Aug 01, 2021

v0.2.2 - Aug 01, 2021

Information - Updated Nov 25, 2021

Stars: 14
Forks: 2
Issues: 0

Repositories & Extras

Serde is a framework for serializing and deserializing Rust data structures efficiently and generically

Rust Greatest JSON weapon is Serde with over 4.4K stars on github and a massive developer community. This is considered a core Rust library for every developer to learn in BRC's opinion

Serde is a framework for serializing and deserializing Rust data structures efficiently and generically

Wasm template for Rust hosting without npm-deploy on github pages using Travis script

It automatically hosts your wasm projects on gh-pages using a travis script on the latest commit

Wasm template for Rust hosting without npm-deploy on github pages using Travis script

Roctogen: a rust client library for the GitHub v3 API

This client API is generated from the Isahc HTTP client

Roctogen: a rust client library for the GitHub v3 API

A rust github template for ease of use

Install the rust toolchain in order to have cargo installed by following

A rust github template for ease of use

📓 Relnotes: Automatic GitHub Release Notes

Tera templates for release notes format

📓 Relnotes: Automatic GitHub Release Notes

Rust-generated WebAssembly GitHub action template

A template to bootstrap the creation of a Rust-generated WebAssembly GitHub action

Rust-generated WebAssembly GitHub action template

Template for Rust lib/bin module with built-in GitHub Action to build and test

You will want to change the lib name and bin name in Cargo

Template for Rust lib/bin module with built-in GitHub Action to build and test

cargo_auto_github_lib

Library for cargo-auto automation tasks written in rust language with functions for github

cargo_auto_github_lib

Huber is to simplify the package management from GitHub projects with a builtin awesome list...

Huber is to simplify the package management from GitHub projects with a builtin awesome list (live updating) of popular projects

Huber is to simplify the package management from GitHub projects with a builtin awesome list...

Renote is a CLI to extend GitHub operation experience, which is a complementary tool to...

Renote is a CLI to extend GitHub operation experience, which is a complementary tool to use with gh advanced search options

Renote is a CLI to extend GitHub operation experience, which is a complementary tool to...
Facebook Instagram Twitter GitHub Dribbble
Privacy