refactor(sessionresolver): replace dnsclientmaker with function (#811)

See https://github.com/ooni/probe/issues/2135
This commit is contained in:
Simone Basso 2022-06-08 22:29:01 +02:00 committed by GitHub
commit bf7ea423d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 62 additions and 166 deletions

View file

@ -59,13 +59,13 @@ type Resolver struct {
// we will construct a default codec.
jsonCodec jsonCodec
// dnsClientMaker is the OPTIONAL dnsclientmaker to
// use. If not set, we will use the default.
dnsClientMaker dnsclientmaker
// mu provides synchronisation of internal fields.
mu sync.Mutex
// newChildResolverFn is the OPTIONAL function to override
// the construction of a new resolver in unit tests
newChildResolverFn func(h3 bool, URL string) (model.Resolver, error)
// once ensures that CloseIdleConnection is
// run just once.
once sync.Once