cleanup: move caching resolvers from netx to netxlite (#799)

Now that we have properly refactored the caching resolvers we can
move them into netxlite as optional resolvers created using the
proper abstract factories we just added.

This diff reduces the complexity and the code size of netx.

See https://github.com/ooni/probe/issues/2121.
This commit is contained in:
Simone Basso 2022-06-05 21:58:34 +02:00 committed by GitHub
commit 5d54aa9c5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 36 deletions

View file

@ -67,8 +67,8 @@ func NewResolver(config Config) model.Resolver {
model.ValidLoggerOrDefault(config.Logger),
config.BaseResolver,
)
r = MaybeWrapWithCachingResolver(config.CacheResolutions, r)
r = MaybeWrapWithStaticDNSCache(config.DNSCache, r)
r = netxlite.MaybeWrapWithCachingResolver(config.CacheResolutions, r)
r = netxlite.MaybeWrapWithStaticDNSCache(config.DNSCache, r)
r = netxlite.MaybeWrapWithBogonResolver(config.BogonIsError, r)
return config.Saver.WrapResolver(r) // WAI when config.Saver==nil
}