add type len

This commit is contained in:
zu1k
2020-08-21 09:53:08 +08:00
parent 6262f510e9
commit 9f6ae0cb9b
5 changed files with 28 additions and 1 deletions

View File

@@ -11,6 +11,16 @@ func (ps ProxyList) Len() int {
return len(ps)
}
func (ps ProxyList) TypeLen(t string) int {
l := 0
for _, p := range ps {
if p.TypeName() == t {
l++
}
}
return l
}
func (ps ProxyList) Less(i, j int) bool {
return ps[i].BaseInfo().Name < ps[j].BaseInfo().Name
}