wireguard-dashboard/http/kernel.go
2024-12-13 15:07:57 +08:00

27 lines
459 B
Go

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()
}