refactor(netxlite): introduce the getaddrinfo transport (#775)
This diff modifies the system resolver to use a getaddrinf transport. Obviously the transport is a fake, but its existence will allow us to observe DNS events more naturally. A lookup using the system resolver would be a ANY lookup that will contain all the resolved IP addresses into the same response. This change was also part of websteps-illustrated, albeit the way in which I did it there was less clean than what we have here. Ref issue: https://github.com/ooni/probe/issues/2096
This commit is contained in:
parent
7e0b47311d
commit
923d81cdee
14 changed files with 432 additions and 163 deletions
|
|
@ -78,7 +78,7 @@ var defaultCertPool *x509.CertPool = netxlite.NewDefaultCertPool()
|
|||
// NewResolver creates a new resolver from the specified config
|
||||
func NewResolver(config Config) model.Resolver {
|
||||
if config.BaseResolver == nil {
|
||||
config.BaseResolver = &netxlite.ResolverSystem{}
|
||||
config.BaseResolver = netxlite.NewResolverSystem()
|
||||
}
|
||||
var r model.Resolver = config.BaseResolver
|
||||
r = &netxlite.AddressResolver{
|
||||
|
|
@ -260,7 +260,7 @@ func NewDNSClientWithOverrides(config Config, URL, hostOverride, SNIOverride,
|
|||
}
|
||||
switch resolverURL.Scheme {
|
||||
case "system":
|
||||
return &netxlite.ResolverSystem{}, nil
|
||||
return netxlite.NewResolverSystem(), nil
|
||||
case "https":
|
||||
config.TLSConfig.NextProtos = []string{"h2", "http/1.1"}
|
||||
httpClient := &http.Client{Transport: NewHTTPTransport(config)}
|
||||
|
|
|
|||
Loading…
Reference in a new issue