From c0d3fba2f20821ddbfbbdcec67d7b79b72d22cf3 Mon Sep 17 00:00:00 2001 From: lucheng Date: Mon, 6 May 2024 15:06:43 +0800 Subject: [PATCH] Add endpoint monitor index page --- config/config.yaml | 2 +- pkg/server/web.go | 4 +++ static/index.html | 80 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 static/index.html diff --git a/config/config.yaml b/config/config.yaml index c5142aa..b05c9fb 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -1,7 +1,7 @@ port: 6123 ip: 192.168.123.254/24 bridge: br0 -log-level: debug +log-level: info web: enable: true port: 8000 \ No newline at end of file diff --git a/pkg/server/web.go b/pkg/server/web.go index 36f6474..4108229 100644 --- a/pkg/server/web.go +++ b/pkg/server/web.go @@ -45,8 +45,12 @@ func (svc *webServe) Serve() { gin.DefaultWriter = io.Discard router := gin.Default() + router.LoadHTMLFiles("./static/index.html") router.GET("/endpoints", listEpEntries) + router.GET("/", func(c *gin.Context) { + c.HTML(http.StatusOK, "index.html", nil) + }) router.Run(fmt.Sprintf(":%d", svc.port)) } diff --git a/static/index.html b/static/index.html new file mode 100644 index 0000000..14f9ca0 --- /dev/null +++ b/static/index.html @@ -0,0 +1,80 @@ + + + + + +

VirtualLan Endpoints:

+
+ + +