29 lines
487 B
Go
29 lines
487 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"log"
|
||
|
"net/http"
|
||
|
"wireguard-dashboard/config"
|
||
|
"wireguard-dashboard/initialize"
|
||
|
"wireguard-dashboard/route"
|
||
|
)
|
||
|
|
||
|
func init() {
|
||
|
initialize.Init() // 初始化
|
||
|
}
|
||
|
|
||
|
func main() {
|
||
|
route.IncludeRouters()
|
||
|
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())
|
||
|
}
|
||
|
}
|