fix: dns empty response

This commit is contained in:
Zeyu Chen 2023-04-26 22:35:12 +08:00 committed by yuhan6665
parent ae518cce52
commit bfd5da2f00
4 changed files with 22 additions and 3 deletions

View file

@ -215,7 +215,7 @@ func (s *DNS) LookupIP(domain string, option dns.IPOption) ([]net.IP, error) {
newError("failed to lookup ip for domain ", domain, " at server ", client.Name()).Base(err).WriteToLog()
errs = append(errs, err)
}
if err != context.Canceled && err != context.DeadlineExceeded && err != errExpectedIPNonMatch {
if err != context.Canceled && err != context.DeadlineExceeded && err != errExpectedIPNonMatch && err != dns.ErrEmptyResponse {
return nil, err
}
}

View file

@ -13,6 +13,7 @@ import (
_ "github.com/xtls/xray-core/app/proxyman/outbound"
"github.com/xtls/xray-core/app/router"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/serial"
"github.com/xtls/xray-core/core"
@ -260,7 +261,7 @@ func TestUDPServer(t *testing.T) {
IPv6Enable: true,
FakeEnable: false,
})
if err != feature_dns.ErrEmptyResponse {
if !errors.AllEqual(feature_dns.ErrEmptyResponse, errors.Cause(err)) {
t.Fatal("error: ", err)
}
if len(ips) != 0 {