cli: add support for passing proxy command line parameter (#981)

This implements the bare minimum needed to have circumvention proxy support in OONI Probe CLI.

The reference issue is https://github.com/ooni/probe/issues/1955. (Most of that issue is implemented, save for the fact that currently we do not have support for `http` and `https` proxies.)

While there, add to `Makefile` a rule for correctly building `ooniprobe` and `miniooni` for "this system" (i.e., the default `GOOS` and `GOARCH` on a system), because we needed this for testing this patch and we needed to figure out the commands instead.
This commit is contained in:
Arturo Filastò
2022-11-15 09:55:05 +01:00
committed by GitHub
parent 9750032639
commit d6def35286
6 changed files with 66 additions and 5 deletions
+4 -1
View File
@@ -44,6 +44,9 @@ func init() {
softwareVersion := Cmd.Flag(
"software-version", "Override the application version",
).Default(version.Version).String()
proxy := Cmd.Flag(
"proxy", "specify a proxy address for speaking to the OONI Probe backend (use: --proxy=psiphon:/// for psiphon)",
).String()
Cmd.PreAction(func(ctx *kingpin.ParseContext) error {
// TODO(bassosimone): we need to properly deprecate --batch
@@ -78,7 +81,7 @@ func init() {
}
probe := ooni.NewProbe(*configPath, homePath)
err = probe.Init(*softwareName, *softwareVersion)
err = probe.Init(*softwareName, *softwareVersion, *proxy)
if err != nil {
return nil, err
}