brook快速搭建socks5代理

安装brook:

wget https://github.com/txthinking/brook/releases/download/v20200201/brook
chmod +x brook
mv brook /usr/bin

如何搭建Socks5?

Run socks5 server
Start socks5 server: $ brook socks5 -l :9999 -i your_server_ip
This will listen on TCP/UDP port 9999, your can choose other port
Or with auth --username username --password password
If you have firewall, ensure it allowed both TCP/UDP 9999 port.
Don't forget to allow UDP port
Stop brook: press Control + C

简单使用:(将本地1000端口设置为socks5端口):

brook socks5 -l :1000 -i 0.0.0.0

后台运行:

nohup brook socks5 -l :1000 -i 0.0.0.0 &

如何设置密码?

末尾添加:--username 用户名 --password 密码  即可。
nohup brook socks5 -l :1081 -i 0.0.0.0 --username xxxxx --password xxxxx >/dev/null 2>&1 &

Systemd方法

nano /lib/systemd/system/socks5.service
[Unit]
Description=shadowsocks-libev
After=network.target
[Service]
ExecStart=/home/geerda/brook/brook_linux_amd64 socks5 -l :1081 -i 0.0.0.0 --username xxxxx --password xxxxx 
Restart=on-abort
[Install]
WantedBy=multi-user.target
systemctl enable socks5.service
systemctl start socks5.service
systemctl status socks5.service