-
Notifications
You must be signed in to change notification settings - Fork 380
fix(node): allow hostnames in public address validation #5312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR modifies the validatePublicAddress function to accept hostnames in addition to IP addresses for the NAT address configuration. Previously, the function would reject any input that wasn't a valid IP address.
Key Changes:
- Modified validation logic to only perform IP-specific checks (loopback, private) when the host is a valid IP address
- Updated test cases to reflect that hostnames are now valid inputs
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| pkg/node/node.go | Refactored validatePublicAddress to validate IP-specific constraints only when the host is an IP, allowing hostnames to pass through |
| pkg/node/node_test.go | Updated test cases to expect hostnames to be valid and added new test cases for hostname formats |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Is there a benefit or it is ok to allow any valid hostname? I think we should only have hostnames that point to the IP where Bee is installed, right? Bee should not start if we provide |
The current validation only checks hostname format, not DNS resolution or whether the resolved IP is valid/public. This allows example.com:1634 to pass. cc @janos |
Checklist
Description
Allow hostname to pass the validation for public address.
Test:
./dist/bee start --nat-addr="example.com:1234" --config=config.ymlOpen API Spec Version Changes (if applicable)
Motivation and Context (Optional)
Related Issue (Optional)
Screenshots (if appropriate):