在受限的VPS环境下 使用233boy的sing-box脚本

在233boy的群里, 总是遇到有人在受限的VPS环境下安装失败.

看了不少失败的案例, 一般是2个原因:
1. 访问github资源失败
2. 检测服务器IP失败

LT; DR

安装命令
bash <(wget -qO- -o- https://gh-proxy.org/https://github.com/233boy/sing-box/raw/main/install.sh | sed s#one\.one\.one\.one#www.cloudflare.com#gi)
维护, 在安装完成之后
find /etc/sing-box/sh -type f -name "*.sh" -exec sed -i 's#one\.one\.one\.one/dns-query#dns.alidns.com/resolve#gi' {} +
find /etc/sing-box/sh -type f -name "*.sh" -exec sed -i 's#one\.one\.one\.one#www.cloudflare.com#gi' {} +

 

访问github资源的问题

用github proxy解决
这里可能会遇到两个问题.

1a) 翻墙脚本里面一般还会获取github资源(脚本或压缩包). 
而如果github proxy只解决了获取github脚本本身的问题, 那么脚本运行起来了之后, 获取github资源还是会失败.
所以我们需要能处理 github脚本嵌套调用 的 github proxy.
最早的 https://github.com/hunshcn/gh-proxy 就没有处理github脚本的嵌套调用
而 https://github.com/crazypeace/ghproxy 就处理了github脚本的嵌套调用
所以如果你用到的github proxy发现脚本跑起来了, 但是下载github资源报错, 说明没有处理github脚本的嵌套调用. 那么你需要换一个github proxy, 或者自己搭一个.

1b) 常见的github proxy是用域名访问的. 
那么你的VPS厂商是有可能在网络环境针对github proxy域名进行屏蔽的.
所以如果你发现一开始github脚本就拉不下来, 你可以用 curl 访问一下 github proxy 看能否得到 html结果, 如果得不到, 说明被屏蔽了. 那么你需要换一个github proxy, 或者自己搭一个.

加上 github proxy后的脚本命令变为
bash <(wget -qO- -o- https://gh-proxy.org/https://github.com/233boy/sing-box/raw/main/install.sh)

 

检测服务器自身IP的问题

这里直接使用结论
查找 one.one.one.one 替换为 www.cloudflare.com
加上替换操作后的脚本命令变为
bash <(wget -qO- -o- https://gh-proxy.org/https://github.com/233boy/sing-box/raw/main/install.sh | sed s#one\.one\.one\.one#www.cloudflare.com#gi)

 

========

安装后, 使用菜单添加配置时, 还会遇到问题.
因为VPS上面安装的脚本的内容是从github下载压缩包再解决的, 所以脚本内容在检测服务器IP和查询域名DNS方面还是有问题.

处理DNS解析问题的说明在此 

查询域名DNS的问题

find /etc/sing-box/sh -type f -name "*.sh" -exec sed -i 's#one\.one\.one\.one/dns-query#dns.alidns.com/resolve#gi' {} +

检测服务器自身IP的问题

find /etc/sing-box/sh -type f -name "*.sh" -exec sed -i 's#one\.one\.one\.one#www.cloudflare.com#gi' {} +

========

后记

同理可得

233boy的v2ray脚本

安装命令
bash <(wget -qO- -o- https://gh-proxy.org/https://git.io/v2ray.sh | sed s#one\.one\.one\.one#www.cloudflare.com#gi)
维护, 在安装完成之后
find /etc/v2ray/sh -type f -name "*.sh" -exec sed -i 's#one\.one\.one\.one/dns-query#dns.alidns.com/resolve#gi' {} +
find /etc/v2ray/sh -type f -name "*.sh" -exec sed -i 's#one\.one\.one\.one#www.cloudflare.com#gi' {} +

233boy的xray脚本

安装命令

bash <(wget -qO- -o- https://gh-proxy.org/https://github.com/233boy/Xray/raw/main/install.sh | sed s#one\.one\.one\.one#www.cloudflare.com#gi)

维护, 在安装完成之后

find /etc/xray/sh -type f -name "*.sh" -exec sed -i 's#one\.one\.one\.one/dns-query#dns.alidns.com/resolve#gi' {} +
find /etc/xray/sh -type f -name "*.sh" -exec sed -i 's#one\.one\.one\.one#www.cloudflare.com#gi' {} +


评论

The Hot3 in Last 7 Days

酒馆SillyTavern 玩英文角色卡 也能以中文输出 设置世界书Lorebooks

极简一键脚本 搭NaiveProxy梯子 自定义端口 与Caddy V2前置的VLESS/Vmess V2Ray共存 可开CDN