{"id":36905732,"url":"https://github.com/bestnite/sub2sing-box","last_synced_at":"2026-01-12T15:51:50.738Z","repository":{"id":227010052,"uuid":"770047303","full_name":"bestnite/sub2sing-box","owner":"bestnite","description":"将节点和订阅转换为 sing-box 配置","archived":false,"fork":false,"pushed_at":"2025-10-15T07:42:02.000Z","size":239,"stargazers_count":141,"open_issues_count":0,"forks_count":23,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-15T15:47:33.040Z","etag":null,"topics":["converter","sing-box"],"latest_commit_sha":null,"homepage":"https://singbox.nite07.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bestnite.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-03-10T19:15:52.000Z","updated_at":"2025-10-15T10:08:01.000Z","dependencies_parsed_at":"2024-03-15T17:44:13.337Z","dependency_job_id":"c22466ec-c801-4192-b098-4108121db3f5","html_url":"https://github.com/bestnite/sub2sing-box","commit_stats":null,"previous_names":["nitezs/sub2sing-box","bestnite/sub2sing-box"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/bestnite/sub2sing-box","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bestnite%2Fsub2sing-box","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bestnite%2Fsub2sing-box/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bestnite%2Fsub2sing-box/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bestnite%2Fsub2sing-box/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bestnite","download_url":"https://codeload.github.com/bestnite/sub2sing-box/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bestnite%2Fsub2sing-box/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28341884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T15:50:39.657Z","status":"ssl_error","status_checked_at":"2026-01-12T15:49:49.297Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["converter","sing-box"],"created_at":"2026-01-12T15:51:50.069Z","updated_at":"2026-01-12T15:51:50.719Z","avatar_url":"https://github.com/bestnite.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sub2sing-box\n\n将订阅/节点连接转换为 sing-box 配置的工具。\n\n## 控制台命令\n\n使用 `sub2sing-box \u003ccommand\u003e -h` 查看各命令的帮助信息。\n\n## 配置\n\n示例:\n\n```json\n{\n  \"subscriptions\": [\"订阅地址1\", \"订阅地址2\"],\n  \"proxies\": [\"代理1\", \"代理2\"],\n  \"template\": \"模板路径或网络地址\",\n  \"delete\": \"剩余流量\",\n  \"rename\": { \"原文本\": \"新文本\" },\n  \"group-type\": \"selector\",\n  \"sort\": \"name\",\n  \"sort-type\": \"asc\",\n  \"output\": \"./config.json\"\n}\n```\n\n将上述 JSON 内容保存为 `sub2sing-box.json`，执行:\n\n```\nsub2sing-box convert -c ./sub2sing-box.json\n```\n\n即可生成 sing-box 配置，无需每次重复设置参数。\n\n## 模板\n\n### 默认模板\n\n默认模板位于 `templates` 目录，使用 `tun` 配置，该配置仅供参考，请根据实际情况修改。\n\n### 占位符\n\n模板中可使用以下占位符:\n\n- `\u003call-proxy-tags\u003e`: 插入所有节点标签\n- `\u003call-country-tags\u003e`: 插入所有国家标签\n- `\u003c国家(地区)二字码\u003e`: 插入指定国家(地区)所有节点标签，如 `\u003ctw\u003e`\n\n#### 占位符使用示例:\n\n假设有节点：\n\n- US\n- SG\n- TW\n\n```json\n{\n  \"type\": \"selector\",\n  \"tag\": \"节点选择\",\n  \"outbounds\": [\"\u003call-proxy-tags\u003e\", \"direct\"],\n  \"interrupt_exist_connections\": true\n}\n\n// 转换后\n\n{\n  \"type\": \"selector\",\n  \"tag\": \"节点选择\",\n  \"outbounds\": [\"US\", \"SG\", \"TW\", \"direct\"],\n  \"interrupt_exist_connections\": true\n}\n```\n\n```json\n{\n  \"type\": \"selector\",\n  \"tag\": \"节点选择\",\n  \"outbounds\": [\"\u003call-country-tags\u003e\", \"direct\"],\n  \"interrupt_exist_connections\": true\n}\n\n// 转换后\n\n{\n  \"type\": \"selector\",\n  \"tag\": \"节点选择\",\n  \"outbounds\": [\"美国(US)\", \"新加坡(SG)\", \"台湾(TW)\", \"direct\"],\n  \"interrupt_exist_connections\": true\n}\n\n// 其中 \"美国(US)\", \"新加坡(SG)\", \"台湾(TW)\" 为策略组，分别包含 US, SG, TW 节点\n```\n\n```json\n{\n  \"type\": \"selector\",\n  \"tag\": \"巴哈姆特\",\n  \"outbounds\": [\"\u003ctw\u003e\", \"direct\"],\n  \"interrupt_exist_connections\": true\n}\n\n// 转换后\n\n{\n  \"type\": \"selector\",\n  \"tag\": \"巴哈姆特\",\n  \"outbounds\": [\"台湾(TW)\", \"direct\"],\n  \"interrupt_exist_connections\": true\n}\n```\n\n## Docker 使用\n\n```\ndocker run -p 8080:8080 nite07/sub2sing-box:latest\n```\n\n可以挂载目录添加自定义模板\n\n## Server 模式 API\n\n### GET /convert\n\n| query | 描述                                                                                                                    |\n| ----- | ----------------------------------------------------------------------------------------------------------------------- |\n| data  | 同上方配置，但需要使用 [base64 URL safe 编码](\u003chttps://gchq.github.io/CyberChef/#recipe=To_Base64('A-Za-z0-9%2B/%3D')\u003e) |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbestnite%2Fsub2sing-box","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbestnite%2Fsub2sing-box","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbestnite%2Fsub2sing-box/lists"}