fix(geolocate): do resolver lookup with proxy (#306)

The use cases for using a proxy become more clear over time. When I
originally wrote the proxy code the idea was to use the proxy to proxy
both the communication with the backend and measurements.

It become increasingly clear that we _only_ want to proxy the
communication with the backends. Therefore, there's no point in
skipping the resolver lookup step when we use a proxy.

Part of https://github.com/ooni/probe/issues/985
This commit is contained in:
Simone Basso 2021-04-07 18:48:02 +02:00 committed by GitHub
commit 54e590b776
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 90 deletions

View file

@ -644,13 +644,10 @@ func (s *Session) MaybeLookupBackendsContext(ctx context.Context) error {
// LookupLocationContext performs a location lookup. If you want memoisation
// of the results, you should use MaybeLookupLocationContext.
func (s *Session) LookupLocationContext(ctx context.Context) (*geolocate.Results, error) {
// Implementation note: we don't perform the lookup of the resolver IP
// when we are using a proxy because that might leak information.
task := geolocate.Must(geolocate.NewTask(geolocate.Config{
EnableResolverLookup: s.proxyURL == nil,
Logger: s.Logger(),
Resolver: s.resolver,
UserAgent: s.UserAgent(),
Logger: s.Logger(),
Resolver: s.resolver,
UserAgent: s.UserAgent(),
}))
return task.Run(ctx)
}