B1aZerr/dsh-net-switch ↗★ 0

dsh-net-switch

Runtime network switch for DeepSeek Harness: flip Harness's own outbound traffic between a local Clash Verge proxy and direct/LAN without restarting, from a status chip in the session header, the network_mode agent tool and the /net command. 支持通过状态条、Agent工具或命令实时切换DSH出站流量代理,适合有网络环境切换需求的用户。

패키지
dsh-net-switch
호환성
미검증
버전
0.1.0
라이선스
MIT
최근 업데이트
2026. 10. 10.

설치

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:B1aZerr/dsh-net-switch

3. 配置

在 profile 的 cordis.patch.yml 里覆盖(可选,全部有默认值):

- id: net-switch
  name: 'dsh-net-switch'
  config:
    proxy: 'http://127.0.0.1:7897'   # 显式代理;省略则依次看环境变量 → verge.yaml → 默认 7897
    mode: lan                        # 启动模式:clash | lan(默认 lan,即保持现状)
    autoFallback: true               # 代理不通时自动回退直连(false = 严格模式,请求直接失败)
    probeIntervalMs: 5000            # 探活间隔
    probeTimeoutMs: 2000             # 单次探活超时
    noProxy: ['nas.home.arpa']       # 额外绕过项(主机名/IP/CIDR)
    persist: true                    # 记住最后一次选择,重启后恢复
    statePath: null                  # 状态文件路径;默认 $DSH_HOME/storages/dsh-net-switch.json
    publishEnvToChildren: true       # 同时把代理写进子进程环境(git/curl/npm/pwsh)
    enabled: true                    # false = 整个插件不启用

模式来源优先级:config.mode → 状态文件里记住的选择 → lan。

HTTP 路由

宿主暴露两个仅限回环的路由,GUI 胶囊靠它们工作:

方法路径说明
GET/dsh-net-switch/state返回完整状态 JSON(含 mode / effective / reachable / degraded / proxy / noProxy / summary)
POST/dsh-net-switch/mode请求体 {"mode":"clash"|"lan"} 或 {"toggle":true},返回新状态

安全栅栏:Host 必须是回环地址;POST 还要求 Origin(若浏览器给了)与 Host 同源。别的网页无法通过跨站请求改你的出网路由。