Revert "node: fix listening on IPv6 address (#27628) (#27635)"

This reverts commit ebfb635126.
This commit is contained in:
devopsbo3 2023-11-10 12:27:53 -06:00 committed by GitHub
parent 923d43b402
commit f3f9be7ed2
5 changed files with 6 additions and 10 deletions

View file

@ -27,7 +27,6 @@ import (
"fmt" "fmt"
"io" "io"
"math/big" "math/big"
"net"
"os" "os"
"os/signal" "os/signal"
"path/filepath" "path/filepath"
@ -744,7 +743,7 @@ func signer(c *cli.Context) error {
port := c.Int(rpcPortFlag.Name) port := c.Int(rpcPortFlag.Name)
// start http server // 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) httpServer, addr, err := node.StartHTTPEndpoint(httpEndpoint, rpc.DefaultHTTPTimeouts, handler)
if err != nil { if err != nil {
utils.Fatalf("Could not start RPC api: %v", err) utils.Fatalf("Could not start RPC api: %v", err)

View file

@ -26,7 +26,6 @@ import (
"fmt" "fmt"
"math" "math"
"math/big" "math/big"
"net"
"net/http" "net/http"
"os" "os"
"path/filepath" "path/filepath"
@ -2015,7 +2014,7 @@ func SetupMetrics(ctx *cli.Context) {
} }
if ctx.IsSet(MetricsHTTPFlag.Name) { 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) log.Info("Enabling stand-alone metrics HTTP endpoint", "address", address)
exp.Setup(address) exp.Setup(address)
} else if ctx.IsSet(MetricsPortFlag.Name) { } else if ctx.IsSet(MetricsPortFlag.Name) {

View file

@ -19,7 +19,6 @@ package debug
import ( import (
"fmt" "fmt"
"io" "io"
"net"
"net/http" "net/http"
_ "net/http/pprof" _ "net/http/pprof"
"os" "os"
@ -309,7 +308,7 @@ func Setup(ctx *cli.Context) error {
port := ctx.Int(pprofPortFlag.Name) 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. // This context value ("metrics.addr") represents the utils.MetricsHTTPFlag.Name.
// It cannot be imported because it will cause a cyclical dependency. // It cannot be imported because it will cause a cyclical dependency.
StartPProf(address, !ctx.IsSet("metrics.addr")) StartPProf(address, !ctx.IsSet("metrics.addr"))

View file

@ -19,7 +19,6 @@ package node
import ( import (
"crypto/ecdsa" "crypto/ecdsa"
"fmt" "fmt"
"net"
"os" "os"
"path/filepath" "path/filepath"
"runtime" "runtime"
@ -264,7 +263,7 @@ func (c *Config) HTTPEndpoint() string {
if c.HTTPHost == "" { if c.HTTPHost == "" {
return "" 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. // DefaultHTTPEndpoint returns the HTTP endpoint used by default.
@ -279,7 +278,7 @@ func (c *Config) WSEndpoint() string {
if c.WSHost == "" { if c.WSHost == "" {
return "" 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. // DefaultWSEndpoint returns the websocket endpoint used by default.

View file

@ -112,7 +112,7 @@ func (h *httpServer) setListenAddr(host string, port int) error {
} }
h.host, h.port = host, port 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 return nil
} }