Generate config of sing-box
系列 - Use Sing-Box
注意
此文仅适用于客户端, 不适用于服务器和路由器。
由于:
- sing-box 不像 clash 那样支持
proxy-providers
。 - sing-box 在 Linux 和 Windows 平台的核心程序不支持定时更新配置文件。
- 机场不支持 sing-box。
所以只能使用“(远端) 后端下载订阅→提取节点→根据模板生成适用的配置→客户端下载配置”的方式, 那么选用哪个后端呢?
serenity、subconverter 及其 二次开发版本 都还行, 但我选择更简便的 sing-box-subscribe。
Fork sing-box-subscribe。
默认的
up_mbps
和down_mbps
可能不适合自己的网络, 建议自行对带宽测速后, 更改 hysteria.py 和 hysteria2.py 中的这两个值。在 Vercel 部署
sing-box-subscribe
。创建用于存放自定义模板的 GitHub 仓库, 比如 sing-box-templates。
拼接出最终的 URL, 比如:
#!/bin/bash url_gene="https://a.com" # 生成配置的后端地址 url_sub="https://b.com" # 来自机场的订阅链接 url_tpl="https://raw.githubusercontent.com/senzyo/sing-box-templates/public/tun/doh/ali/google/testingcf.jsdelivr.net/config.json" # 配置所用模板的地址 url_dl="$url_gene/config/$url_sub&ua=clashmeta&emoji=1&file=$url_tpl" echo $url_dl curl -L -o config.json "$url_dl"
在 Android 或 Apple 设备的 sing-box 图形客户端中添加这个最终的 URL 作为订阅链接。
对于 Linux 和 Windows, 阅读 sing-box on Linux 和 sing-box on Windows。