mirror of
https://github.com/vx3r/wg-gen-web.git
synced 2025-09-11 12:24:27 +00:00
update readme, some improvements in error handling
This commit is contained in:
@ -2,6 +2,7 @@ package status
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
log "github.com/sirupsen/logrus"
|
||||
@ -12,11 +13,16 @@ import (
|
||||
func ApplyRoutes(r *gin.RouterGroup) {
|
||||
g := r.Group("/status")
|
||||
{
|
||||
g.GET("/enabled", readEnabled)
|
||||
g.GET("/interface", readInterfaceStatus)
|
||||
g.GET("/clients", readClientStatus)
|
||||
}
|
||||
}
|
||||
|
||||
func readEnabled(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, os.Getenv("WG_STATS_API") != "")
|
||||
}
|
||||
|
||||
func readInterfaceStatus(c *gin.Context) {
|
||||
status, err := core.ReadInterfaceStatus()
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user