-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Use net.JoinHostPort() for IPv6-safe host:port formatting #11959
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,7 @@ package config | |
|
|
||
| import ( | ||
| "encoding/json" | ||
| "fmt" | ||
| "net" | ||
| "os" | ||
|
|
||
| "github.com/kelseyhightower/envconfig" | ||
|
|
@@ -56,7 +56,7 @@ func (cfg *Config) String() string { | |
| } | ||
|
|
||
| func (cfg *Config) HostAddr() string { | ||
| return fmt.Sprintf("%s:%s", cfg.Host, cfg.Port) | ||
| return net.JoinHostPort(cfg.Host, cfg.Port) | ||
| } | ||
|
Comment on lines
58
to
60
|
||
|
|
||
| func (cfg *Config) ConfigureLogging() { | ||
|
|
||
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.
PR description says IPv6 BPF FV tests broke due to unbracketed IPv6 in URLs and that this PR replaces string concatenation with JoinHostPort(), but there are still unbracketed host:port URL constructions elsewhere (e.g., felix/fv/health_test.go:429 uses "http://"+felix.IP+":9099/..." and felix/k8sfv/metric.go:28 uses "http://"+felixIP+":9091/...", plus felix/fv/utils/utils.go:203 for etcd endpoints). Either expand this PR to cover these remaining cases or narrow the description/scope accordingly; otherwise IPv6 test coverage may still fail under the stricter net/url parsing.