1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-21 09:36:34 -05:00

Fix queryStrategy ignored (#1285)

This commit is contained in:
世界 2021-09-24 13:46:34 +08:00 committed by Shelikhoo
parent 908408dd45
commit 8cc6fbc6f9
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316

View File

@ -175,29 +175,27 @@ func (s *DNS) IsOwnLink(ctx context.Context) bool {
// LookupIP implements dns.Client. // LookupIP implements dns.Client.
func (s *DNS) LookupIP(domain string) ([]net.IP, error) { func (s *DNS) LookupIP(domain string) ([]net.IP, error) {
return s.lookupIPInternal(domain, dns.IPOption{ return s.lookupIPInternal(domain, *s.ipOption)
IPv4Enable: true,
IPv6Enable: true,
FakeEnable: s.ipOption.FakeEnable,
})
} }
// LookupIPv4 implements dns.IPv4Lookup. // LookupIPv4 implements dns.IPv4Lookup.
func (s *DNS) LookupIPv4(domain string) ([]net.IP, error) { func (s *DNS) LookupIPv4(domain string) ([]net.IP, error) {
return s.lookupIPInternal(domain, dns.IPOption{ if !s.ipOption.IPv4Enable {
IPv4Enable: true, return nil, dns.ErrEmptyResponse
IPv6Enable: false, }
FakeEnable: s.ipOption.FakeEnable, o := *s.ipOption
}) o.IPv6Enable = false
return s.lookupIPInternal(domain, o)
} }
// LookupIPv6 implements dns.IPv6Lookup. // LookupIPv6 implements dns.IPv6Lookup.
func (s *DNS) LookupIPv6(domain string) ([]net.IP, error) { func (s *DNS) LookupIPv6(domain string) ([]net.IP, error) {
return s.lookupIPInternal(domain, dns.IPOption{ if !s.ipOption.IPv6Enable {
IPv4Enable: false, return nil, dns.ErrEmptyResponse
IPv6Enable: true, }
FakeEnable: s.ipOption.FakeEnable, o := *s.ipOption
}) o.IPv4Enable = false
return s.lookupIPInternal(domain, o)
} }
func (s *DNS) lookupIPInternal(domain string, option dns.IPOption) ([]net.IP, error) { func (s *DNS) lookupIPInternal(domain string, option dns.IPOption) ([]net.IP, error) {