Implement the circumvention nettest group

Only Psiphon for now. Closes #87 #77.
This commit is contained in:
Simone Basso
2019-12-28 17:48:07 +01:00
parent 5e868fe043
commit 259ab41b15
9 changed files with 70 additions and 74 deletions
+6
View File
@@ -36,4 +36,10 @@ var NettestGroups = map[string]NettestGroup{
WhatsApp{},
},
},
"circumvention": NettestGroup{
Label: "Circumvention Tools",
Nettests: []Nettest{
Psiphon{},
},
},
}
+33
View File
@@ -0,0 +1,33 @@
package nettests
// Psiphon test implementation
type Psiphon struct {
}
// Run starts the test
func (h Psiphon) Run(ctl *Controller) error {
builder, err := ctl.Ctx.Session.NewExperimentBuilder(
"psiphon",
)
if err != nil {
return err
}
return ctl.Run(builder, []string{""})
}
// PsiphonTestKeys contains the test keys
type PsiphonTestKeys struct {
IsAnomaly bool `json:"-"`
}
// GetTestKeys generates a summary for a test run
func (h Psiphon) GetTestKeys(tk map[string]interface{}) (interface{}, error) {
return PsiphonTestKeys{
IsAnomaly: tk["failure"] != nil,
}, nil
}
// LogSummary writes the summary to the standard output
func (h Psiphon) LogSummary(s string) error {
return nil
}