前言¶
DeepSeek Harness (dsh) 运行在本地,若要在外网设备上使用,通常需要将端口暴露到公网,存在安全隐患。dsh-relay 提供了一种通过云端中继(Cloud Relay)和宿主机插件(Host Plugin)结合的方案,在不修改 dsh 核心代码的前提下,将本地实例完整映射到公网,实现零端口暴露的远程访问。
插件概况¶
- 名称: dsh-relay
- 作者: SunNull
- 分类: 联网工具
- 许可: MIT
核心功能¶
- Cloud relay for DeepSeek Harness: 通过云端中继服务转发请求。
- Expose your home dsh instance: 将家中的 dsh 实例完整暴露给任何设备,支持会话实时同步、流式输出等所有原生功能。
- Out-of-tree plugin + wire-trunk architecture: 作为树外插件,使用 Wire-Trunk 架构实现通信。
- Process invisible browser: 家端插件以回环身份复放请求,进程不可见。
- HTTPS support: 支持公网访问的加密连接。
- Cordis architecture: 基于 Cordis 生态开发。
安装与启用¶
该插件依赖 Node.js 环境(需 Node >= 22)。
安装命令:
dsh plugin --profile web add "github:SunNull/dsh-relay"
典型用法¶
生成认证凭据(用于配置中继连接):
* 生成干线令牌(32位):
node -e "console.log(require('crypto').randomBytes(24).toString('hex'))"
- 生成配对码(8位):
node -e "console.log(require('crypto').randomBytes(4).toString('hex'))"
安装方式:
* 标准安装(推荐用于启用管理面板):
dsh plugin --profile web add "github:SunNull/dsh-relay"
- 使用安装器(可自动配置):
node install.mjs --relay-url ws://<你的服务器IP>:8443/trunk --token <TOKEN>
工作原理¶
Wire-Trunk 架构:
* 家端: 作为树外插件,运行在 dsh 进程内部。它充当”隐形浏览器”,复用本地 127.0.0.1:3080 的 dsh 协议连接,并将请求原封不动转发至云端。
* 云端: 纯转发面,负责将 HTTPS 请求中继至家端。
* 安全性: 家端无需开放入站端口,请求以回环身份进入;认证(配对码)在云端入口处理,天然穿透 NAT。
注意事项¶
- 环境要求: Node.js 版本需 >= 22。
- 配置文件: 插件使用
~/.dsh/profiles/web/cordis.patch.yml进行配置。 - 插件类型: 基于
host-plugin开发,运行在 dsh 进程内部。 - 许可协议: MIT。
参考链接¶
- GitHub: https://github.com/SunNull/dsh-relay
- 插件目录: https://www.skillhub.cn/plugins/SunNull/dsh-relay