2018-03-21 12:18:45 +01:00
|
|
|
package im
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/measurement-kit/go-measurement-kit"
|
2018-05-03 14:59:55 +02:00
|
|
|
"github.com/ooni/probe-cli/nettests"
|
2018-03-21 12:18:45 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
// FacebookMessenger test implementation
|
|
|
|
type FacebookMessenger struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
// Run starts the test
|
|
|
|
func (h FacebookMessenger) Run(ctl *nettests.Controller) error {
|
|
|
|
mknt := mk.NewNettest("FacebookMessenger")
|
|
|
|
ctl.Init(mknt)
|
|
|
|
return mknt.Run()
|
|
|
|
}
|
|
|
|
|
|
|
|
// FacebookMessengerSummary for the test
|
|
|
|
type FacebookMessengerSummary struct {
|
|
|
|
DNSBlocking bool
|
|
|
|
TCPBlocking bool
|
2018-03-23 15:22:58 +01:00
|
|
|
Blocked bool
|
2018-03-21 12:18:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Summary generates a summary for a test run
|
|
|
|
func (h FacebookMessenger) Summary(tk map[string]interface{}) interface{} {
|
2018-03-23 15:22:58 +01:00
|
|
|
var (
|
|
|
|
dnsBlocking bool
|
|
|
|
tcpBlocking bool
|
|
|
|
)
|
|
|
|
if tk["facebook_dns_blocking"] == nil {
|
|
|
|
dnsBlocking = false
|
|
|
|
} else {
|
|
|
|
dnsBlocking = tk["facebook_dns_blocking"].(bool)
|
|
|
|
}
|
|
|
|
|
|
|
|
if tk["facebook_tcp_blocking"] == nil {
|
|
|
|
tcpBlocking = false
|
|
|
|
} else {
|
|
|
|
tcpBlocking = tk["facebook_tcp_blocking"].(bool)
|
|
|
|
}
|
|
|
|
|
2018-03-21 12:18:45 +01:00
|
|
|
return FacebookMessengerSummary{
|
2018-03-23 15:22:58 +01:00
|
|
|
DNSBlocking: dnsBlocking,
|
|
|
|
TCPBlocking: tcpBlocking,
|
|
|
|
Blocked: dnsBlocking || tcpBlocking,
|
2018-03-21 12:18:45 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// LogSummary writes the summary to the standard output
|
|
|
|
func (h FacebookMessenger) LogSummary(s string) error {
|
|
|
|
return nil
|
|
|
|
}
|