一个基于 Next.js 16 的在线订阅合并转换工具,支持将多个代理订阅链接合并为单一配置文件,输出为 Clash YAML、sing-box JSON 或 Base64 链接格式。
- 多订阅合并 — 支持同时输入多个订阅链接(HTTP/HTTPS),自动去重合并
- 多格式输出 — 支持 Clash (YAML)、sing-box (JSON)、Base64 订阅三种格式
- 节点过滤 — 通过正则表达式排除不需要的节点
- 节点重命名 — 支持正则和普通字符串匹配重命名节点
- 自定义策略组 — 支持 select、url-test、fallback、load-balance 四种类型,通过正则/关键词筛选节点
- 自定义路由规则 — 支持 GEOSITE、GEOIP、DOMAIN-SUFFIX、DOMAIN-KEYWORD、IP-CIDR、MATCH 等多种规则类型
- 两种合并模式
passthrough— 保留原始订阅中的 proxy-groups 和 rulescustom— 使用用户自定义的策略组和路由规则
- 实时预览 — Test Run 功能可预览生成的配置内容和节点统计
- 一键导入 — 生成订阅链接后支持一键导入 Clash / Shadowrocket 客户端
- 纯前端状态管理 — 配置保存在 localStorage,无需后端存储,保护隐私
| 协议 | 解析 | 输出 |
|---|---|---|
| SS (Shadowsocks) | ✅ | ✅ |
| SSR (ShadowsocksR) | ✅ | ✅ |
| VMess | ✅ | ✅ |
| VLESS | ✅ | ✅ |
| Trojan | ✅ | ✅ |
| Hysteria2 | ✅ | ✅ |
| TUIC | ✅ | ✅ |
- Node.js >= 18
- npm / yarn / pnpm / bun
# 安装依赖
npm install
# 启动开发服务器
npm run dev打开 http://localhost:3000 即可使用。
# 构建生产版本
npm run build
# 启动生产服务器
npm start- 在输入框中粘贴订阅链接(每行一个,或用
|/ 逗号分隔) - 选择目标格式(Clash / sing-box / Base64)
- 选择合并模式(passthrough / custom)
- 根据需要配置节点过滤、重命名、策略组和路由规则
- 点击 Generate Subscription Link 生成订阅链接
- 点击 Test Run & Preview 可预览配置内容
GET /api/convert?urls=<订阅链接>&target=<格式>&exclude=<排除正则>
参数说明:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
urls |
string | 是 | 订阅链接,多个用 | 或逗号分隔;支持 base64 编码 |
target |
string | 否 | 输出格式:clash(默认)、singbox、base64 |
exclude |
string | 否 | 排除节点的正则表达式 |
config |
string | 否 | 完整的 base64 编码配置 JSON(高级用法) |
示例:
# 生成 Clash 配置
curl "http://localhost:3000/api/convert?urls=https://example.com/sub1|https://example.com/sub2&target=clash"
# 生成 sing-box 配置
curl "http://localhost:3000/api/convert?urls=https://example.com/sub&target=singbox"
# 生成 Base64 订阅
curl "http://localhost:3000/api/convert?urls=https://example.com/sub&target=base64"POST /api/convert
Content-Type: application/json
请求体:
{
"name": "my_config",
"urls": ["https://example.com/sub1", "https://example.com/sub2"],
"target": "clash",
"mode": "custom",
"excludeNodes": "过期|测试",
"renameRules": [
{ "from": "香港", "to": "🇭🇰 HK", "isRegex": false }
],
"groups": [
{
"name": "🚀 节点选择",
"type": "select",
"filter": ".*"
}
],
"rules": [
{ "type": "GEOSITE", "payload": "cn", "target": "🎯 全球直连" },
{ "type": "GEOIP", "payload": "cn", "target": "🎯 全球直连" },
{ "type": "MATCH", "payload": "", "target": "🚀 节点选择" }
]
}subscription-merge/
├── src/
│ ├── app/
│ │ ├── api/convert/route.ts # API 路由(GET/POST)
│ │ ├── page.tsx # 主页面 UI
│ │ ├── layout.tsx # 根布局
│ │ └── globals.css # 全局样式
│ └── lib/
│ ├── types.ts # TypeScript 类型定义
│ ├── parser.ts # 订阅链接解析(SS/SSR/VMess/VLESS/Trojan/H2/TUIC)
│ ├── converter.ts # 核心转换引擎
│ ├── clash.ts # Clash 配置生成
│ ├── singbox.ts # sing-box 配置生成
│ └── templates.ts # 默认策略组和路由规则模板
├── package.json
├── tsconfig.json
├── next.config.ts
└── README.md
- 框架: Next.js 16 (App Router)
- 语言: TypeScript 5
- 样式: Tailwind CSS 4
- 运行时: React 19
MIT