Trojan Rust

Usage Examples

Using the trojan-rs client with applications and system tools

The client exposes a standard SOCKS5 proxy interface. Most applications support SOCKS5 natively or through wrapper tools.

curl

curl --proxy socks5h://127.0.0.1:1080 https://example.com

Use socks5h:// (with the h suffix) to resolve DNS through the proxy. Without h, DNS resolution happens locally.

wget

https_proxy=socks5h://127.0.0.1:1080 wget https://example.com

Browser

Configure your browser's SOCKS5 proxy setting to 127.0.0.1:1080.

Firefox

  1. Settings, then Network Settings, then Manual proxy configuration
  2. SOCKS Host: 127.0.0.1, Port: 1080
  3. Select SOCKS v5
  4. Check "Proxy DNS when using SOCKS v5"

Chromium / Chrome

chromium --proxy-server="socks5://127.0.0.1:1080"

System-Wide (Linux)

proxychains

Route any application through the SOCKS5 proxy:

# Install
sudo apt install proxychains4

# Configure /etc/proxychains4.conf
# Add: socks5 127.0.0.1 1080

# Use
proxychains4 -q wget https://example.com
proxychains4 -q apt update

tsocks

# Configure /etc/tsocks.conf
# server = 127.0.0.1
# server_port = 1080
# server_type = 5

tsocks wget https://example.com

SSH

ssh -o ProxyCommand='nc -X 5 -x 127.0.0.1:1080 %h %p' user@remote-host

Git

# For HTTPS repositories
git config --global http.proxy socks5h://127.0.0.1:1080

# For SSH repositories
git config --global core.sshCommand "ssh -o ProxyCommand='nc -X 5 -x 127.0.0.1:1080 %h %p'"

Docker

# Configure Docker daemon proxy
# /etc/systemd/system/docker.service.d/proxy.conf
# [Service]
# Environment="ALL_PROXY=socks5://127.0.0.1:1080"

sudo systemctl daemon-reload
sudo systemctl restart docker

On this page