fix(ooniprobe): dnscheck,stunreachability run w/ default input (#633)
This diff is part of https://github.com/ooni/probe/issues/1814 and teaches `ooniprobe` to run dnscheck and stunreachability by using the default static input feature of the `InputLoader`. I've manually tested that we can still run `websites` like we did before (including category filtering). I've also manually tested that now we can run `experimental` and get parseable results for dnscheck and stunreachability. With this diff in, we have fixed the original problem highlighted in the https://github.com/ooni/probe/issues/1814 issue. Yet, because of the way in which I solved the problem, there is more work to do. My changes have broken stunreachability for mobile and now it's time I apply fixes to make it work again. This diff was extracted from https://github.com/ooni/probe-cli/pull/539, which at this point only basically contains the remaining fixes to ensure we can run stunreachability on mobile. Co-authored-by: Arturo Filastò <arturo@filasto.net> Co-authored-by: Arturo Filastò <arturo@filasto.net>
This commit is contained in:
parent
2044b78a5a
commit
1896d2172a
4 changed files with 109 additions and 78 deletions
|
|
@ -1,13 +1,42 @@
|
|||
package nettests
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
engine "github.com/ooni/probe-cli/v3/internal/engine"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/model"
|
||||
)
|
||||
|
||||
// STUNReachability nettest implementation.
|
||||
type STUNReachability struct{}
|
||||
|
||||
func (n STUNReachability) lookupURLs(ctl *Controller) ([]string, error) {
|
||||
inputloader := &engine.InputLoader{
|
||||
CheckInConfig: &model.CheckInConfig{
|
||||
// not needed because we have default static input in the engine
|
||||
},
|
||||
ExperimentName: "stunreachability",
|
||||
InputPolicy: engine.InputOrStaticDefault,
|
||||
Session: ctl.Session,
|
||||
SourceFiles: ctl.InputFiles,
|
||||
StaticInputs: ctl.Inputs,
|
||||
}
|
||||
testlist, err := inputloader.Load(context.Background())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ctl.BuildAndSetInputIdxMap(ctl.Probe.DB(), testlist)
|
||||
}
|
||||
|
||||
// Run starts the nettest.
|
||||
func (n STUNReachability) Run(ctl *Controller) error {
|
||||
builder, err := ctl.Session.NewExperimentBuilder("stunreachability")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return ctl.Run(builder, []string{""})
|
||||
urls, err := n.lookupURLs(ctl)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return ctl.Run(builder, urls)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue