1
0

merge: 合并代码20241018

This commit is contained in:
TsMask
2024-10-18 17:26:59 +08:00
parent 49860c2f28
commit 17f57175c7
289 changed files with 21476 additions and 12863 deletions

View File

@@ -11,6 +11,7 @@ import (
_ "net/http/pprof"
"be.ems/features"
"be.ems/features/dbrest"
"be.ems/features/event"
"be.ems/features/fm"
@@ -212,6 +213,12 @@ func main() {
fmt.Println("dborm.initDbClient err:", err)
os.Exit(4)
}
err = dborm.InitGormConnect(conf.Database.Type, conf.Database.User, conf.Database.Password,
conf.Database.Host, conf.Database.Port, conf.Database.Name, conf.Database.ConnParam, true)
if err != nil {
fmt.Println("dborm.InitGormConnect err:", err)
os.Exit(4)
}
err = fm.InitDbClient(conf.Database.Type, conf.Database.User, conf.Database.Password,
conf.Database.Host, conf.Database.Port, conf.Database.Name, conf.Database.ConnParam)
if err != nil {
@@ -251,7 +258,10 @@ func main() {
// AMF上报的UE事件, 无前缀,暂时特殊处理
app.POST(event.UriUEEventAMF, event.PostUEEventFromAMF)
var listenLocalhost bool = false
// register feature service gin.Engine
features.InitServiceEngine(app)
// var listenLocalhost bool = false
for _, rest := range conf.Rest {
// ipv4 goroutines
if rest.IPv4 != "" {
@@ -262,16 +272,16 @@ func main() {
go HttpListen(listen, app)
}
}
if rest.IPv4 != "0.0.0.0" && !listenLocalhost {
listenLocalhost = true
// 默认启动localhost侦听
listenLocal := "127.0.0.1" + ":" + strconv.Itoa(int(rest.Port))
if strings.ToLower(rest.Scheme) == "https" {
go HttpListenTLS(listenLocal, rest.CaFile, rest.CertFile, rest.KeyFile, rest.ClientAuthType, app)
} else {
go HttpListen(listenLocal, app)
}
}
// if rest.IPv4 != "0.0.0.0" && !listenLocalhost {
// listenLocalhost = true
// // 默认启动localhost侦听
// listenLocal := "127.0.0.1" + ":" + strconv.Itoa(int(rest.Port))
// if strings.ToLower(rest.Scheme) == "https" {
// go HttpListenTLS(listenLocal, rest.CaFile, rest.CertFile, rest.KeyFile, rest.ClientAuthType, app)
// } else {
// go HttpListen(listenLocal, app)
// }
// }
// ipv6 goroutines
if rest.IPv6 != "" {
listenv6 := "[" + rest.IPv6 + "]" + ":" + strconv.Itoa(int(rest.Port))