1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-02-08 09:15:23 -05:00
This commit is contained in:
Darien Raymond
2018-11-01 10:39:03 +01:00
parent c73e899f54
commit 15cd999ed3
4 changed files with 22 additions and 4 deletions

View File

@@ -6,12 +6,15 @@ import (
"v2ray.com/core/common/net"
)
// CIDRList is an alias of []*CIDR to provide sort.Interface.
type CIDRList []*CIDR
// Len implements sort.Interface.
func (l *CIDRList) Len() int {
return len(*l)
}
// Less implements sort.Interface.
func (l *CIDRList) Less(i int, j int) bool {
ci := (*l)[i]
cj := (*l)[j]
@@ -37,6 +40,7 @@ func (l *CIDRList) Less(i int, j int) bool {
return ci.Prefix < cj.Prefix
}
// Swap implements sort.Interface.
func (l *CIDRList) Swap(i int, j int) {
(*l)[i], (*l)[j] = (*l)[j], (*l)[i]
}