feat(dnsovergetaddrinfo): collect the CNAME (#876)
* feat(dnsovergetaddrinfo): collect the CNAME This diff modifies how dnsovergetaddrinfo.go works such that the returned DNSResponse includes the CNAME. Closes https://github.com/ooni/probe/issues/2226. While there, recognize that we can remove getaddrinfoLookupHost and always call getaddrinfoLookupANY everywhere. (This simplification is why we did https://github.com/ooni/probe-cli/pull/874.) * fix: extra debugging because of failing CI Everything is OK locally (on macOS). However, maybe things are a bit different on GNU/Linux perhaps? Here's the error: ``` --- FAIL: TestPass (0.11s) resolver_test.go:113: unexpected rcode FAIL coverage: 95.7% of statements FAIL github.com/ooni/probe-cli/v3/internal/cmd/jafar/resolver 0.242s ``` I'm a bit confused because jafar's resolver is _unrelated_. But actually this error never occurred again after a committed the debugging diff.
This commit is contained in:
parent
cc24f28b9d
commit
080abf90d9
6 changed files with 49 additions and 46 deletions
|
|
@ -57,8 +57,8 @@ func TestDNSOverGetaddrinfo(t *testing.T) {
|
|||
t.Run("RoundTrip", func(t *testing.T) {
|
||||
t.Run("with invalid query type", func(t *testing.T) {
|
||||
txp := &dnsOverGetaddrinfoTransport{
|
||||
testableLookupHost: func(ctx context.Context, domain string) ([]string, error) {
|
||||
return []string{"8.8.8.8"}, nil
|
||||
testableLookupANY: func(ctx context.Context, domain string) ([]string, string, error) {
|
||||
return []string{"8.8.8.8"}, "dns.google", nil
|
||||
},
|
||||
}
|
||||
encoder := &DNSEncoderMiekg{}
|
||||
|
|
@ -75,8 +75,8 @@ func TestDNSOverGetaddrinfo(t *testing.T) {
|
|||
|
||||
t.Run("with success", func(t *testing.T) {
|
||||
txp := &dnsOverGetaddrinfoTransport{
|
||||
testableLookupHost: func(ctx context.Context, domain string) ([]string, error) {
|
||||
return []string{"8.8.8.8"}, nil
|
||||
testableLookupANY: func(ctx context.Context, domain string) ([]string, string, error) {
|
||||
return []string{"8.8.8.8"}, "dns.google", nil
|
||||
},
|
||||
}
|
||||
encoder := &DNSEncoderMiekg{}
|
||||
|
|
@ -124,10 +124,10 @@ func TestDNSOverGetaddrinfo(t *testing.T) {
|
|||
done := make(chan interface{})
|
||||
txp := &dnsOverGetaddrinfoTransport{
|
||||
testableTimeout: 1 * time.Microsecond,
|
||||
testableLookupHost: func(ctx context.Context, domain string) ([]string, error) {
|
||||
testableLookupANY: func(ctx context.Context, domain string) ([]string, string, error) {
|
||||
defer wg.Done()
|
||||
<-done
|
||||
return []string{"8.8.8.8"}, nil
|
||||
return []string{"8.8.8.8"}, "dns.google", nil
|
||||
},
|
||||
}
|
||||
encoder := &DNSEncoderMiekg{}
|
||||
|
|
@ -150,10 +150,10 @@ func TestDNSOverGetaddrinfo(t *testing.T) {
|
|||
done := make(chan interface{})
|
||||
txp := &dnsOverGetaddrinfoTransport{
|
||||
testableTimeout: 1 * time.Microsecond,
|
||||
testableLookupHost: func(ctx context.Context, domain string) ([]string, error) {
|
||||
testableLookupANY: func(ctx context.Context, domain string) ([]string, string, error) {
|
||||
defer wg.Done()
|
||||
<-done
|
||||
return nil, errors.New("no such host")
|
||||
return nil, "", errors.New("no such host")
|
||||
},
|
||||
}
|
||||
encoder := &DNSEncoderMiekg{}
|
||||
|
|
@ -172,8 +172,8 @@ func TestDNSOverGetaddrinfo(t *testing.T) {
|
|||
|
||||
t.Run("with NXDOMAIN", func(t *testing.T) {
|
||||
txp := &dnsOverGetaddrinfoTransport{
|
||||
testableLookupHost: func(ctx context.Context, domain string) ([]string, error) {
|
||||
return nil, ErrOODNSNoSuchHost
|
||||
testableLookupANY: func(ctx context.Context, domain string) ([]string, string, error) {
|
||||
return nil, "", ErrOODNSNoSuchHost
|
||||
},
|
||||
}
|
||||
encoder := &DNSEncoderMiekg{}
|
||||
|
|
|
|||
Loading…
Reference in a new issue