Skip to content

Commit

Permalink
remove netutils.JoinHostPort
Browse files Browse the repository at this point in the history
Signed-off-by: zirain <zirain2009@gmail.com>
  • Loading branch information
zirain committed Oct 31, 2024
1 parent c1c0a04 commit 9ac2399
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 0 additions & 5 deletions internal/utils/net/port.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package net
import (
"fmt"
"net"
"strconv"
)

const (
Expand All @@ -23,7 +22,3 @@ func LocalAvailablePort() (int, error) {

return l.Addr().(*net.TCPAddr).Port, l.Close()
}

func JoinHostPort(host string, port int) string {
return net.JoinHostPort(host, strconv.Itoa(port))
}
8 changes: 5 additions & 3 deletions internal/xds/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import (
// Register embed
_ "embed"
"fmt"
"net"
"strconv"
"strings"
"text/template"

"k8s.io/apimachinery/pkg/util/sets"

egv1a1 "github.com/envoyproxy/gateway/api/v1alpha1"
"github.com/envoyproxy/gateway/internal/utils/net"
netutils "github.com/envoyproxy/gateway/internal/utils/net"
"github.com/envoyproxy/gateway/internal/utils/regex"
)

Expand Down Expand Up @@ -199,9 +201,9 @@ func GetRenderedBootstrapConfig(opts *RenderBootstrapConfigOptions) (string, err
host, port = *sink.OpenTelemetry.Host, uint32(sink.OpenTelemetry.Port)
}
if len(sink.OpenTelemetry.BackendRefs) > 0 {
host, port = net.BackendHostAndPort(sink.OpenTelemetry.BackendRefs[0].BackendObjectReference, "")
host, port = netutils.BackendHostAndPort(sink.OpenTelemetry.BackendRefs[0].BackendObjectReference, "")
}
addr := net.JoinHostPort(host, int(port))
addr := net.JoinHostPort(host, strconv.Itoa(int(port)))
if addresses.Has(addr) {
continue
}
Expand Down

0 comments on commit 9ac2399

Please sign in to comment.