Commit Graph

828 Commits

Author SHA1 Message Date
Simone Basso
5c217594d7
refactor(errorsx): autogenerate all failure names (#474)
Part of https://github.com/ooni/probe/issues/1591
2021-09-07 14:50:38 +02:00
Simone Basso
8b38ea7e98
refactor(errorsx): improve errno generating code (#473)
No functional change, as it's clearly obvious from the output.

While there, also rename the generator for certifi. We are planning
on merging errorsx into netxlite. The first step is to give different
names to the code generating programs.

See https://github.com/ooni/probe/issues/1591
2021-09-07 14:25:42 +02:00
Simone Basso
fe3c90479d
refactor(netxlite): adapt single-use-quic-dialer from websteps (#472)
This is the last bit of functionality we need before rewriting a
chunk of websteps to use netxlite.

To rewrite most of it, we still need to move over:

1. dnstransport code

2. errorsx code

With both done, netxlite is a good library for websteps as well
as for most other operations we perform outside of the experiments.

Part of https://github.com/ooni/probe/issues/1591
2021-09-06 22:14:49 +02:00
Simone Basso
b9c4ad0b2b
fix(netxlite): http3 propagates CloseIdleConnections to its dialer (#471)
With this change, we are now able to change more dependent code to simplify
the way in which we create and manage resolvers.

See https://github.com/ooni/probe/issues/1591
2021-09-06 21:52:00 +02:00
Simone Basso
bdad392b61
feat(netxlite): write factories for quic code (#470)
Part of https://github.com/ooni/probe/issues/1591
2021-09-06 21:34:14 +02:00
Simone Basso
3ba5626b95
feat(netxlite): add CloseIdleConnections to quic dialer (#469)
Like before, do not touch the rest of the tree. Rather create
compatibility types declared as legacy.

We will soon be able to close idle connections for an HTTP3
transport using any kind of resolvers more easily.

See https://github.com/ooni/probe/issues/1591
2021-09-06 20:56:14 +02:00
Simone Basso
aa77867145
fix(netxlite): clearly document quirk and make code robust (#468)
This quirk really saddens me. It's a piece of tech debt we're
carrying over from the original netx implementation.

We cannot remove it _until_ we have legacy netx code around.

The second best thing we can do is to clearly move this code in
a place where it's clear it's a quirk and write and use some extra
code that makes sure the quirk's assumptions are always met.

Sigh.

See https://github.com/ooni/probe/issues/1591
2021-09-06 20:17:45 +02:00
Simone Basso
ba5bae4769
refactor(netxlite): let NewHTTPTransport work with single-use dialers (#467)
To make this happen, we need to take as argument a TLSDialer rather than
a TLSHandshaker. Then, we need to arrange the code so that we always
enforce a timeout for both TCP and TLS connections.

Because a TLSDialer can be constructed with a custom TLSConfig, we cover
also the case where the users wants to provide such a config.

While there, make sure we have better unit tests of the HTTP code.

See https://github.com/ooni/probe/issues/1591
2021-09-06 19:27:59 +02:00
Simone Basso
3114d6ca0e
feat(netxlite): integrate websteps code to use ooni/oohttp (#466)
Part of https://github.com/ooni/probe/issues/1591
2021-09-06 17:21:34 +02:00
Simone Basso
6df27d919d
fix(netxlite): http factory that propagates close-idle-connections (#465)
While there reorganize mocks' tls implementation to use a single file
called tls.go (and tls_test.go) just like netxlite does.

While there write tests ensuring we always add timeouts when we are
making TCP connections (be them TLS or cleartext).

See https://github.com/ooni/probe/issues/1591
2021-09-06 16:53:28 +02:00
Simone Basso
2572376fdb
feat(netxlite): implement single use {,tls} dialer (#464)
This basically adapts already existing code inside websteps to
instead be into the netxlite package, where it belongs.

In the process, abstract the TLSDialer but keep a reference to the
previous name to avoid refactoring existing code (just for now).

While there, notice that the right name is CloseIdleConnections (i.e.,
plural not singular) and change the name.

While there, since we abstracted TLSDialer to be an interface, create
suitable factories for making a TLSDialer type from a Dialer and a
TLSHandshaker.

See https://github.com/ooni/probe/issues/1591
2021-09-06 14:12:30 +02:00
Simone Basso
ef9592f75e
feat(netxlite): TLSDialer closes idle connections (#463)
We are proceeding with this plan of every major type being able to
close idle connections, which will simplify making DNS resolvers.

See https://github.com/ooni/probe/issues/1591.
2021-09-06 13:29:37 +02:00
Simone Basso
3caf5800a2
fix(netxlite): gracefully handle utls panics (#462)
* fix(netxlite): gracefully handle utls panics

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

* fix(netxlite): remove wrong timeout from newly written test
2021-09-05 21:41:49 +02:00
Simone Basso
b834af83ac
feat: upgrade oohttp and propagate changes (#461)
Part of https://github.com/ooni/probe/issues/1506
2021-09-05 21:23:47 +02:00
Simone Basso
5b8df394b1
refactor(netxlite): add factories to create TLS handshakers (#460)
See https://github.com/ooni/probe/issues/1591
2021-09-05 20:59:42 +02:00
Simone Basso
6a1e92cace
feat(netxlite): add dialer factory, simplify resolver factory (#459)
See https://github.com/ooni/probe/issues/1591
2021-09-05 20:41:46 +02:00
Simone Basso
b52d784f00
fix(netxlite): resolver _always_ short circuits IP addrs (#458)
We will use this in a moment when we will add support for the
dnstransports that currently are in engine/netx.

See https://github.com/ooni/probe/issues/1591
2021-09-05 20:12:05 +02:00
Simone Basso
7a9499fee3
refactor(dialer): it should close idle connections (#457)
Like we did before for the resolver, a dialer should propagate the
request to close idle connections to underlying types.

See https://github.com/ooni/probe/issues/1591
2021-09-05 19:55:28 +02:00
Simone Basso
a3a27b1ebf
fix(netxlite): make default resolver converge faster (#456)
* fix(netxlite): make default resolver converge faster

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

* Update internal/netxlite/resolver.go

* fix(ndt7): adapt tests after previous change

Because now we're running the DNS resolution inside a goroutine
with a child context, the returned error string is different.

The previous error said we canceled the whole dialing operation,
while now we see directly that the context was canceled.
2021-09-05 18:50:05 +02:00
Simone Basso
a3654f60b7
refactor(netxlite): add more functions to resolver (#455)
We would like to refactor the code so that a DoH resolver owns the
connections of its underlying HTTP client.

To do that, we need first to incorporate CloseIdleConnections
into the Resolver model. Then, we need to add the same function
to all netxlite types that wrap a Resolver type.

At the same time, we want the rest of the code for now to continue
with the simpler definition of a Resolver, now called ResolverLegacy.

We will eventually propagate this change to the rest of the tree
and simplify the way in which we manage Resolvers.

To make this possible, we introduce a new factory function that
adapts a ResolverLegacy to become a Resolver.

See https://github.com/ooni/probe/issues/1591.
2021-09-05 18:03:50 +02:00
Simone Basso
2e0118d1a6
refactor(netxlite): hide details without breaking the rest of the tree (#454)
## Description

This PR continues the refactoring of `netx` under the following principles:

1. do not break the rest of the tree and do not engage in extensive tree-wide refactoring yet
2. move under `netxlite` clearly related subpackages (e.g., `iox`, `netxmocks`)
3. move into `internal/netxlite/internal` stuff that is clearly private of `netxlite`
4. hide implementation details in `netxlite` pending new factories
5. refactor `tls` code in `netxlite` to clearly separate `crypto/tls` code from `utls` code

After each commit, I run `go test -short -race ./...` locally. Each individual commit explains what it does. I will squash, but this operation will preserve the original commit titles, so this will give further insight on each step.

## Commits

* refactor: rename netxmocks -> netxlite/mocks

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

* refactor: rename quicx -> netxlite/quicx

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

* refactor: rename iox -> netxlite/iox

Regenerate sources and make sure the tests pass.

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

* refactor(iox): move MockableReader to netxlite/mocks

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

* refactor(netxlite): generator is an implementation detail

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

* refactor(netxlite): separate tls and utls code

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

* refactor(netxlite): hide most types but keep old names as legacy

With this change we avoid breaking the rest of the tree, but we start
hiding some implementation details a bit. Factories will follow.

See https://github.com/ooni/probe/issues/1591
2021-09-05 14:49:38 +02:00
Simone Basso
ae799c4942
fix: completely remove support for h3-29 (#453)
The quic-go library does not support it anymore. So, let us be consistent
and remove any reference to h3-29 from our codebase.

Closes https://github.com/ooni/probe/issues/1740.
2021-09-05 12:57:48 +02:00
Simone Basso
f0927ea00c
ci: master only runs coverage and only with go1.17 (+ fix flaky test) (#452)
* fix: disable debianrepo build on master branch

This just mitigates https://github.com/ooni/probe/issues/1741 and does
not fully address it, but I'd rather avoid delving into this problem until
I open a release/v3.11.0 branch and have to really fix this issue.

* fix: only run coverage using go1.17

This is the version of Go with which we are going to bless v3.11.0
therefore it's the only version of Go that matters.

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

* fix(ptx/obfs4_test.go): avoid context-vs-normal-code race

We want to test whether we get the context failure if the error
generated inside normal code happens _after_ the context cancellation.

The best way to do that is to write code that is not racy. To this
end, we just need to pause normal code until we know that the context
has returned to the caller. We also need to ensure we do not leak
a goroutine, hence we use a WaitGroup to check that.

Fixes https://github.com/ooni/probe/issues/1750
2021-09-05 12:44:44 +02:00
Simone Basso
276beb8719
fix(oohelper): do not stop if DNS fails locally (#450)
When a probe gets a local DNS failure, it will continue and nonetheless
query the test helper without any IP address, just an empty list.

This diff fixes the behavior of cmd/oohelper to do the same.

Work part of https://github.com/ooni/probe/issues/1707.
2021-09-05 12:06:02 +02:00
Simone Basso
619826ac34
fix: skip two integration tests in short mode (#451)
Reference issue: https://github.com/ooni/probe/issues/1769

Motivation: The CI is failing. Those are integration tests. Let us figure out the issue when we approach release. Until we approach release, do not let those tests distracting us. Normal merges should only pass the `-short` tests.
2021-09-05 11:58:02 +02:00
Simone Basso
8f18813e17
cli: upgrade to lucas-clemente/quic-go 0.23.0 (#449)
See https://github.com/ooni/probe/issues/1754 for a comprehensive description.
2021-08-23 16:49:22 +02:00
kelmenhorst
a9014e7950
cli: websteps: fix DNSDo (#447)
This fixes an inattention bug in the websteps code.
2021-08-20 16:09:21 +02:00
Simone Basso
394bf26313
feat: relicense the repository under GNU GPLv3 (#446)
We're going to integrate some pieces of code under the GNU GPLv3
soon, therefore we also need to relicense this repository.
2021-08-20 14:50:46 +02:00
Simone Basso
2e5b4f13dd
fix(internal/platform): support freebsd (#445)
See https://github.com/ooni/probe/issues/1696
2021-08-20 14:00:06 +02:00
Simone Basso
c3bec9de2a
doc(Readme.md): minor refactoring (#444) 2021-08-20 13:18:39 +02:00
Simone Basso
4a9e76ec8a
CONTRIBUTING: ref org-wide guidelines + minor fixes (#443)
Reference issue: https://github.com/ooni/probe/issues/1670
2021-08-19 18:55:49 +02:00
kelmenhorst
1874f7a7c2
enable utls for websteps (#442)
This diff enables `websteps` to use uTLS for TLS parroting. It integrates the `oohttp.StdlibTransport` wrapper which uses the `ooni/oohttp` fork. `oohttp` supports TLS-like connections like `utls.Conn`.
As a prototype, the testhelper and `websteps` code now uses the `utls.HelloChrome_Auto` fingerprint, i.e. the simulated TLS fingerprint of the Google Chrome browser.

It is a further contribution for my GSoC project.

Reference issue: https://github.com/ooni/probe/issues/1733
2021-08-18 16:10:27 +02:00
Simone Basso
21a2b315fe
coverage: start using also go1.17 (#440)
This is part of the migration from go1.16 go go1.17.

Reference issue: https://github.com/ooni/probe/issues/1738
2021-08-18 11:47:01 +02:00
Simone Basso
2aca86b434
fix: improve the pull request template (#439)
Specifically, don't say the description is optional and make sure
there is a handy link to the issue tracker.
2021-08-18 11:46:37 +02:00
Roopak Venkatakrishnan
143949afe6
Update x/sys for go 1.17 (#438)
Updating x/sys so that this supports go 1.17. Once this is in here we will need to cut a new release.

More context: https://github.com/Homebrew/homebrew-core/pull/83413

See also https://github.com/ooni/probe/issues/1737

Co-authored-by: Simone Basso <bassosimone@gmail.com>
2021-08-18 11:33:22 +02:00
Simone Basso
a8e5ac4709
doc: sketch out pull request template (#437)
My main concern here is to remind contributors (_including myself_) about the documents they should have read and that every change may entail also changes in ooni/spec. This work counts as a cleanup before closing https://github.com/ooni/probe/issues/1729.
2021-08-17 13:07:11 +02:00
Simone Basso
f18a9852db
doc: mention the test helper spec we're using (#436)
See https://github.com/ooni/probe/issues/1729
2021-08-17 12:52:51 +02:00
Simone Basso
f2b6a5972f
refactor: sync messages with spec draft (#435)
Work part of: https://github.com/ooni/probe/issues/1733

Spec draft: https://github.com/ooni/spec/pull/219
2021-08-17 11:56:36 +02:00
Simone Basso
ce854e8ae1
refactor(oohelperd): better distinguish different helpers (#434)
Part of https://github.com/ooni/probe/issues/1733
2021-08-17 11:23:53 +02:00
Simone Basso
bef5b87a8a
refactor: fully move IDNAResolver to netxlite (#433)
We started doing this in https://github.com/ooni/probe-cli/pull/432.

This work is part of https://github.com/ooni/probe/issues/1733.
2021-08-17 11:02:12 +02:00
kelmenhorst
c31591f298
cli: new testhelper and the websteps experiment prototype (#432)
This is the extension of https://github.com/ooni/probe-cli/pull/431, and my final deliverable for GSoC 2021.

The diff introduces:

1) The new `testhelper` which supports testing multiple IP endpoints per domain and introduces HTTP/3 control measurements. The specification of the `testhelper` can be found at https://github.com/ooni/spec/pull/219. The `testhelper` algorithm consists of three main steps:

   * `InitialChecks` verifies that the input URL can be parsed, has an expected scheme, and contains a valid domain name.

   * `Explore` enumerates all the URLs that it discovers by redirection from the original URL, or by detecting h3 support at the target host.

   * `Generate` performs a step-by-step measurement of each discovered URL.

2) A prototype of the corresponding new experiment `websteps` which uses the control measurement of the `testhelper` to know which URLs to measure, and what to expect. The prototype does not yet have:

   * unit and integration tests,

   * an analysis tool to compare the control and the probe measurement.

This PR is my final deliverable as it is the outcome of the trials, considerations and efforts of my GSoC weeks at OONI. 
It fully integrates HTTP/3 (QUIC) support which has been only used in the `urlgetter` experiment until now.

Related issues: https://github.com/ooni/probe/issues/1729 and https://github.com/ooni/probe/issues/1733.
2021-08-17 10:29:06 +02:00
Simone Basso
14c1640f7f
feat(errorsx): cover more syscall errors and add tests (#430)
* feat(errorsx): cover more syscall errors and add tests

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

* fix tests
2021-07-08 12:23:37 +02:00
Simone Basso
3747598b4a
refactor(errorsx): auto-generate syscall errors mapping (#429)
* refactor(errorsx): auto-generate syscall errors mapping

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

* fix: generate independently of the platform
2021-07-02 15:22:02 +02:00
Simone Basso
b13c7bf8fb
Merge pull request #428 from ooni/sandbox-sbs
refactor(netxlite): move generator in a subpackage
2021-07-02 14:37:45 +02:00
Simone Basso
a3c71dc282 refactor(netxlite): move generator in a subpackage
This way, we don't need to use `// +build ignore`, which prevents
the editor from linting the file itself.

Work part of https://github.com/ooni/probe/issues/1505.
2021-07-02 14:26:28 +02:00
Simone Basso
5968065c43
Merge pull request #427 from ooni/sandbox-sbs
refactor(errorsx): directly return ErrWrapper when needed
2021-07-02 14:15:45 +02:00
Simone Basso
b9ff9136e2 refactor(errorsx): directly return ErrWrapper when needed
The utility of SafeErrWrapperBuilder is low. Let us instead change the
code to always create ErrWrapper when we're in this package.

While there, also note some TODO-next items.

Part of https://github.com/ooni/probe/issues/1505.
2021-07-02 14:00:46 +02:00
Simone Basso
362ece04c4
Merge pull request #426 from ooni/issue/1424-3
netxlite: utls for TLS parroting
2021-07-02 12:44:58 +02:00
kelmenhorst
285290a98d netxlite: utls for TLS parroting
This is the ground work for https://github.com/ooni/probe/issues/1424.
2021-07-02 12:41:27 +02:00
Simone Basso
17bfb052c5
refactor(errorsx): start hiding private details and moving around stuff (#424)
* refactor(errorsx): start hiding private details and moving around stuff

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

* fix: remove now-addressed todo comments
2021-07-02 11:35:00 +02:00