A lightweight authenticated SOCKS5 + HTTP CONNECT proxy server. Deploy on Railway (or any container host) to route your traffic through a different region.
Your Machine → proxy-relay-server (Singapore) → Internet
- SOCKS5 proxy with username/password auth
- HTTP CONNECT proxy with Bearer token auth
- Single port — protocol auto-detected per connection
- Token authentication — no open relay
- Lightweight — pure Go stdlib server, no third-party proxy libs
# From source
git clone https://github.com/anivaryam/proxy-relay.git
cd proxy-relay
make installDeploy to Railway, Docker, or any host:
# Docker
docker build -t proxy-relay .
docker run -p 8080:8080 -e PROXY_AUTH_TOKEN=your-secret-token proxy-relay
# Or from source
make build-server
PROXY_AUTH_TOKEN=your-secret-token ./bin/proxy-relay-serverproxy-relay config set-server socks5h://your-server:port
proxy-relay config set-token your-secret-tokenproxy-relay on
source ~/.proxy-relay/proxy.env # for terminal appsproxy-relay off
unset http_proxy https_proxy all_proxy HTTP_PROXY HTTPS_PROXY ALL_PROXY- Push this repo to GitHub
- Connect it to Railway
- Railway auto-detects the Dockerfile
- Set environment variable:
PROXY_AUTH_TOKEN=your-secret-token - Under Networking, enable TCP Proxy to get a public
host:port - Use that
host:portas your server address
Important: Enable TCP Proxy in Railway networking settings (not just the default HTTP). SOCKS5 needs raw TCP access.
| Variable | Required | Description |
|---|---|---|
PROXY_AUTH_TOKEN |
Yes | Auth token for client connections |
PORT |
No | Listen port (default 8080) |
proxy-relay on Enable system proxy
proxy-relay off Disable system proxy
proxy-relay status Show proxy status
proxy-relay config set-server <addr> Set server address
proxy-relay config set-token <token> Set auth token
proxy-relay config show Show config
After proxy-relay on, configure your browser to use the SOCKS5 proxy:
Firefox: Settings → Network → Manual proxy → SOCKS Host: <host>, Port: <port>, SOCKS v5, check "Proxy DNS"
Chrome: Use a proxy extension like SwitchyOmega, or launch with:
google-chrome --proxy-server="socks5://<host>:<port>"The server listens on a single TCP port. On each connection, it peeks at the first byte to detect the protocol:
0x05→ SOCKS5 (username/password auth, password = token)- Otherwise → HTTP CONNECT (Proxy-Authorization: Bearer token)
Both protocols authenticate against the same PROXY_AUTH_TOKEN, then relay traffic bidirectionally to the target.
Client config is stored at ~/.proxy-relay/config.yml:
server_addr: socks5h://your-server:port
auth_token: your-secret-tokenMIT