
Linjiangxian0203/dsh-remote-tunnel
30最近提交 2026年8月16日
dsh-remote-tunnel DSH 插件
dsh-remote-tunnel 是一个 DSH 插件,管理远程 dsh web 服务器 SSH 隧道的完整生命周期。它分配专用远程端口,在服务器端注册表中记录,通过 systemd 监管远程 dsh 进程,并维护一个在断网后自动重连的弹性本地隧道。专为个人用户和共享服务器的团队设计,提供设置、健康检查、状态监控和清理等命令。
如何安装 dsh-remote-tunnel DSH 插件
dsh plugin --profile remote add dsh-remote-tunnel复制不会执行命令。安装 dsh-remote-tunnel DSH 插件前请核对仓库和版本。
dsh-remote-tunnel DSH 插件数据来源
dsh-remote-tunnel DSH 插件快照日期:2026年8月16日
discovered
dsh-remote-tunnel DSH 插件能做什么
- 基于 flock 锁的原子远程端口分配,双重检查(注册表+实际绑定),支持并发安全
- systemd 监管(系统或用户单元),自动重启且重启后持久化;无需 root 即可使用用户单元
- 弹性 SSH 隧道,带退避重连(默认无限重试)和心跳机制保持注册表新鲜
- 本地端口冲突时自动移位,并显示占用进程(Windows 上使用 netstat + tasklist)
- 注册表审计命令,比较 TSV 注册表与实际端口占用情况
dsh-remote-tunnel DSH 插件适合哪些场景
- 从本地浏览器通过安全隧道访问运行在远程 Linux 服务器上的 dsh web 界面
- 多用户共享同一台远程服务器,每个用户获得独立端口和工作空间
- 通过一条命令链自动化设置远程 dsh 开发环境
dsh-remote-tunnel DSH 插件适合谁
- 需要在远程服务器上处理文件和会话的 DSH 用户
- 管理多开发者共享 dsh 服务器的团队负责人或管理员
dsh-remote-tunnel DSH 插件的限制
- 远程服务器必须安装 Node ≥ 22.19、dsh、systemd 和基于密钥的 SSH 登录
- 远程操作系统仅支持 Linux(依赖 systemd);本地机器可以是 Windows/macOS/Linux
- Windows OpenSSH 8.1 之前的版本存在 ClearAllForwardings 问题,可能破坏隧道转发(需要升级到更新版本)
- 该插件处于早期开发阶段,部分功能(如心跳、注册表回退)可能需要手动配置
dsh-remote-tunnel DSH 插件的仓库 README 摘录
以下文字摘自 dsh-remote-tunnel DSH 插件的上游仓库 Linjiangxian0203/dsh-remote-tunnel 的 README,版权归原作者,仅作引用。
**Remote Host Tunnel Manager**: automates the "local browser → dsh web on a remote Linux server" link — remote port allocation with a registry, systemd supervision, resilient SSH tunneling, local URL output, and full lifecycle management. Built for single users and for teams sharing one server. - Sessions and files live **on the server** (the remote dsh web's workspace = server directories); the local machine only keeps a tunnel - Each user automatically gets a **dedicated remote port**, double-checked on the server (real occupancy + registry) before allocation — safe under concurrency - Every allocation is **recorded in a registry on the server** (`/etc/dsh-ports.tsv`, or a per-user fallback depending on permissions) — `audit` compares the registry against real occupancy at any time - The tunnel **auto-reconnects** after network drops (backoff respawn), and heartbeats keep the registry fresh - Occupied local ports shift automatically, with the occupying process reported ## If you're just a user (not developing) ```powershell # 1. Install (published npm package) dsh plugin --profile remote add dsh-remote-tunnel # 2. Confirm your server is visible (Host aliases from ~/.ssh/confi
阅读完整 README仓库许可: MIT
dsh-remote-tunnel DSH 插件常见问题
如何安装 dsh-remote-tunnel?
在终端中执行 `dsh plugin --profile remote add dsh-remote-tunnel`。这会安装已发布的 npm 包到你的 DSH CLI 配置文件(名为 'remote')。确保本地已安装 DSH 且 Node 版本 ≥ 22.19。
如何添加远程主机?
`~/.ssh/config` 中的主机条目会自动被发现。如果需要手动添加,使用 `dsh --profile remote hosts add <别名> --host <IP> --user <用户名> --workspace <路径>`。例如:`dsh --profile remote hosts add lab --host 192.0.2.10 --user alice --workspace /home/alice/project`。
隧道启动失败怎么办?
首先运行 `dsh --profile remote check <主机>` 来诊断缺失的依赖(密钥、Node、dsh、systemd、注册表权限)。常见问题包括 SSH 密钥未设置、远程 Node 版本太低或 systemd 不可用。check 命令会逐步给出指导。
如何处理本地端口冲突?
插件会自动移位本地端口,并显示占用进程。你也可以在运行 `up` 时使用 `--local-port <端口>` 指定自定义端口。本地端口范围默认为 3081-3140,可在 `config.yaml` 中配置。
多个用户可以共享同一台远程服务器吗?
可以。每个用户独立运行 `up`,获得不同的远程端口。服务器端的注册表(`/etc/dsh-ports.tsv` 或用户级回退)记录分配情况。`audit` 命令显示谁持有哪个端口。对于共享注册表,管理员需要设置 TSV 文件并配置适当权限(参见 README 中的“共享服务器”部分)。