Improve: simple dns prefetch

This commit is contained in:
Dreamacro
2018-06-11 18:36:39 +08:00
parent 4f192ef575
commit 4f769debe7
8 changed files with 30 additions and 21 deletions

View File

@ -16,15 +16,11 @@ func (i *IPCIDR) RuleType() C.RuleType {
}
func (i *IPCIDR) IsMatch(addr *C.Addr) bool {
if addr.AddrType == C.AtypDomainName {
return false
}
ip := net.ParseIP(addr.Host)
if ip == nil {
if addr.IP == nil {
return false
}
return i.ipnet.Contains(ip)
return i.ipnet.Contains(*addr.IP)
}
func (g *IPCIDR) Adapter() string {