+3
-2
@@ -19,6 +19,7 @@ package node
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
@@ -263,7 +264,7 @@ func (c *Config) HTTPEndpoint() string {
|
||||
if c.HTTPHost == "" {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("%s:%d", c.HTTPHost, c.HTTPPort)
|
||||
return net.JoinHostPort(c.HTTPHost, fmt.Sprintf("%d", c.HTTPPort))
|
||||
}
|
||||
|
||||
// DefaultHTTPEndpoint returns the HTTP endpoint used by default.
|
||||
@@ -278,7 +279,7 @@ func (c *Config) WSEndpoint() string {
|
||||
if c.WSHost == "" {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("%s:%d", c.WSHost, c.WSPort)
|
||||
return net.JoinHostPort(c.WSHost, fmt.Sprintf("%d", c.WSPort))
|
||||
}
|
||||
|
||||
// DefaultWSEndpoint returns the websocket endpoint used by default.
|
||||
|
||||
+1
-1
@@ -112,7 +112,7 @@ func (h *httpServer) setListenAddr(host string, port int) error {
|
||||
}
|
||||
|
||||
h.host, h.port = host, port
|
||||
h.endpoint = fmt.Sprintf("%s:%d", host, port)
|
||||
h.endpoint = net.JoinHostPort(host, fmt.Sprintf("%d", port))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user