fix: 服务绑定127

This commit is contained in:
TsMask
2024-03-22 20:15:01 +08:00
parent ee10888757
commit 2480cffe1c
3 changed files with 10 additions and 26 deletions

View File

@@ -13,17 +13,9 @@ logger:
# clientAuthType: 0:NoClientCert (default), 1:RequestClientCert, 2:RequireAnyClientCert, # clientAuthType: 0:NoClientCert (default), 1:RequestClientCert, 2:RequireAnyClientCert,
# 3:VerifyClientCertIfGiven, 4:RequireAndVerifyClientCerts # 3:VerifyClientCertIfGiven, 4:RequireAndVerifyClientCerts
rest: rest:
- ipv4: 0.0.0.0 - ipv4: 127.0.0.1
ipv6: ipv6:
port: 33030 port: 33030
- ipv4: 0.0.0.0
ipv6:
port: 33443
schema: https
clientAuthType: 0
caFile: /usr/local/omc/etc/certs/omc-ca.crt
certFile: /usr/local/omc/etc/certs/omc-server.crt
keyFile: /usr/local/omc/etc/certs/omc-server.key
webServer: webServer:
enabled: false enabled: false

View File

@@ -16,14 +16,6 @@ rest:
- ipv4: 0.0.0.0 - ipv4: 0.0.0.0
ipv6: ipv6:
port: 33040 port: 33040
- ipv4: 0.0.0.0
ipv6:
port: 33443
scheme: https
clientAuthType: 0
caFile: ./etc/certs/omc-ca.crt
certFile: ./etc/certs/omc-server.crt
keyFile: ./etc/certs/omc-server.key
webServer: webServer:
enabled: false enabled: false

View File

@@ -204,15 +204,15 @@ func main() {
go HttpListen(listen, app) go HttpListen(listen, app)
} }
} }
if rest.IPv4 != "0.0.0.0" { // if rest.IPv4 != "0.0.0.0" {
// 默认启动localhost侦听 // // 默认启动localhost侦听
listenLocal := "127.0.0.1" + ":" + strconv.Itoa(int(rest.Port)) // listenLocal := "127.0.0.1" + ":" + strconv.Itoa(int(rest.Port))
if strings.ToLower(rest.Scheme) == "https" { // if strings.ToLower(rest.Scheme) == "https" {
go HttpListenTLS(listenLocal, rest.CaFile, rest.CertFile, rest.KeyFile, rest.ClientAuthType, app) // go HttpListenTLS(listenLocal, rest.CaFile, rest.CertFile, rest.KeyFile, rest.ClientAuthType, app)
} else { // } else {
go HttpListen(listenLocal, app) // go HttpListen(listenLocal, app)
} // }
} // }
// ipv6 goroutines // ipv6 goroutines
if rest.IPv6 != "" { if rest.IPv6 != "" {
listenv6 := "[" + rest.IPv6 + "]" + ":" + strconv.Itoa(int(rest.Port)) listenv6 := "[" + rest.IPv6 + "]" + ":" + strconv.Itoa(int(rest.Port))