From fc21418f52169449e420a8a47915b34e253f2cf3 Mon Sep 17 00:00:00 2001 From: xream Date: Sun, 31 May 2026 20:50:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=20sing-box=20tailsca?= =?UTF-8?q?le=20=E7=9A=84=20ssh-server=20=E9=85=8D=E7=BD=AE=E5=B9=B6?= =?UTF-8?q?=E8=A1=A5=E5=85=85=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 增加 `ssh-server` 到 `ssh_server` 的映射能力,支持布尔开关和对象配置(enabled/disable-pty/disable-sftp/disable-forwarding) - 更新 `scripts/demo.js` 注释:补充 sing-box 说明和 `ssh-server` 示例配置 --- backend/src/core/proxy-utils/producers/sing-box.js | 10 ++++++++++ scripts/demo.js | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/backend/src/core/proxy-utils/producers/sing-box.js b/backend/src/core/proxy-utils/producers/sing-box.js index 2ceadcf9..19dc83a9 100644 --- a/backend/src/core/proxy-utils/producers/sing-box.js +++ b/backend/src/core/proxy-utils/producers/sing-box.js @@ -1065,6 +1065,16 @@ const tailscaleParser = (proxy = {}) => { ipVersionParser(proxy, parsedProxy); domainResolverParser(proxy, parsedProxy); } + if (isPlainObject(proxy['ssh-server'])) { + parsedProxy.ssh_server = { + enabled: proxy['ssh-server'].enabled !== false, + disable_pty: proxy['ssh-server']['disable-pty'], + disable_sftp: proxy['ssh-server']['disable-sftp'], + disable_forwarding: proxy['ssh-server']['disable-forwarding'], + }; + } else if (proxy['ssh-server']) { + parsedProxy.ssh_server = !!proxy['ssh-server']; + } return parsedProxy; }; diff --git a/scripts/demo.js b/scripts/demo.js index 1a10b30f..8bf9c1ae 100644 --- a/scripts/demo.js +++ b/scripts/demo.js @@ -50,7 +50,8 @@ function operator(proxies = [], targetPlatform, context) { // 26. `_qx_obfs_http` 为 QX 的 http obfs 原始值, 例如 `http`, `vmess-http`, `vemss-http`, `shadowsocks-http`, 用于 QX 输入输出时保留原始写法. `vemss-http` 应该是 huaqian 的 typo, 没测过, 反正也支持, 报错就自己改成 `vmess-http` 吧 // 27. WireGuard 支持 `ip-cidr`(IPv4 前缀长度) 和 `ipv6-cidr`(IPv6 前缀长度) 字段: 内部会保存前缀长度, 若未设置则默认分别为 `32` 和 `128`. 输出到 `mihomo`/`Shadowrocket`/`sing-box`/`URI` 时会带上该后缀 // 28. sing-box 1.14.0 起才有 `control_http_client` , 暂时可使用 `control-http-client` 字段设置 sing-box 的 `control_http_client` - // 若 `control-http-client` 非空, 输出 sing-box Tailscale endpoint 时会跳过旧版拨号字段映射, 避免和 `detour`/`dialer-proxy` 等 legacy dialer options 冲突. 需要给控制面设置前置代理时, 请写到 `control-http-client.detour` + // 若 `control-http-client` 非空, 输出 sing-box Tailscale endpoint 时会跳过旧版拨号字段映射, 避免和 `detour`/`dialer-proxy` 等 legacy dialer options 冲突. 需要给控制面设置前置代理时, 请写到 `control-http-client.detour`(1.14.0-alpha.26 又改回去了...) + // 29. sing-box 支持使用 `ssh-server` 给 tailscale 设置 `ssh_server`, 直接设为 `true` 或 `{ "enabled": true, "disable-pty": true, "disable-sftp": true, "disable-forwarding": true }` // require 为 Node.js 的 require, 在 Node.js 运行环境下 可以用来引入模块 // 例如在 Node.js 环境下, 将文件内容写入 /tmp/1.txt 文件