daemon/config: make DNSConfig.DNS a netip.Addr#50600
Merged
robmry merged 1 commit intomoby:masterfrom Aug 4, 2025
Merged
Conversation
Modernize the field and allow using it as-is in some places, or convert it to a string (which won't produce an error down the line). Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
thaJeztah
commented
Aug 1, 2025
| doc: "single DNS, invalid IP-address", | ||
| input: `{"dns": ["1.1.1.1o"]}`, | ||
| expectedErr: `invalid IP address: 1.1.1.1o`, | ||
| expectedErr: `ParseAddr("1.1.1.1o"): unexpected character (at "o")`, |
Member
Author
There was a problem hiding this comment.
This is the only downside; I dislike the errors produced by stdlib. In this case, the error is not exported, so it's not possible to dismantle it (i.e., do an errors.As and cherry-pick the bits that are useful to produce a user-friendly error); https://github.com/golang/go/blob/e666972a674eb96f5847c7bbeb5c6e1bcb572af5/src/net/netip/netip.go#L141-L153
type parseAddrError struct {
in string // the string given to ParseAddr
msg string // an explanation of the parse failure
at string // optionally, the unparsed portion of in at which the error occurred.
}
func (err parseAddrError) Error() string {
q := strconv.Quote
if err.at != "" {
return "ParseAddr(" + q(err.in) + "): " + err.msg + " (at " + q(err.at) + ")"
}
return "ParseAddr(" + q(err.in) + "): " + err.msg
}
thaJeztah
commented
Aug 1, 2025
Comment on lines
-65
to
+70
| sboxOptions = append(sboxOptions, libnetwork.OptionDNS(ctr.HostConfig.DNS)) | ||
| dnsAddrs, err := toNetIP(ctr.HostConfig.DNS) |
Member
Author
There was a problem hiding this comment.
Would be great if we could change HostConfig.DNS as well, but it's part of the API, so much harder to change.
akerouanton
approved these changes
Aug 4, 2025
robmry
approved these changes
Aug 4, 2025
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.
Modernize the field and allow using it as-is in some places, or convert it to a string (which won't produce an error down the line).
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)