Commit Graph

1070 Commits

Author SHA1 Message Date
Simone Basso
342a74cad8
fix(MOBILE/android): make scripts monorepo compatible (#866)
This diff contains minor changes to make the build scripts in here
compatible with https://github.com/bassosimone/monorepo.

See 5e4c797380
2022-08-17 18:47:09 +02:00
Simone Basso
b7cc22bcbf
fix(Makefile): re-enable Android builds (#865)
It turns out the problem described in https://github.com/ooni/probe/issues/2122
only affects darwin/arm64, so we should be good to re-enable Android.
2022-08-17 17:17:35 +02:00
Simone Basso
6de4c51315
doc: minor Readme.md changes 2022-08-17 13:54:23 +02:00
Ain Ghazal
d50a39ae92
feat: avoid safe options to be serialized into the measurement (#859)
Skip options that begin with the `Safe` prefix from appearing in the
serialization of a Measurement that will be submitted to the OONI
backend.

Fixes https://github.com/ooni/probe/issues/2214
2022-08-17 13:48:59 +02:00
Simone Basso
2083edb258
cleanup: chmod -x mk && mv mk Makefile (#863)
While there, document what we need to document without mentioning too
many details about release builds, for which we have the Makefile.

See https://github.com/ooni/probe/issues/2218.
2022-08-17 13:46:41 +02:00
Simone Basso
5c0368c862
refactor(mk): move build rules into separate scripts (#855)
See https://github.com/ooni/probe/issues/2218
2022-08-17 13:16:53 +02:00
Simone Basso
4e99e5030a
fix(registry): ensure we can run telegram and webconnectivity (#862)
I made a mistake while adapting code from an experimental branch thus
breaking these two experiments because of interface conversion.

This diff fixes it.

While there, remove the panic trap for miniooni. Because miniooni is
an experimental tool, we want to see the full panic text, which definitely
leads to a more pleasant and effective debugging experience.

See https://github.com/ooni/probe/issues/2216 for context on why we
were trying to change how we register experiments.

The broken commit is 6a0ae5c70b.
2022-08-17 12:17:52 +02:00
Simone Basso
3cc2ce0b81
cleanup: define required Go version just once (#861)
See https://github.com/ooni/probe/issues/2217
2022-08-17 11:39:38 +02:00
Simone Basso
6a0ae5c70b
refactor(engine): allow scripts to register experiments (#860)
See https://github.com/ooni/probe/issues/2216
2022-08-17 10:57:03 +02:00
DecFox
69602abe8a
refactor(simplequicping): use step-by-step (#852)
See https://github.com/ooni/probe/issues/2159 and https://github.com/ooni/spec/pull/254
2022-08-17 09:19:11 +02:00
DecFox
fbd7cd2b7e
feat: add support for system resolver in measurexlite (#858)
* feat: add support for system resolver in measurexlite

* more tests for coverage

* Apply suggestions from code review

Co-authored-by: decfox <decfox@github.com>
Co-authored-by: Simone Basso <bassosimone@gmail.com>
2022-08-11 18:18:25 +02:00
DecFox
fc51590a67
feat: refactor dns implementation in measurexlite (#857)
* refactor: remove query-based mapping and introducing resolver wrapper

* refactor dnsping to adapt to measurexlite

* dnsping: extra comments

* Apply suggestions from code review

* Update internal/measurexlite/dns_test.go

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

Co-authored-by: decfox <decfox@github.com>
Co-authored-by: Simone Basso <bassosimone@gmail.com>
2022-08-11 16:00:37 +02:00
DecFox
576b52b1e3
feat: collect system resolver results using context (#856)
* feat: Introduce context-based tracing to the system resolver

* testing: added tests for context-based tracing in netxlite resolvers

* Apply suggestions from code review

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

Co-authored-by: decfox <decfox@github.com>
Co-authored-by: Simone Basso <bassosimone@gmail.com>
2022-08-11 10:20:28 +02:00
Simone Basso
a818373e2c
contributing: mention go channels axioms 2022-07-08 19:49:20 +02:00
DecFox
5501b2201a
feat: dnsping using step-by-step (#831)
Reference issue for this pull request: https://github.com/ooni/probe/issues/2159

This diff refactors the `dnsping` experiment to use the [step-by-step measurement style](https://github.com/ooni/probe-cli/blob/master/docs/design/dd-003-step-by-step.md).

Co-authored-by: decfox <decfox@github.com>
Co-authored-by: Simone Basso <bassosimone@gmail.com>
2022-07-08 19:42:24 +02:00
Simone Basso
8aad36a257
feat(miniooni): introduce the --repeat-every command line flag (#819)
Until OONI Run v2 has support for repeating the measurement with a schedule, introduce a command line flag requested by users to repeat a measurement every given number of seconds.

Part of https://github.com/ooni/probe/issues/2184
2022-07-08 17:04:31 +02:00
Simone Basso
9a0153a349
feat(oonirun): add support for OONIRun v2 links (#844)
This diff adds support for OONIRun v2 links.

Part of https://github.com/ooni/probe/issues/2184.
2022-07-08 16:53:59 +02:00
Simone Basso
ebb78c2848
feat(oonirun): implement OONIRun v1 (#843)
This diff adds support for running OONIRun v1 links.

Run with `miniooni` using:

```
./miniooni -i LINK oonirun
```

Part of https://github.com/ooni/probe/issues/2184
2022-07-08 15:17:52 +02:00
Simone Basso
0b4a49190a
feat: start sketching out the oonirun package (#842)
This diff refactors the ./internal/cmd/miniooni pkg and moves the code
for running experiments inside of the ./internal/oonirun pkg.

It's the first concrete step towards https://github.com/ooni/probe/issues/2184.
2022-07-08 14:20:49 +02:00
Simone Basso
e5697e641e
fix(engine): repair broken integration test (#841)
The integration test that was broken was:

```
--- FAIL: TestCreateInvalidExperiment (0.35s)
    experiment_integration_test.go:192: expected a nil builder here
```

While there improve the documentation of the ExperimentSession
and see there's a method that we are not using.

This diff is a cleanup that I come up with while working
on https://github.com/ooni/probe/issues/2184.
2022-07-08 13:12:12 +02:00
Simone Basso
a960ca51f0
cleanup(miniooni): remove --limit option (#840)
This option has been disabled for a long time and we said in the
codebase we were going to remove it after 2021-11-01.

So, it feels okay to remove it.

This diff is a cleanup in preparation for https://github.com/ooni/probe/issues/2184.
2022-07-08 12:42:02 +02:00
Simone Basso
97864b324f
refactor(engine): more abstract Experiment{,Builder} (#838)
This diff modifies the engine package to make Experiment and
ExperimentBuilder interfaces rather than structs.

The previosuly existing structs are now named experiment{,Builder}.

This diff helps https://github.com/ooni/probe/issues/2184
because it allows us to write unit tests more easily.

There should be no functional change.

While there, I removed a bunch of deprecated functions, which were
unnecessarily complicate the implementation and could be easily
replaced by passing them a context.Context or context.Background().
2022-07-08 12:29:23 +02:00
Simone Basso
5b27df1a37
measurexlite: fix flaky tls_test.go (#839)
Bug reported by @DecFox and subsequently observed in several
CI builds. No need to create an issue.
2022-07-08 12:29:08 +02:00
Simone Basso
086ae43b15
refactor(engine): set options from any value (#837)
This diff refactors how we set options for experiments to accept
in input an any value or a map[string]any, depending on which method
we choose to actually set options.

There should be no functional change, except that now we're not
guessing the type and then attempting to set the value of the selected
field: now, instead, we match the provided type and the field's type
as part of the same function (i.e., SetOptionAny).

This diff is functional to https://github.com/ooni/probe/issues/2184,
because it will allow us to load options from a map[string]any,
which will be part of the OONI Run v2 JSON descriptor.

If we didn't apply this change, we would only have been to set options
from a map[string]string, which is good enough as a solution for the
CLI but is definitely clumsy when you have to write stuff like:

```JSON
{
  "options": {
    "HTTP3Enabled": "true"
  }
}
```

when you could instead more naturally write:

```JSON
{
  "options": {
    "HTTP3Enabled": true
  }
}
```
2022-07-08 11:51:59 +02:00
Simone Basso
6019b25baf
refactor(engine): *http.Client -> model.HTTPClient (#836)
This diff makes the implementation of the engine package more
abstract by changing HTTPClient() to return a model.HTTPClient
as opposed to returning an *http.Client.

Part of https://github.com/ooni/probe/issues/2184
2022-07-08 11:08:10 +02:00
Simone Basso
d419ed8ac8
refactor(oohelperd): improve tests implementation (#835)
After this diff has landed, we have addressed all the points
originally published at https://github.com/ooni/probe/issues/2134.
2022-07-05 20:25:18 +02:00
Simone Basso
535a5d3e00
refactor(oohelperd): flatten package hierarchy (#834)
In https://github.com/ooni/probe-cli/pull/832's initial diff, I
mentioned it would be cool to flatten oohelperd's hier.

I'm doing this now, and just for the master branch.

This diff is mostly a mechanical refactoring with very light
and apparently rather safe manual changes.
2022-07-05 19:10:39 +02:00
Simone Basso
a4d17085f5
fix(oohelperd): use throw-away HTTPClient, Dialer, Resolver (#833)
This diff modifies the implementation of oohelperd in the master branch
to always use throw-away HTTPClient, Dialer, and Resolver.

The rationale of this change is to ensure we're not hitting limits of the
HTTPClient regarding the max number of connections per host.

This issue is described at https://github.com/ooni/probe/issues/2182.

While there, it feels more correct to use throw-away Dialer and Resolver.

We have a different patch for the release/3.15 branch because of
netx-related refactorings: https://github.com/ooni/probe-cli/pull/832.
2022-07-05 18:41:35 +02:00
Ain Ghazal
59410edba9
doc(step-by-step): further improvements on design doc (#830)
* doc(step-by-step): further improvements on design doc

* Update docs/design/dd-003-step-by-step.md

* Update dd-003-step-by-step.md

Co-authored-by: Simone Basso <bassosimone@gmail.com>
2022-07-04 11:35:45 +02:00
Simone Basso
5ebdeb56ca
feat: tlsping and tcpping using step-by-step (#815)
## Checklist

- [x] I have read the [contribution guidelines](https://github.com/ooni/probe-cli/blob/master/CONTRIBUTING.md)
- [x] reference issue for this pull request: https://github.com/ooni/probe/issues/2158
- [x] if you changed anything related how experiments work and you need to reflect these changes in the ooni/spec repository, please link to the related ooni/spec pull request: https://github.com/ooni/spec/pull/250

## Description

This diff refactors the codebase to reimplement tlsping and tcpping
to use the step-by-step measurements style.

See docs/design/dd-003-step-by-step.md for more information on the
step-by-step measurement style.
2022-07-01 12:22:22 +02:00
Simone Basso
5371c7f486
fix(workflows): elevate GITHUB_TOKEN permissions when needed (#822)
I am not 100% sure I was able to fix all the cases in which we
need higher permissions than the strict default.

At least, I tried.

It may be reasonable to make an interim release to check whether I
successfully fixed all the cases.

Ref issue: https://github.com/ooni/probe/issues/2154
2022-07-01 12:11:32 +02:00
Simone Basso
9b08dcac3f
fix(oonimkall): only set annotations on success (#821)
This bug is one of these bugs that definitely help one to stay
humble and focused on improving the codebase.

Of course I `<facepalmed>` when I understood the root cause.

We did not move the annotations below the `if` which is checking
whether the measurement was successful when we refactored the
codebase to support returning multiple measurements per run, which
happened in https://github.com/ooni/probe-cli/pull/527.

While I am not going to whip myself too much because of this, it's
clearly a bummer that we didn't notice this bug back then. On top
of this, it's also quite sad it took us so much time to notice that
there was this bug inside the tree.

The lesson (hopefully) learned is probably that we need to be more
careful when we refactor and we should always ask the question of
whether, not only we have tests, but whether these tests could maybe
be improved to give us even more confidence about correctness.

The reference issue is https://github.com/ooni/probe/issues/2173.
2022-07-01 09:54:35 +02:00
Ain Ghazal
74aebedac3
doc(step-by-step): readability improvements (#820)
This diff contains readability improvements for the step-by-step design document.

Co-authored-by: Simone Basso <bassosimone@gmail.com>
2022-06-30 09:55:18 +02:00
Simone Basso
797dd27ffc
chore: avoid duplicating the code of conduct (#818) 2022-06-28 12:52:18 +02:00
Simone Basso
d4f530b7ea
chore: use go1.18.3 (#816)
This diff changes all github actions and mk to use go1.18.3.

That's what I am using locally.

Also, both oohttp and oocrypto are on go1.18.3 already.
2022-06-17 20:12:14 +02:00
Simone Basso
28585fbdc2
doc: mention step-by-step design document
This commit changes the README of `./internal` to make
sure we're referring to the step-by-step design doc.
2022-06-17 11:02:54 +02:00
Simone Basso
c3fb7308d8
doc: mention how to generate a dependency graph
Thanks @ainghazal for mentioning this useful tool to me!
2022-06-17 10:56:47 +02:00
Simone Basso
be2da83b1b
doc: publish the step-by-step design document (#814)
This pull request publishes the step-by-step design document that I have been discussing with @hellais and @DecFox recently. Compared to the document that was approved, this one has been edited for readability.

While there, I figured it was also be beneficial to publish the few ooni/probe-cli related design documents we produced in the past, because they probably help someone to get acquainted with the codebase.

Reference issue for this pull request: https://github.com/ooni/probe/issues/2148
2022-06-14 14:38:29 +02:00
Simone Basso
1685ef75b5
refactor(netxlite): expose useful HTTPTransport/DNSTransport factories (#813)
These factories will soon be useful to finish with
https://github.com/ooni/probe/issues/2135.
2022-06-09 00:30:18 +02:00
Simone Basso
1a706e47bc
refactor(netxlite): more abstract proxy-enabled dialer construction (#812)
This will help with https://github.com/ooni/probe/issues/2135
2022-06-08 23:10:06 +02:00
Simone Basso
bf7ea423d3
refactor(sessionresolver): replace dnsclientmaker with function (#811)
See https://github.com/ooni/probe/issues/2135
2022-06-08 22:29:01 +02:00
Simone Basso
a02cc6100b
refactor(sessionresolver): minor changes in files and types naming (#810)
Part of https://github.com/ooni/probe/issues/2135
2022-06-08 22:01:51 +02:00
Simone Basso
beba543b98
cleanup: use NewHTTPTransportWithResolver more often (#808)
We can simplify code in a bunch of places using a useful factory.

Part of https://github.com/ooni/probe/issues/2121.
2022-06-08 15:13:01 +02:00
Simone Basso
f1b8071c65
hotfix(sessionresolver): prevent data race inside http3 (#809)
See https://github.com/ooni/probe/issues/2135#issuecomment-1149840579
2022-06-08 15:06:15 +02:00
Simone Basso
fe29b432e0
refactor: start refactoring session resolver (#807)
This diff addresses the following points of https://github.com/ooni/probe/issues/2135:

- [x] the `childResolver` type is useless and we can use `model.Resolver` directly;
- [x] we should use `model/mocks` instead of custom fakes;
- [x] we should not use `log.Log` rather we should use `model.DiscardLogger`;
- [x] make `timeLimitedLookup` easier to test with a `-short` tests;
- [x] ensure `timeLimitedLookup` returns as soon as its context expires regardless of the child resolver;

Subsequent diffs will address more points mentioned in there.
2022-06-08 14:06:22 +02:00
Simone Basso
dea23b49d5
refactor(oohelperd): use netxlite rather than netx (#806)
The oohelperd implementation did not actually need using netx because
it was just constructing default types with logging, which is what
netxlite already does. Hence, let's avoid using netx here.

See https://github.com/ooni/probe/issues/2121
2022-06-08 10:14:10 +02:00
Simone Basso
87d35f4225
refactor(oohelper): use netxlite rather than netx (#805)
The oohelper does not need to use netx and it's enough to use
netxlite, hence let us apply this refactor.

The original code used DoT but the explanatory comment said we were
using DoT because of unclear issues inside GitHub actions.

We are now using DoH and this is fine as well. The comment implied
that any encrypted transport would do.

See https://github.com/ooni/probe/issues/2121
2022-06-08 09:52:47 +02:00
Simone Basso
4cf58380c3
[forwardport] fix(stunreachability): don't emit spurious progress events (#803)
This diff forward ports 4fb5f7de69b900cfc2bd211f723108a67bda350d to master.

See https://github.com/ooni/probe/issues/2058#issuecomment-1145847069

This diff WILL need to be forwardported to master.
2022-06-06 16:21:17 +02:00
Simone Basso
504181906a
[forwardport] fix(dnscheck): remove apparently-broken static input (#804)
This diff forward ports 261d1a4cdc88522f6a8f63d6c540f51054566b28 to master
whose original commit message follows:

- - -

It's not working for me from a couple of places and also it does not
seem to be documented upstream, see:

https://docs.namebase.io/guides-1/resolving-handshake-1/hdns.io

This diff WILL need to be forwardported to master.
2022-06-06 16:08:09 +02:00
Simone Basso
57e207e644
doc(netx): reference issue mentioning future improvements (#802)
See https://github.com/ooni/probe/issues/2121#issuecomment-1147424810
2022-06-06 15:16:30 +02:00