Plugin directory / Developer / dsh-proxy-switch
dsh-proxy-switch
Verified · install-tested on dsh sg88
What it does
DSH 网络代理开关:直连失败自动回退到 HTTP/SOCKS5 代理,设置面板可配置代理地址
Works — verified, early-stage project
DSH 网络代理开关:直连失败自动回退到 HTTP/SOCKS5 代理,设置面板可配置代理地址 It installs cleanly and boots without issues in our testing. It's early-stage but functional.
“Verified” means our automated CI actually ran dsh plugin add in a clean profile and it booted — nothing more. Feature descriptions and version compatibility are the author’s claims. This is not a security audit and not an endorsement of third-party code.
README
dsh-proxy-switch
DSH(DeepSeek Harness)网络代理开关插件:直连网络不通时,自动改用配置的 HTTP/SOCKS5 代理重试,代理地址可在 DSH 设置面板中随时修改。
功能
- 🔌 直连失败自动回退:LLM 请求、网络搜索、web_fetch 等所有对外请求(均走 host 全局
fetch)直连失败(连接拒绝 / DNS 失败 / 超时 / 连接重置)时,自动用配置的代理重发一次。 - 🎛️ 设置面板分区:DSH Web 设置弹窗新增「代理」分区,可配置:
- 总开关(启用 / 停用代理回退)
- HTTP(S) 代理地址(默认
http://192.168.31.2:7890) - SOCKS5 代理地址(默认
socks5://192.168.31.2:7891) - 代理选择模式(自动 / 始终 HTTP / 始终 SOCKS5)
- 💾 持久化:设置写入
~/.dsh/settings.yaml,修改后立即生效,无需重启 DSH。 - 🧹 零第三方依赖:CONNECT 隧道与 SOCKS5 握手均自实现,不引入任何外部包。
安装
dsh plugin --profile web add link:<本目录绝对路径>
# 例如:
dsh plugin --profile web add link:D:\deepseek\dsh-proxy-switch
安装后 重启 dsh web 生效(dsh web),然后打开 Web 设置 → 代理。
使用
- 重启后在设置面板找到「代理」分区。
- 打开「启用代理回退」开关。
- 按需修改代理地址(HTTP 与 SOCKS5 可同时保留,模式选「自动」时 https 目标优先 HTTP 代理)。
- 保存即生效:此后任何对外请求直连不通时会自动走代理。
配置项
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
enabled |
boolean | false |
总开关,关闭时所有请求保持直连 |
httpProxy |
string | http://192.168.31.2:7890 |
HTTP(S) 代理地址 |
socksProxy |
string | socks5://192.168.31.2:7891 |
SOCKS5 代理地址 |
mode |
string | auto |
auto 自动(https 优先 HTTP)/ http 始终 HTTP / socks5 始终 SOCKS5 |
对应 ~/.dsh/settings.yaml 中的 proxy: 段。
工作原理
- host 端(
lib/index.js)注册proxy设置命名空间,并包装globalThis.fetch。 - 包装逻辑:先直连 → 抛网络层错误且
enabled=true时 → 用配置的代理重发(lib/proxy-fetch.js)。 - 代理通道自实现:HTTP 代理走 CONNECT 隧道(RFC 7230),SOCKS5 走 RFC 1928 握手;TLS 由 Node
tls处理,响应保持流式(SSE 正常)。 - client 端(
lib/client.js)通过设置面板 slot(settings.section)注册「代理」分区 UI。
开发
# 本地改动后(host 端 / client 端均无需构建,直接生效)
# host 端改动需要重启 dsh web;client 端 bundle 内容变更会被 HMR 热载
许可
MIT
Install
Install the catalog once, then DeepSeek Harness can find and install any plugin from this site automatically:
dsh plugin add dshbase-catalog Then say "install dsh-proxy-switch for me" — your agent finds it in the directory and installs it. Docs: dshbase-catalog · verified packs.
This plugin is GitHub source (not published to npm) — install it straight from the repo:
Web profile:
dsh plugin --profile web add github:sg88/dsh-proxy-switch Headless (CLI) profile:
dsh plugin --profile headless add github:sg88/dsh-proxy-switch Test report
Verified: L1 install + L2 load + L3 runtime from GitHub source on dsh 0.1.0-rc.6.