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:
parent
fed1f04b53
commit
c494c77c1c
8
http.go
8
http.go
@ -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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user