Conversation
📝 WalkthroughWalkthroughThe changes add error handling and validation to endpoint address conversion in the WireGuard proxy binding layer. The Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
|
| p.wgCurrentUsed = addrToEndpoint(endpoint) | ||
| ep, err := addrToEndpoint(endpoint) | ||
| if err != nil { | ||
| log.Errorf("failed to convert endpoint address: %v", err) |
There was a problem hiding this comment.
The address validation is on wrong place and handled in incorrect way.
If the endpoint is nil throw and panic. Never allowed to be nil!
There was a problem hiding this comment.
Yeah, it'll stick to the old endpoint in that case
There was a problem hiding this comment.
That is wrong. The address to endpoint must to work without error. In this scope the error is not acceptable path.
There was a problem hiding this comment.
The error was completely ignored before. How would you like to handle it?
There was a problem hiding this comment.
The first expectation is that the endpoint should not be nil. If it is nil, a panic should be thrown. If the addr nor ipv4 nor ipv6 a panic should also be thrown. Another option is to pass the addr instead of the endpoint.



Describe your changes
Fixes:
Issue ticket number and link
Stack
Checklist
Documentation
Select exactly one:
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
✏️ Tip: You can customize this high-level summary in your review settings.