Skip to content

Commit

Permalink
Fix queryStrategy ignored (#1285)
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai authored and xiaokangwang committed Sep 27, 2021
1 parent 908408d commit 8cc6fbc
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions app/dns/dns.go
Expand Up @@ -175,29 +175,27 @@ func (s *DNS) IsOwnLink(ctx context.Context) bool {

// LookupIP implements dns.Client.
func (s *DNS) LookupIP(domain string) ([]net.IP, error) {
return s.lookupIPInternal(domain, dns.IPOption{
IPv4Enable: true,
IPv6Enable: true,
FakeEnable: s.ipOption.FakeEnable,
})
return s.lookupIPInternal(domain, *s.ipOption)
}

// LookupIPv4 implements dns.IPv4Lookup.
func (s *DNS) LookupIPv4(domain string) ([]net.IP, error) {
return s.lookupIPInternal(domain, dns.IPOption{
IPv4Enable: true,
IPv6Enable: false,
FakeEnable: s.ipOption.FakeEnable,
})
if !s.ipOption.IPv4Enable {
return nil, dns.ErrEmptyResponse
}
o := *s.ipOption
o.IPv6Enable = false
return s.lookupIPInternal(domain, o)
}

// LookupIPv6 implements dns.IPv6Lookup.
func (s *DNS) LookupIPv6(domain string) ([]net.IP, error) {
return s.lookupIPInternal(domain, dns.IPOption{
IPv4Enable: false,
IPv6Enable: true,
FakeEnable: s.ipOption.FakeEnable,
})
if !s.ipOption.IPv6Enable {
return nil, dns.ErrEmptyResponse
}
o := *s.ipOption
o.IPv4Enable = false
return s.lookupIPInternal(domain, o)
}

func (s *DNS) lookupIPInternal(domain string, option dns.IPOption) ([]net.IP, error) {
Expand Down

0 comments on commit 8cc6fbc

Please sign in to comment.