Fix: use sorted cidr list (#1156) (#773)

Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
This commit is contained in:
yuhan6665 2021-10-22 00:02:07 -04:00 committed by 世界
parent c4fc277758
commit 0f0a424e8c
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -58,7 +58,7 @@ func (m *GeoIPMatcher) Init(cidrs []*CIDR) error {
m.ip6 = make([]ipv6, 0, ip6Count)
m.prefix6 = make([]uint8, 0, ip6Count)
for _, cidr := range cidrs {
for _, cidr := range cidrList {
ip := cidr.Ip
prefix := uint8(cidr.Prefix)
switch len(ip) {