mirror of
https://github.com/bestnite/sub2sing-box.git
synced 2025-10-25 16:51:01 +00:00
37296750316157319ac2db78e1e458d9f1726327
sub2sing-box
控制台命令
sub2sing-box <command> -h 查看帮助
Api
GET /convert?data=xxx
data 为 base64 URL 编码(将编码字符串中/替换为_,+替换为-)的 JSON 结构体,示例
{
"subscriptions": ["订阅地址1", "订阅地址2"],
"proxies": ["代理1", "代理2"],
"template": "模板路径/网络地址",
"delete": "",
"rename": {"原文本": "新文本"},
"group-type": "selector",
"sort": "name",
"sort-type": "asc"
}
该 JSON 同时可用于 convert 的 --config 参数,以便本地生成 sing-box 配置。
例如将上方 JSON 内容存放于 config.json 后执行 sub2sing-box convert -c ./config.json 即可生成 sing-box 配置,免去每次生成时重复设置参数
Template 占位符
<all-proxy-tags>: 插入所有节点标签{ "type": "selector", "tag": "节点选择", "outbounds": ["<all-proxy-tags>", "direct"], "interrupt_exist_connections": true }<all-country-tags>: 插入所有国家标签{ "type": "selector", "tag": "节点选择", "outbounds": ["<all-country-tags>", "direct"], "interrupt_exist_connections": true }<国家(地区)二字码>: 插入国家(地区)所有节点标签,例如<tw>{ "type": "selector", "tag": "巴哈姆特", "outbounds": ["<tw>", "direct"], "interrupt_exist_connections": true }
Docker
docker run -p 8080:8080 nite07/sub2sing-box
模板
默认模板(./templates/example.json) 是 tun+fakeip 配置,大家可以根据需求自行修改
Languages
Go
83.6%
HTML
15.8%
Dockerfile
0.4%
Shell
0.2%