fix(server): build ping address with net.JoinHostPort for IPv6 hosts

fmt.Sprintf("%s:%d", host, port) produces a malformed address for IPv6
literal hosts (go vet: "address format does not work with IPv6").

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Mikhail Chusavitin
2026-08-27 17:08:51 +03:00
co-authored by Claude Sonnet 5
parent 70c939ea4b
commit 5b65c99b0e
+1 -1
View File
@@ -1695,7 +1695,7 @@ func (s *Server) handleCollectStart(w http.ResponseWriter, r *http.Request) {
// pingHost dials host:port up to total times with 2s timeout each, returns true if
// at least need attempts succeeded.
func pingHost(host string, port int, total, need int) (bool, string) {
addr := fmt.Sprintf("%s:%d", host, port)
addr := net.JoinHostPort(host, strconv.Itoa(port))
var successes atomic.Int32
done := make(chan struct{}, total)
for i := 0; i < total; i++ {