Commit Graph

54 Commits

Author SHA1 Message Date
Simone Basso
39aec6677d
cleanup(shellx): do not directly depend on apex/log (#357) 2021-06-04 14:02:18 +02:00
Simone Basso
33de701263
refactor: flatten and separate (#353)
* refactor(atomicx): move outside the engine package

After merging probe-engine into probe-cli, my impression is that we have
too much unnecessary nesting of packages in this repository.

The idea of this commit and of a bunch of following commits will instead
be to reduce the nesting and simplify the structure.

While there, improve the documentation.

* fix: always use the atomicx package

For consistency, never use sync/atomic and always use ./internal/atomicx
so we can just grep and make sure we're not risking to crash if we make
a subtle mistake on a 32 bit platform.

While there, mention in the contributing guidelines that we want to
always prefer the ./internal/atomicx package over sync/atomic.

* fix(atomicx): remove unnecessary constructor

We don't need a constructor here. The default constructed `&Int64{}`
instance is already usable and the constructor does not add anything to
what we are doing, rather it just creates extra confusion.

* cleanup(atomicx): we are not using Float64

Because atomicx.Float64 is unused, we can safely zap it.

* cleanup(atomicx): simplify impl and improve tests

We can simplify the implementation by using defer and by letting
the Load() method call Add(0).

We can improve tests by making many goroutines updated the
atomic int64 value concurrently.

* refactor(fsx): can live in the ./internal pkg

Let us reduce the amount of nesting. While there, ensure that the
package only exports the bare minimum, and improve the documentation
of the tests, to ease reading the code.

* refactor: move runtimex to ./internal

* refactor: move shellx into the ./internal package

While there, remove unnecessary dependency between packages.

While there, specify in the contributing guidelines that
one should use x/sys/execabs instead of os/exec.

* refactor: move ooapi into the ./internal pkg

* refactor(humanize): move to ./internal and better docs

* refactor: move platform to ./internal

* refactor(randx): move to ./internal

* refactor(multierror): move into the ./internal pkg

* refactor(kvstore): all kvstores in ./internal

Rather than having part of the kvstore inside ./internal/engine/kvstore
and part in ./internal/engine/kvstore.go, let us put every piece of code
that is kvstore related into the ./internal/kvstore package.

* fix(kvstore): always return ErrNoSuchKey on Get() error

It should help to use the kvstore everywhere removing all the
copies that are lingering around the tree.

* sessionresolver: make KVStore mandatory

Simplifies implementation. While there, use the ./internal/kvstore
package rather than having our private implementation.

* fix(ooapi): use the ./internal/kvstore package

* fix(platform): better documentation
2021-06-04 10:34:18 +02:00
Simone Basso
a4cf473ee9
Release 3.10.0 beta.3 (#345)
* chore: run go-generate

See https://github.com/ooni/probe/issues/1468

* chore: update all the dependencies

Unclear to me why `go get -u -v ./...` did not actually update
all of them and I needed to spell out each of them and force to
update by going `go get -u -v $pkg@latest` ¯\_(ツ)_/¯.

Part of https://github.com/ooni/probe/issues/1468

* fix(c/o/i/d/actions_test.go): ensure we check for return value

Part of https://github.com/ooni/probe/issues/1468

* chore: update the user agents we use

See https://github.com/ooni/probe/issues/1468

* chore: set version to 3.10.0-beta.3

See https://github.com/ooni/probe/issues/1468

* chore: use probe-assets v0.3.1

Part of https://github.com/ooni/probe/issues/1468
2021-05-13 08:16:28 +02:00
Arturo Filastò
ac7d7dc8a3
Add support for tracking the is_uploaded status in the results table (#312)
* Add support for tracking the is_uploaded status in the results table

* Add unit tests for measurement upload status

This implements: https://github.com/ooni/probe/issues/1457

* Update cmd/ooniprobe/internal/database/actions.go

Co-authored-by: Simone Basso <bassosimone@gmail.com>
2021-04-30 17:08:16 +02:00
Simone Basso
1d70b81187
More progress towards release v3.10.0 (#320)
* chore: unvendor github.com/mitchellh/go-wordwrap

The library seems reasonably maintained and tested.

Part of https://github.com/ooni/probe/issues/1439

* fix(netx/quicdialer): ensure we handle all errors

Part of https://github.com/ooni/probe/issues/1439

* fix previous

* cleanup: remove unnecessary shutil fork

Part of https://github.com/ooni/probe/issues/1439

* doc: documented some undocumented functions

Part of https://github.com/ooni/probe/issues/1439

* fix(ooniprobe): rename mis-named function

Part of https://github.com/ooni/probe/issues/1439
2021-04-29 15:59:53 +02:00
Simone Basso
4578df0a2b
fix: disable maxRuntime with --input or --input-file (#305)
When this happens, the user is expressing the intention of
explicitly testing all the input they provided.

So, disable maxRuntime in these cases.

Part of https://github.com/ooni/probe/issues/1436.
2021-04-07 14:55:04 +02:00
Simone Basso
654441f5cd
fix: move preventMistakes in InputLoader (#304)
This fixes an issue where URLs provided with --input are not
accepted by the preventMistakes filter.

The filter itself needs to execute _only_ on URLs returned
by the checkIn API, rather than on URLs returned by the
InputLoader, which may instead be user provided.

Reference issue: https://github.com/ooni/probe/issues/1435
2021-04-07 14:14:25 +02:00
Simone Basso
46d19f47ec
fix: disable maxRuntime when not WebConnectivity (#302)
This commit cherry-picks 6306c09963

See https://github.com/ooni/probe/issues/1433

Conflicts:
	internal/version/version.go
2021-04-06 20:48:56 +02:00
Simone Basso
c5ad5eedeb
feat: create tunnel inside NewSession (#286)
* feat: create tunnel inside NewSession

We want to create the tunnel when we create the session. This change
allows us to nicely ignore the problem of creating a tunnel when we
already have a proxy, as well as the problem of locking. Everything is
happening, in fact, inside of the NewSession factory.

Modify miniooni such that --tunnel is just syntactic sugar for
--proxy, at least for now. We want, in the future, to teach the
tunnel to possibly use a socks5 proxy.

Because starting a tunnel is a slow operation, we need a context in
NewSession. This causes a bunch of places to change. Not really a big
deal except we need to propagate the changes.

Make sure that the mobile code can create a new session using a
proxy for all the APIs we support.

Make sure all tests are still green and we don't loose coverage of
the various ways in which this code could be used.

This change is part of https://github.com/ooni/probe/issues/985.

* changes after merge

* fix: only keep tests that can hopefully work

While there, identify other places where we should add more
tests or fix integration tests.

Part of https://github.com/ooni/probe/issues/985
2021-04-05 15:28:13 +02:00
Simone Basso
8fe4e5410d
feat(tunnel): introduce persistent tunnel state dir (#294)
* feat(tunnel): introduce persistent tunnel state dir

This diff introduces a persistent state directory for tunnels, so that
we can bootstrap them more quickly after the first time.

Part of https://github.com/ooni/probe/issues/985

* fix: make tunnel dir optional

We have many tests where it does not make sense to explicitly
provide a tunnel dir because we're not using tunnels.

This should simplify setting up a session.

* fix(tunnel): repair tests

* final changes

* more cleanups
2021-04-05 11:27:41 +02:00
Simone Basso
31e478b04e
refactor: redesign how we import assets (#260)
* fix(pkg.go.dev): import a subpackage containing the assets

We're trying to fix this issue that pkg.go.dev does not build.

Thanks to @hellais for this very neat idea! Let's keep our
fingers crossed and see whether it fixes!

* feat: use embedded geoip databases

Closes https://github.com/ooni/probe/issues/1372.

Work done as part of https://github.com/ooni/probe/issues/1369.

* fix(assetsx): add tests

* feat: simplify and just vendor uncompressed DBs

* remove tests that seems not necessary anymore

* fix: run go mod tidy

* Address https://github.com/ooni/probe-cli/pull/260/files#r605181364

* rewrite a test in a better way

* fix: gently cleanup the legacy assetsdir

Do not remove the whole directory with brute force. Just zap the
files whose name we know. Then attempt to delete the legacy directory
as well. If not empty, just fail. This is fine because it means the
user has stored other files inside the directory.

* fix: create .miniooni if missing
2021-04-01 16:57:31 +02:00
Simone Basso
bd451016f5
release 3.9.0 process: reduce warnings (#279)
* fix(riseupvpn): address gofmt warning

Thanks to https://goreportcard.com/report/github.com/ooni/probe-cli.

* fix(utils.go): correct the docu-comment

Thanks to https://goreportcard.com/report/github.com/ooni/probe-cli

* fix: improve spelling

Thanks to https://goreportcard.com/report/github.com/ooni/probe-cli

* fix(modelx_test.go): avoid inefassign warning

Thanks to https://goreportcard.com/report/github.com/ooni/probe-cli

* fix: reduce number of ineffective assignments

Thanks to https://goreportcard.com/report/github.com/ooni/probe-cli
2021-03-31 15:59:19 +02:00
Simone Basso
5c47a87af7
feat(ooniprobe): discard lists not in selected categories (#278)
* feat(ooniprobe): discard lists not in selected categories

One day we may make an integration mistake and for any reason
we may end up with URLs that do not belong to the categories
originally selected by the user. If that happens, it's nice to
have a safety net where we remove URLs that do not belong to
the right category before proceeding with testing.

This diff was conceived while discussing the robustness of
https://github.com/ooni/probe/issues/1299 with @hellais.

* fix behavior and add unit test

* more robust
2021-03-31 14:30:30 +02:00
Simone Basso
969d8b772f
fix(ooniprobe): consistent progress with maxRuntime (#277)
See https://github.com/ooni/probe/issues/1299
2021-03-31 14:06:05 +02:00
Simone Basso
4e344f1fcf
fix(ooniprobe): disable maxRuntime when in the background (#276)
Part of https://github.com/ooni/probe/issues/1299
2021-03-31 12:19:03 +02:00
Simone Basso
dae02ce5b6
feat(ooniprobe): propagate the RunType CheckIn hint (#274)
This diff propagates the RunType CheckIn hint such that we run
using less URLs when running in the background.

Part of https://github.com/ooni/probe/issues/1299.
2021-03-30 11:59:29 +02:00
Simone Basso
c264f61536
feat(ooniprobe): introduce websites_max_runtime (#273)
We cannot control anymore the maximum number of URLs using the API
because now we are using check-in, that has no such limit.

We could theoretically clamp the number of URLs to measure after
the call to check-in, and still honour the setting.

Yet, the right thing to do seems to introduce a max runtime variable
because that is what desktop and mobile do.

Thus, introduce code that warns the user about the change in the
settings, should they have set the URL limit to nonzero.

We are going to do a best effort conversion from the URL limit to
the maximum runtime for the rest of 2021.

Since then, we will silently ignore the URL limit.

This work is part of https://github.com/ooni/probe/issues/1299.
2021-03-30 11:16:12 +02:00
Simone Basso
b718335ee3
refactor(inputloader): remove unnecessary javisms (#271)
Part of https://github.com/ooni/probe/issues/1299.
2021-03-29 20:00:50 +02:00
Simone Basso
5973c88a05
feat(inputloader): use check-in to fetch URLs (#267)
* ongoing work

* reduce diff with master

* feat(inputloader): use the check-in API

Part of https://github.com/ooni/probe/issues/1299

* fix: better naming for a variable

* chore: add more tests

* fix: add one more TODO
2021-03-29 18:46:26 +02:00
Simone Basso
0115d6c470
refactor(inputloader): better docs and naming (#265)
* refactor(inputloader): better docs and naming

Work done as part of https://github.com/ooni/probe/issues/1299.

* fix: correct a typo
2021-03-26 09:34:27 +01:00
Simone Basso
9c820cf855
fix(ooniprobe): send batch output to stdout (#261)
Rationale explained in detail in a documentation comment.

Reference issue: https://github.com/ooni/probe/issues/1384.
2021-03-24 11:39:45 +01:00
Arturo Filastò
70d7c1a22c
Add signal to the im test group (#259)
* Add signal to the im test group

* fix(ipconfig_test.go): disable when running in CI

Reference issue: https://github.com/ooni/probe/issues/1418

* fix(geolocate): remove unused variable

Came across this while looking into this issue with the CI that
is now failing. Guess fixing it here comes across as leaving the
camp slightly less in a bad shape than how I found it.

Co-authored-by: Simone Basso <bassosimone@gmail.com>
2021-03-22 14:31:50 +01:00
Simone Basso
a02052fb0c
chore: rename stun_reachability => stunreachability (#254)
See https://github.com/ooni/probe/issues/1394

Ok @hellais @FedericoCeratto
2021-03-11 19:35:22 +01:00
Simone Basso
da95fa9365
refactor: signal et al. are now experimental nettests (#243)
* refactor: signal et al. are now experimental nettests

We move signal into the experimental nettests group. While there,
also start adding dnscheck and stunreachability as well.

It seems there's more work to be done to correctly represent
the results of dnscheck, but this is fine!

The experimental section is here exactly for this reason!

In terms of UI, the new command is `ooniprobe run experimental`.

We will most likely move signal out of experimental soon, since it's
already working quite well. We need to keep it here for one more
cycle because the desktop app is not ready for it.

See the following issues:

1. https://github.com/ooni/probe/issues/1378

2. https://github.com/ooni/probe/issues/1262

* fix(dnscheck): spell check

* fix: improve documentation
2021-03-08 13:38:34 +01:00
Simone Basso
f5461323db
fix(run): run unattended short also on Windows (#242)
We already have a short run unattended on macOS and we wanna do
the same for Windows. See https://github.com/ooni/probe/issues/1377.
2021-03-08 12:47:19 +01:00
Simone Basso
0d4323ae66
Release 3.6.0 (#239)
* chore: update dependencies

* chore: update user agent for measurements

* chore: we're now at v3.6.0

* chore: update assets

* chore: update bundled CA

* fix: address some goreportcard.com warnings

* fix(debian/changelog): zap release that breaks out build scripts

We're forcing the content of changelog with `dch`, so it's fine to
not have any specific new release in there.

* fix: make sure tests are passing locally

Notably, I removed a chunk of code where we were checking for network
activity. Now we don't fetch the databases and it's not important. Before,
it was important because the databases are ~large.

* fix: temporarily comment out riseupvn integration tests

See https://github.com/ooni/probe/issues/1354 for work aimed at
reducing the rate of false positives (thanks @cyBerta!)
2021-03-03 14:42:17 +01:00
Arturo Filastò
12e1164940
Create the LaunchAgents directory if it does not exist (#237)
* Create the LaunchAgents directory if it does not exist

Fixes: https://github.com/ooni/probe/issues/1368

* Update cmd/ooniprobe/internal/autorun/autorun_darwin.go

Co-authored-by: Simone Basso <bassosimone@gmail.com>

Co-authored-by: Simone Basso <bassosimone@gmail.com>
2021-03-02 20:24:09 +01:00
Simone Basso
322394fe63
feat: use go1.16 and resources embedding (#235)
* feat: use go1.16 embedding for resources

We want to embed everything that can be easily embedded. We should, at a
minimum, replace the downloading of resources and bindata.

Ref: https://github.com/ooni/probe/issues/1367.

* fix: get rid of bindata and use go embed instead

* fix: start unbreaking some automatic tests

* fix: fetch resources as part of the mobile build

* fix: convert more stuff to go1.16

I still expect many breakages, but we'll fix them.

* fix: make the windows CI green

* fix: get resources before running QA

* fix: go1.16 uses modules by default

* hopefully fix all other outstanding issues

* fix(QA/telegram.py): add another DC IP address

* Apply suggestions from code review
2021-03-02 12:08:24 +01:00
Arturo Filastò
5e5cfa72e7
MVP of a signal messenger test (#230)
* MVP of a signal messenger test

* Add minimal signal test unit tests

* Add Signal test to the im nettest group

* Add test for https://sfu.voip.signal.org/

* Fix bug in client-side determination of blocking status

* Add uptime.signal.org to the test targets

* Add more tests

* Check for invalid CA being passed
* Check that the update function works as expected

* Update internal/engine/experiment/signal/signal_test.go

Co-authored-by: Simone Basso <bassosimone@gmail.com>

* fix: back out URL we shouldn't have changed

When merging probe-engine into probe-cli, we changed too many URLs
and some of them should not have been changed.

I noticed this during the review of Signal and I choose to add
this commit to revert such changes.

While there, make sure the URL of the experiment is OK.

* fix(signal): reach 100% of coverage

Just so that we can focus on areas of the codebase where we need
more coverage, let us avoid missing an easy line to test.

Co-authored-by: Simone Basso <bassosimone@gmail.com>
2021-02-26 10:16:34 +01:00
Arturo Filastò
978cd28d88
Disable sentry based crash reporting in probe-cli (#228) 2021-02-12 19:49:18 +01:00
Simone Basso
18ca6d5f35
fix: use golang.org/x/sys/execabs (#224)
Closes https://github.com/ooni/probe-engine/issues/1195
2021-02-10 07:40:48 +01:00
Simone Basso
26d807c50f
fix: always use probe-cli version (and make it alpha) (#219)
See https://github.com/ooni/probe-engine/issues/1181

While there, run `go fmt ./...`
2021-02-04 11:00:27 +01:00
Simone Basso
6062b652f6
Release 3.5.1 (#218)
* chore: bless 3.5.1

* fix(debian): there is an unexpected empty line in template

* fix: make sure we can install the package

We notice that the package was broken only when installing. Apparently, the
debian script do not check for errors during the build.

* fix(debian): nice that the build breaks now let's see if it fixes
2021-02-03 21:32:45 +01:00
Simone Basso
cb6aa1fd3c
chore: release 3.5.0 (#217) 2021-02-03 20:22:41 +01:00
Simone Basso
31cf7d2fdf
doc: ensure all top dirs have an explanatory README (#214)
* doc: ensure all top dirs have an explanatory README

This makes the repository a lil bit nicer to newcomers.

Part of https://github.com/ooni/probe/issues/1335

* fix: re-run bindata to embed the README

The readme is small, so we can pay the price of adding it.

On a related note, I am very pleased the Go team implemented the
`//go:embed` feature, so we can get rid of this bindata thing.
2021-02-03 16:54:00 +01:00
Arturo Filastò
d5b3e90605
Drop the include_ip & include_network settings (#210)
Refactor the copy for the publishing of results setting
2021-02-03 13:52:39 +01:00
Simone Basso
4eeadd06a5
refactor: move more commands to internal/cmd (#207)
* refactor: move more commands to internal/cmd

Part of https://github.com/ooni/probe/issues/1335.

We would like all commands to be at the same level of engine
rather than inside engine (now that we can do it).

* fix: update .gitignore

* refactor: also move jafar outside engine

* We should be good now?
2021-02-03 12:23:15 +01:00
Simone Basso
d57c78bc71
chore: merge probe-engine into probe-cli (#201)
This is how I did it:

1. `git clone https://github.com/ooni/probe-engine internal/engine`

2. ```
(cd internal/engine && git describe --tags)
v0.23.0
```

3. `nvim go.mod` (merging `go.mod` with `internal/engine/go.mod`

4. `rm -rf internal/.git internal/engine/go.{mod,sum}`

5. `git add internal/engine`

6. `find . -type f -name \*.go -exec sed -i 's@/ooni/probe-engine@/ooni/probe-cli/v3/internal/engine@g' {} \;`

7. `go build ./...` (passes)

8. `go test -race ./...` (temporary failure on RiseupVPN)

9. `go mod tidy`

10. this commit message

Once this piece of work is done, we can build a new version of `ooniprobe` that
is using `internal/engine` directly. We need to do more work to ensure all the
other functionality in `probe-engine` (e.g. making mobile packages) are still WAI.

Part of https://github.com/ooni/probe/issues/1335
2021-02-02 12:05:47 +01:00
Simone Basso
b1ce300c8d
fix: import path should be github.com/ooni/probe-cli/v3 (#200)
See https://github.com/ooni/probe/issues/1335#issuecomment-771499511
2021-02-02 10:32:46 +01:00
Simone Basso
504a4e79d4
feat: implement darwin launch agent (#192)
* feat: sketch out periodic command

* feat: sketch out periodic command for macOS

* feat: implement darwin's launch agent

* refactor: better way to run on darwin

Make sure we have code that builds on all platforms.

* fix(run): max 10 URLs with darwin in unattended mode

* feat: add support for seeing/streaming logs

* feat: implement the status command and add usage hints

* feat(periodic): run onboarding if needed

* fix: no too confusing function names

* fix: s/periodic/autorun/

Discussed earlier this morning with @hellais.

* fix: we cannot show logs before Big Sur

Bug reported by @hellais.
2021-01-14 18:32:05 +01:00
Simone Basso
2381c50dc5
feat: implement syslog logging (#181)
* feat: implement syslog logging

With this functionality in tree, macOS users could easily access
ooniprobe logs by filtering by process name in the console app.

Part of https://github.com/ooni/probe/issues/1289

* fix: build on windows

* fix: all build issues
2020-12-01 13:31:15 +01:00
Simone Basso
23c8df1f0c
Rename the binary as ooniprobe (#58)
While there run the build container as unpriv user.
2019-10-02 19:27:15 +02:00
Arturo Filastò
47a2fbb88c Add rm command to delete results 2018-09-18 09:54:27 +02:00
Arturo Filastò
30c6041423 Remove unused nettest command 2018-09-17 16:33:56 +02:00
Arturo Filastò
4ed94dfc53 Improve the presentation of the measurement listing from the CLI 2018-09-13 14:54:56 +02:00
Arturo Filastò
e0c0acffeb Make error reporting more robust to panic 2018-09-10 16:29:14 +02:00
Arturo Filastò
5055eaa88a Add info and reset commands 2018-09-10 15:15:29 +02:00
Arturo Filastò
d88764aa34 Add support for crash reporting via sentry and change the send_crash_reports key 2018-06-29 15:29:05 +02:00
Arturo Filastò
b8dff783e1 Add sentry for sending crash logs 2018-06-29 15:10:19 +02:00
Arturo Filastò
7951ee6bb5 Add onboard command 2018-06-25 16:31:44 +02:00