标签搜索

TUIC搭建流程

steven
2023-06-04 / 0 评论 / 76 阅读 / 正在检测是否收录...

本文基于tuic-server-1.0.0版本

tuic是一个基于quic协议的高性能代理,

更多介绍:https://github.com/EAimTY/tuic

安装服务端(X86):

apt -y update
apt -y install certbot
curl -Lo /root/tuic https://github.com/EAimTY/tuic/releases/download/tuic-server-1.0.0/tuic-server-1.0.0-x86_64-unknown-linux-gnu && chmod +x /root/tuic

新建tuic配置文件:

nano tuic_config.json

写入如下配置:

{
    "server": "[::]:443",
    "users": {
        "1b25508d-545c-49a5-bebe-bf9fe42359b5": "steven"
    },
    "certificate": "/root/fullchain.pem",
    "private_key": "/root/privkey.pem",
    "congestion_control": "bbr",
    "log_level": "warn",
    "alpn": ["h3"]
}

新建systemd配置文件:

nano /lib/systemd/system/tuic.service

写入如下配置:

[Unit]
After=network.target nss-lookup.target

[Service]
User=root
WorkingDirectory=/root
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW
ExecStart=/root/tuic -c /root/tuic_config.json
Restart=on-failure
RestartSec=10
LimitNOFILE=infinity

[Install]
WantedBy=multi-user.target

申请证书:

certbot certonly \
--standalone \
--agree-tos \
--no-eff-email \
--email [email protected] \
-d node.st8.one

cp /etc/letsencrypt/live/node.st8.one/fullchain.pem .
cp /etc/letsencrypt/live/node.st8.one/privkey.pem .

启动tuic服务并设置开机自启:

systemctl enable --now tuic && sleep 0.2 && systemctl status tuic

下载客户端

curl -Lo /root/tuic https://github.com/EAimTY/tuic/releases/download/tuic-client-1.0.0-rc0/tuic-client-1.0.0-rc0-x86_64-unknown-linux-gnu && chmod +x /root/tuic

新建tuic客户端配置:

nano tuic_config.json
{
    "relay": {
        "server": "node.st8.one:443",
        "uuid": "1b25508d-545c-49a5-bebe-bf9fe42359b5",
        "password": "steven",
        "congestion_control": "bbr"
    },
    "local": {
        "server": "[::]:50086",
                     "username": "steven",
                     "password": "abcd123456"
    },
    "alpn": ["h3"],
    "log_level": "warn"
}

新建systemd配置文件:

nano /lib/systemd/system/tuic.service

写入如下配置:

[Unit]
After=network.target nss-lookup.target

[Service]
User=root
WorkingDirectory=/root
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW
ExecStart=/root/tuic -c /root/tuic_config.json
Restart=on-failure
RestartSec=10
LimitNOFILE=infinity

[Install]
WantedBy=multi-user.target

启动tuic服务并设置开机自启:

systemctl enable --now tuic && sleep 0.2 && systemctl status tuic
0

评论 (0)

取消