Repository navigation
feat(desktop): 端口窗口新增主机侧转发规则与反向转发 (#2231) - #2290
Merged
Merged
Conversation
- 端口窗口标题栏“+”打开“添加转发规则”:主机端口 → 另一台服务器(T3), 主机端口 → 本机(T4 反向转发,只在设置允许时提供);默认只监听主机回环地址, 监听全部网卡每次都询问、不记住,目标不是主机回环地址时先询问(S28) - 端口窗口新增“转发规则”一节:监听地址(全部网卡用警告色)、目标、连接数和状态, 可逐条停止,全部停止也停止规则;规则随会话结束,重连后不自动恢复 - 设置 › 工具 › 远程工作区新增“端口转发 › 反向转发”,默认自动(不允许) - Core 客户端接上 remote.startHostForward / remote.startReverseForward 和四个新错误码 - 固定 Core main 62d44ce(Lithe-IDEA/Lithe-core-rust#159) - 中英词条、无头截图、功能矩阵和远程开发 Note 同步更新
This was referenced Nov 21, 2026
xiaoyumuxi
marked this pull request as ready for review
November 22, 2026 00:27
This was referenced Nov 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 Issue / Linked issue
remote.startHostForward/remote.startReverseForward、四个新错误码、偏好里的reverseForwarding。已合入 main 62d44ce,本 PR 固定该提交)PR 类型 / Type
改动说明 / What changes
背景 / Why
#2286 的端口窗口只能把主机的端口转到本机。#2231 还要求两件事:
这两种都会在主机上监听,安全上比本机转发敏感。所以:
Core #159 实现了这两种转发和对应的错误码。本 PR 在桌面端接上它们:添加规则的对话框、规则列表,以及设置里的开关。
改动 / Changes
添加转发规则对话框(
workbench/remote_port_rules.go、remote_port_rules_view.go)remote.parseForwardAddress解析。网址里带用户名或密码时拒绝。127.0.0.1上监听:端口窗口(
workbench/remote_ports.go、remote_ports_view.go)RemoteForward.IsLocal()),主机转发和反向转发都只列在规则里。设置 › 工具 › 远程工作区(
settingswindow/remote_workspace_view.go、remote_preferences_state.go)remote.editPreferences写入,再重新读取。Core 客户端(
internal/core/remote_forward.go、remote_preferences.go、errors.go)RemoteStartHostForward(remote.startHostForward)和RemoteStartReverseForward(remote.startReverseForward)。RemoteForward新增Kind(local / host / reverse)以及主机侧字段。forward_host_port_in_useforward_host_port_deniedforward_host_unsupportedreverse_forward_disabledReverseForwarding。固定 Core 修订(
scripts/desktop/build-desktop-core.sh)PINNED_CORE_REVISION指向 Core main 62d44ce([Bug] 双击左侧文件栏目中的文件会卡住 #159 已合入,代码树与分支提交 e9d4cb2 相同)。日志
remote.ports.addRule、remote.ports.ruleHost、remote.ports.ruleReverse、remote.ports.ruleConfirm、remote.ports.stopRule。remote_port_rule操作下,只记命令和错误码。// log-exempt:注释。文案、截图与矩阵
shared/i18n/features/remote-ports.json新增 40 条规则相关词条,remote-settings.json新增 6 条,中英都有,并已重新生成。docs/assets/remote-ports/:docs/assets/remote-settings/的 4 张截图都重新截了,多出“端口转发”一组;README 同步更新。remote-workspace.json:测试
workbench/remote_port_rules_test.go有 5 个测试:settingswindow/remote_workspace_view_test.go新增TestRemoteWorkspaceReverseForwardingIsAppliedAndRestored:先应用“允许”,再恢复成自动。TestVisualRemotePorts新增三个场景,窗口高度改为 960。截图 / Screenshots
转发规则列表:
127.0.0.1:15432转到另一台服务器;0.0.0.0:9200监听全部网卡,用警告色;反向转发转回本机127.0.0.1:3000。添加转发规则(勾选了监听全部网卡)
监听全部网卡前询问(每次都问、不记住)
设置 › 工具 › 远程工作区:新增的“端口转发 › 反向转发”
不在本 PR 范围内 / Out of scope
类型专属:feat
多平台对齐
platform-specific),理由:范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/remote-workspace.json:能力描述、验证动作、说明和两端证据;验证状态仍是pending(没有原生窗口和真实主机验收)./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh和./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEAD.artifacts/下生成的矩阵视图插件归属 / Plugin ownership
develop-lithe第三节“插件归属与宿主零依赖”的自查命令,结果为空shared/i18n/UI 验证 / UI evidence
TestVisualRemotePorts:7 个场景,1200×960;TestVisualRemoteWorkspace:2 个场景;docs/assets/remote-ports/和docs/assets/remote-settings/统一日志系统 / Structured logging
performed动作、remote_port_rule失败),没有print或手写事件 ID// log-exempt:界面文案 / i18n
shared/i18n/features/remote-ports.json和remote-settings.json补齐中英词条,已运行node scripts/i18n/generate-i18n.mjs并提交生成结果node scripts/i18n/verify-app-language-localization.mjs和node scripts/i18n/generate-i18n.mjs --check都通过,没有放宽脚本逻辑归属 / Logic placement
crates/remote,桌面端只负责对话框、询问和呈现:性能与内存 / Performance and memory
设置 / Settings
remote.preferences的同一个解析结果插件契约 / Plugin contract
N/A:只用了 Core 的远程客户端 API(
crates/remote),没有改插件契约、能力版本、插件函数协议或宿主方法。发行包与资源 / Bundle and resources
remote/preferences.json,规则只在内存里。已运行./scripts/desktop/verify/verify-runtime-bundle-immutability.sh无用代码与重构 / Dead code and refactoring
验证 / Verification
scripts/desktop/desktop-go.sh test ./internal/workbench/ ./internal/settingswindow/ ./internal/core/ ./internal/remoteconn/(Core 为 e9d4cb2,与固定的 main 62d44ce 代码树相同)scripts/desktop/desktop-go.sh vet(同上四个包,含vivahead lithevisual标签)gofmt -l改动的 Go 文件TestVisualRemotePorts、TestVisualRemoteWorkspace(-tags 'vivahead lithevisual')node scripts/i18n/generate-i18n.mjs --check、node scripts/i18n/verify-app-language-localization.mjs./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEAD./scripts/desktop/verify/verify-runtime-bundle-immutability.sh./scripts/agent-notes/verify-agent-notes.shdevelop-lithe第三节插件归属自查rg未能执行的检查和原因:
提交前确认 / Final checks
main(994b67331)创建,目标分支main/Users/example