f4f3ed7c42
The code that is now into the tracex package was written a long time ago, so let's start to make it more in line with the coding style of packages that were written more recently. I didn't apply all the changes I'd like to apply in a single diff and for now I am committing just this diff. Broadly, what we need to do is: 1. improve documentation 2. ~always use pointer receivers (object receives have the issue that they are not mutable by accident meaning that you can mutate them but their state do not change after the call returns, which is potentially a source of bugs in case you later refactor to use a pointer receiver, so always use pointer receivers) 3. ~always avoid embedding (let's say we want to avoid embedding for types we define and it's instead fine to embed types that are defined in the stdlib: if later we add a new method, we will not see a broken build and we'll probably forget to add the new method to all wrappers -- conversely, if we're wrapping rather than embedding, we'll see a broken build and act accordingly) 4. prefer unit tests and group tests by type being tested rather than using a flat structure for tests There's a coverage slippage that I'll compensate in a follow-up diff where I'll focus on unit testing. Reference issue: https://github.com/ooni/probe/issues/2121 |
||
---|---|---|
.. | ||
dialer | ||
httptransport | ||
resolver | ||
tlsdialer | ||
tracex | ||
fake_test.go | ||
integration_test.go | ||
netx_internal_test.go | ||
netx_test.go | ||
netx.go | ||
README.md |
Package github.com/ooni/probe-engine/netx
OONI extensions to the net
and net/http
packages. This code is
used by ooni/probe-engine
as a low level library to collect
network, DNS, and HTTP events occurring during OONI measurements.
This library contains replacements for commonly used standard library interfaces that facilitate seamless network measurements. By using such replacements, as opposed to standard library interfaces, we can:
- save the timing of HTTP events (e.g. received response headers)
- save the timing and result of every Connect, Read, Write, Close operation
- save the timing and result of the TLS handshake (including certificates)
By default, this library uses the system resolver. In addition, it is possible to configure alternative DNS transports and remote servers. We support DNS over UDP, DNS over TCP, DNS over TLS (DoT), and DNS over HTTPS (DoH). When using an alternative transport, we are also able to intercept and save DNS messages, as well as any other interaction with the remote server (e.g., the result of the TLS handshake for DoT and DoH).
This package is a fork of github.com/ooni/netx.