From a0412a689f433fc7fc4e579649a8ee6c2df983cc Mon Sep 17 00:00:00 2001 From: devopsbo3 <69951731+devopsbo3@users.noreply.github.com> Date: Fri, 10 Nov 2023 12:31:54 -0600 Subject: [PATCH] Revert "node: fix listening on IPv6 address (#27628) (#27635)" This reverts commit ebfb635126d546331a5834826b952db3464566b9. --- cmd/clef/main.go | 3 +-- cmd/utils/flags.go | 3 +-- internal/debug/flags.go | 3 +-- node/config.go | 5 ++--- node/rpcstack.go | 2 +- 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/cmd/clef/main.go b/cmd/clef/main.go index a8b0bf816a38..14f09dc1a810 100644 --- a/cmd/clef/main.go +++ b/cmd/clef/main.go @@ -27,7 +27,6 @@ import ( "fmt" "io" "math/big" - "net" "os" "os/signal" "path/filepath" @@ -744,7 +743,7 @@ func signer(c *cli.Context) error { port := c.Int(rpcPortFlag.Name) // start http server - httpEndpoint := net.JoinHostPort(c.String(utils.HTTPListenAddrFlag.Name), fmt.Sprintf("%d", port)) + httpEndpoint := fmt.Sprintf("%s:%d", c.String(utils.HTTPListenAddrFlag.Name), port) httpServer, addr, err := node.StartHTTPEndpoint(httpEndpoint, rpc.DefaultHTTPTimeouts, handler) if err != nil { utils.Fatalf("Could not start RPC api: %v", err) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 6f0e5702506d..7bb47f128236 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -26,7 +26,6 @@ import ( "fmt" "math" "math/big" - "net" "net/http" "os" "path/filepath" @@ -2015,7 +2014,7 @@ func SetupMetrics(ctx *cli.Context) { } if ctx.IsSet(MetricsHTTPFlag.Name) { - address := net.JoinHostPort(ctx.String(MetricsHTTPFlag.Name), fmt.Sprintf("%d", ctx.Int(MetricsPortFlag.Name))) + address := fmt.Sprintf("%s:%d", ctx.String(MetricsHTTPFlag.Name), ctx.Int(MetricsPortFlag.Name)) log.Info("Enabling stand-alone metrics HTTP endpoint", "address", address) exp.Setup(address) } else if ctx.IsSet(MetricsPortFlag.Name) { diff --git a/internal/debug/flags.go b/internal/debug/flags.go index 52a6342452a1..d425a17db42b 100644 --- a/internal/debug/flags.go +++ b/internal/debug/flags.go @@ -19,7 +19,6 @@ package debug import ( "fmt" "io" - "net" "net/http" _ "net/http/pprof" "os" @@ -309,7 +308,7 @@ func Setup(ctx *cli.Context) error { port := ctx.Int(pprofPortFlag.Name) - address := net.JoinHostPort(listenHost, fmt.Sprintf("%d", port)) + address := fmt.Sprintf("%s:%d", listenHost, port) // This context value ("metrics.addr") represents the utils.MetricsHTTPFlag.Name. // It cannot be imported because it will cause a cyclical dependency. StartPProf(address, !ctx.IsSet("metrics.addr")) diff --git a/node/config.go b/node/config.go index 949db887e4e4..37c1e4882b84 100644 --- a/node/config.go +++ b/node/config.go @@ -19,7 +19,6 @@ package node import ( "crypto/ecdsa" "fmt" - "net" "os" "path/filepath" "runtime" @@ -264,7 +263,7 @@ func (c *Config) HTTPEndpoint() string { if c.HTTPHost == "" { return "" } - return net.JoinHostPort(c.HTTPHost, fmt.Sprintf("%d", c.HTTPPort)) + return fmt.Sprintf("%s:%d", c.HTTPHost, c.HTTPPort) } // DefaultHTTPEndpoint returns the HTTP endpoint used by default. @@ -279,7 +278,7 @@ func (c *Config) WSEndpoint() string { if c.WSHost == "" { return "" } - return net.JoinHostPort(c.WSHost, fmt.Sprintf("%d", c.WSPort)) + return fmt.Sprintf("%s:%d", c.WSHost, c.WSPort) } // DefaultWSEndpoint returns the websocket endpoint used by default. diff --git a/node/rpcstack.go b/node/rpcstack.go index b33c2380513b..e91585a2b630 100644 --- a/node/rpcstack.go +++ b/node/rpcstack.go @@ -112,7 +112,7 @@ func (h *httpServer) setListenAddr(host string, port int) error { } h.host, h.port = host, port - h.endpoint = net.JoinHostPort(host, fmt.Sprintf("%d", port)) + h.endpoint = fmt.Sprintf("%s:%d", host, port) return nil }