naresh97 / trojan-rs

A Trojan proxy implementation written in Rust. Optimizing for size.
GNU General Public License v3.0
3 stars 0 forks source link
censorship-circumvention network privacy proxy rust tls tunnel

trojan-rs

GitHub Actions Workflow Status

To circumvent certain firewalls, I previously used trojan-go which worked pretty well. Unfortunately, the binary size of around 8MB was slightly too large to use on my portable router runnin OpenWRT. So I decided to write an implementation of the Trojan Client/Server in Rust.

The goal is to keep the binary under 1MB.

Based on the Trojan protocol described here.

Usage

Modify client.toml and server.toml appropriately. See samples.

trojan-rs [OPTIONS] <COMMAND> [ADAPTER]

Commands:
  server  runs the Trojan Server
  client  runs the Trojan Client with the specified adapter

Options:
  --config <FILE>   defaults to "./server.toml" or "./client.toml"
  --log             defaults to INFO
                    values: DEBUG, INFO, WARN, ERROR

Adapter:
  --adapter <ADAPTER_TYPE>  used in client mode
                            defaults to socks5
                            values: socks5 tun

Architecture

On the client side:

CLIENT <-> SOCKS5 SERVER <-> TROJAN CLIENT <-> INTERNET

On the server side:

INTERNET <-> TROJAN SERVER  <-> SERVER
                            <-> FALLBACK