[relay] Preserve non-standard port in WS dialer URL prep#6061
[relay] Preserve non-standard port in WS dialer URL prep#6061
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughReplaces string-based WebSocket URL rewriting with a url.Parse-based ChangesWebSocket URL Preparation Refactoring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Release artifactsBuilt for PR head
GHCR images (amd64)
This comment is updated by the Release workflow. Artifact links expire according to the workflow retention policy. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@shared/relay/client/dialer/ws/ws.go`:
- Around line 57-70: After parsing the relay address in ws.go, ensure the parsed
URL contains an authority host before returning: after the scheme mapping (cases
for "rel"/"rels") add a check like if parsed.Host == "" (or parsed.Hostname() ==
"") return "", fmt.Errorf("missing host in relay address %q", address) so opaque
inputs like "rel:example.com:33080" are rejected; keep the rest of the logic
(set parsed.Path = relay.WebSocketURLPath and return parsed.String()) unchanged
and reference the existing parsed variable and the function that constructs the
WS URL.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1f91ec78-3f9d-4a38-bc9c-c772f5fd6695
📒 Files selected for processing (1)
shared/relay/client/dialer/ws/ws.go
|



Describe your changes
Rewrite
prepareURLin the relay WS dialer to usenet/urlparsing instead of astrings.Replacebased scheme rewrite, and add tests covering non-standard ports and other edge cases.url.Parse, switch on the scheme, and set the path explicitlyrel, and rejected schemesIssue ticket number and link
#6057
Stack
Checklist
Documentation
Select exactly one:
Internal refactor with no user-visible API change.
Docs PR URL (required if "docs added" is checked)
Paste the PR link from https://github.com/netbirdio/docs here:
https://github.com/netbirdio/docs/pull/__
Summary by CodeRabbit
Bug Fixes
Tests