Documentation ¶
Overview ¶
Package example contains a simple example experiment.
You could use this code to boostrap the implementation of a new experiment that you are working on.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrFailure = errors.New("mocked error")
ErrFailure is the error returned when you set the config.ReturnError field to true.
Functions ¶
func NewExperimentMeasurer ¶
func NewExperimentMeasurer(config Config, testName string) model.ExperimentMeasurer
NewExperimentMeasurer creates a new ExperimentMeasurer.
Types ¶
type Config ¶
type Config struct { Message string `ooni:"Message to emit at test completion"` ReturnError bool `ooni:"Toogle to return a mocked error"` SleepTime int64 `ooni:"Amount of time to sleep for"` }
Config contains the experiment config.
This contains all the settings that user can set to modify the behaviour of this experiment. By tagging these variables with `ooni:"..."`, we allow miniooni's -O flag to find them and set them.
type Measurer ¶
type Measurer struct {
// contains filtered or unexported fields
}
Measurer performs the measurement.
func (Measurer) ExperimentName ¶
ExperimentName implements model.ExperimentMeasurer.ExperimentName.
func (Measurer) ExperimentVersion ¶
ExperimentVersion implements model.ExperimentMeasurer.ExperimentVersion.
func (Measurer) GetSummaryKeys ¶
func (m Measurer) GetSummaryKeys(measurement *model.Measurement) (interface{}, error)
GetSummaryKeys implements model.ExperimentMeasurer.GetSummaryKeys.
func (Measurer) Run ¶
func (m Measurer) Run( ctx context.Context, sess model.ExperimentSession, measurement *model.Measurement, callbacks model.ExperimentCallbacks, ) error
Run implements model.ExperimentMeasurer.Run.
type SummaryKeys ¶
type SummaryKeys struct {
IsAnomaly bool `json:"-"`
}
SummaryKeys contains summary keys for this experiment.
Note that this structure is part of the ABI contract with ooniprobe therefore we should be careful when changing it.