Fix: resolve ip crash
This commit is contained in:
parent
f93d6aa294
commit
2b93c9d4c9
1 changed files with 8 additions and 6 deletions
|
@ -131,12 +131,14 @@ func (r *Resolver) resolveIP(m *D.Msg) (msg *D.Msg, err error) {
|
||||||
return nil, errors.New("GeoIP can't use")
|
return nil, errors.New("GeoIP can't use")
|
||||||
}
|
}
|
||||||
|
|
||||||
ips, _ := r.msgToIP(res.Msg)
|
ips, err := r.msgToIP(res.Msg)
|
||||||
if record, _ := mmdb.Country(ips[0]); record.Country.IsoCode == "CN" || record.Country.IsoCode == "" {
|
if err == nil {
|
||||||
// release channel
|
if record, _ := mmdb.Country(ips[0]); record.Country.IsoCode == "CN" || record.Country.IsoCode == "" {
|
||||||
go func() { <-fallbackMsg }()
|
// release channel
|
||||||
msg = res.Msg
|
go func() { <-fallbackMsg }()
|
||||||
return
|
msg = res.Msg
|
||||||
|
return msg, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue