mirror of
https://github.com/openziti/zrok.git
synced 2025-02-27 23:51:38 +01:00
24 lines
385 B
Go
24 lines
385 B
Go
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])
|
|
})
|
|
}
|
|
|
|
func modePoints(lc *store.LimitClass) int {
|
|
points := 0
|
|
if lc.BackendMode != "" {
|
|
points += 1
|
|
}
|
|
if lc.ShareMode != "" {
|
|
points += 1
|
|
}
|
|
return points
|
|
}
|