Skip to content

Instantly share code, notes, and snippets.

@SilverBut
Last active July 7, 2024 19:14
Show Gist options
  • Save SilverBut/32be4a41cbdc50dd3a02627738b2b9cb to your computer and use it in GitHub Desktop.
Save SilverBut/32be4a41cbdc50dd3a02627738b2b9cb to your computer and use it in GitHub Desktop.
[Haproxy cfg checking Socks5] Haproxy cfg to check the Socks5 connection #tags: GFW, network, haproxy, config
#---------------------------------------------------------------------
# Example configuration for a possible web application. See the
# full configuration options online.
#
# http://haproxy.1wt.eu/download/1.4/doc/configuration.txt
#
#---------------------------------------------------------------------
global
log 127.0.0.1 local2
chroot /usr/share/haproxy
pidfile /run/haproxy.pid
maxconn 2000
user haproxy
daemon
defaults
mode tcp
log global
option dontlognull
timeout check 30s
maxconn 2000
# This server group is used for final users.
# Each server should point at one foreign Internet address
# SOCKS5 is accepted
listen shadowsocks_turnup
bind 127.0.1.1:3000
mode tcp
option tcp-check
tcp-check connect
tcp-check send-binary 050100
tcp-check expect binary 0500 # means local client working okay
tcp-check send-binary 050100030a676f6f676c652e636f6d0050 # try to acess google
tcp-check expect binary 05000001000000000000
tcp-check send GET\ /generate_204\ HTTP/1.0\r\n
tcp-check send Host:\ google.com\r\n
tcp-check send User-Agent:\ curl/7.52.1\r\n
tcp-check send Accept:\ */*\r\n
tcp-check send \r\n
tcp-check expect rstring ^HTTP/1.0\ 204
balance leastconn
timeout server 600000
timeout client 600000
timeout connect 500
server vnet-xxxx 127.0.1.1:4000 check inter 15s downinter 1m fall 4 weight 10
listen monitor_mgmt
mode http
bind 127.0.1.1:3389
stats enable
stats admin if TRUE
stats uri /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment