package
0.30.0
Repository: https://github.com/ooni/probe-engine.git
Documentation: pkg.go.dev

# README

Package github.com/ooni/probe-cli/v3/internal/model

Shared data structures and interfaces. We include in this package the most fundamental types. Use go doc to get more thorough documentation about what is inside this package and when to put a type inside this package.

# Functions

ArchivalNewHTTPHeadersList constructs a new ArchivalHTTPHeader list given HTTP headers.
ArchivalNewHTTPHeadersMap creates a map representation of HTTP headers.
ErrorToStringOrOK emits "ok" on "<nil>"" values for success.
MeasurementFormatTimeNowUTC formats the current time as UTC using the [MeasurementDateFormat].
NewOOAPIURLInfoWithDefaultCategoryAndCountry constructs a new instance of [*OOAPIURLInfo] with default category and country code.
NewPrinterCallbacks returns a new default callback handler.
ScrubMeasurement removes [currentIP] from [m] by rewriting it in place while preserving the underlying types.
ValidLoggerOrDefault is a factory that either returns the logger provided as argument, if not nil, or DiscardLogger.

# Constants

DefaultCategoryCode is the default category code to use when a URL's category code is unknown.
DefaultCountryCode is the default country code to use when a URL's country code is unknown.
DefaultProbeASN is the default probe ASN as a number.
DefaultProbeCC is the default probe CC.
DefaultProbeIP is the default probe IP.
DefaultProbeNetworkName is the default probe network name.
DefaultResolverASN is the default resolver ASN.
DefaultResolverIP is the default resolver IP.
DefaultResolverNetworkName is the default resolver network name.
HTTPHeaderAccept is the Accept header used for measuring.
HTTPHeaderAcceptLanguage is the Accept-Language header used for measuring.
HTTPHeaderUserAgent is the User-Agent header used for measuring.
InputNone indicates that the experiment does not want any input and ignores the input if provided with it.
InputOptional indicates that the experiment handles input, if any; otherwise it fetchs input/uses a default.
InputOrQueryBackend indicates that the experiment requires external input to run and that this kind of input is URLs from the citizenlab/test-lists repository.
We gather input from StaticInput and SourceFiles.
InputStrictlyRequired indicates that the experiment requires input and we currently don't have an API for fetching such input.
MeasurementDateFormat is the data format used by a measurement.
OOAPIReportDefaultDataFormatVersion is the default data format version.
DefaultFormat is the default format.
RunTypeManual indicates that the user manually run `ooniprobe run`.
RunTypeTimed indicates that the user run `ooniprobe run unattended`, which is the correct way to run ooniprobe from scripts and cronjobs.
Scrubbed is the string that replaces IP addresses.
THDNSNameError is the error returned by the control on NXDOMAIN.
THIPInfoFlagIsBogon indicates that the address is a bogon.
THIPInfoFlagResolvedByProbe indicates that the probe has resolved this IP address.
THIPInfoFlagResolvedByTH indicates that the test helper has resolved this IP address.
THIPInfoFlagValidForDomain indicates that an IP address is valid for the domain because it works with TLS.

# Variables

ArchivalExtDNS is the version of df-002-dnst.md.
ArchivalExtHTTP is the version of df-001-httpt.md.
ArchivalExtNetevents is the version of df-008-netevents.md.
ArchivalExtTCPConnect is the version of df-005-tcpconnect.md.
ArchivalExtTLSHandshake is the version of df-006-tlshandshake.md.
ArchivalExtTunnel is the version of df-009-tunnel.md.
DefaultProbeASNString is the default probe ASN as a string.
DefaultResolverASNString is the default resolver ASN as a string.
DiscardLogger is the default logger that discards its input.
ErrInvalidBinaryDataFormat is the format returned when marshaling and unmarshaling binary data and the value of "format" is unknown.
ErrInvalidProbeIP indicates that we're dealing with a string that is not the valid serialization of an IP address.
ErrNoAvailableTestHelpers is emitted when there are no available test helpers.
HTTPUnexpectedRedirectURL indicates that the redirect URL returned by the server is not the expected one.
HTTPUnexpectedStatusCode indicates that we re not getting the expected (range of) HTTP status code(s).

# Structs

