Skip to content

feat(ssh): add pane-scoped local port forwarding - #280

Open
WilliamWang1721 wants to merge 9 commits into
Kuddev:mainfrom
WilliamWang1721:feature/ssh-port-forward-253
Open

WilliamWang1721 wants to merge 9 commits into
Kuddev:mainfrom
WilliamWang1721:feature/ssh-port-forward-253

Conversation

@WilliamWang1721

@WilliamWang1721 WilliamWang1721 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Closes #253

Result

Add lightweight local port forwarding to native SSH panes.

Once an SSH session is ready, the focused pane exposes a Ports control where users can:

  • forward a remote server port to a local 127.0.0.1 port
  • view forwards owned by the current SSH pane
  • stop an individual forward

This implements the core workflow requested in #253 without introducing a separate SSH implementation or a larger VS Code-style Ports subsystem.

Implementation

The forwarding path reuses Pebrel's existing SSH stack:

  • existing authenticated SharedSession
  • existing SSH connection pool
  • existing authenticated_session()
  • existing channel_open_direct_tcpip()
  • existing SSH Tokio runtime / GPUI bridge

Each forward is owned directly by its TerminalView. Closing or failing the SSH pane therefore releases its listener and active forwarding tasks naturally with the pane lifecycle.

Local forwarding is intentionally limited to:

127.0.0.1:<local port> -> SSH server 127.0.0.1:<remote port>

No extra SSH process or second authentication path is created.

Scope

This PR deliberately does not add:

  • reverse forwarding (-R)
  • SOCKS forwarding (-D)
  • arbitrary remote hosts
  • persisted forwarding rules
  • automatic port discovery
  • retry/reconnect management
  • browser/service detection
  • new settings
  • CLI or Runtime API surface
  • a global port-forward manager

Those can be considered separately if there is demand.

Size

The final feature diff is approximately:

  • +335 / -26
  • net +309 lines
  • one focused feature commit

The small deletion mostly comes from sharing the existing SSH-runtime bridge that was previously local to Remote Files.

Validation

The implementation was validated using Pebrel's existing native test workflow:

  • rustfmt ✅
  • CI contracts ✅
  • platform cfg budget ✅
  • Ubuntu full native tests ✅
  • Windows x64 full native tests ✅
  • Windows ARM64 full native tests ✅
  • macOS ARM full native tests ✅
  • macOS Intel full native tests ✅
  • macOS ARM release workspace ✅
  • macOS Intel release workspace ✅
  • architecture checks ✅
  • translation/allocation contracts ✅

Validation run:
https://github.com/WilliamWang1721/pebrel/actions/runs/35962262104

UI Review Screenshots

Current-head evidence for 4399916e115b7d0d42d9d23dcd31b864ba095de0. UI review workflow run

Windows — success

PR #280 — Windows — 00-full-app-review.png

PR #280 — Windows — 01-ssh-ports-regression-review.png

Raw evidence: Windows originals

macOS — success

PR #280 — macOS — 00-full-app-review.png

PR #280 — macOS — 01-ssh-ports-regression-review.png

Raw evidence: macOS originals

@WilliamWang1721
WilliamWang1721 force-pushed the feature/ssh-port-forward-253 branch from 80d9ff6 to e44b905 Compare September 24, 2026 07:49
github-actions Bot added a commit to WilliamWang1721/pebrel that referenced this pull request Sep 25, 2026
github-actions Bot added a commit to WilliamWang1721/pebrel that referenced this pull request Sep 25, 2026
github-actions Bot added a commit to WilliamWang1721/pebrel that referenced this pull request Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] SSH 端口转发

1 participant