399d2f65da
This commit introduce a measurement library that consists of refactored code from earlier websteps experiments. I am not going to add tests for the time being, because this library is still a bit in flux, as we finalize websteps. I will soon though commit documentation explaining in detail how to use it, which currrently is at https://github.com/ooni/probe-cli/pull/506 and adds a new directory to internal/tutorial. The core idea of this measurement library is to allow two measurement modes: 1. tracing, which is what we're currently doing now, and the tutorial shows how we can rewrite the measurement part of web connectivity with measurex using less code. Under a tracing approach, we construct a normal http.Client that however has tracing configured, we gather events for resolve, connect, TLS handshake, QUIC handshake, HTTP round trip, etc. and then we try to make sense of what happened from the events stream; 2. step-by-step, which is what websteps does, and basically means that after each operation you immediately write into a Measurement structure its results and immediately draw the conclusions on what seems odd (which later may become an anomaly if we see what the test helper measured). This library is also such that it produces a data format compatible with the current OONI spec. This work is part of https://github.com/ooni/probe/issues/1733.
49 lines
1.8 KiB
Go
49 lines
1.8 KiB
Go
package measurex
|
|
|
|
//
|
|
// Oddity
|
|
//
|
|
// Here we define the oddity type.
|
|
//
|
|
|
|
// Oddity is an unexpected result on the probe or
|
|
// or test helper side during a measurement. We will
|
|
// promote the oddity to anomaly if the probe and
|
|
// the test helper see different results.
|
|
type Oddity string
|
|
|
|
// This enumeration lists all known oddities.
|
|
var (
|
|
// tcp.connect
|
|
OddityTCPConnectTimeout = Oddity("tcp.connect.timeout")
|
|
OddityTCPConnectRefused = Oddity("tcp.connect.refused")
|
|
OddityTCPConnectHostUnreachable = Oddity("tcp.connect.host_unreachable")
|
|
OddityTCPConnectOher = Oddity("tcp.connect.other")
|
|
|
|
// tls.handshake
|
|
OddityTLSHandshakeTimeout = Oddity("tls.handshake.timeout")
|
|
OddityTLSHandshakeReset = Oddity("tls.handshake.reset")
|
|
OddityTLSHandshakeOther = Oddity("tls.handshake.other")
|
|
OddityTLSHandshakeUnexpectedEOF = Oddity("tls.handshake.unexpected_eof")
|
|
OddityTLSHandshakeInvalidHostname = Oddity("tls.handshake.invalid_hostname")
|
|
OddityTLSHandshakeUnknownAuthority = Oddity("tls.handshake.unknown_authority")
|
|
|
|
// quic.handshake
|
|
OddityQUICHandshakeTimeout = Oddity("quic.handshake.timeout")
|
|
OddityQUICHandshakeHostUnreachable = Oddity("quic.handshake.host_unreachable")
|
|
OddityQUICHandshakeOther = Oddity("quic.handshake.other")
|
|
|
|
// dns.lookup
|
|
OddityDNSLookupNXDOMAIN = Oddity("dns.lookup.nxdomain")
|
|
OddityDNSLookupTimeout = Oddity("dns.lookup.timeout")
|
|
OddityDNSLookupRefused = Oddity("dns.lookup.refused")
|
|
OddityDNSLookupBogon = Oddity("dns.lookup.bogon")
|
|
OddityDNSLookupOther = Oddity("dns.lookup.other")
|
|
|
|
// http.status
|
|
OddityStatus403 = Oddity("http.status.403")
|
|
OddityStatus404 = Oddity("http.status.404")
|
|
OddityStatus503 = Oddity("http.status.503")
|
|
OddityStatusOther = Oddity("http.status.other")
|
|
)
|