Shadowsocks-rust是shadowsocks服务rust语言的实现,其不但具有libev版shadowsocks的特性,得益于rust语言的良好性能,rust版shadowsocks更是支持了负载均衡等新特性。

下面以Debian系统为例,介绍如何搭建服务端。

  • 首先,从项目的Github release页面下载并解压运行shadowsocks rust的二进制文件。这里以x86_64平台为例。
1
2
wget https://github.com/shadowsocks/shadowsocks-rust/releases/download/v1.17.1/shadowsocks-v1.17.1.x86_64-unknown-linux-gnu.tar.xz
tar -xf shadowsocks-v1.17.1.x86_64-unknown-linux-gnu.tar.xz
  • 然后,将ssserver移动到/usr/bin目录,并赋予可执行权限。
1
2
3
mv ssserver /usr/bin
cd /usr/bin
chmod a+x ssserver
  • 接着,创建ssserver的配置文件 。
1
2
mkdir /etc/shadowsocks-rust
vim /etc/shadowsocks-rust/config.json

写入:

1
2
3
4
5
6
7
8
9
{
"server":"0.0.0.0",
"mode":"tcp_and_udp",
"server_port":30055,
"local_port":1080,
"password":"xxxxxxxx",
"timeout":60,
"method":"aes-256-gcm",
}
  • 然后,创建systemd的守护进程。
1
vim /lib/systemd/system/shadowsocks-rust.service

写入以下内容。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[Unit]
Description=shadowsocks-rust
After=network.target

[Service]
Type=simple
User=nobody
Group=nogroup
LimitNOFILE=65535
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
ExecStart=/usr/bin/ssserver --log-without-time -c /etc/shadowsocks-rust/config.json

[Install]
WantedBy=multi-user.target
  • 最后,设置shadowsocks开机自启,并启动服务,查看状态。
1
2
3
4
systemctl daemon-reload
systemctl enable shadowsocks-rust
systemctl start shadowsocks-rust
systemctl status shadowsocks-rust

如果日志显示Active,说明服务启动成功,您就可以配合ss客户端使用了!