前言
我们已经基于MDPC实现了 xray, hy2, sing-box 这三个内核的翻墙客户端
如果进一步地, 实现一个像是 v2rayN 那样, 支持多个内核, 在"启用"一个节点之后 , 就自动启动对应的内核呢?
面向GPT开发
开发人员: Hermes 对接 mimo-v2.5-pro
学习基础知识
基于 /home/ubuntu/my-dream-proxy-client/ 这个项目进行开发
你先学习一下这个项目
开发后端
把 配置文件 mdpc-config.yaml.default 的结构改为
listen: 127.0.0.1
port: 18080
log: ""
xray:
files-dir: bin/xray/
core-start: "bin/xray/xray run -confdir bin/xray/"
core-test: "bin/xray/xray run -confdir bin/xray/ -test"
core1:
files-dir: ""
core-start: ""
core-test: ""
相应的, API 改为
文件操作 — /api/*/files
GET /api/xray/files
GET /api/xray/files/{filename}
PUT /api/xray/files/{filename}
DELETE /api/xray/files/{filename}
进程操作 — /api/*/core
GET /api/xray/core/status
POST /api/xray/core/start
POST /api/xray/core/stop
POST /api/xray/core/test
注意 mdpc-config.yaml.default 里面是可以包含多个 翻墙内核结构的,
对于示例来说, 有一个 core1 的结构, 那么API 应该对应地有:
文件操作 — /api/*/files
GET /api/core1/files
GET /api/core1/files/{filename}
PUT /api/core1/files/{filename}
DELETE /api/core1/files/{filename}
进程操作 — /api/*/core
GET /api/core1/core/status
POST /api/core1/core/start
POST /api/core1/core/stop
POST /api/core1/core/test
给 mdpc-config.yaml.default 配置文件 添加 hy2 和 sing-box 结构
要求 翻墙内核 只能同时运行1个.
如果某个内核正在运行, 前端调用api core/start 那么应该先停止当前运行的内核, 再启动新内核
开发前端 outbound 页面
开发一个 MDPC 自己的 outbounds 配置文件及 前端HTML页面.
MDPC 自己的 outbounds 配置文件 格式 yaml, 内容为 节点URI链接的列表, 如
outbounds:
"anytls://自签证书"
“vless://Reality协议”
“hysteria2://自签证书pinSHA256”
MDPC 的 outbouds 前端页面参考 sing-box 的 outbounds页面.
tab 栏 log, dns, route, inbounds, outbounds (未实现的页面先预留位置)
页面主体部分从上到下为:
节点URI文本框 (包括添加按钮, 清空按钮),
outbound列表(包括同步按钮, 删除按钮),
表单 (增加一项 "Core", 意思是使用哪个翻墙内核),
读取配置按钮,
raw文本框 (对应 MDPC 的 outnouds 配置文件 原始内容)
MDPC 的 outbound 页面顶部 [启动] [停止] 按钮
调用API时, 参考 表单中 core 元素的值
在启动之前, 还应该 使用 表单中选定的URI 生成 对应的 翻墙内核 的 outbound 配置文件
开发前端 inbound 页面
MDPC inbound页面, 2个文本框
一个是 socks 端口
一个是 http 端口
都保存在localstorage中
在MDPC outbound页面 生成 hy2 配置文件时, 读取localStorage中的记录.
xray 的 inbound 页面, 也有同样的 2个文本框
一个是 socks 端口
一个是 http 端口
都保存在localstorage中
生成填充建议时, 要读取localStorage中的记录.
把生成生成填充建议 "提取"为函数, 供 MDPC 的 inbound 页面调用
sing-box 的 indbound 页面, 也有同样的 2个文本框
一个是 socks 端口
一个是 http 端口
都保存在localstorage中
生成填充建议时, 要读取localStorage中的记录.
把生成生成填充建议 "提取"为函数, 供 MDPC 的 inbound 页面调用
MDPC 的 inbound页面,
添加一个 "保存xray和sing-box配置" 按钮,
调用 xray页面的 生成inbound填充建议 函数, 调用 api-files 接口保存
调用 sing-box页面的 生成inbound填充建议 函数, 调用 api-files 接口保存添加一个跳转链接, 跳转至 xray 的inbound页面
添加一个跳转链接, 跳转至 sing-box 的inbound页面
Github
https://github.com/crazypeace/my-dream-proxy-client/releases/tag/v1.3.0
使用手册
开发故事
https://zelikk.blogspot.com/2026/06/mdpc-my-dream-proxy-client-n-core-1-outbound.html


可以共享、可以push的免费邮箱,更可使用自定义域名,完美契合您的各项需求。
2 条回复
排序