zrok/controller/limits/limitClasses.go

24 lines
385 B
Go
Raw Normal View History

2024-05-23 20:08:14 +02:00
package limits
import (
"github.com/openziti/zrok/controller/store"
"sort"
)
func sortLimitClasses(lcs []*store.LimitClass) {
sort.Slice(lcs, func(i, j int) bool {
return modePoints(lcs[i]) > modePoints(lcs[j])
2024-05-23 20:08:14 +02:00
})
}
func modePoints(lc *store.LimitClass) int {
points := 0
if lc.BackendMode != "" {
points += 1
}
if lc.ShareMode != "" {
points += 1
}
return points
}