Chore: aggregate mmdb (#474)

This commit is contained in:
Kr328
2020-01-11 21:07:01 +08:00
committed by Dreamacro
parent f688eda2c2
commit 9071351022
4 changed files with 43 additions and 35 deletions

View File

@ -1,6 +1,10 @@
package dns
import "net"
import (
"net"
"github.com/Dreamacro/clash/component/mmdb"
)
type fallbackFilter interface {
Match(net.IP) bool
@ -9,11 +13,7 @@ type fallbackFilter interface {
type geoipFilter struct{}
func (gf *geoipFilter) Match(ip net.IP) bool {
if mmdb == nil {
return false
}
record, _ := mmdb.Country(ip)
record, _ := mmdb.Instance().Country(ip)
return record.Country.IsoCode == "CN" || record.Country.IsoCode == ""
}