From 481cf4b9e8698a8f77ba1cc770a1bf6a567ece02 Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Fri, 23 Oct 2020 19:02:17 +0200 Subject: [PATCH] add missing sorting --- core/status.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/status.go b/core/status.go index cbb4bfe..474e8a5 100644 --- a/core/status.go +++ b/core/status.go @@ -7,6 +7,7 @@ import ( "io/ioutil" "net/http" "os" + "sort" "time" "gitlab.127-0-0-1.fr/vx3r/wg-gen-web/model" @@ -172,5 +173,10 @@ func ReadClientStatus() ([]*model.ClientStatus, error) { clientStatus = append(clientStatus, newClientStatus) } + + sort.Slice(clientStatus, func(i, j int) bool { + return clientStatus[i].LastHandshakeRelative < clientStatus[j].LastHandshakeRelative + }) + return clientStatus, nil }