0c5b6aa37c
This is the command I used: ``` rg 'github.com/openobservatory/gooni' --files-with-matches \ | xargs sed -i '' 's/github.com\/openobservatory\/gooni/github.com\/ooni\/probe-cli/g' ```
61 lines
1.4 KiB
Go
61 lines
1.4 KiB
Go
package im
|
|
|
|
import (
|
|
"github.com/measurement-kit/go-measurement-kit"
|
|
"github.com/ooni/probe-cli/nettests"
|
|
)
|
|
|
|
// WhatsApp test implementation
|
|
type WhatsApp struct {
|
|
}
|
|
|
|
// Run starts the test
|
|
func (h WhatsApp) Run(ctl *nettests.Controller) error {
|
|
mknt := mk.NewNettest("Whatsapp")
|
|
ctl.Init(mknt)
|
|
return mknt.Run()
|
|
}
|
|
|
|
// WhatsAppSummary for the test
|
|
type WhatsAppSummary struct {
|
|
RegistrationServerBlocking bool
|
|
WebBlocking bool
|
|
EndpointsBlocking bool
|
|
Blocked bool
|
|
}
|
|
|
|
// Summary generates a summary for a test run
|
|
func (h WhatsApp) Summary(tk map[string]interface{}) interface{} {
|
|
var (
|
|
webBlocking bool
|
|
registrationBlocking bool
|
|
endpointsBlocking bool
|
|
)
|
|
|
|
var computeBlocking = func(key string) bool {
|
|
const blk = "blocked"
|
|
if tk[key] == nil {
|
|
return false
|
|
}
|
|
if tk[key].(string) == blk {
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
registrationBlocking = computeBlocking("registration_server_status")
|
|
webBlocking = computeBlocking("whatsapp_web_status")
|
|
endpointsBlocking = computeBlocking("whatsapp_endpoints_status")
|
|
|
|
return WhatsAppSummary{
|
|
RegistrationServerBlocking: registrationBlocking,
|
|
WebBlocking: webBlocking,
|
|
EndpointsBlocking: endpointsBlocking,
|
|
Blocked: registrationBlocking || webBlocking || endpointsBlocking,
|
|
}
|
|
}
|
|
|
|
// LogSummary writes the summary to the standard output
|
|
func (h WhatsApp) LogSummary(s string) error {
|
|
return nil
|
|
}
|