Uh oh!
There was an error while loading. Please reload this page.
feat(port): accept hostnames in SSH port forwarding - #294
Conversation
The devcontainer spec's forwardPorts property supports host:port format with hostnames (e.g. "db:5432"), but toAddress rejected anything that wasn't a literal IP or "localhost". Remove the net.ParseIP gate so hostnames pass through to be resolved at connection time. Also update the splitParts 3-part disambiguation to use a numeric check instead of net.ParseIP, allowing hostname-based container addresses.
✅ Deploy Preview for devsydev canceled.
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ames Verify that `--forward-ports <localPort>:nginx:8080` correctly forwards traffic through a hostname-addressed compose service, exercising the hostname support added in the previous commit.
Extract repeated string literals into package-level constants to satisfy the goconst linter for new code introduced in the hostname support commit.
Uh oh!
There was an error while loading. Please reload this page.
Summary
net.ParseIPgate intoAddress()that rejected non-IP hostnames, allowing hostnames likedatabase.internalto pass through for resolution at SSH connection timesplitParts()3-part disambiguation to use a numeric check (strconv.Atoi) instead ofnet.ParseIP, so hostname-based container addresses (e.g.8080:redis:6379) are correctly parsedParsePortSpec,toAddress, andsplitPartscovering hostnames, IPs, localhost, unix sockets, and error cases (29 tests)Devcontainer spec alignment
The devcontainer spec explicitly supports hostnames in
forwardPorts:The
"db:5432"example confirms hostnames are a first-class format. This PR aligns the CLI's--forward-ports/--reverse-forward-portsparsing (ParsePortSpec) with the spec. The config-basedforwardPortspath (parseForwardPortinpkg/tunnel/services.go) already accepted hostnames — this PR closes the gap in the CLI path.Deviation note: The 2-part
"host:port"format from the spec (e.g."db:5432") is handled byparseForwardPortfor config values, not byParsePortSpecwhich interprets 2-part specs ashostPort:containerPort. This is unchanged pre-existing behavior —ParsePortSpecserves the CLI'shost:hostPort:containerHost:containerPortformat, not the devcontainer config format.