TUIC 安裝指南#
一鍵腳本#
wget https://raw.githubusercontent.com/imbalaomao/tuic-install/main/tuic.sh && bash tuic.sh
項目 | |
---|---|
程序 | /opt/tuic/server |
配置 | /opt/tuic/server_config.json |
查看日誌 | journalctl -u tuic --output cat -e |
實時日誌 | journalctl -u tuic --output cat -f |
更新#
systemctl stop tuic && wget -O /opt/tuic/tuic_server https://github.com/EAimTY/tuic/releases/download/tuic-server-1.0.0/tuic-server-1.0.0-x86_64-unknown-linux-musl && chmod +x /opt/tuic/tuic_server && systemctl restart tuic && sleep 0.2 && systemctl status tuic
卸載#
systemctl disable tuic && rm -rf /etc/systemd/system/tuic.service
rm -rf /opt/tuic
~/.acme.sh/acme.sh --remove -d example.com(替換成你的域名)
分步安裝#
- 下載新版 tuic 核心
為保證兼容性,下載 musl 版本核心
mkdir /opt/tuic && cd /opt/tuic
wget -O server https://github.com/EAimTY/tuic/releases/download/tuic-server-1.0.0-rc0/tuic-server-1.0.0-rc0-x86_64-unknown-linux-musl && chmod +x server
- 創建配置文件
- 創建
server.json
並填入以下內容:
{
"server": "[::]:8443",
"users": {
"生成一個UUID填在這裡": "隨便設置一個密碼"
},
"certificate": "域名證書文件,若沒有請使用acme.sh",
"private_key": "域名私鑰文件,若沒有請使用acme.sh",
"congestion_control": "bbr",
"alpn": [
"spdy/3.1"
],
"max_external_packet_size": 1500,
"log_level": "debug",
"gc_interval": "3s",
"max_idle_time": "30s"
}
- 創建服務
- 創建
/etc/systemd/system/tuic.service
並填入以下內容:
[Unit]
After=network.target nss-lookup.target
[Service]
User=root
WorkingDirectory=/opt/tuic
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW
ExecStart=/opt/tuic/server -c /opt/tuic/server.json
Restart=on-failure
RestartSec=10
LimitNOFILE=infinity
[Install]
WantedBy=multi-user.target
- 啟動程序
systemctl enable --now tuic && sleep 0.2 && systemctl status tuic
客戶端配置#
以 Nekoray 為例
選擇手動輸入配置 —— 自定義 (其他核心),在下方最大的空白處填入以下內容:
{
"relay": {
"server": "服務器域名:8443",
"uuid": "你的UUID",
"password": "密碼",
"ip": "服務器IP",
"udp_relay_mode": "quic",
"congestion_control": "bbr",
"alpn": ["spdy/3.1"],
"gc_lifetime": "15s",
"gc_interval": "3s"
},
"local": {
"server": "127.0.0.1:1080"
},
"log_level": "debug"
}
之後在地址處填入域名、端口處填入8443
、Socks Port處填入1080
、核心選擇添加好的 tuic 核心、命令處填入-c %config%
、配置文件後綴選擇json
,保存即可