fix: default start localhost listen

This commit is contained in:
2023-12-20 10:45:44 +08:00
parent 472a5932e8
commit de7b8c4bf1

View File

@@ -197,7 +197,6 @@ func main() {
} else { } else {
go HttpListen(listen, app) go HttpListen(listen, app)
} }
} }
// ipv6 goroutines // ipv6 goroutines
if rest.IPv6 != "" { if rest.IPv6 != "" {
@@ -208,6 +207,17 @@ func main() {
go HttpListen(listenv6, app) 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 { if conf.WebServer.Enabled {