Commit Graph

1030 Commits

Author SHA1 Message Date
Simone Basso 01a513a496 refactor: DNSTransport I/Os DNS messages (#760)
This diff refactors the DNSTransport model to receive in input a DNSQuery and return in output a DNSResponse.

The design of DNSQuery and DNSResponse takes into account the use case of a transport using getaddrinfo, meaning that we don't need to serialize and deserialize messages when using getaddrinfo.

The current codebase does not use a getaddrinfo transport, but I wrote one such a transport in the Websteps Winter 2021 prototype (https://github.com/bassosimone/websteps-illustrated/).

The design conversation that lead to producing this diff is https://github.com/ooni/probe/issues/2099
2022-05-25 17:03:58 +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 928de50145 cleanup: minor Readme.md tweaks and changes (#757) 2022-05-25 09:22:35 +02:00
Simone Basso 09523f8efb cleanup(geolocate): use netxlite rather than netx (#756)
See https://github.com/ooni/probe/issues/2114
2022-05-25 09:12:02 +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
Simone Basso 6924d1ad81 refactor: only use shaping dialer for ndt7 and dash (#754)
See https://github.com/ooni/probe/issues/2112 for context.

While there, run `go fix -fix buildtag ./...`
2022-05-24 18:23:42 +02:00
Simone Basso b68b8e1e8f fix({simplequic,tls}ping): default SNI to URL's hostname (#753)
See https://github.com/ooni/probe/issues/2111
2022-05-24 16:29:13 +02:00
Simone Basso 83cf447edd fix(oonimkall): export CheckInConfig.RunType (#752)
This commit cherry-picks e3e3b61 from release/3.15.

See https://github.com/ooni/probe/issues/2110 for context.
2022-05-23 18:41:34 +02:00
Simone Basso c8f91983ca fix(Readme.md): go1.18.2 is now required
Building with go1.17 would still probably work, but in going
forward it will not, and it's better anyway to specify the exact
version with which we expect people to build.
2022-05-23 07:15:08 +02:00
Simone Basso ebc00a95fe refactor: use ooni/oocrypto instead of ooni/go (#751)
Rather than building for Android using ooni/go, we're now using
ooni/oocryto as the TLS dependency. Such a repository only forks
crypto/tls and some minor crypto packages and includes the
same set of patches that we have been using in ooni/go.

This new strategy should be better than the previous one in
terms of building for Android, because we can use the vanilla
go1.18.2 build. It also seems that it is easier to track and
merge from upstream with ooni/oocrypto than it is with ooni/go.

Should this assessment be wrong, we can revert back to the
previous scenario where we used ooni/go.

See https://github.com/ooni/probe/issues/2106 for extra context.
2022-05-22 19:53:37 +02:00
Simone Basso a1df3b4070 chore: upgrade to go1.18.2 (#750)
I have not upgraded ooni/go yet because I am also checking whether it
would be possible instead to use ooni/oocrypto as documented in the
https://github.com/ooni/probe/issues/2106 issue.

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

Closes https://github.com/ooni/probe/issues/2077
2022-05-22 18:11:37 +02:00
Simone Basso 395961c4da chore: we're not hacking on v3.16.0-alpha (#749)
See https://github.com/ooni/probe/issues/2100
2022-05-20 20:03:48 +02:00
Simone Basso a4bdc6dea0 fix(mk): use NDK version that works with gomobile (#748)
The one we were using previously does not work, so use the LTS
rather than using the latest non-LTS stable.

Part of https://github.com/ooni/probe/issues/2100
2022-05-20 13:06:50 +02:00
Simone Basso 6713fc6bc6 cleanup(geolocate): remove IP lookuppers blocked by sanctions (#747)
Closes https://github.com/ooni/probe/issues/2104
2022-05-20 12:43:56 +02:00
Simone Basso e5d59e834e chore: update the user-agent used for measuring (#746)
See https://github.com/ooni/probe/issues/2100
2022-05-20 12:43:37 +02:00
Simone Basso f626a015c9 feat(ooniprobe): add vanilla_tor to experimental (#745)
While there make vanilla_tor only run in unattended mode.

While there also make torsf unattended-mode only.

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

See https://github.com/ooni/probe/issues/2057
2022-05-20 11:47:22 +02:00
Simone Basso 733ce44292 chore(mk): update the version of the tools we use (#744)
See https://github.com/ooni/probe/issues/2100
2022-05-19 22:09:54 +02:00
Simone Basso 1a7234e0f1 chore: run go generate ./... (#743)
See https://github.com/ooni/probe/issues/2100
2022-05-19 20:44:39 +02:00
Simone Basso 518511de67 chore: update all dependencies (#742)
See https://github.com/ooni/probe/issues/2100

See also https://github.com/ooni/probe/issues/2069: we needed to
retain the original version of bifurcation/mint as explained in there.
2022-05-19 18:59:39 +02:00
Simone Basso dc641784c3 chore: upgrade to ooni/probe-assets v0.9.0 (#741)
See https://github.com/ooni/probe/issues/2100
2022-05-19 16:42:50 +02:00
Simone Basso 5c2f031163 chore: use go1.17.10 (#740)
See https://github.com/ooni/probe/issues/2100
2022-05-19 14:41:36 +02:00
Simone Basso 30e1ed9f40 fix(ooniprobe show): correctly handle % in the JSON (#738)
This diff fixes the way in which we print JSON results inside
`ooniprobe show <ID>` by using the "%s" fmt specifier rather than
using the JSON string itself as the format string.

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

FWIW, `ooniprobe show --batch <ID>` was already WAI.
2022-05-18 16:56:13 +02:00
DecFox cced980387 fix(webconnectivity): pass TestHelpers to measurement (#736)
* Passed the TestHelpers field to RunAsyc and MeasureAsync. This reflects the test_helpers in the measurement.

* Spec already contains the correct output.

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

Co-authored-by: decfox <decfox>
2022-05-18 15:46:08 +02:00
stergem 143fd498d5 fix(ooniprobe): remove empty measurements directories (#720)
See https://github.com/ooni/probe/issues/2090

Co-authored-by: Simone Basso <bassosimone@gmail.com>
2022-05-18 15:32:38 +02:00
Simone Basso 1f83c19853 fix(backend api): re-enable previosuly disabled tests (#737)
See https://github.com/ooni/probe/issues/2098
2022-05-18 11:31:46 +02:00
Simone Basso 7c45f7b88c fix(netxlite): ensure we only accept DNS responses (#735)
Previously, the DNS decoder did not check whether it was parsing
a DNS query or a DNS response, which was wrong.

As a side note, it seems I am using "reply" in the codebase instead
of "response". The latter seems correct DNS terminology.

This diff has been extracted from https://github.com/bassosimone/websteps-illustrated/commit/9249d14f80b4c685234da8e344b36c8904ee69e9

See https://github.com/ooni/probe/issues/2096.
2022-05-16 11:17:30 +02:00
Simone Basso ce052b665e feat(netxlite): implements NS queries (#734)
This diff has been extracted from https://github.com/bassosimone/websteps-illustrated/commit/eb0bf38957e79fbad198fcdc9f9c7b36f61a8e2c.

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

While there, skip the broken tests caused by issue
https://github.com/ooni/probe/issues/2098.
2022-05-16 10:46:53 +02:00
Simone Basso c1b06a2d09 fix(netxlite): prefer composition over embedding (#733)
This diff has been extracted and adapted from https://github.com/bassosimone/websteps-illustrated/commit/8848c8c516a40663c2718b1aff271884a116a147

The reason to prefer composition over embedding is that we want the
build to break if we add new methods to interfaces we define. If the build
does not break, we may forget about wrapping methods we should
actually be wrapping. I noticed this issue inside netxlite when I was working
on websteps-illustrated and I added support for NS and PTR queries.

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

While there, perform comprehensive netxlite code review
and apply minor changes and improve the docs.
2022-05-15 19:25:27 +02:00
Simone Basso 9d2301cae2 fix(netxlite): reject replies with wrong queryID (#732)
This diff has been extracted from https://github.com/bassosimone/websteps-illustrated/commit/c2f7ccab0ec971d5c084ea4c571b76f7530b28ee

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

While there, export DecodeReply to decode a raw reply without
interpreting the Rcode or parsing the results, which seems a
nice extra feature to have to more flexibly parse DNS replies
in other parts of the codebase.
2022-05-14 19:38:46 +02:00
Simone Basso f5b801ae95 refactor(netxlite): add Transport suffix to DNS transports (#731)
This diff has been extracted from https://github.com/bassosimone/websteps-illustrated/commit/c2f7ccab0ec971d5c084ea4c571b76f7530b28ee

See https://github.com/ooni/probe/issues/2096
2022-05-14 17:38:31 +02:00
Simone Basso 6c388d2c61 netxlite: factor common code for parsing UDPAddr (#730)
This diff has been extracted from https://github.com/bassosimone/websteps-illustrated/commit/c2f7ccab0ec971d5c084ea4c571b76f7530b28ee

See https://github.com/ooni/probe/issues/2096
2022-05-14 17:15:08 +02:00
Simone Basso 2238908afe cleanup(quic): wait for handshake completion in netxlite (#729)
See https://github.com/ooni/probe/issues/2097
2022-05-14 16:32:32 +02:00
Simone Basso 5904e6988d fix(netxlite): map servfail error (#728)
This error occurred for example when querying kazemjalali.com
in websteps measurements run from Iran.

This error is relatively uncommon, but it still makes sense to
create a specific mapping rule for it.

Originally: https://github.com/bassosimone/websteps-illustrated/commit/4269e82fbda40a7c35c1ebdc212d12f4c5053bd9

See https://github.com/ooni/probe/issues/2096
2022-05-13 19:25:22 +02:00
Simone Basso b872dd0e1e fix(netxlite): HTTPSSvc: better no_answer checks (#727)
I've seen some measurements returning some IP addresses for HTTPSSvc
queries but not returning any ALPN value.

For example:

```
% d4
decoding DNS round trip 0:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57768
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;psiphon.ca.                    IN      HTTPS

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57768
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;psiphon.ca.                    IN      HTTPS
;; ANSWER SECTION:
psiphon.ca.             121     IN      A       31.13.85.53
```

Now, the response is clearly bogus. At the time of this writing that
IP address belongs to Facebook. This measurement has been collected in
China, so it's expected for the GFW to behave like this.

Yet, I don't feel like it's accurate to report this measurement as a
"no answer" response. Rather, this response is a valid one containing
a clearly invalid IP address and should be flagged as such.

Originally: https://github.com/bassosimone/websteps-illustrated/commit/57a023bcf4ebb1dd9dbdac83c18dc53a165011f8

See https://github.com/ooni/probe/issues/2096
2022-05-13 19:00:51 +02:00
Simone Basso 192dfd49b4 fix(netxlite): consolidate IPv4/IPv6 checking code (#726)
Originally https://github.com/bassosimone/websteps-illustrated/commit/966e7f7cdde534dca8beaf54dda08746660cc324

See https://github.com/ooni/probe/issues/2096
2022-05-13 18:49:18 +02:00
Simone Basso e126e73de7 fix(netxlite): LookupHTTPS: short circuit IP addr (#725)
This diff fixes the short-circuit-IP-addr resolver to
correctly handle IP addrs during LookupHTTPS.

The original diff was: https://github.com/bassosimone/websteps-illustrated/commit/2b51d144bf642f10237102bdc79a0defc30c1579

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

While there, add unit tests for IPv6.
2022-05-13 18:26:15 +02:00
Simone Basso ec0561ea8c feat(netxlite): implement parallel resolver (#724)
This diff imports the parallel resolver from websteps winter 2022
edition, which was originally implemented here:

https://github.com/bassosimone/websteps-illustrated/commit/55231d73cd822a851f532dea1b8089694d58100e

See https://github.com/ooni/probe/issues/2096
2022-05-13 17:36:58 +02:00
Simone Basso 0efd4ff130 chore: import improved bogons handling code (#723)
This diff imports improved bogons handling code from websteps
winter 2022 edition's repository.

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

See https://github.com/bassosimone/websteps-illustrated/blob/a65f3e8579b59565789a1f38c468b0a9646783cd/internal/netxlite/bogon.go
2022-05-13 15:32:47 +02:00
Simone Basso 1776ea1288 cleanup: remove websteps summer 2021 implementation (#722)
See https://github.com/ooni/probe/issues/2094
2022-05-13 15:06:03 +02:00
Simone Basso e93756be20 chore(ci): start saving/restoring go build cache (#721)
This commit uses a build cache for the coverage and netxlite github actions.

See https://github.com/ooni/probe/issues/2093.
2022-05-13 14:39:06 +02:00
Yeganathan S ded4b08113 fix(ndt7): discards all incoming websockets messages during upload (#719)
See https://github.com/ooni/probe/issues/2084
2022-05-12 08:18:05 +02:00
Simone Basso b7cc309901 feat: re-implement the vanilla_tor experiment (#718)
This diff re-implements the vanilla_tor experiment. This experiment was
part of the ooni/probe-legacy implementation.

The reference issue is https://github.com/ooni/probe/issues/803. We didn't
consider the possible improvements mentioned by the
https://github.com/ooni/probe/issues/803#issuecomment-598715694 comment,
which means we'll need to create a follow-up issue for them. We will
then decide whether, when, and how to implement those follow-up measurements
either into `vanilla_tor` or into the existing `tor` experiment.

This novel `vanilla_tor` implementation emits test_keys that are mostly
compatible with the original implementation, however:

1. the `timeout` is a `float64` rather than integer (but the default
timeout is an integer, so there are no JSON-visible changes);

2. the `tor_log` string is gone and replaced by the `tor_logs` list
of strings, which contains the same information;

3. the definition of `error` has been augmented to include the
case in which there is an unknown error;

4. the implementation of vanilla_tor mirrors closely the one of torsf
and we have taken steps to make the two implementations as comparable
as possible in terms of the generated JSON measurement.

The main reason why we replaced `tor_log` with `tor_logs` are:

1. that `torsf` already used that;

2. that reading the JSON is easier with this implementation compared to
an implementation where all logs are into the same string.

If one is processing the new data format using Python, then it will
not be difficult convert `tor_log` to `tor_logs`. In any case, because
we extract the most interesting fields (e.g., the percentage of the
bootstrap where tor fails), it seems that logs are probably more useful
as something you want to read in edge cases (I guess).

Also, because we want `torsf` and `vanilla_tor` to have similar JSONs,
we renamed `torsf`'s `default_timeout` to `timeout`. This change has little
to none real-world impact, because no stable version of OONI Probe has
ever shipped a `torsf` producing the `default_timeout` field.

Regarding the structure of this diff, we have:

1. factored code to parse tor logs into a separate package;

2. implemented `vanilla_tor` as a stripped down `torsf` and added further
changes to ensure compatibility with the previous `vanilla_tor`'s data format;

3. improved `torsf` to merge back the changes in `vanilla_tor`, so the two
data formats of the two experiments are as similar as possible.

We believe producing as similar as possible data formats helps anyone who's
reading measurements generated by both experiments.

We have retained/introduced `vanilla_tor`'s `error` field, which is not very
useful when one has a more precise failure but is still what `vanilla_tor`
used to emit, so it makes sense to also have this field.

In addition to changing the implementation, we also updated the specs.

As part of our future work, we may want to consider factoring the common code
of these two experiments into the same underlying support library.
2022-05-10 15:43:28 +02:00
Yeganathan S 3d81845614 fix(httpx): correctly combine paths (#706)
See https://github.com/ooni/probe/issues/2010

Co-authored-by: Simone Basso <bassosimone@gmail.com>
2022-05-09 21:32:49 +02:00
Simone Basso 36ca28d673 feat: add a simple dnsping experiment (#674)
See https://github.com/ooni/probe/issues/1987 (issue).

See https://github.com/ooni/spec/pull/238 (impl).

While there, fix the build for go1.18 by adding go1.18 specific tests. I was
increasingly bothered by the build being red.
2022-05-09 15:28:18 +02:00
Simone Basso a7a6d7df7f feat: introduce the simplequicping experiment (#717)
See https://github.com/ooni/probe/issues/2091 (issue) and https://github.com/ooni/spec/pull/237 (spec).
2022-05-09 11:22:44 +02:00
Simone Basso 2917dd6c76 feat: introduce the tlsping experiment (#716)
See https://github.com/ooni/probe/issues/2088 (issue) and https://github.com/ooni/spec/pull/236 (spec).
2022-05-09 10:25:50 +02:00
Simone Basso e983a5cffb feat: introduce the tcpping experiment (#696)
See https://github.com/ooni/probe/issues/2030 (reference issue) and https://github.com/ooni/spec/pull/235 (spec).
2022-05-09 09:33:18 +02:00
stergem 8010e9783a chore: upgrade to github.com/upper/db/v4 (#705)
* Upgrade to github.com/upper/db/v4

* fix(oonitest): repair imports after merge

Oops, okay, it seems the merge did not preserve all the import
changes, so let's ensure we use the right imports here!

* cleanup(go.mod): don't refer to upper.io/db/v3

These lines didn't disappear previously because the merge commit
failed to remove all references to upper.io/db/v3.

Co-authored-by: stergem <sgemelas@protonmail.com>
Co-authored-by: Simone Basso <bassosimone@gmail.com>
2022-05-06 13:05:24 +02:00