2018-02-07 19:02:18 +01:00
|
|
|
package config
|
|
|
|
|
2018-02-12 11:18:14 +01:00
|
|
|
var websiteCategories = []string{
|
|
|
|
"ALDR",
|
|
|
|
"ANON",
|
|
|
|
"COMM",
|
|
|
|
"COMT",
|
|
|
|
"CTRL",
|
|
|
|
"CULTR",
|
|
|
|
"DATE",
|
|
|
|
"ECON",
|
|
|
|
"ENV",
|
|
|
|
"FILE",
|
|
|
|
"GAME",
|
|
|
|
"GMB",
|
|
|
|
"GOVT",
|
|
|
|
"GRP",
|
|
|
|
"HACK",
|
|
|
|
"HATE",
|
|
|
|
"HOST",
|
|
|
|
"HUMR",
|
|
|
|
"IGO",
|
|
|
|
"LGBT",
|
|
|
|
"MILX",
|
|
|
|
"MMED",
|
|
|
|
"NEWS",
|
|
|
|
"POLR",
|
|
|
|
"PORN",
|
|
|
|
"PROV",
|
|
|
|
"PUBH",
|
|
|
|
"REL",
|
|
|
|
"SRCH",
|
|
|
|
"XED",
|
|
|
|
}
|
|
|
|
|
|
|
|
// NettestConfig represents the configuration for a particular nettest
|
|
|
|
type NettestConfig struct {
|
|
|
|
Name string
|
|
|
|
Options string
|
|
|
|
}
|
|
|
|
|
|
|
|
// Websites test group
|
|
|
|
type Websites struct {
|
2018-02-07 19:02:18 +01:00
|
|
|
EnabledCategories []string `json:"enabled_categories"`
|
|
|
|
}
|
|
|
|
|
2018-02-12 11:18:14 +01:00
|
|
|
// NettestConfigs returns a list configured enabled tests for the group
|
|
|
|
func (s *Websites) NettestConfigs() []NettestConfig {
|
|
|
|
var nts []NettestConfig
|
|
|
|
nts = append(nts, NettestConfig{"web_connectivity", "options"})
|
|
|
|
return nts
|
|
|
|
}
|
|
|
|
|
|
|
|
// InstantMessaging nettest group
|
|
|
|
type InstantMessaging struct {
|
2018-02-07 19:02:18 +01:00
|
|
|
EnabledTests []string `json:"enabled_tests"`
|
|
|
|
}
|
|
|
|
|
2018-02-12 11:18:14 +01:00
|
|
|
func (s *InstantMessaging) isEnabled(nt string) bool {
|
|
|
|
for _, v := range s.EnabledTests {
|
|
|
|
if v == nt {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
// NettestConfigs returns a list configured enabled tests for the group
|
|
|
|
func (s *InstantMessaging) NettestConfigs() []NettestConfig {
|
|
|
|
var nts []NettestConfig
|
|
|
|
if s.isEnabled("facebook_messenger") {
|
|
|
|
nts = append(nts, NettestConfig{"facebook_messenger", "options"})
|
|
|
|
}
|
|
|
|
if s.isEnabled("telegram") {
|
|
|
|
nts = append(nts, NettestConfig{"telegram", "options"})
|
|
|
|
}
|
|
|
|
if s.isEnabled("whatsapp") {
|
|
|
|
nts = append(nts, NettestConfig{"whatsapp", "options"})
|
|
|
|
}
|
|
|
|
return nts
|
|
|
|
}
|
|
|
|
|
|
|
|
// Performance nettest group
|
|
|
|
type Performance struct {
|
2018-02-07 19:02:18 +01:00
|
|
|
EnabledTests []string `json:"enabled_tests"`
|
|
|
|
NDTServer string `json:"ndt_server"`
|
|
|
|
NDTServerPort string `json:"ndt_server_port"`
|
|
|
|
DashServer string `json:"dash_server"`
|
|
|
|
DashServerPort string `json:"dash_server_port"`
|
|
|
|
}
|
|
|
|
|
2018-02-12 11:18:14 +01:00
|
|
|
// Middlebox nettest group
|
|
|
|
type Middlebox struct {
|
2018-02-07 19:02:18 +01:00
|
|
|
EnabledTests []string `json:"enabled_tests"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// NettestGroups related settings
|
|
|
|
type NettestGroups struct {
|
2018-02-12 11:18:14 +01:00
|
|
|
Websites Websites `json:"websites"`
|
|
|
|
InstantMessaging InstantMessaging `json:"instant_messaging"`
|
|
|
|
Performance Performance `json:"performance"`
|
|
|
|
Middlebox Middlebox `json:"middlebox"`
|
2018-02-07 19:02:18 +01:00
|
|
|
}
|