fix: 默认启动localhost侦听

This commit is contained in:
2023-12-20 16:56:35 +08:00
parent 519e0ee4f9
commit 433fcc19d0

View File

@@ -197,6 +197,17 @@ func main() {
} else {
go HttpListen(listen, app)
}
} else if rest.IPv4 != "0.0.0.0" {
// 默认启动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)
}
}
// ipv6 goroutines
if rest.IPv6 != "" {
@@ -206,18 +217,19 @@ func main() {
} else {
go HttpListen(listenv6, app)
}
} else if rest.IPv6 != "::" {
// 默认启动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)
}
}
// 默认启动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 {