ooni-probe-cli/internal/engine
Simone Basso c2ea0b4704
feat(webconnectivity): try all the available THs (#980)
We introduce a fork of internal/httpx, named internal/httpapi, where there is a clear split between the concept of an API endpoint (such as https://0.th.ooni.org/) and of an API descriptor (such as using `GET` to access /api/v1/test-list/url).

Additionally, httpapi allows to create a SequenceCaller that tries to call a given API descriptor using multiple API endpoints. The SequenceCaller will stop once an endpoint works or when all the available endpoints have been tried unsuccessfully.

The definition of "success" is the following: we consider "failure" any error that occurs during the HTTP round trip or when reading the response body. We DO NOT consider "failure" errors (1) when parsing the input URL; (2) when the server returns >= 400; (3) when the server returns a string that does not parse as valid JSON. The idea of this classification of failures is that we ONLY want to retry when we see what looks like a network error that may be caused by (collateral or targeted) censorship.

We take advantage of the availability of this new package and we refactor web_connectivity@v0.4 and web_connectivity@v0.5 to use a SequenceCaller for calling the web connectivity TH API. This means that we will now try all the available THs advertised by the backend rather than just selecting and using the first one provided by the backend.

Because this diff is designed to be backported to the `release/3.16` branch, we have omitted additional changes to always use httpapi where we are currently using httpx. Yet, to remind ourselves about the need to do that, we have deprecated the httpx package. We will rewrite all the code currently using httpx to use httpapi as part of future work.

It is also worth noting that httpapi will allow us to refactor the backend code such that (1) we remove code to select a backend URL endpoint at the beginning and (2) we try several endpoints. The design of the code is such that we can add to the mix some endpoints using as `http.Client` a special client using a tunnel. This will allow us to automatically fallback backend queries.

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

Related to https://github.com/ooni/probe/issues/1519.
2022-11-21 16:28:53 +01:00
..
experiment feat(webconnectivity): try all the available THs (#980) 2022-11-21 16:28:53 +01:00
geolocate fix(geolocate): always use netxlite functionality (#976) 2022-10-12 18:07:42 +02:00
mockable feat(oonirun): improve tests (#915) 2022-08-31 18:40:27 +02:00
netx refactor(datafmt): use "udp" instead of "quic" (#946) 2022-09-08 17:19:59 +02:00
probeservices fix(go-build-alpine): honour OONI_PSIPHON_TAGS (#968) 2022-10-03 11:55:47 +02:00
sessionresolver fix(probeservices): use api.ooni.io (#926) 2022-09-02 16:48:14 +02:00
testdata fix: add missing files causing tests to fail (#202) 2021-02-02 14:18:22 +01:00
.gitignore feat: support embedding encrypted psiphon config (#285) 2021-04-02 17:36:06 +02:00
allexperiments.go refactor(engine): allow scripts to register experiments (#860) 2022-08-17 10:57:03 +02:00
doc.go feat(engine): allow runner to return many measurements (#527) 2021-09-30 00:54:52 +02:00
experiment_integration_test.go feat: clearly indicate which resolver we're using (#885) 2022-08-27 15:47:48 +02:00
experiment_test.go refactor: spin geoipx off geolocate (#893) 2022-08-28 20:00:25 +02:00
experiment.go refactor(engine): scrub the whole measurement (#956) 2022-09-12 22:22:25 +02:00
experimentbuilder_test.go refactor(engine): allow scripts to register experiments (#860) 2022-08-17 10:57:03 +02:00
experimentbuilder.go refactor(engine): allow scripts to register experiments (#860) 2022-08-17 10:57:03 +02:00
inputloader_network_test.go refactor(engine): allow scripts to register experiments (#860) 2022-08-17 10:57:03 +02:00
inputloader_test.go refactor(engine): allow scripts to register experiments (#860) 2022-08-17 10:57:03 +02:00
inputloader.go fix(dnscheck): trim the static input list (#923) 2022-09-02 13:54:59 +02:00
inputprocessor_test.go refactor: interfaces and data types into the model package (#642) 2022-01-03 13:53:23 +01:00
inputprocessor.go refactor: interfaces and data types into the model package (#642) 2022-01-03 13:53:23 +01:00
location.go refactor(ooniprobe): migrate database to internal (#979) 2022-11-15 10:35:30 +01:00
saver_test.go refactor: interfaces and data types into the model package (#642) 2022-01-03 13:53:23 +01:00
saver.go feat(oonirun): improve tests (#915) 2022-08-31 18:40:27 +02:00
session_integration_test.go refactor: spin geoipx off geolocate (#893) 2022-08-28 20:00:25 +02:00
session_internal_test.go fix(ooniprobe): use ooniprobe-cli-unattended for unattended runs (#714) 2022-04-29 13:41:09 +02:00
session_nopsiphon_test.go refactor: only use shaping dialer for ndt7 and dash (#754) 2022-05-24 18:23:42 +02:00
session_nopsiphon.go refactor: only use shaping dialer for ndt7 and dash (#754) 2022-05-24 18:23:42 +02:00
session_psiphon_test.go refactor: only use shaping dialer for ndt7 and dash (#754) 2022-05-24 18:23:42 +02:00
session_psiphon.go refactor: only use shaping dialer for ndt7 and dash (#754) 2022-05-24 18:23:42 +02:00
session.go fix(E2E): ensure miniooni.bash is WAI (#972) 2022-10-08 13:14:11 +02:00
submitter_test.go refactor: interfaces and data types into the model package (#642) 2022-01-03 13:53:23 +01:00
submitter.go feat(oonirun): improve tests (#915) 2022-08-31 18:40:27 +02:00