Commit Graph

126 Commits

Author SHA1 Message Date
Simone Basso
0fc5d0e904
fix(E2E): ensure miniooni.bash is WAI (#972)
This diff re-enables `E2E/miniooni.bash`. To make it working properly, we
needed to figure out which were the right cloudfronts to use.

I looked into the configuration and determined that both cloudfronts
should be used because they basically map to the same host.

I also determined it was backwards to test a mixture of prod and testing
APIs, and probably also flaky. So, I  choose to only test the prod.

Additionally, I added support for testing all supported tunnels.

Closes https://github.com/ooni/probe/issues/2336
2022-10-08 13:14:11 +02:00
DecFox
62e9f8e101
fix: ooporthelper connection_refused (#974)
Closes https://github.com/ooni/probe/issues/2338

Co-authored-by: decfox <decfox@github.com>
2022-10-08 10:26:08 +02:00
Simone Basso
18a9523496
feat(miniooni): implement torsf tunnel (#921)
This diff adds to miniooni support for using the torsf tunnel. Such a
tunnel consists of a snowflake pluggable transport in front of a custom
instance of tor and requires tor to be installed.

The usage is like:

```
./miniooni --tunnel=torsf [...]
```

The default snowflake rendezvous method is "domain_fronting". You can
select the AMP cache instead using "amp":

```
./miniooni --snowflake-rendezvous=amp --tunnel=torsf [...]
```

Part of https://github.com/ooni/probe/issues/1955
2022-10-03 16:52:20 +02:00
Simone Basso
5466f30526
feat: autogen GH workflows and split build, test, and publish (#971)
Closes https://github.com/ooni/probe/issues/2337.
2022-10-03 14:20:54 +02:00
Simone Basso
c420c8bb29
feat(miniooni): run local oonirun v2 descriptor (#966)
We introduce the -f, --input-file FILE option with which we
are able to run an OONI Run v2 descriptor stored locally.

In this running mode, there are no checks related to whether the
descriptor has changed, since we're dealing with a local file.

Closes https://github.com/ooni/probe/issues/2328
2022-09-29 11:43:23 +02:00
DecFox
d6a362d96f
feat: port-filtering experiment (#891)
Part of https://github.com/ooni/probe/issues/2005
2022-09-14 19:54:43 +02:00
Simone Basso
34dc029b33
feat(miniooni): optionally log using emojis (#932)
As silly as it seems, emojis help _a lot_ when eyeballing logs
to quickly identify unexpected lines.

I'm doing this work as part of https://github.com/ooni/probe/issues/2257
2022-09-05 10:06:44 +02:00
Simone Basso
7df25795c0
fix(probeservices): use api.ooni.io (#926)
See https://github.com/ooni/probe/issues/2147.

Note that this PR also tries to reduce usage of legacy names inside unit/integration tests.
2022-09-02 16:48:14 +02:00
Simone Basso
d0da224a2a
feat(oonirun): improve tests (#915)
See https://github.com/ooni/probe/issues/2184

While there, rename `runtimex.PanicIfFalse` to `runtimex.Assert` (it was about time...)
2022-08-31 18:40:27 +02:00
Simone Basso
a8a29cc0dd
fix(miniooni): handle panics with --repeat-every (#914)
Most of miniooni panics on errors. We should not panic on error with
--repeat-every, rather we should try the next measurement.

See https://github.com/ooni/probe/issues/2250
2022-08-31 13:07:24 +02:00
Simone Basso
0bc6aae601
feat(miniooni): make CLI much more user friendly (#913)
Part of https://github.com/ooni/probe/issues/2184, because I wanted
to allow swapping commands and options more freely.

As a side effect, this PR closes https://github.com/ooni/probe/issues/2248.

AFAICT, every usage that was legal before is still legal. What has
changed seems the freedom to swap commands and options and a much
better help that lists the available options.
2022-08-31 12:44:46 +02:00
Simone Basso
7daa686c68
refactor(miniooni): divide et impera (#912)
This diff splits miniooni's implementation in smaller and more
easily tractable blocks ahead of future refactoring.

I'm trying to make `miniooni oonirun -i URL` as possible as
`miniooni -i URL oonirun`, because users typically expect this
kind of flexibity from modern Unix commands.

Part of https://github.com/ooni/probe/issues/2184
2022-08-31 10:20:04 +02:00
Simone Basso
705589bbe1
fix(oohelperd): measurement -> wctask (#906)
Make sure we don't say measurement in metrics.

See https://github.com/ooni/probe/issues/2183#issuecomment-1230327725
2022-08-29 18:52:30 +02:00
Simone Basso
8c855ca597
fix(oohelperd): metrics improvements after design review (#903)
This diff updates the metrics according to https://github.com/ooni/probe/issues/2183#issuecomment-1230327725
2022-08-29 16:36:46 +02:00
Simone Basso
9bd1c5ff20
fix(oohelperd): refuse to measure bogons (#898)
See the explanatory newly-added comment for more information.

Closes https://github.com/ooni/probe/issues/2064
2022-08-29 00:06:57 +02:00
Simone Basso
dcdd8fb712
feat(oohelperd): add prometheus metrics (#897)
Closes https://github.com/ooni/probe/issues/2183

While there, avoid exposing nil values for optional fields of the
THResponse struct (i.e., "ip_info" and "tls_handshake").

While there, fix `measurexlite`'s `OperationLogger` test
and make it deterministic rather than racy.
2022-08-28 23:54:22 +02:00
Simone Basso
4241ee4bc1
feat(oohelperd): log messages at info level (#896)
We're using a request-specific logger where we also print the ID
of the request. This design helps to observe logs produced by
concurrent requests.

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

While there, fix https://github.com/ooni/probe/issues/2241
2022-08-28 22:26:58 +02:00
Simone Basso
7c1b2bbcb0
refactor: move WebGetTitle inside measurexlite (#895)
Part of https://github.com/ooni/probe/issues/2240
2022-08-28 20:26:40 +02:00
Simone Basso
bb6563f363
refactor: move TH structs and definitions to model (#894)
This commit moves the TH structs and definitions to model. We don't want
oohelperd to depend on web_connectivity@v0.4.

Part of https://github.com/ooni/probe/issues/2240
2022-08-28 20:20:12 +02:00
Simone Basso
110a11828b
refactor: spin geoipx off geolocate (#893)
A bunch of packages (including oohelperd) just need the ability to
use MaxMind-like databases. They don't need the additional functionality
implemented by the geolocate package. Such a package, in fact, is
mostly (if not only) needed by the engine package.

Therefore, move code to query MaxMind-like databases to a separate
package, and avoid depending on geolocate in all the packages for
which it's sufficient to use geoipx.

Part of https://github.com/ooni/probe/issues/2240
2022-08-28 20:00:25 +02:00
Simone Basso
1e7384d1cc
feat(oohelperd): measure TLS for :443 endpoints (#886)
This diff improves oohelperd to measure :443 endpoints with TLS.

Part of https://github.com/ooni/probe/issues/2237.
2022-08-28 14:34:40 +02:00
Simone Basso
df0e099b73
feat(oohelperd): follow (and record) TH and probe endpoints (#890)
This diff introduces the following `oohelperd` enhancements:

1. measure both IP addresses resolved by the TH and IP addresses resolved by the probe;

2. when the URL scheme is http and there's no explicit port, measure both 80 and 443 (which will pay off big once we introduce support for optionally performing TLS handshakes);

3. include information about the probe and TH IP addresses into the results: who resolved each IP address, whether an address is a bogon, the ASN associated to an address.

This diff is part of https://github.com/ooni/probe/issues/2237
2022-08-28 13:49:24 +02:00
Simone Basso
867a243fef
refactor(oohelperd): make performing additional measurements easier (#889)
This diff refactors oohelperd to make performing additional measurements easier. We need:

1. to run the DNS task _before_ other tasks such that we can measure both IP addresses returned by the TH and the ones returned by the probe. When we'll introduce TLS measurements, this will allow us to validate probe-provided IP addresses inside the TH call. If probe-provided addresses work with TLS, they are legitimate for the domain.

2. to tie the number of TCP measurements to a list of endpoints collected by the probe _or_ the TH rather than just to the one provided by the probe. Anticipating this change, let us refactor how we read the results of the TCP task to make it independent of the number of addresses provided by the probe.

This work is part of https://github.com/ooni/probe/issues/2237
2022-08-28 12:17:31 +02:00
Simone Basso
b8cc548d41
fix(oohelperd): enforce timeout for each measurement step (#888)
While working on https://github.com/ooni/probe/issues/2237, I noticed
there's no enforced timeout for measurement tasks.

So, this diff introduces the following timeouts:

1. use a 4 seconds timeout for the DNS lookup;

2. use a 10 seconds timeout for TCP;

3. use a 15 seconds timeout for HTTP.

They are a bit stricter than what we have on the probe because the TH
should supposedly have better bandwidth and connectivity.
2022-08-28 12:02:17 +02:00
Simone Basso
d711c19b55
fix(oohelperd): by default listen on localhost (#887)
Part of https://github.com/ooni/probe/issues/2183
2022-08-28 11:54:15 +02:00
Simone Basso
080abf90d9
feat(dnsovergetaddrinfo): collect the CNAME (#876)
* feat(dnsovergetaddrinfo): collect the CNAME

This diff modifies how dnsovergetaddrinfo.go works such that the
returned DNSResponse includes the CNAME.

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

While there, recognize that we can remove getaddrinfoLookupHost and
always call getaddrinfoLookupANY everywhere. (This simplification is
why we did https://github.com/ooni/probe-cli/pull/874.)

* fix: extra debugging because of failing CI

Everything is OK locally (on macOS). However, maybe things are a bit
different on GNU/Linux perhaps?

Here's the error:

```
--- FAIL: TestPass (0.11s)
    resolver_test.go:113: unexpected rcode
FAIL
coverage: 95.7% of statements
FAIL	github.com/ooni/probe-cli/v3/internal/cmd/jafar/resolver	0.242s
```

I'm a bit confused because jafar's resolver is _unrelated_. But actually this
error never occurred again after a committed the debugging diff.
2022-08-23 13:53:08 +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
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
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
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
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
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
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
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
2502a237fb
cleanup: netx does not use netxlite legacy names (#801)
This diff refactors netx and netxlite to ensure we're not using
netxlite legacy names inside of netx.

To this end, we're cheating a bit. We're exposing a new factory to
get an unwrapped stdlib resolver rather than defining a legacy name
to export the private name of the same factory.

This is actually a fine place to stop, for now, the next and
netxlite refactoring at https://github.com/ooni/probe/issues/2121.
2022-06-06 14:46:44 +02:00
Simone Basso
07c0b08505
cleanup(netxlite): drop the DefaultDialer legacy name (#796)
Part of https://github.com/ooni/probe/issues/2121
2022-06-05 18:44:17 +02:00
Simone Basso
15da0f5344
cleanup(jafar): do not depend on netx and urlgetter (#792)
There's no point in doing that. Also, once this change is merged, it becomes easier to cleanup/simplify netx.

See https://github.com/ooni/probe/issues/2121
2022-06-02 22:25:37 +02:00
Simone Basso
58adb68b2c
refactor: move tracex outside of engine/netx (#782)
* refactor: move tracex outside of engine/netx

Consistently with https://github.com/ooni/probe/issues/2121 and
https://github.com/ooni/probe/issues/2115, we can now move tracex
outside of engine/netx. The main reason why this makes sense now
is that the package is now changed significantly from the one
that we imported from ooni/probe-engine.

We have improved its implementation, which had not been touched
significantly for quite some time, and converted it to unit
testing. I will document tomorrow some extra work I'd like to
do with this package but likely could not do $soon.

* go fmt

* regen tutorials
2022-06-02 00:50:55 +02:00
Simone Basso
923d81cdee
refactor(netxlite): introduce the getaddrinfo transport (#775)
This diff modifies the system resolver to use a getaddrinf transport.

Obviously the transport is a fake, but its existence will allow us
to observe DNS events more naturally.

A lookup using the system resolver would be a ANY lookup that will
contain all the resolved IP addresses into the same response.

This change was also part of websteps-illustrated, albeit the way in
which I did it there was less clean than what we have here.

Ref issue: https://github.com/ooni/probe/issues/2096
2022-06-01 09:59:44 +02:00
Simone Basso
bbcd2e2280
refactor(netx): merge archival, trace, and the savers (#772)
This diff creates a new package under netx called tracex that
contains everything we need to perform measurements using events
tracing and postprocessing (which is the technique with which
we implement most network experiments).

The general idea here is to (1) create a unique package out of
all of these packages; (2) clean up the code a bit (improve tests,
docs, apply more recent code patterns); (3) move the resulting
code as a toplevel package inside of internal.

Once this is done, netx can be further refactored to avoid
subpackages and we can search for more code to salvage/refactor.

See https://github.com/ooni/probe/issues/2121
2022-05-31 21:53:01 +02:00
Simone Basso
7a0a156aec
Spring cleanup: remove unused/unneded code (#761)
* cleanup: remove the archival package

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

* cleanup: remove websteps fall 2021 edition

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

* cleanup: remove JavaScript based testing framework

https://github.com/ooni/probe/issues/2116

* cleanup: remove the unused ooapi package

See https://github.com/ooni/probe/issues/2116
2022-05-25 13:21:39 +02:00
Simone Basso
8b0815efab
cleanup: move legacy from internal/engine to internal (#759)
No functional change.

See https://github.com/ooni/probe/issues/2115
2022-05-25 10:19:03 +02:00
Simone Basso
2d721baa91
cleanup: merge httpheader and httpfailure into model (#758)
These two small packages could easily be merged into the model
package, since they're clearly model-like packages.

Part of https://github.com/ooni/probe/issues/2115
2022-05-25 09:54:50 +02:00
Simone Basso
d922bd9afc
cleanup: mark more integration tests as !short mode (#755)
The objective is to make PR checks run much faster.

See https://github.com/ooni/probe/issues/2113 for context.

Regarding netxlite's tests:

Checking for every commit on master or on a release branch is
good enough and makes pull requests faster than one minute since
netxlite for windows is now 1m slower than coverage.

We're losing some coverage but coverage from integration tests
is not so good anyway, so I'm not super sad about this loss.
2022-05-24 21:01:15 +02:00