Skip to content

Commit

Permalink
Revert "node: fix listening on IPv6 address (ethereum#27628) (ethereu…
Browse files Browse the repository at this point in the history
…m#27635)"

This reverts commit ebfb635.
  • Loading branch information
devopsbo3 committed Nov 10, 2023
1 parent de4aa37 commit a0412a6
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 10 deletions.
3 changes: 1 addition & 2 deletions cmd/clef/main.go
Expand Up @@ -27,7 +27,6 @@ import (
"fmt"
"io"
"math/big"
"net"
"os"
"os/signal"
"path/filepath"
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions cmd/utils/flags.go
Expand Up @@ -26,7 +26,6 @@ import (
"fmt"
"math"
"math/big"
"net"
"net/http"
"os"
"path/filepath"
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions internal/debug/flags.go
Expand Up @@ -19,7 +19,6 @@ package debug
import (
"fmt"
"io"
"net"
"net/http"
_ "net/http/pprof"
"os"
Expand Down Expand Up @@ -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"))
Expand Down
5 changes: 2 additions & 3 deletions node/config.go
Expand Up @@ -19,7 +19,6 @@ package node
import (
"crypto/ecdsa"
"fmt"
"net"
"os"
"path/filepath"
"runtime"
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion node/rpcstack.go
Expand Up @@ -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
}

Expand Down

0 comments on commit a0412a6

Please sign in to comment.