Skip to content

Instantly share code, notes, and snippets.

@nabilfreeman
Last active April 3, 2023 00:00
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nabilfreeman/6cf00c0cb909c353f478e40d1438b449 to your computer and use it in GitHub Desktop.
Save nabilfreeman/6cf00c0cb909c353f478e40d1438b449 to your computer and use it in GitHub Desktop.
HAProxy Shadowsocks relay example. You can run this on a server in China with good peering, and then proxy traffic to your outside server. Speed will be better (and improved obfuscation).
# 1. Install haproxy on Ubuntu.
# 2. Edit file path: /etc/haproxy/haproxy.cfg
# 3. Run with: haproxy -f /etc/haproxy/haproxy.cfg
# 4. haproxy will run in the background, so you can disconnect safely.
# 5. Point your Shadowsocks client at <CHINA IP>:8001 (or 8002, etc.) - you will actually be connected to your interational server!
global
defaults
log global
mode tcp
option dontlognull
timeout connect 1000
timeout client 150000
timeout server 150000
frontend singapore-in
bind *:8001
default_backend singapore-out
backend singapore-out
server server1 123.456.789.0:8888 maxconn 20480
frontend london-in
bind *:8002
default_backend london-out
backend london-out
server server1 123.456.789.0:8888 maxconn 20480
frontend hongkong-in
bind *:8003
default_backend hongkong-out
backend hongkong-out
server server1 123.456.789.0:8888 maxconn 20480
@nabilfreeman
Copy link
Author

Thanks, me!

@nabilfreeman
Copy link
Author

Nabs you've done it again, I keep forgetting how to do this and then remember I made this gist 🇨🇳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment