feat(netxlite): implements NS queries (#734)
This diff has been extracted from eb0bf38957.
See https://github.com/ooni/probe/issues/2096.
While there, skip the broken tests caused by issue
https://github.com/ooni/probe/issues/2098.
This commit is contained in:
parent
c1b06a2d09
commit
ce052b665e
26 changed files with 859 additions and 75 deletions
|
|
@ -23,8 +23,8 @@ import (
|
|||
// Deprecated: please use ParallelResolver in new code. We cannot
|
||||
// remove this code as long as we use tracing for measuring.
|
||||
//
|
||||
// QUIRK: unlike the ParallelResolver, this resolver retries each
|
||||
// query three times for soft errors.
|
||||
// QUIRK: unlike the ParallelResolver, this resolver's LookupHost retries
|
||||
// each query three times for soft errors.
|
||||
type SerialResolver struct {
|
||||
// Encoder is the MANDATORY encoder to use.
|
||||
Encoder model.DNSEncoder
|
||||
|
|
@ -142,3 +142,18 @@ func (r *SerialResolver) lookupHostWithoutRetry(
|
|||
}
|
||||
return r.Decoder.DecodeLookupHost(qtype, replydata, queryID)
|
||||
}
|
||||
|
||||
// LookupNS implements Resolver.LookupNS.
|
||||
func (r *SerialResolver) LookupNS(
|
||||
ctx context.Context, hostname string) ([]*net.NS, error) {
|
||||
querydata, queryID, err := r.Encoder.Encode(
|
||||
hostname, dns.TypeNS, r.Txp.RequiresPadding())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
replydata, err := r.Txp.RoundTrip(ctx, querydata)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return r.Decoder.DecodeNS(replydata, queryID)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue