一键安装fscarmen的Cloudflare Warp脚本
wget -N https://gitlab.com/fscarmen/warp/-/raw/main/menu.sh && bash menu.sh c
使用warp命令,选择安装 WARP Linux Client,开启 Socks5 代理模式,默认40000端口即可
测试是否开启成功
curl https://www.cloudflare.com/cdn-cgi/trace # 应该返回warp=off
curl --socks5 127.0.0.1:40000 https://www.cloudflare.com/cdn-cgi/trace # 应该返回warp=on
一键安装sing-box脚本
bash <(wget -qO- -o- https://github.com/233boy/sing-box/raw/main/install.sh)
测试sing-box默认生成的的协议(注意开放端口)
修改sing-box配置文件 /etc/sing-box/config.json
{
"log": {
"output": "/var/log/sing-box/access.log",
"level": "info",
"timestamp": true
},
"dns": {
"servers": [
{
"tag": "cf",
"type": "udp",
"server": "1.1.1.1",
"server_port": 53,
"detour": "warp"
}
]
},
"inbounds": [
{
"type": "mixed",
"tag": "mixed-in",
"listen": "0.0.0.0",
"listen_port": 7890
}
],
"outbounds": [
{
"type": "socks",
"tag": "warp",
"server": "127.0.0.1",
"server_port": 40000
},
{
"tag": "direct",
"type": "direct"
}
],
"route": {
"final": "warp"
}
}
测试是否正常
sing-box check -c /etc/sing-box/config.json
如果无报错,重启sing-box服务
systemctl restart sing-box
再次测试
curl --proxy socks5://127.0.0.1:7890 https://www.cloudflare.com/cdn-cgi/trace
可以配合sing-box no-auto-tls以及nginx转发和Cloudflare CDN,实现Cloudflare优化线路效果
sing-box no-auto-tls
ngxin配置文件
location /path {
if ($http_upgrade != "websocket") {
return 404;
}
proxy_pass http://127.0.0.1:port;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 5d;
}
修改对应path和port即可
