Add support for custom collectors and bouncers

This commit is contained in:
Arturo Filastò 2018-09-21 18:54:44 +02:00
parent 5a3c5e94f8
commit 0d21186492
6 changed files with 23 additions and 5 deletions

2
Gopkg.lock generated
View File

@ -68,7 +68,7 @@
branch = "master"
name = "github.com/measurement-kit/go-measurement-kit"
packages = ["."]
revision = "18bd1b84e534aacc7292c22da5c900b6d7bff41b"
revision = "cf0ee00807adfae92a6ec595ef985c7110903369"
[[projects]]
branch = "master"

View File

@ -119,8 +119,10 @@ type Sharing struct {
// Advanced settings
type Advanced struct {
UseDomainFronting bool `json:"use_domain_fronting"`
SendCrashReports bool `json:"send_crash_reports"`
UseDomainFronting bool `json:"use_domain_fronting"`
SendCrashReports bool `json:"send_crash_reports"`
CollectorURL string `json:"collector_url"`
BouncerURL string `json:"bouncer_url"`
}
// AutomatedTesting settings

View File

@ -58,6 +58,8 @@
},
"advanced": {
"use_domain_fronting": false,
"send_crash_reports": true
"send_crash_reports": true,
"bouncer_url": "https://bouncer.ooni.io/",
"collector_url": "https://c.collector.ooni.io/",
}
}

View File

@ -59,6 +59,8 @@
},
"advanced": {
"use_domain_fronting": false,
"send_crash_reports": true
"send_crash_reports": true,
"collector_url": "",
"bouncer_url": "https://bouncer.ooni.io/"
}
}

View File

@ -27,6 +27,8 @@ func init() {
strings.Join(nettestGroupNames, ", "))).Required().String()
noCollector := cmd.Flag("no-collector", "Disable uploading measurements to a collector").Bool()
collectorURL := cmd.Flag("collector-url", "Specify the address of a custom collector").String()
bouncerURL := cmd.Flag("bouncer-url", "Specify the address of a custom bouncer").String()
cmd.Action(func(_ *kingpin.ParseContext) error {
log.Infof("Starting %s", *nettestGroup)
@ -44,6 +46,14 @@ func init() {
if *noCollector == true {
ctx.Config.Sharing.UploadResults = false
}
if *collectorURL != "" {
ctx.Config.Advanced.CollectorURL = *collectorURL
}
if *bouncerURL != "" {
ctx.Config.Advanced.BouncerURL = *bouncerURL
}
log.Debugf("Using collector %s", ctx.Config.Advanced.CollectorURL)
log.Debugf("Using bouncer %s", ctx.Config.Advanced.CollectorURL)
group, ok := groups.NettestGroups[*nettestGroup]
if !ok {

View File

@ -96,6 +96,8 @@ func (c *Controller) Init(nt *mk.Nettest) error {
RandomizeInput: false, // It's important to disable input randomization to ensure the URLs are written in sync to the DB
SoftwareName: "ooniprobe-desktop",
SoftwareVersion: ooni.Version,
CollectorBaseURL: c.Ctx.Config.Advanced.CollectorURL,
BouncerBaseURL: c.Ctx.Config.Advanced.BouncerURL,
OutputPath: msmtPath,
GeoIPCountryPath: geoIPCountryPath,