Last active
April 29, 2024 07:22
-
-
Save kenchou/d6ceac9cf48931427489b2c9ab37568c to your computer and use it in GitHub Desktop.
systemd KCP 加速服务
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Unit] | |
| Description=Kcptun server | |
| Requires=network.target | |
| After=network-online.target | |
| [Service] | |
| Type=simple | |
| User=ken | |
| RemainAfterExit=yes | |
| Environment="MODE=fast3" | |
| EnvironmentFile=/etc/default/kcptun-server@%i | |
| ExecStart=/usr/bin/kcptun-server -t $TARGET -l $LISTEN -mode $MODE -sockbuf 16777217 | |
| ExecReload=/usr/bin/kill -HUP $MAINPID | |
| RestartSec=5 | |
| Restart=on-failure | |
| [Install] | |
| WantedBy=multi-user.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /etc/default/kcptun-server@ssh | |
| # kcptun-server -t "127.0.0.1:22" -l ":4000" -mode fast3 -sockbuf 16777217 | |
| # 目标服务 | |
| TARGET=127.0.0.1:22 | |
| # KCP 服务监听端口, kcp port --> target port | |
| LISTEN=:4000 | |
| MODE=fast3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Unit] | |
| Description=Kcptun client | |
| Requires=network.target | |
| After=network-online.target | |
| [Service] | |
| Type=simple | |
| User=nobody | |
| RemainAfterExit=yes | |
| Environment="MODE=fast3" | |
| EnvironmentFile=/etc/default/kcptun@%i | |
| ExecStart=/usr/bin/kcptun-client -r $REMOTE -l $LISTEN -mode $MODE -autoexpire 900 -sockbuf 16777217 -dscp 46 | |
| ExecReload=/usr/bin/kill -HUP $MAINPID | |
| RestartSec=5 | |
| Restart=on-failure | |
| [Install] | |
| WantedBy=multi-user.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /etc/default/kcptun@remotehost-servicename | |
| # eg. /etc/default/kcptun@outland-shadowsocks | |
| # kcptun-client -r "remote-server:$REMOTE_PORT" -l ":$LOCAL_PORT" -mode fast3 -autoexpire 900 -sockbuf 16777217 -dscp 46 | |
| # KCP 服务端端口 | |
| REMOTE=remote-server:4000 | |
| # KCP 客户端监听端口. | |
| # kcp client port (local) -> kcp server port (remote) | |
| LISTEN=:4000 | |
| MODE=fast3 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
服务端启动
systemctl start kcptun-server@ssh
开机启动启动
systemctl enable kcptun-server@ssh
客户端启动
systemctl start kcptun@remotehost-ssh
开机自动启动
systemctl enable kcptun@remotehost-ssh