← Back to Pull requests

feat(forward): 按端口创建临时 HTTPS 公网预览 #871

Closed
unknown closed this pull request without merging on Nov 29, 2026 07:41 UTC
View on GitHub
unknown unknown commented on Nov 29, 2026 05:58 UTC
Author

创建与管理

在“端口转发”填写或选中端口,再选择 WebMux 转发(需要登录) 或 Cloudflare 临时公网链接(持有链接即可访问),最后点击“添加转发”。默认选择 WebMux。终端或聊天页的“转发”和“转发并打开”也先显示方式选择,取消时不发送创建请求。

  • 服务端在一次 POST /api/forwards 中保存方式并登记端口。WebMux 使用登录网关;Cloudflare 在边缘注册后提供独立 HTTPS 根域名。列表显示对应的状态和链接,公网预览支持取消启动、停止、失败重试和移除。

  • webmux forward add PORT --mode webmux|cloudflare 支持显式选择。CLI 和 API 省略模式时默认 WebMux。forward ls 显示方式和状态,forward ls --json 可读取已就绪的公网地址。

  • 端口限定在已登记的本机应用,排除 WebMux 管理端口。每个端口独立管理隧道进程;移除转发或退出服务会清理子进程。用户故事 US-R03、US-R04、US-S18。
  • 验证

  • 修订后的创建流程使用独立 WebMux 与只返回随机测试标记的回环 HTTP 实例做真实 Quick Tunnel 联调。创建返回 201 和 starting,Chromium 访问公网 /deep/route 得到 200 且标记匹配。相同端口的 WebMux 网关返回 404,停止返回 200 和 stopped,旧公网链接随后返回 530。

  • 桌面和手机 14 项 Playwright 用例通过,22 项转发对话框和终端提示组件测试通过,覆盖提交前选择、取消、默认值、检测端口、等待链接、鉴权、回收和主隧道共存。361 项前后端协议契约测试通过。

  • CLI 测试覆盖省略模式、显式 WebMux、显式 Cloudflare、无效值。核对了 webmux forward add --help 的选项、默认值与公网示例。服务层竞态测试覆盖多端口、重复启动、不可达端口、失败和重试。

  • 本 PR 前一版已通过隔离 Legato 空库的真实公网浏览器验收:根路径进入 /login、无效登录错误、/forgot-password、刷新、后退、两个 favicon 和同源请求。该次隧道已关闭。
  • 本地 make check 通过,Go lint 0 项。CLI、API、转发管理和服务入口的 race 测试通过。提交 97641f44 的 18 项 GitHub CI 检查全部通过。CI 记录
  • 限制

    验收范围为单一 HTTP 入口。Quick Tunnel 不支持 SSE。隔离 Legato 没有专用测试账号,成功登录、受保护页面和退出未在真实公网验证。本次交互修订后的真实公网复测使用隔离 HTTP 测试应用。

    界面

    桌面、平板与手机采用同类演示数据,各有一条已登记的 WebMux 转发。右侧显示新端口提交前的默认选择。动图展示选择 Cloudflare、创建、注册就绪与停止。

    | 视口与主题 | 修改前 | 修改后 |
    | --- | --- | --- |
    | 1280×900 light | !before | !after |
    | 1280×900 dark | !before | !after |
    | 768×800 light | !before | !after |
    | 768×800 dark | !before | !after |
    | 390×844 light | !before | !after |
    | 390×844 dark | !before | !after |

    !桌面浅色,创建和停止公网预览

    Diff: 456 lines (+342 / -114) across 5 files Reviewer: mzdluo123 Review duration: 103m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.46) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 456 lines diff across 5 files
    0.46
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.366
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #871"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.5% (MEDIUM) · Higher = larger blast radius
    45.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.7% · Safe to merge
    19.7%