refactor(netx): merge archival, trace, and the savers (#772)
This diff creates a new package under netx called tracex that contains everything we need to perform measurements using events tracing and postprocessing (which is the technique with which we implement most network experiments). The general idea here is to (1) create a unique package out of all of these packages; (2) clean up the code a bit (improve tests, docs, apply more recent code patterns); (3) move the resulting code as a toplevel package inside of internal. Once this is done, netx can be further refactored to avoid subpackages and we can search for more code to salvage/refactor. See https://github.com/ooni/probe/issues/2121
This commit is contained in:
@@ -16,8 +16,7 @@ import (
|
||||
"github.com/ooni/probe-cli/v3/internal/atomicx"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/experiment/urlgetter"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/netx"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/netx/archival"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/netx/trace"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/netx/tracex"
|
||||
"github.com/ooni/probe-cli/v3/internal/model"
|
||||
"github.com/ooni/probe-cli/v3/internal/runtimex"
|
||||
)
|
||||
@@ -168,15 +167,15 @@ func (m *Measurer) Run(
|
||||
// with IP addresses successfully, we just get back the IPs when we are
|
||||
// passing as input an IP address rather than a domain name.
|
||||
begin := measurement.MeasurementStartTimeSaved
|
||||
evsaver := new(trace.Saver)
|
||||
evsaver := new(tracex.Saver)
|
||||
resolver := netx.NewResolver(netx.Config{
|
||||
BogonIsError: true,
|
||||
Logger: sess.Logger(),
|
||||
ResolveSaver: evsaver,
|
||||
})
|
||||
addrs, err := m.lookupHost(ctx, URL.Hostname(), resolver)
|
||||
queries := archival.NewDNSQueriesList(begin, evsaver.Read())
|
||||
tk.BootstrapFailure = archival.NewFailure(err)
|
||||
queries := tracex.NewDNSQueriesList(begin, evsaver.Read())
|
||||
tk.BootstrapFailure = tracex.NewFailure(err)
|
||||
if len(queries) > 0 {
|
||||
// We get no queries in case we are resolving an IP address, since
|
||||
// the address resolver doesn't generate events
|
||||
|
||||
Reference in New Issue
Block a user