1
0
mirror of https://github.com/fumiama/RVC-Models-Downloader.git synced 2024-11-17 13:47:11 +09:00

optimize(http): use net.JoinHostPort

This commit is contained in:
源文雨 2024-04-18 18:54:36 +09:00
parent fed1f04b53
commit c494c77c1c

View File

@ -8,7 +8,6 @@ import (
"errors"
"net"
"net/http"
"strings"
"time"
"github.com/FloatTech/ttl"
@ -61,12 +60,7 @@ var cli = http.Client{
}
var tlsConn *tls.Conn
for _, a := range addrs {
if strings.Contains(a, ":") {
a = "[" + a + "]:" + port
} else {
a += ":" + port
}
conn, err := httpdialer.DialContext(ctx, network, a)
conn, err := httpdialer.DialContext(ctx, network, net.JoinHostPort(a, port))
if err != nil {
continue
}