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
,保存即可