mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-17 17:48:40 +00:00
fix bug
This commit is contained in:
parent
a6e8fe409a
commit
13b70d5543
2 changed files with 7 additions and 1 deletions
|
@ -189,7 +189,10 @@ func (s *DNS) LookupIP(domain string, option dns.IPOption) ([]net.IP, uint32, er
|
||||||
// Static host lookup
|
// Static host lookup
|
||||||
switch addrs, err := s.hosts.Lookup(domain, option); {
|
switch addrs, err := s.hosts.Lookup(domain, option); {
|
||||||
case err != nil:
|
case err != nil:
|
||||||
return nil, 0, err
|
if go_errors.Is(err, dns.ErrEmptyResponse) {
|
||||||
|
return nil, 0, dns.ErrEmptyResponse
|
||||||
|
}
|
||||||
|
return nil, 0, errors.New("returning nil for domain ", domain).Base(err)
|
||||||
case addrs == nil: // Domain not recorded in static host
|
case addrs == nil: // Domain not recorded in static host
|
||||||
break
|
break
|
||||||
case len(addrs) == 0: // Domain recorded, but no valid IP returned (e.g. IPv4 address with only IPv6 enabled)
|
case len(addrs) == 0: // Domain recorded, but no valid IP returned (e.g. IPv4 address with only IPv6 enabled)
|
||||||
|
|
|
@ -86,6 +86,9 @@ func (h *StaticHosts) lookup(domain string, option dns.IPOption, maxDepth int) (
|
||||||
return addrs, nil
|
return addrs, nil
|
||||||
case len(addrs) == 1:
|
case len(addrs) == 1:
|
||||||
if err, ok := addrs[0].(dns.RCodeError); ok {
|
if err, ok := addrs[0].(dns.RCodeError); ok {
|
||||||
|
if uint16(err) == 0 {
|
||||||
|
return nil, dns.ErrEmptyResponse
|
||||||
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if addrs[0].Family().IsDomain() { // Try to unwrap domain
|
if addrs[0].Family().IsDomain() { // Try to unwrap domain
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue