:art:变更启动方式

This commit is contained in:
coward
2024-12-13 15:07:57 +08:00
parent 628c09fdde
commit eba3e841c3
5 changed files with 72 additions and 24 deletions

26
http/kernel.go Normal file
View File

@@ -0,0 +1,26 @@
package http
import (
"fmt"
"gitee.ltd/lxh/logger/log"
"net/http"
"wireguard-ui/config"
"wireguard-ui/http/router"
)
// Kernel
// @description: http启动
// @return error
func Kernel() error {
router.Rooters()
handler := router.InitRouter()
addr := fmt.Sprintf(":%d", config.Config.Http.Port)
httpServer := http.Server{
Addr: addr,
Handler: handler,
}
log.Infof("[HTTP] server runing in %s", addr)
return httpServer.ListenAndServe()
}