Client page adjustment

This commit is contained in:
Khanh Ngo 2020-06-01 17:59:57 +07:00
parent 9169e75e88
commit e3fac242bb
No known key found for this signature in database
GPG key ID: D5FAA6A16150E49E
4 changed files with 164 additions and 55 deletions

View file

@ -92,6 +92,21 @@ func WireGuardClients() echo.HandlerFunc {
}
}
// GetClients handler return a list of Wireguard client data
func GetClients() echo.HandlerFunc {
return func(c echo.Context) error {
// access validation
validSession(c)
clientDataList, err := util.GetClients(true)
if err != nil {
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, fmt.Sprintf("Cannot get client list: %v", err)})
}
return c.JSON(http.StatusOK, clientDataList)
}
}
// NewClient handler
func NewClient() echo.HandlerFunc {
return func(c echo.Context) error {