0
0
mirror of https://github.com/vx3r/wg-gen-web.git synced 2024-12-18 00:13:23 +00:00

add missing sorting

This commit is contained in:
Christoph Haas 2020-10-23 19:02:17 +02:00
parent c1203ff8c9
commit 481cf4b9e8

View File

@ -7,6 +7,7 @@ import (
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"os" "os"
"sort"
"time" "time"


"gitlab.127-0-0-1.fr/vx3r/wg-gen-web/model" "gitlab.127-0-0-1.fr/vx3r/wg-gen-web/model"
@ -172,5 +173,10 @@ func ReadClientStatus() ([]*model.ClientStatus, error) {


clientStatus = append(clientStatus, newClientStatus) clientStatus = append(clientStatus, newClientStatus)
} }

sort.Slice(clientStatus, func(i, j int) bool {
return clientStatus[i].LastHandshakeRelative < clientStatus[j].LastHandshakeRelative
})

return clientStatus, nil return clientStatus, nil
} }