refactor(engine): allow scripts to register experiments (#860)
See https://github.com/ooni/probe/issues/2216
This commit is contained in:
parent
69602abe8a
commit
6a0ae5c70b
53 changed files with 1438 additions and 1200 deletions
28
internal/registry/example.go
Normal file
28
internal/registry/example.go
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package registry
|
||||
|
||||
//
|
||||
// Registers the `example' experiment.
|
||||
//
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/experiment/example"
|
||||
"github.com/ooni/probe-cli/v3/internal/model"
|
||||
)
|
||||
|
||||
func init() {
|
||||
allexperiments["example"] = &Factory{
|
||||
build: func(config interface{}) model.ExperimentMeasurer {
|
||||
return example.NewExperimentMeasurer(
|
||||
*config.(*example.Config), "example",
|
||||
)
|
||||
},
|
||||
config: &example.Config{
|
||||
Message: "Good day from the example experiment!",
|
||||
SleepTime: int64(time.Second),
|
||||
},
|
||||
interruptible: true,
|
||||
inputPolicy: model.InputNone,
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue