1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-28 18:25:23 +00:00

fixed a panic issue caused by not checking type of input address in fake dns

This commit is contained in:
Shelikhoo 2021-04-18 23:45:51 +01:00
parent 4737a1fd5d
commit 8ba4ac15ac
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316

View File

@ -24,6 +24,9 @@ type Holder struct {
} }
func (fkdns *Holder) IsIPInIPPool(ip net.Address) bool { func (fkdns *Holder) IsIPInIPPool(ip net.Address) bool {
if ip.Family().IsDomain() {
return false
}
return fkdns.ipRange.Contains(ip.IP()) return fkdns.ipRange.Contains(ip.IP())
} }
@ -139,6 +142,9 @@ type HolderMulti struct {
} }
func (h *HolderMulti) IsIPInIPPool(ip net.Address) bool { func (h *HolderMulti) IsIPInIPPool(ip net.Address) bool {
if ip.Family().IsDomain() {
return false
}
for _, v := range h.holders { for _, v := range h.holders {
if v.IsIPInIPPool(ip) { if v.IsIPInIPPool(ip) {
return true return true