Documentation
¶
Overview ¶
Package experiment contains network experiment.
Index ¶
- type Experiment
- func (e *Experiment) CloseReport(ctx context.Context) (err error)
- func (e *Experiment) Measure(ctx context.Context, input string) (measurement model.Measurement, err error)
- func (e *Experiment) OpenReport(ctx context.Context) (err error)
- func (e *Experiment) ReportID() string
- func (e *Experiment) SaveMeasurement(measurement model.Measurement, filePath string) error
- func (e *Experiment) SaveMeasurementEx(measurement model.Measurement, filePath string, ...) error
- func (e *Experiment) SubmitMeasurement(ctx context.Context, measurement *model.Measurement) error
- type MeasureFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Experiment ¶
type Experiment struct {
// DoMeasure fills a measurement.
DoMeasure MeasureFunc
// Callbacks handles experiment events.
Callbacks handler.Callbacks
// Report is the report used by this experiment.
Report *collector.Report
// Session is the session to which this experiment belongs.
Session *session.Session
// TestName is the experiment name.
TestName string
// TestStartTime is the UTC time when the test started.
TestStartTime string
// TestVersion is the experiment version.
TestVersion string
}
Experiment is a network experiment.
func New ¶
func New( sess *session.Session, testName, testVersion string, measure MeasureFunc, ) *Experiment
New creates a new experiment. You should not call this function directly rather you should do <package>.NewExperiment where <package> is a subpackage inside of the experiment package, e.g., `.../experiment/ndt7`.
func (*Experiment) CloseReport ¶
func (e *Experiment) CloseReport(ctx context.Context) (err error)
CloseReport closes the open report. This function is idempotent.
func (*Experiment) Measure ¶
func (e *Experiment) Measure( ctx context.Context, input string, ) (measurement model.Measurement, err error)
Measure performs a measurement with the specified input. Note that as part of running the measurement, we'll also apply privacy settings. So, the measurement you get back is already scrubbed (if needed).
func (*Experiment) OpenReport ¶
func (e *Experiment) OpenReport(ctx context.Context) (err error)
OpenReport opens a new report for the experiment. This function is idempotent.
func (*Experiment) ReportID ¶
func (e *Experiment) ReportID() string
ReportID returns the report ID or an empty string, if not open.
func (*Experiment) SaveMeasurement ¶
func (e *Experiment) SaveMeasurement( measurement model.Measurement, filePath string, ) error
SaveMeasurement saves a measurement on the specified file.
func (*Experiment) SaveMeasurementEx ¶
func (e *Experiment) SaveMeasurementEx( measurement model.Measurement, filePath string, marshal func(v interface{}) ([]byte, error), openFile func(name string, flag int, perm os.FileMode) (*os.File, error), write func(fp *os.File, b []byte) (n int, err error), ) error
SaveMeasurementEx is like SaveMeasurement but allows you to mock any operation that SaveMeasurement would perform. You generally want to call SaveMeasurement rather than this function.
func (*Experiment) SubmitMeasurement ¶
func (e *Experiment) SubmitMeasurement( ctx context.Context, measurement *model.Measurement, ) error
SubmitMeasurement submits a measurement to the selected collector. It is safe to call this function from different goroutines concurrently as long as the measurement is not shared by the goroutines.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package dash contains the dash network experiment.
|
Package dash contains the dash network experiment. |
|
Package example contains a simple example of experiment.
|
Package example contains a simple example of experiment. |
|
Package fbmessenger contains the Facebook Messenger network experiment.
|
Package fbmessenger contains the Facebook Messenger network experiment. |
|
Package handler contains experiment events handler
|
Package handler contains experiment events handler |
|
Package hhfm contains the HTTP Header Field Manipulation network experiment.
|
Package hhfm contains the HTTP Header Field Manipulation network experiment. |
|
Package hirl contains the HTTP Invalid Request Line network experiment.
|
Package hirl contains the HTTP Invalid Request Line network experiment. |
|
Package mkevent processes MK events
|
Package mkevent processes MK events |
|
Package mkhelper contains common code to get the proper helper and configure it into settings.
|
Package mkhelper contains common code to get the proper helper and configure it into settings. |
|
Package mkrunner contains code to run an MK based test
|
Package mkrunner contains code to run an MK based test |
|
Package ndt contains the ndt network experiment.
|
Package ndt contains the ndt network experiment. |
|
Package ndt7 contains the ndt7 network experiment.
|
Package ndt7 contains the ndt7 network experiment. |
|
Package psiphon implements the psiphon network experiment.
|
Package psiphon implements the psiphon network experiment. |
|
Package telegram contains the Telegram network experiment.
|
Package telegram contains the Telegram network experiment. |
|
Package web_connectivity contains the Web Connectivity network experiment.
|
Package web_connectivity contains the Web Connectivity network experiment. |
|
Package whatsapp contains the WhatsApp network experiment.
|
Package whatsapp contains the WhatsApp network experiment. |