Commit Graph

701 Commits

Author SHA1 Message Date
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
Simone Basso
ceb2aa8a8d
fix(netx): make sure we save quic udp conn events (#423)
https://github.com/ooni/probe-cli/pull/421 was wrong because we need
a more rich interface for quic-go to call ReadMsgUDP.

With this commit, we use such an interface: OOBCapablePacketConn.

Still part of https://github.com/ooni/probe/issues/1505.
2021-07-02 11:00:12 +02:00
Simone Basso
30c7e2cdb3
feat(errorsx): add error wrapper for quic (#422)
Part of https://github.com/ooni/probe/issues/1505
2021-07-02 10:39:14 +02:00
Simone Basso
250a595f89
refactor: cleaner way of passing a UDPConn around (#421)
* refactor: cleaner way of passing a UDPConn around

Also part of https://github.com/ooni/probe/issues/1505

* Update internal/engine/netx/quicdialer/connectionstate.go
2021-07-01 21:56:29 +02:00
Simone Basso
ec350cba1a
refactor: move ErrorWrapperQUICDialer to errorsx (#420)
I needed to add some tests as integration tests due to circular
imports, but this is ~fine because we quite likely want many
integration tests in the errorsx package anyway.

Part of https://github.com/ooni/probe/issues/1505.
2021-07-01 20:58:15 +02:00
Simone Basso
5c52d99d57
refactor: move ErrorWrapperResolver to errorsx pkg (#419)
Part of https://github.com/ooni/probe/issues/1505
2021-07-01 18:51:40 +02:00
Simone Basso
863899469e
refactor: move ErrorWrapperTLSHandshaker to errorsx (#418)
Part of https://github.com/ooni/probe/issues/1505
2021-07-01 18:00:09 +02:00
Simone Basso
ceefcaf45e
refactor: move dialer's errorwrapper in i/errorsx (#417)
Part of https://github.com/ooni/probe/issues/1505
2021-07-01 17:15:44 +02:00
Simone Basso
72acd175a0
refactor: move i/e/n/errorx to i/errorsx (#416)
Still working towards https://github.com/ooni/probe/issues/1505
2021-07-01 16:34:36 +02:00
Simone Basso
6895946a34
refactor: introduce factory for stdlib http transport (#413)
With this factory, we want to construct ourselves the TLS dialer
so that we can use a dialer wrapper that always sets timeouts when
reading, addressing https://github.com/ooni/probe/issues/1609.

As a result, we cannot immediately replace the i/e/netx factory
for creating a new HTTP transport, since the functions signatures
are not directly compatible.

Refactoring is part of https://github.com/ooni/probe/issues/1505.
2021-07-01 15:26:08 +02:00
Simone Basso
f59e98fd05
fix(ptx): use another obfs4 bridge (#415)
See discussion at https://github.com/ooni/probe-cli/pull/413#issuecomment-871552943.
2021-07-01 15:13:01 +02:00
Simone Basso
4dc2907472
refactor: move base http3 transport into netxlite (#412)
This diff is part of https://github.com/ooni/probe/issues/1505.

You will notice that I have not adapted all the (great) tests we had
previously. They should live at another layer, and namely the one that
deals with performing measurements.

When I'm refactoring such a layer I'll ensure those tests that I have
not adapted here are reintroduced into the tree.
2021-06-30 15:19:10 +02:00
Simone Basso
527e1a0707
refactor: move httptransport w/ logging to netxlite (#411)
Part of https://github.com/ooni/probe/issues/1505
2021-06-26 18:11:47 +02:00
Simone Basso
046dd4545d
feat(netxlite): add QUICDialerLogger (#410)
Part of https://github.com/ooni/probe/issues/1505
2021-06-26 16:54:02 +02:00
Simone Basso
b07890af4d
fix(netxlite): improve TLS auto-configuration (#409)
Auto-configure every relevant TLS field as close as possible to
where it's actually used.

As a side effect, add support for mocking the creation of a TLS
connection, which should possibly be useful for uTLS?

Work that is part of https://github.com/ooni/probe/issues/1505
2021-06-25 20:51:59 +02:00
Simone Basso
f1f5ed342e
refactor: move quic dns dialing to netxlite (#408)
Part of https://github.com/ooni/probe/issues/1505
2021-06-25 18:38:13 +02:00
Simone Basso
a4d61a4be4
fix(netxlite): close quic packetconn (#407)
Noticed when working on https://github.com/ooni/probe/issues/1505.

Justification for this diff:

1. [DialEarlyContext calls dialContext with the last argument set to false](https://github.com/lucas-clemente/quic-go/blob/v0.21.1/client.go#L153);

2. [the semantics of the last argument is whether we own the connection](https://github.com/lucas-clemente/quic-go/blob/v0.21.1/client.go#L187);

3. [this value is propagated to the client data structure](https://github.com/lucas-clemente/quic-go/blob/v0.21.1/client.go#L269);

4. [client.dial](https://github.com/lucas-clemente/quic-go/blob/v0.21.1/client.go#L302) runs the session in a background goroutine and only destroys the `packetHandlers` when the connection is owned;

5. [packetHandlerMap.Destroy](https://github.com/lucas-clemente/quic-go/blob/v0.21.1/packet_handler_map.go#L293) closes the underlying PacketConn.

6. also, the documentation clearly states that when you use `DialEarlyContext` you can use the same packet conn multiple times, so it does not take ownership.
2021-06-25 17:58:42 +02:00
Simone Basso
925ca22b88
refactor: move quicdialing base functionality to netxlite (#406)
Part of https://github.com/ooni/probe/issues/1505
2021-06-25 17:04:24 +02:00
Simone Basso
c00cad1382
refactor(quicdialer): separate saving from listening (#405)
With this change, we will soon be able to move the creation of
a QUIC session inside of the netxlite package.

Part of https://github.com/ooni/probe/issues/1505.
2021-06-25 16:20:08 +02:00
Simone Basso
d031829a4b
refactor: move tlsdialer to netxlite (#404)
Part of https://github.com/ooni/probe/issues/1505
2021-06-25 13:42:48 +02:00
Simone Basso
7f2463d745
refactor: merge tlsx into netxlite (#403)
Part of https://github.com/ooni/probe/issues/1505
2021-06-25 12:39:45 +02:00
Simone Basso
f1ee763f94
refactor(netx): move tlshandshaker logger to netxlite (#402)
Part of https://github.com/ooni/probe/issues/1505
2021-06-25 12:21:34 +02:00
Simone Basso
acef18a955
fix(netx): repair BogonResolver tests (#401)
The BogonResolver relied on its wrapper resolver to pass along the
list of addresses _and_ the error. But the idiomatic thing to do is
often to return `nil` when there is an error.

I broke this very fragile assumption in https://github.com/ooni/probe-cli/pull/399.

I could of course fix it, but this assumption is clearly wrong
and we should not allow such fragile code in the tree.

We are not using BogonIsError much in the tree. The only place in
which we're using it for measuring seems to be dnscheck.

It may be that this surprising behavior was what caused the issue at
https://github.com/ooni/probe/issues/1510 in the first place.

Regardless, let's remove fragile code and adjust the test that was
failing. Also that test is quick so it can run in `-short` mode.

Spotted while working on https://github.com/ooni/probe/issues/1505.
2021-06-25 11:51:10 +02:00
Simone Basso
6b7d270bda
refactor: move tls handshaker to netxlite (#400)
Part of https://github.com/ooni/probe/issues/1505
2021-06-25 11:07:26 +02:00
Simone Basso
b8428b302f
refactor(netxlite): make sure we always use netxmocks (#399)
* refactor(netxlite): make sure we always use netmocks

While there, improve logging and make sure we test 100% of the
package with unit tests only. (We don't need to have integration
testing in this package because it's fairly simple/obvious.)

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

* further improve logs
2021-06-23 17:00:44 +02:00
Simone Basso
c5dd9a68f1
feat(netxmocks): implement mocks for netxlite.Resolver (#398)
While there, make sure we require using &netxmocks.Dialer.

Still part of https://github.com/ooni/probe/issues/1505
2021-06-23 16:21:13 +02:00
Simone Basso
16aa8e5538
refactor: rename i/e/n/mockablex => i/netxmocks (#397)
Needed to more easily do https://github.com/ooni/probe/issues/1505
2021-06-23 16:06:02 +02:00
Simone Basso
8a0beee808
refactor: start pivoting netx (#396)
What do I mean by pivoting? Netx is currently organized by row:

```
               | dialer | quicdialer | resolver | ...
 saving        |        |            |          | ...
 errorwrapping |        |            |          | ...
 logging       |        |            |          | ...
 mocking/sys   |        |            |          | ...
```

Every row needs to implement saving, errorwrapping, logging, mocking (or
adapting to the system or to some underlying library).

This causes cross package dependencies and, in turn, complexity. For
example, we need the `trace` package for supporting saving.

And `dialer`, `quickdialer`, et al. need to depend on such a package.

The same goes for errorwrapping.

This arrangement further complicates testing. For example, I am
currently working on https://github.com/ooni/probe/issues/1505 and
I realize it need to repeat integration tests in multiple places.

Let's say instead we pivot the above matrix as follows:

```
             | saving | errorwrapping | logging | ...
 dialer      |        |               |         | ...
 quicdialer  |        |               |         | ...
 logging     |        |               |         | ...
 mocking/sys |        |               |         | ...
 ...
```

In this way, now every row contains everything related to a specific
action to perform. We can now share code without relying on extra
support packages. What's more, we can write tests and, judding from
the way in which things are made, it seems we only need integration
testing in `errorwrapping` because it's where data quality matters
whereas, in all other cases, unit testing is fine.

I am going, therefore, to proceed with these changes and "pivot"
`netx`. Hopefully, it won't be too painful.
2021-06-23 15:53:12 +02:00