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

56 lines
1013 B
Go

package main
import (
"gitee.ltd/lxh/logger/log"
"github.com/urfave/cli/v2"
"math/rand"
"os"
"sort"
"time"
tui "wireguard-ui/cli"
"wireguard-ui/http"
"wireguard-ui/initialize"
"wireguard-ui/script"
)
func init() {
initialize.Init()
if err := script.New().Do(); err != nil {
log.Errorf("执行脚本失败: %v", err.Error())
}
}
func main() {
rand.New(rand.NewSource(time.Now().Local().UnixNano()))
app := &cli.App{
Name: "api-proxy",
Usage: "api proxy application",
}
app.Commands = []*cli.Command{
{
Name: "http:serve",
Aliases: []string{"app:serve"},
Usage: "",
Action: func(ctx *cli.Context) error {
return http.Kernel()
},
},
{
Name: "cmd:serve",
Aliases: []string{"command:serve"},
Usage: "use command exec",
Action: func(ctx *cli.Context) error {
return tui.Kernel()
},
},
}
sort.Sort(cli.CommandsByName(app.Commands))
if err := app.Run(os.Args); err != nil {
log.Fatalf("服务启动失败: %v", err.Error())
}
}