Pages

Sunday, 25 March 2018

用hxsocks搭建ss服务器

登陆linux vps.
git clone https://github.com/luckypoem/hxsocks hxsocks-by-luckypoem
cd hxsocks-by-luckypoem
cp config.json.sample config.json
nano config.json
(把第2行的method改为aes-256-cfb ,把pre-shared-password改为你的密码,把ip.address改为0.0.0.0 ,port改为你的端口号
然后运行:pip2 install ipaddress cryptography

python2 hxsserver.py
不过这条命令python2 hxsserver.py是运行在前台的,容易退出,我们可以利用systemd来把该命令运行为service:
nano /etc/systemd/system/hxsocks-by-luckypoem.service
其内容为:
[Unit]
After=network.target

[Service]
ExecStart=/usr/bin/python2 /root/hxsocks-by-luckypoem/hxsserver.py
Restart=always

[Install]
WantedBy=multi-user.target

然后,
systemctl start hxsocks-by-luckypoem (启动服务)
systemctl enable hxsocks-by-luckypoem (让该服务随vps的启动而启动)

然后,在客户机器上,在ss的客户端程序里填入你服务器的ip,你的端口号,你的密码,加密方式一栏填写aes-256-cfb。

hxsocks本身还有一个用法,我未完全弄懂。

项目地址:
https://github.com/luckypoem/hxsocks/
---------

install:

pip3 install https://github.com/v3aqb/hxcrypto/archive/master.zip
pip3 install https://github.com/v3aqb/hxsocks/archive/master.zip

config file example:

servers:
    - ss://aes-128-gcm:password@0.0.0.0:8138
    - ss://aes-256-cfb:password@0.0.0.0:8139
users:
    user1: password1

run:

hxsocks -c config.yaml

client: 兼容ss的客户端

from https://github.com/v3aqb/hxsocks

No comments:

Post a Comment