ArchivalDNSAnswer is a DNS answer.
ArchivalDNSLookupResult is the result of a DNS lookup.
ArchivalExtSpec describes a data format extension.
ArchivalHTTPRequest contains an HTTP request.
ArchivalHTTPRequestResult is the result of sending an HTTP request.
ArchivalHTTPResponse contains an HTTP response.
ArchivalHTTPTor contains Tor information.
ArchivalNetworkEvent is a network event.
ArchivalOpenVPNHandshakeResult contains the result of a OpenVPN handshake.
ArchivalOpenVPNOptions is a subset of [vpnconfig.OpenVPNOptions] that we want to include in the archived result.
ArchivalTCPConnectResult contains the result of a TCP connect.
ArchivalTCPConnectStatus is the status of ArchivalTCPConnectResult.
ArchivalTLSOrQUICHandshakeResult is the result of a TLS or QUIC handshake.
Database Measurement model.
MeasurementURLNetwork is used for the JOIN between Measurement and URL.
DatabaseNetwork represents a network tested by the user.
Database Result model.
ResultNetwork is used to represent the structure made from the JOIN between the results and networks tables.
DatabaseURL represents URLs from the testing lists.
ExperimentArgs contains the arguments passed to an experiment.
ExperimentOptionInfo contains info about an experiment option.
ExperimentTargetLoaderConfig is the configuration to create a new [ExperimentTargetLoader].
HTTPSSvc is the reply to an HTTPS DNS query.
LocationASN contains ASN information related to a location.
Measurement is a OONI measurement.
OOAPICheckInConfig contains config for a checkin API call.
OOAPICheckInConfigWebConnectivity is the WebConnectivity portion of OOAPICheckInConfig.
OOAPICheckInInfoWebConnectivity contains the WebConnectivity part of OOAPICheckInInfo.
OOAPICheckInResult is the result returned by the checkin API.
OOAPICheckInResultConfig contains configuration.
OOAPICheckInResultNettests contains nettests information returned by the checkin API call.
OOAPICheckReportIDResponse is the check-report-id API response.
OOAPICollectorOpenResponse is the response returned by the open report API.
OOAPICollectorUpdateRequest is a request for the collector update API.
OOAPICollectorUpdateResponse is the response from the collector update API.
OOAPILoginAuth contains authentication info.
OOAPILoginCredentials contains the login credentials.
OOAPIMeasurementMeta contains measurement metadata.
OOAPIMeasurementMetaConfig contains configuration for GetMeasurementMeta.
OOAPIProbeMetadata contains metadata about a probe.
OOAPIRegisterRequest is a request to the register API.
OOAPIRegisterResponse is a reponse from the register API.
OOAPIReportTemplate is the template for opening a report.
OOAPIService describes a backend service.
OOAPITorTarget is a target for the tor experiment.
OOAPIURLInfo contains information on a test lists URL.
OOAPIVPNConfig contains the configuration needed to start an OpenVPN connection, returned as part of [OOAPIVPNProviderConfig].
OOAPIVPNProviderConfig is a minimal valid configuration subset for the openvpn experiment; at the moment it provides credentials valid for endpoints in a provider, and a list of inputs to be tested on this provider.
PerformanceTestKeys is the result summary for a performance test.
PrinterCallbacks is the default event handler.
THDNSResult is the result of the DNS lookup performed by the control vantage point.
THHTTPRequestResult is the result of the HTTP request performed by the control vantage point.
THIPInfo contains information about IP addresses resolved either by the probe or by the TH and processed by the TH.
THRequest is the request that we send to the control.
THResponse is the response from the control service.
THTCPConnectResult is the result of the TCP connect attempt performed by the control vantage point.
THTLSHandshakeResult is the result of the TLS handshake attempt performed by the control vantage point.
UploadedTotalCount is the count of the measurements which have been uploaded vs the total measurements in a given result set.

# Interfaces

Dialer is a SimpleDialer with the possibility of closing open connections.
DialerWrapper is a type that takes in input a Dialer and returns in output a wrapped Dialer.
The DNSDecoder decodes DNS responses.
The DNSEncoder encodes DNS queries to bytes.
DNSQuery is an encoded DNS query ready to be sent using a DNSTransport.
DNSResponse is a parsed DNS response ready for further processing.
DNSTransport represents an abstract DNS transport.
Experiment is an experiment instance.
ExperimentBuilder builds an experiment.
ExperimentCallbacks contains experiment event-handling callbacks.
ExperimentInputProcessor processes inputs for an experiment.
ExperimentMeasurer is the interface that allows to run a measurement for a specific experiment.
ExperimentSession is the experiment's view of a session.
ExperimentTarget contains a target for the experiment to measure.
ExperimentTargetLoader loads targets from local or remote sources.
ExperimentTargetLoaderSession is the session according to [ExperimentTargetLoader].
GeoIPASNlookupper performs ASN lookups.
HTTPClient is an http.Client-like interface.
HTTPTransport is an http.Transport-like structure.
KeyValueStore is a generic key-value store.
LocationProvider is an interface that returns the current location.
MeasurementSummaryKeys is the measurement summary.
MeasurementSummaryKeysProvider is the interface that the experiment test keys should implement when they want to have a customized implementation of the [MeasurementSummaryKeys].
MeasuringNetwork defines the constructors required for implementing OONI experiments.
QUICDialer dials QUIC sessions.
QUICDialerWrapper is a type that takes in input a QUICDialer and returns in output a wrapped QUICDialer.
ReadableDatabase only supports reading data.
Resolver performs domain name resolutions.
Saver saves a measurement on some persistent storage.
SimpleDialer establishes network connections.
Submitter submits a measurement to the OONI collector.
TLSDialer is a Dialer dialing TLS connections.
TLSHandshaker is the generic TLS handshaker.
Trace allows to collect measurement traces.
UDPLikeConn is a net.PacketConn with some extra functions required to convince the QUIC library (quic-go/quic-go) to inflate the receive buffer of the connection.
UDPListener listens for connections over UDP, e.g.
UnderlyingNetwork implements the underlying network APIs on top of which we implement network extensions such as [MeasuringNetwork].
WritableDatabase supports writing and updating data.

# Type aliases

ArchivalBinaryData is a wrapper for bytes that serializes the enclosed data using the specific ooni/spec data format for binary data.
ArchivalHTTPHeader is a single HTTP header.
ArchivalScrubbedMaybeBinaryString is a possibly-binary string.
DebugLogger is a logger emitting only debug messages.
GeoIPASNLookupperFunc transforms a func into a [GeoIPASNLookupper].
InfoLogger is a logger emitting debug and infor messages.
InputPolicy describes the experiment policy with respect to input.
Logger defines the common interface that a logger should have.
MeasurementInput is the input of an OONI measurement.
RunType describes the type of a ooniprobe run.
TLSConn is the type of connection that oohttp expects from any library that implements TLS functionality.