Skip to content

Commit

Permalink
optimize(http): use net.JoinHostPort
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Apr 18, 2024
1 parent fed1f04 commit c494c77
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions http.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"errors"
"net"
"net/http"
"strings"
"time"

"github.com/FloatTech/ttl"
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit c494c77

Please sign in to comment.