fix(util): skip localhost side-listener for loopback-alias binds

Binding a non-default loopback address already confines the server to
local clients; an extra localhost listener only risks grabbing ports a
colocated frontend expects to own.
This commit is contained in:
user.email committed 2026-10-24 22:45:19 -07:00
1 parent d8b725d607
commit 2bb43f4772
1 file changed
+1 -1
+1 -1
View File
@@ -165,7 +165,7 @@ func NewIpAndLocalListeners(host string, port int, timeout time.Duration) (ipLis
Timeout: timeout,
}
if host != "localhost" && host != "" && host != "0.0.0.0" && host != "127.0.0.1" && host != "[::]" && host != "[::1]" {
if host != "localhost" && host != "" && host != "0.0.0.0" && host != "127.0.0.1" && host != "[::]" && host != "[::1]" && !isLoopbackHost(host) {
listener, err = net.Listen("tcp", JoinHostPort("localhost", port))
if err != nil {
glog.V(0).Infof("skip starting on %s:%d: %v", host, port, err)