Repository navigation
Add onctl port-forward (pf), for every provider - #1169
Merged
Merged
Conversation
Forwards local ports to ports on a VM over the ssh connection onctl already uses -- ssh -L without working out the user, key, address and port -- so it works for every provider, and through the tunnel for boxes (which have no address of their own). Forwards are REMOTE, LOCAL:REMOTE (0 picks a free local port) or LOCAL:HOST:REMOTE (somewhere only the VM can reach), on 127.0.0.1 unless --address says otherwise. One ssh connection carries them all; before each forwarded connection it's checked with a keepalive, because a VM that was paused doesn't close its old connection, it just stops answering. A dead one is replaced, which resumes a paused box. cloud.KeyAuthorizer lets a provider put the key on an existing VM itself, so port-forward works on a box made in the dashboard; boxes implements it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U8g3mHkS6JmtYVYc4AjcV4
cdalar
enabled auto-merge
October 4, 2026 21:26
The counter is bumped by the forwarder's goroutine and read by the test, which the race detector flagged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U8g3mHkS6JmtYVYc4AjcV4
Boxes images have only a name and a description, so the table showed three empty columns (TYPE, OS FLAVOR, OS VERSION) for them. Hetzner's table is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U8g3mHkS6JmtYVYc4AjcV4
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1169 +/- ##
==========================================
+ Coverage 38.81% 39.09% +0.28%
==========================================
Files 57 59 +2
Lines 6073 6244 +171
==========================================
+ Hits 2357 2441 +84
- Misses 3716 3803 +87 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Step 2 of
docs/plans/boxes-provider.md, built for every provider rather than boxes only.How it works
direct-tcpip, likessh -L), so the user, key, port and static-inventory handling matchonctl ssh. For boxes, that ssh connection runs through the tunnel (cloud.Dialer, from Add the boxes provider: hosted microVMs, onctl login, ssh through the provider #1168).127.0.0.1by default:--address 0.0.0.0shares the forwards on your network.connect failed ("Connection refused")) and doesn't trigger a reconnect.cloud.KeyAuthorizer: lets a provider put the key on an existing VM itself, sopfworks on a box made in the dashboard. Boxes implements it.pfalias: kubectl has no built-in alias forport-forward; it's offered here alongside the full name.Also:
onctl imagesleaves out columns that no image fills in. For boxes, that drops the three empty Hetzner-only columns (TYPE, OS FLAVOR, OS VERSION).Tests
REMOTE,LOCAL:REMOTE,LOCAL:HOST:REMOTE, plus invalid forms).direct-tcpip, checking:go test -race -shuffle=on ./...and golangci-lint are clean.Live, against boxctl.io (throwaway boxes, destroyed afterwards):
pause -f, the next connection resumed the box and got through in 6.3s. Before this fix, that case hung.🤖 Generated with Claude Code
https://claude.ai/code/session_01U8g3mHkS6JmtYVYc4AjcV4