2021-02-02 12:05:47 +01:00
|
|
|
package engine
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/dash"
|
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/dnscheck"
|
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/example"
|
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/fbmessenger"
|
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/hhfm"
|
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/hirl"
|
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/httphostheader"
|
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/ndt7"
|
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/psiphon"
|
2022-02-14 19:21:16 +01:00
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/quicping"
|
2021-02-02 12:05:47 +01:00
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/riseupvpn"
|
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/run"
|
2021-02-26 10:16:34 +01:00
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/signal"
|
2021-02-02 12:05:47 +01:00
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/sniblocking"
|
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/stunreachability"
|
2022-05-09 09:33:18 +02:00
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/tcpping"
|
2021-02-02 12:05:47 +01:00
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/telegram"
|
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/tlstool"
|
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/tor"
|
2021-06-18 13:51:18 +02:00
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/torsf"
|
2021-02-02 12:05:47 +01:00
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/urlgetter"
|
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/webconnectivity"
|
2021-09-30 02:06:27 +02:00
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/webstepsx"
|
2021-02-02 12:05:47 +01:00
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/experiment/whatsapp"
|
|
|
|
)
|
|
|
|
|
|
|
|
var experimentsByName = map[string]func(*Session) *ExperimentBuilder{
|
|
|
|
"dash": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, dash.NewExperimentMeasurer(
|
|
|
|
*config.(*dash.Config),
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &dash.Config{},
|
|
|
|
interruptible: true,
|
|
|
|
inputPolicy: InputNone,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
"dnscheck": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, dnscheck.NewExperimentMeasurer(
|
|
|
|
*config.(*dnscheck.Config),
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &dnscheck.Config{},
|
2021-12-03 15:30:56 +01:00
|
|
|
inputPolicy: InputOrStaticDefault,
|
2021-02-02 12:05:47 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
"example": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, example.NewExperimentMeasurer(
|
|
|
|
*config.(*example.Config), "example",
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &example.Config{
|
|
|
|
Message: "Good day from the example experiment!",
|
|
|
|
SleepTime: int64(time.Second),
|
|
|
|
},
|
|
|
|
interruptible: true,
|
|
|
|
inputPolicy: InputNone,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
"facebook_messenger": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, fbmessenger.NewExperimentMeasurer(
|
|
|
|
*config.(*fbmessenger.Config),
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &fbmessenger.Config{},
|
|
|
|
inputPolicy: InputNone,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
"http_header_field_manipulation": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, hhfm.NewExperimentMeasurer(
|
|
|
|
*config.(*hhfm.Config),
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &hhfm.Config{},
|
|
|
|
inputPolicy: InputNone,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
"http_host_header": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, httphostheader.NewExperimentMeasurer(
|
|
|
|
*config.(*httphostheader.Config),
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &httphostheader.Config{},
|
2021-03-26 09:34:27 +01:00
|
|
|
inputPolicy: InputOrQueryBackend,
|
2021-02-02 12:05:47 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
"http_invalid_request_line": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, hirl.NewExperimentMeasurer(
|
|
|
|
*config.(*hirl.Config),
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &hirl.Config{},
|
|
|
|
inputPolicy: InputNone,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
"ndt": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, ndt7.NewExperimentMeasurer(
|
|
|
|
*config.(*ndt7.Config),
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &ndt7.Config{},
|
|
|
|
interruptible: true,
|
|
|
|
inputPolicy: InputNone,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
"psiphon": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, psiphon.NewExperimentMeasurer(
|
|
|
|
*config.(*psiphon.Config),
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &psiphon.Config{},
|
|
|
|
inputPolicy: InputOptional,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2022-02-14 19:21:16 +01:00
|
|
|
"quicping": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, quicping.NewExperimentMeasurer(
|
|
|
|
*config.(*quicping.Config),
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &quicping.Config{},
|
|
|
|
inputPolicy: InputStrictlyRequired,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2021-02-02 12:05:47 +01:00
|
|
|
"riseupvpn": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, riseupvpn.NewExperimentMeasurer(
|
|
|
|
*config.(*riseupvpn.Config),
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &riseupvpn.Config{},
|
|
|
|
inputPolicy: InputNone,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
"run": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, run.NewExperimentMeasurer(
|
|
|
|
*config.(*run.Config),
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &run.Config{},
|
|
|
|
inputPolicy: InputStrictlyRequired,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2021-02-26 10:16:34 +01:00
|
|
|
"signal": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, signal.NewExperimentMeasurer(
|
|
|
|
*config.(*signal.Config),
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &signal.Config{},
|
|
|
|
inputPolicy: InputNone,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2021-02-02 12:05:47 +01:00
|
|
|
"sni_blocking": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, sniblocking.NewExperimentMeasurer(
|
|
|
|
*config.(*sniblocking.Config),
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &sniblocking.Config{},
|
2021-03-26 09:34:27 +01:00
|
|
|
inputPolicy: InputOrQueryBackend,
|
2021-02-02 12:05:47 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2021-03-11 19:35:22 +01:00
|
|
|
"stunreachability": func(session *Session) *ExperimentBuilder {
|
2021-02-02 12:05:47 +01:00
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, stunreachability.NewExperimentMeasurer(
|
|
|
|
*config.(*stunreachability.Config),
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &stunreachability.Config{},
|
2021-12-03 15:30:56 +01:00
|
|
|
inputPolicy: InputOrStaticDefault,
|
2021-02-02 12:05:47 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2022-05-09 09:33:18 +02:00
|
|
|
"tcpping": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, tcpping.NewExperimentMeasurer(
|
|
|
|
*config.(*tcpping.Config),
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &tcpping.Config{},
|
|
|
|
inputPolicy: InputStrictlyRequired,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2021-02-02 12:05:47 +01:00
|
|
|
"telegram": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, telegram.NewExperimentMeasurer(
|
|
|
|
*config.(*telegram.Config),
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &telegram.Config{},
|
|
|
|
inputPolicy: InputNone,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
"tlstool": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, tlstool.NewExperimentMeasurer(
|
|
|
|
*config.(*tlstool.Config),
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &tlstool.Config{},
|
2021-03-26 09:34:27 +01:00
|
|
|
inputPolicy: InputOrQueryBackend,
|
2021-02-02 12:05:47 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
"tor": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, tor.NewExperimentMeasurer(
|
|
|
|
*config.(*tor.Config),
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &tor.Config{},
|
|
|
|
inputPolicy: InputNone,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2021-06-18 13:51:18 +02:00
|
|
|
"torsf": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, torsf.NewExperimentMeasurer(
|
|
|
|
*config.(*torsf.Config),
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &torsf.Config{},
|
|
|
|
inputPolicy: InputNone,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2021-02-02 12:05:47 +01:00
|
|
|
"urlgetter": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, urlgetter.NewExperimentMeasurer(
|
|
|
|
*config.(*urlgetter.Config),
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &urlgetter.Config{},
|
|
|
|
inputPolicy: InputStrictlyRequired,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
"web_connectivity": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, webconnectivity.NewExperimentMeasurer(
|
|
|
|
*config.(*webconnectivity.Config),
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &webconnectivity.Config{},
|
2021-03-26 09:34:27 +01:00
|
|
|
inputPolicy: InputOrQueryBackend,
|
2021-02-02 12:05:47 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2021-08-17 10:29:06 +02:00
|
|
|
"websteps": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
2021-09-30 02:06:27 +02:00
|
|
|
return NewExperiment(session, webstepsx.NewExperimentMeasurer(
|
|
|
|
*config.(*webstepsx.Config),
|
2021-08-17 10:29:06 +02:00
|
|
|
))
|
|
|
|
},
|
2021-09-30 02:06:27 +02:00
|
|
|
config: &webstepsx.Config{},
|
2021-08-17 10:29:06 +02:00
|
|
|
inputPolicy: InputOrQueryBackend,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2021-02-02 12:05:47 +01:00
|
|
|
"whatsapp": func(session *Session) *ExperimentBuilder {
|
|
|
|
return &ExperimentBuilder{
|
|
|
|
build: func(config interface{}) *Experiment {
|
|
|
|
return NewExperiment(session, whatsapp.NewExperimentMeasurer(
|
|
|
|
*config.(*whatsapp.Config),
|
|
|
|
))
|
|
|
|
},
|
|
|
|
config: &whatsapp.Config{},
|
|
|
|
inputPolicy: InputNone,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
// AllExperiments returns the name of all experiments
|
|
|
|
func AllExperiments() []string {
|
|
|
|
var names []string
|
|
|
|
for key := range experimentsByName {
|
|
|
|
names = append(names, key)
|
|
|
|
}
|
|
|
|
return names
|
|
|
|
}
|