example

package
v0.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2020 License: BSD-3-Clause Imports: 4 Imported by: 0

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

This section is empty.

Functions

func NewExperimentMeasurer added in v0.8.0

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 added in v0.17.0

type Measurer struct {
	// contains filtered or unexported fields
}

Measurer performs the measurement.

func (Measurer) ExperimentName added in v0.17.0

func (m Measurer) ExperimentName() string

ExperimentName implements model.ExperimentMeasurer.ExperimentName.

func (Measurer) ExperimentVersion added in v0.17.0

func (m Measurer) ExperimentVersion() string

ExperimentVersion implements model.ExperimentMeasurer.ExperimentVersion.

func (Measurer) Run added in v0.17.0

func (m Measurer) Run(
	ctx context.Context, sess model.ExperimentSession,
	measurement *model.Measurement, callbacks model.ExperimentCallbacks,
) error

Run implements model.ExperimentMeasurer.Run.

type TestKeys

type TestKeys struct {
	Success bool `json:"success"`
}

TestKeys contains the experiment's result.

This is what will end up into the Measurement.TestKeys field when you run this experiment.

In other words, the variables in this struct will be the specific results of this experiment.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL