wireguard-dashboard/main.go
2024-03-07 15:11:29 +08:00

36 lines
678 B
Go

package main
import (
"fmt"
"gitee.ltd/lxh/logger/log"
"net/http"
"wireguard-dashboard/config"
"wireguard-dashboard/initialize"
"wireguard-dashboard/route"
"wireguard-dashboard/script"
)
func init() {
initialize.Init() // 初始化
if err := script.NewScript().Do(); err != nil {
log.Errorf("执行脚本失败: %v", err.Error())
}
}
func main() {
route.IncludeRouters(
route.Captcha,
route.UserApi,
)
handler := route.InitRouter()
httpServe := http.Server{
Addr: fmt.Sprintf(":%d", config.Config.Http.Port),
Handler: handler,
}
if err := httpServe.ListenAndServe(); err != nil {
log.Panicf("启动http服务端失败: %v", err.Error())
}
}