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