feat(netxlite): implement parallel resolver (#724)

This diff imports the parallel resolver from websteps winter 2022
edition, which was originally implemented here:

55231d73cd

See https://github.com/ooni/probe/issues/2096
This commit is contained in:
Simone Basso 2022-05-13 17:36:58 +02:00 committed by GitHub
commit ec0561ea8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 408 additions and 2 deletions

View file

@ -1,5 +1,9 @@
package netxlite
//
// Serial resolver implementation
//
import (
"context"
"errors"
@ -10,11 +14,13 @@ import (
"github.com/ooni/probe-cli/v3/internal/model"
)
// SerialResolver uses a transport and sends performs a LookupHost
// SerialResolver uses a transport and performs a LookupHost
// operation in a serial fashion (query for A first, wait for response,
// then query for AAAA, and wait for response), hence its name.
//
// You should probably use NewSerialResolver to create a new instance.
//
// Deprecated: please use ParallelResolver in new code.
type SerialResolver struct {
// Encoder is the MANDATORY encoder to use.
Encoder model.DNSEncoder
@ -25,7 +31,7 @@ type SerialResolver struct {
// NumTimeouts is MANDATORY and counts the number of timeouts.
NumTimeouts *atomicx.Int64
// Txp is the underlying DNS transport.
// Txp is the MANDATORY underlying DNS transport.
Txp model.DNSTransport
}