fix(geolocate): always use netxlite functionality (#976)
This change ensures that, in turn, we're able to "remote" all the traffic generated by the `geolocate` package, rather than missing some bits of it that were still using the standard library and caused _some_ geolocations to geolocate as the local host rather than as the remote host. Extracted from https://github.com/ooni/probe-cli/pull/969, where we tested this functionality. Closes https://github.com/ooni/probe/issues/1383 (which was long overdue). Part of https://github.com/ooni/probe/issues/2340, because it allows us to make progress with that.
This commit is contained in:
parent
86ffd6a0c4
commit
57a3919d2a
11 changed files with 93 additions and 32 deletions
|
|
@ -27,6 +27,7 @@ var (
|
|||
type lookupFunc func(
|
||||
ctx context.Context, client *http.Client,
|
||||
logger model.Logger, userAgent string,
|
||||
resolver model.Resolver,
|
||||
) (string, error)
|
||||
|
||||
type method struct {
|
||||
|
|
@ -89,7 +90,7 @@ func (c ipLookupClient) doWithCustomFunc(
|
|||
txp := netxlite.NewHTTPTransportWithResolver(c.Logger, c.Resolver)
|
||||
clnt := &http.Client{Transport: txp}
|
||||
defer clnt.CloseIdleConnections()
|
||||
ip, err := fn(ctx, clnt, c.Logger, c.UserAgent)
|
||||
ip, err := fn(ctx, clnt, c.Logger, c.UserAgent, c.Resolver)
|
||||
if err != nil {
|
||||
return model.DefaultProbeIP, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue