Trojan Rust

Quick Start

Get trojan-rs up and running in minutes

This guide walks you through installing trojan-rs and running a basic server.

1. Install

Download a pre-built binary from GitHub Releases, or install via Cargo:

cargo install trojan

See Installation for all methods.

2. Generate Certificates

For testing, generate a self-signed certificate:

trojan cert generate \
  --domain example.com \
  --domain localhost \
  --ip 127.0.0.1 \
  --output /etc/trojan \
  --days 365

For production, use certificates from a CA (e.g., Let's Encrypt). See Certificates.

3. Create a Config File

Create config.toml:

[server]
listen = "0.0.0.0:443"
fallback = "127.0.0.1:80"

[tls]
cert = "/etc/trojan/cert.pem"
key = "/etc/trojan/key.pem"

[auth]
passwords = ["your-secret-password"]

[logging]
level = "info"

4. Start the Server

trojan server -c config.toml

The server is now listening on port 443. Any connection that fails Trojan authentication is forwarded to the fallback address (port 80).

5. Connect a Client

Configure any Trojan-compatible client to connect to your server's address on port 443 with the password you configured.

You can also use the built-in client:

trojan client -c client.toml

Where client.toml contains:

[client]
listen = "127.0.0.1:1080"
remote = "your-server.com:443"
password = "your-secret-password"

This starts a local SOCKS5 proxy on port 1080.

Next Steps

On this page