1
0
mirror of https://github.com/nitezs/sub2sing-box.git synced 2024-12-23 11:04:42 -05:00
将节点和订阅转换为 sing-box 配置
Go to file
2024-10-01 15:31:48 +08:00
.github/workflows 🔥 Deprecate Woodpecker CI in favor of GitHub Actions 2024-04-25 22:23:12 +08:00
.vscode add: template 2024-03-11 19:50:21 +08:00
api Auto detect if need country group 2024-10-01 01:27:22 +08:00
cmd Auto detect if need country group 2024-10-01 12:45:55 +08:00
common Auto detect if need country group 2024-10-01 12:45:55 +08:00
constant Auto detect if need country group 2024-10-01 01:27:22 +08:00
model 🐛Fix #9 2024-09-19 18:12:24 +08:00
parser 🐛Fix #9 2024-09-19 18:12:24 +08:00
templates 📝 Modify templates 2024-10-01 15:31:48 +08:00
util ️ Improve 2024-08-05 15:01:05 +08:00
.gitignore ️ Refactor some parsers 2024-08-04 17:01:09 +08:00
.goreleaser.yaml 🔥 Deprecate Woodpecker CI in favor of GitHub Actions 2024-04-25 22:23:12 +08:00
docker-compose.yaml mod docker-compose.yaml 2024-04-17 22:51:29 +08:00
Dockerfile mod 2024-04-18 00:15:36 +08:00
entrypoint.sh fix: docker 2024-03-19 02:54:03 +08:00
go.mod 🐛Fix #9 2024-09-19 18:12:24 +08:00
go.sum feat: api server 2024-03-12 01:34:08 +08:00
LICENSE fix: docker 2024-03-19 02:54:03 +08:00
main.go 🐛Fix #9 2024-09-19 18:12:24 +08:00
README.md 📝 Modify README and templates 2024-10-01 12:50:40 +08:00

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 配置,大家可以根据需求自行修改