编译安装
snap install go --classicgit clone -b dev-next https://github.com/sagernet/sing-boxcd sing-box/cmd/sing-boxGOOS=linux GOARCH=amd64 go build -tags with_quic,with_acme -trimpath -ldflags "-s -w -buildid=" -o /usr/local/bin/ycycxz-sing-boxchmod +x /usr/local/bin/ycycxz-sing-boxmkdir -p /etc/ycycxz-sing-boxcd;ycycxz-sing-box version服务器端配置
/etc/ycycxz-sing-box/ycycxz.jsoncat <<EOF > /etc/ycycxz-sing-box/ycycxz.json{"inbounds": [{"type": "shadowtls","listen_port": 42324,"version": 2,"password": "ycycxz","handshake": {"server": "tesla.com","server_port": 443},"detour": "trojan-in"},{"type": "trojan","tag": "trojan-in","listen": "127.0.0.1","users": [{"password": "ycycxz"}]}]}EOFsystemd
cat <<EOF > /etc/systemd/system/ycycxz-sing-box.service[Unit]Description=ycycxz-sing-boxAfter=network-online.target[Service]LimitAS=infinityLimitNOFILE=infinityLimitNPROC=infinityTasksMax=infinityExecStart=/usr/local/bin/ycycxz-sing-box run -c /etc/ycycxz-sing-box/ycycxz.json[Install]WantedBy=multi-user.targetEOFsystemctl daemon-reloadsystemctl enable ycycxz-sing-box启动
systemctl start ycycxz-sing-box#systemctl status ycycxz-sing-box客户端
{"inbounds": [{"type": "mixed","listen": "127.0.0.1","listen_port": 1080}],"outbounds": [{"type": "trojan","password": "ycycxz","detour": "shadowtls-out"},{"type": "shadowtls","tag": "shadowtls-out","server": "4.2.3.24","server_port": 42324,"version": 2,"password": "ycycxz","tls": {"enabled": true,"server_name": "tesla.com"}}]}卸载
systemctl stop ycycxz-sing-boxrm /etc/systemd/system/ycycxz-sing-box.servicesystemctl daemon-reloadrm -rf /etc/ycycxz-sing-boxrm -f /usr/local/bin/ycycxz-sing-box视频教程
How was it? Did this tutorial work? No
