feat(cli/run): read inputs from file/cmdline (#180)
This diff introduces the possibility of specifying --input-file file multiple times to force ooniprobe to read inputs from file. Like we do for miniooni, the file shall contain a single entry per line and this entry should be a URL for websites. Likewise, one can specify --input URL multiple times. This implementation is a very simple, initial implementation and there is a bunch of changes I'd like to add on top of it. And also perhaps a bunch of cleanups. I've chosen to expose these flag _only_ for websites for now. Part of https://github.com/ooni/probe/issues/1283.
This commit is contained in:
parent
a324e94973
commit
cfd3b8f9b2
3 changed files with 59 additions and 19 deletions
|
|
@ -44,6 +44,15 @@ type Controller struct {
|
|||
msmts map[int64]*database.Measurement
|
||||
inputIdxMap map[int64]int64 // Used to map mk idx to database id
|
||||
|
||||
// InputFiles optionally contains the names of the input
|
||||
// files to read inputs from (only for nettests that take
|
||||
// inputs, of course)
|
||||
InputFiles []string
|
||||
|
||||
// Inputs contains inputs to be tested. These are specified
|
||||
// using the command line using the --input flag.
|
||||
Inputs []string
|
||||
|
||||
// numInputs is the total number of inputs
|
||||
numInputs int
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ func lookupURLs(ctl *Controller, limit int64, categories []string) ([]string, ma
|
|||
inputloader := engine.NewInputLoader(engine.InputLoaderConfig{
|
||||
InputPolicy: engine.InputRequired,
|
||||
Session: ctl.Session,
|
||||
SourceFiles: ctl.InputFiles,
|
||||
StaticInputs: ctl.Inputs,
|
||||
URLCategories: categories,
|
||||
URLLimit: limit,
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue