Commit Graph

18 Commits

Author SHA1 Message Date
Simone Basso
5d8cf60f55
fix(oonimkall): allow Android app to set proxy (#303)
Part of https://github.com/ooni/probe/issues/985
2021-04-06 14:53:58 +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
e0b0dfedc1
feat(session): expose CheckIn method (#266)
* feat(session): expose CheckIn method

It seems to me the right thing to do is to query the CheckIn API
from the Session rather than querying it from InputLoader.

Then, InputLoader could just take a reference to a Session-like
interface that allows this functionality.

So, this diff exposes the Session.CheckIn method.

Doing that, in turn, required some refactoring to allow for
more and better unit tests.

While doing that, I also noticed that Session required a mutex
to be a well-behaving type, so I did that.

While doing that, I also tried to cover all the lines in session.go
and, as part of that, I have removed unused code.

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

* fix: reinstate comment I shan't have removed

* fix: repair broken test

* fix: a bit more coverage, annotations, etc.

* Update internal/engine/session.go

* Update internal/engine/session_integration_test.go

* Update internal/engine/session_internal_test.go
2021-03-29 15:04:41 +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
3b029ee0d6
feat(ExperimentOrchestraClient): add CheckIn (#263)
We use ExperimentOrchestraClient in several places to help us
calling probe-services APIs. We need to call CheckIn because we
want to use CheckIn in InputLoader.

(We also want to remove the URLs API, but that is not something
doable now, since the mobile app is still using this API via
the wrappers at pkg/oonimkall.)

Work part of https://github.com/ooni/probe/issues/1299.
2021-03-25 12:02:02 +01:00
Simone Basso
0f61778e7a
oonimkall: mobile api for running WebConnectivity (#223)
* poc: mobile api for running WebConnectivity

Yesterday we had a team meeting where we discussed the importance
of stopping using MK wrappers for running experiments.

Here's a PoC showing how we can do that for WebConnectivity. It
seems to me we probably want to add more tests and merge this code
such that we can experiment with it quite soon.

There seems to be opportunities for auto-generating code, BTW.

While working on this PoC, I've also took a chance to revamp the
external documentation of pkg/oonimkall.

* feat: start making the code more abstract

* chore: write unit tests for new code

* fix(oonimkall): improve naming

* refactor: cosmetic changes

* fix: explain
2021-03-18 08:44:58 +01:00
Simone Basso
78b5bf0caa
refactor+doc(oonimkall): improve docs and simplify code (#253)
This diff has been extracted from a larger diff written for https://github.com/ooni/probe/issues/1346
2021-03-11 09:42:23 +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ò
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
Lorenzo Primiterra
772de83a06
oonimkall: add wrappers for /test-list/urls (#221)
* First wrapper implementation

* Adding CountryCode parameter

* requested changes

* Update pkg/oonimkall/session.go

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

* Requested changes

* Update pkg/oonimkall/session_integration_test.go

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

* Update pkg/oonimkall/session_integration_test.go

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

* Remove duplicated code

* Apply suggestions from code review

Co-authored-by: Simone Basso <bassosimone@gmail.com>
2021-02-26 10:00:25 +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
a5f4fc997c
refactor: we don't wanna export pkg/oonimkall/tasks (#216)
* doc: merge the engine and the cli readmes

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

* refactor: we don't wanna export pkg/oonimkall/tasks

See https://github.com/ooni/probe/issues/1335
2021-02-03 19:48:23 +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
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
99b28c1d95
refactor: start building an Android package (#205)
* refactor: start building an Android package

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

This seems also a good moment to move some packages out of the
engine, e.g., oonimkall. This package, for example, is a consumer
of the engine, so it makes sense it's not _inside_ it.

* fix: committed some stuff I didn't need to commit

* fix: oonimkall needs to be public to build

The side effect is that we will probably need to bump the major
version number every time we change one of these APIs.

(We can also of course choose to violate the basic guidelines of Go
software, but I believe this is bad form.)

I have no problem in bumping the major quite frequently and in
any case this monorepo solution is convinving me more than continuing
to keep a split between engine and cli. The need to embed assets to
make the probe more reliable trumps the negative effects of having to
~frequently bump major because we expose a public API.

* fix: let's not forget about libooniffi

Honestly, I don't know what to do with this library. I added it
to provide a drop in replacement for MK but I have no idea whether
it's used and useful. I would not feel comfortable exposing it,
unlike oonimkall, since we're not using it.

It may be that the right thing to do here is just to delete the
package and reduce the amount of code we're maintaining?

* woops, we're still missing the publish android script

* fix(publish-android.bash): add proper API key

* ouch fix another place where the name changed
2021-02-03 10:51:14 +01:00