Kcptun - A Fast & Secure Tunnel Based On KCP with N:M Multiplexing

原理

kcptun

Installation

仓库 https://github.com/xtaci/kcptun 下载匹配架构的版本,压缩包里就两个二进制文件,一个是 client 另一个是 server,可以重命名为 kcptun_clientkcptun_server 后放到环境变量对应的 bin 目录。

Server Side

~$ kcptun_server -t :8388 -l :4000 -mode fast2
  • -t: The SS server port on server side
  • -l: The Kcptun server's port

Systemd Service Configuration file

~$ sudo nano /lib/systemd/system/kcptun.service

[Unit]
Description=Kcptun
After=network.target

[Service]
ExecStart=/usr/local/bin/kcptun_server -t :8388 -l :4000 -mode fast2
Restart=on-failure
SuccessExitStatus=3 4
RestartForceExitStatus=3 4

[Install]
WantedBy=multi-user.target

Client Side

~$ kcptun_client -r Server_IP:8388 -l :9999 -mode fast2

Configuration the system service of user level

~$ nano ~/.config/systemd/user/kcptun.service

[Unit]
Description=Kcptun
After=network.target

[Service]
ExecStart=/home/herald/.local/bin/kcptun_client -r Server_IP:8388 -l :9999 -mode fast2
Restart=on-failure
SuccessExitStatus=3 4
RestartForceExitStatus=3 4

[Install]
WantedBy=multi-user.target

Enable system service

~$ systemctl --user enable kcptun.service
~$ systemctl --user start kcptun.service