Usage reporting should recognize new discovery server IP:s

This commit is contained in:
Jakob Borg
2015-09-21 10:54:21 +02:00
parent 185b0690c8
commit 8d421a62d2
2 changed files with 23 additions and 4 deletions

View File

@@ -189,12 +189,11 @@ func reportData(m *model.Model) map[string]interface{} {
defaultAnnounceServersDNS, defaultAnnounceServersIP, otherAnnounceServers := 0, 0, 0
for _, addr := range cfg.Options().GlobalAnnServers {
switch addr {
case "udp4://announce.syncthing.net:22027", "udp6://announce-v6.syncthing.net:22027":
if addr == "default" {
defaultAnnounceServersDNS++
case "udp4://194.126.249.5:22027", "udp6://[2001:470:28:4d6::5]:22027":
} else if stringIn(addr, config.DefaultDiscoveryServersIP) {
defaultAnnounceServersIP++
default:
} else {
otherAnnounceServers++
}
}
@@ -229,6 +228,15 @@ func reportData(m *model.Model) map[string]interface{} {
return res
}
func stringIn(needle string, haystack []string) bool {
for _, s := range haystack {
if needle == s {
return true
}
}
return false
}
type usageReportingService struct {
model *model.Model
stop chan struct{}