Linux客户端设置 socks5+kcptun

ss-kcp

kcptun

之前更多使用 Linux 服务器作为服务器来提供代理服务,这里使用 Linux 机器作为客户端,链接远端代理服务器,使用纯终端来设置代理,加速访问。

同时,参考 《pm2 简明使用教程》来配合进行守护进程使用

安软件

1
2
3
4
5
6
7
8
# shadowsocks
pip3 install shadowsocks

# kcptun
wget https://github.com/xtaci/kcptun/releases/download/v20210103/kcptun-linux-amd64-20210103.tar.gz

# cow,用于转换 socks5 协议至 http 和 https
wget https://github.com/cyfdecyf/cow/releases/download/0.9.8/cow-linux64-0.9.8.gz

配置文件

  1. kcptun.json

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    {
    "localaddr": ":1080",
    "remoteaddr": "REMOTE_SERVER:29900",
    "key": "111111",
    "crypt": "aes",
    "mode": "fast",
    "conn": 1,
    "autoexpire": 60,
    "mtu": 1350,
    "sndwnd": 512,
    "rcvwnd": 512,
    "datashard": 70,
    "parityshard": 3,
    "dscp": 46,
    "nocomp": false,
    "acknodelay": false,
    "nodelay": 0,
    "interval": 40,
    "resend": 0,
    "nc": 0,
    "sockbuf": 4194304,
    "keepalive": 10
    }
  2. ss.json

    1
    2
    3
    4
    5
    6
    7
    8
    9
    {
    "server":"127.0.0.1",
    "server_port":1080,
    "local_address": "127.0.0.1",
    "local_port":1087,
    "password":"9SehN7C3GQ9h9Cyt",
    "timeout":300,
    "method":"chacha20"
    }
  3. ~/.cow/rc

    1
    2
    listen = http://127.0.0.1:4411
    proxy = socks5://127.0.0.1:1087

启动

1
2
3
4
5
6
7
8
# socks5 协议转为 http 和 https
/home/rovast/applications/cow-linux64-0.9.8

# 开启 kcptun
/home/rovast/applications/kcptun/client_linux_amd64 -c /home/rovast/applications/kcptun/kcptun.json

# 开启 ss
/usr/bin/ss-local -c /home/rovast/applications/shadowsocks/ss.json

附录