管理端全部功能跑通

This commit is contained in:
robin
2026-02-27 10:35:22 +08:00
parent 4d275c921d
commit 150799f41d
263 changed files with 22664 additions and 4053 deletions

View File

@@ -0,0 +1,43 @@
package main
import (
"fmt"
"os"
"github.com/TeaOSLab/EdgeHttpDNS/internal/apps"
"github.com/TeaOSLab/EdgeHttpDNS/internal/configs"
teaconst "github.com/TeaOSLab/EdgeHttpDNS/internal/const"
"github.com/TeaOSLab/EdgeHttpDNS/internal/nodes"
)
func main() {
app := apps.NewAppCmd().
Version(teaconst.Version).
Product(teaconst.ProductName).
Usage(teaconst.ProcessName + " [-v|start|stop|restart|status|service|daemon]")
app.On("start:before", func() {
_, err := configs.LoadAPIConfig()
if err != nil {
fmt.Println("[ERROR]start failed: load config from '" + configs.ConfigFileName + "' failed: " + err.Error())
os.Exit(1)
}
})
app.On("daemon", func() {
nodes.NewHTTPDNSNode().Daemon()
})
app.On("service", func() {
err := nodes.NewHTTPDNSNode().InstallSystemService()
if err != nil {
fmt.Println("[ERROR]install failed: " + err.Error())
return
}
fmt.Println("done")
})
app.Run(func() {
nodes.NewHTTPDNSNode().Run()
})
}