From de7b8c4bf1855abc69335035e4e9c52652142a52 Mon Sep 17 00:00:00 2001 From: simonzhangsz Date: Wed, 20 Dec 2023 10:45:44 +0800 Subject: [PATCH] fix: default start localhost listen --- restagent/restagent.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/restagent/restagent.go b/restagent/restagent.go index 540f7825..8e935593 100644 --- a/restagent/restagent.go +++ b/restagent/restagent.go @@ -197,7 +197,6 @@ func main() { } else { go HttpListen(listen, app) } - } // ipv6 goroutines if rest.IPv6 != "" { @@ -208,6 +207,17 @@ func main() { go HttpListen(listenv6, app) } } + + // 默认启动localhost侦听 + listenLocal := "127.0.0.1" + ":" + strconv.Itoa(int(rest.Port)) + listenv6Local := "[" + "::1" + "]" + ":" + strconv.Itoa(int(rest.Port)) + if strings.ToLower(rest.Scheme) == "https" { + go HttpListenTLS(listenLocal, rest.CaFile, rest.CertFile, rest.KeyFile, app) + go HttpListenTLS(listenv6Local, rest.CaFile, rest.CertFile, rest.KeyFile, app) + } else { + go HttpListen(listenLocal, app) + go HttpListen(listenv6Local, app) + } } if conf.WebServer.Enabled {