b4934b1619
* nettests/groups.go: remove redundant struct names * go.mod go.sum: update deps except probe-engine * Update to ooni/probe-engine@e768161f91 The API has changed. Methods that used to change bits of the session have been removed. Now the session is more immutable than before. As such, we need to completely fill the config before using it. * Set IncludeCountry to always true Co-authored-by: Arturo Filastò <arturo@filasto.net>
52 lines
1.1 KiB
Go
52 lines
1.1 KiB
Go
package nettests
|
|
|
|
import "github.com/pkg/errors"
|
|
|
|
// Psiphon test implementation
|
|
type Psiphon struct {
|
|
}
|
|
|
|
// Run starts the test
|
|
func (h Psiphon) Run(ctl *Controller) error {
|
|
builder, err := ctl.Session.NewExperimentBuilder(
|
|
"psiphon",
|
|
)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return ctl.Run(builder, []string{""})
|
|
}
|
|
|
|
// PsiphonTestKeys contains the test keys
|
|
type PsiphonTestKeys struct {
|
|
IsAnomaly bool `json:"-"`
|
|
BootstrapTime float64 `json:"bootstrap_time"`
|
|
Failure string `json:"failure"`
|
|
}
|
|
|
|
// GetTestKeys generates a summary for a test run
|
|
func (h Psiphon) GetTestKeys(tk map[string]interface{}) (interface{}, error) {
|
|
var (
|
|
err error
|
|
ok bool
|
|
)
|
|
testKeys := PsiphonTestKeys{IsAnomaly: false, Failure: ""}
|
|
if tk["failure"] != nil {
|
|
testKeys.IsAnomaly = true
|
|
testKeys.Failure, ok = tk["failure"].(string)
|
|
if !ok {
|
|
err = errors.Wrap(err, "failure key invalid")
|
|
}
|
|
}
|
|
testKeys.BootstrapTime, ok = tk["bootstrap_time"].(float64)
|
|
if !ok {
|
|
err = errors.Wrap(err, "bootstrap_time key invalid")
|
|
}
|
|
return testKeys, err
|
|
}
|
|
|
|
// LogSummary writes the summary to the standard output
|
|
func (h Psiphon) LogSummary(s string) error {
|
|
return nil
|
|
}
|