runsisi's

technical notes

Brook 搭建

2019-09-04 runsisi#proxy

Brook 是与 Shadowsocks 类似的一个工具软件(功能更为强大),用 Go 语言编写,因此具有非常好的跨平台支持,搭建相关的服务也非常简单,这里只是简单记录一下。

服务端

# mv brook /usr/bin/brook
# chmod +x /usr/bin/brook
# vi /etc/default/brook 
PORT=12345
PASSWORD=123456789
# vi /lib/systemd/system/brook.service
[Unit]
Description=brook
After=network.target

[Service]
EnvironmentFile=-/etc/default/brook
ExecStart=/usr/bin/brook server -l :${PORT} -p ${PASSWORD}
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=simple

[Install]
WantedBy=multi-user.target
# systemctl daemon-reload brook
# systemctl enable brook
# systemctl start brook

客户端

# mv brook /usr/bin/brook
# chmod +x /usr/bin/brook
# vi /etc/default/brook 
SERVER=123.123.123.123:12345
PASSWORD=123456789
# vi /lib/systemd/system/brook.service
[Unit]
Description=brook
After=network.target

[Service]
EnvironmentFile=-/etc/default/brook
ExecStart=/usr/bin/brook client -l localhost:1080 -i localhost -s ${SERVER} -p ${PASSWORD} --http
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=simple

[Install]
WantedBy=multi-user.target
# systemctl daemon-reload brook
# systemctl enable brook
# systemctl start brook

客户端 -i(即 --ip) 这个参数看上去挺怪异的,由于没有阅读源代码,因此我也没搞清楚它的用途,这里只是照抄的官方文档。