wireguard-dashboard/main.go

37 lines
680 B
Go
Raw Normal View History

2024-03-05 16:59:37 +08:00
package main
import (
"fmt"
"go.uber.org/zap"
2024-03-05 16:59:37 +08:00
"log"
"net/http"
"wireguard-dashboard/config"
"wireguard-dashboard/initialize"
"wireguard-dashboard/route"
"wireguard-dashboard/script"
2024-03-05 16:59:37 +08:00
)
func init() {
initialize.Init() // 初始化
if err := script.NewScript().Do(); err != nil {
zap.S().Errorf("执行脚本错误: %v", err.Error())
}
2024-03-05 16:59:37 +08:00
}
func main() {
2024-03-06 17:13:29 +08:00
route.IncludeRouters(
2024-03-06 17:31:39 +08:00
route.Captcha,
2024-03-06 17:13:29 +08:00
route.UserApi,
)
2024-03-05 16:59:37 +08:00
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())
}
}