internal/

directory
v3.16.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2022 License: GPL-3.0

README

Directory github.com/ooni/probe-cli/internal

This directory contains private Go packages.

Useful commands

You can read the Go documentation of a package by using go doc -all.

For example:

go doc -all ./internal/netxlite

You can get a graph of the dependencies using kisielk/godepgraph.

For example:

godepgraph -s -novendor -p golang.org,gitlab.com ./internal/engine | dot -Tpng -o deps.png

You can further tweak which packages to exclude by appending prefixes to the list passed to the -p flag.

Tutorials

The tutorial package contains tutorials on writing new experiments, using measurements libraries, and networking code.

Network extensions

This section briefly describes the overall design of the network extensions (aka netx) inside ooni/probe-cli. In OONI, we have two distinct but complementary needs:

  1. speaking with our backends or accessing other services useful to bootstrap OONI probe and perform measurements;

  2. implementing network experiments.

We originally implemented these functionality into a separate repository: ooni/netx. The original design document still provides a good overview of the problems we wanted to solve. The newer dd-002-step-by-step.md design document describes the current architecture (as of 2022-06-17) and the future trajectory for netx.

The general idea of netx has always been to provide interfaces replacing standard library objects that we could further wrap to perform network measurements without deviating from the normal APIs expected by Go programmers.

For example,

type Dialer interface {
	DialContext(ctx context.Context, network, address string) (net.Conn, error)
}

is a generic dialer that could be a &net.Dialer{} but could also be a saving dialer that saves the results of dial events. So, you could write something like:

saver := &Saver{}
var dialer Dialer = NewDialer()
dialer = saver.WrapDialer(dialer)
conn, err := dialer.DialContext(ctx, network, address)
events := saver.ExtractEvents()

In short, with the original netx you could write measurement code resembling ordinary Go code but you could also save network events from which to derive whether there was censorship.

Since then, the architecture itself has evolved and netx has been merged into ooni/probe-engine and later ooni/probe-cli. As of 2022-06-06, these are the fundamental netx packages:

  • model/netx.go: contains the interfaces and structs patterned after the Go standard library used by netx;

  • netxlite: implements error wrapping (i.e., mapping Go errors to OONI errors), enforces timeouts, and generally ensures that we're using a stdlib-like network API that meet all our constraints and requirements (e.g., logging);

  • bytecounter: provides support for counting the number of bytes consumed by network interactions;

  • multierror: defines an error type that contains a list of errors for representing the results of operations where multiple sub-operations may fail (e.g., TCP connect fails for all the IP addresses associated with a domain name);

  • tracex: support for collecting events during operations such as TCP connect, QUIC handshake, HTTP round trip. Collecting events allows us to analyze such events and determine whether there was blocking. This measurement strategy is called tracing because we wrap fundamental types (e.g., a dialer or an HTTP transport) to save the result of each operation into a "list of events" type called `Saver;

  • engine/netx: code surviving from the original netx implementation that we're still using for measuring. Issue ooni/probe#2121 describes a slow refactoring process where we'll move code outside of netx and inside netxlite or other packages. We are currently experimenting with step-by-step measurements, an alternative measurement approach where we break down operations in simpler building blocks. This alternative approach may eventually make netx obsolete.

Directories

Path Synopsis
Package atomicx extends sync/atomic.
Package atomicx extends sync/atomic.
Package bytecounter contains code to track the number of bytes sent and received by a probe.
Package bytecounter contains code to track the number of bytes sent and received by a probe.
cmd
apitool
Command apitool is a simple tool to fetch individual OONI measurements.
Command apitool is a simple tool to fetch individual OONI measurements.
getresources
Command getresources downloads the resources
Command getresources downloads the resources
jafar
Jafar is a censorship simulation tool used for testing OONI.
Jafar is a censorship simulation tool used for testing OONI.
jafar/badproxy
Package badproxy implements misbehaving proxies.
Package badproxy implements misbehaving proxies.
jafar/flagx
Package flagx contains extensions for the standard library flag package.
Package flagx contains extensions for the standard library flag package.
jafar/httpproxy
Package httpproxy contains a censoring HTTP proxy.
Package httpproxy contains a censoring HTTP proxy.
jafar/iptables
Package iptables contains code for managing firewall rules.
Package iptables contains code for managing firewall rules.
jafar/resolver
Package resolver contains a censoring DNS resolver.
Package resolver contains a censoring DNS resolver.
jafar/tlsproxy
Package tlsproxy contains a censoring TLS proxy.
Package tlsproxy contains a censoring TLS proxy.
jafar/uncensored
Package uncensored contains code used by Jafar to evade its own censorship efforts by taking alternate routes.
Package uncensored contains code used by Jafar to evade its own censorship efforts by taking alternate routes.
miniooni
Command miniooni is a simple binary for research and QA purposes with a CLI interface similar to MK and OONI Probe v2.x.
Command miniooni is a simple binary for research and QA purposes with a CLI interface similar to MK and OONI Probe v2.x.
oohelper
Command oohelper contains a simple command line client for the Web Connectivity test helper.
Command oohelper contains a simple command line client for the Web Connectivity test helper.
oohelperd
Command oohelperd implements the Web Connectivity test helper.
Command oohelperd implements the Web Connectivity test helper.
oonireport
Command oonireport uploads reports stored on disk to the OONI collector.
Command oonireport uploads reports stored on disk to the OONI collector.
printversion
Command printversion prints the current version of this repository.
Command printversion prints the current version of this repository.
Package engine contains the engine API.
Package engine contains the engine API.
experiment/dash
Package dash implements the DASH network experiment.
Package dash implements the DASH network experiment.
experiment/dnscheck
Package dnscheck contains the DNS check experiment.
Package dnscheck contains the DNS check experiment.
experiment/dnsping
Package dnsping is the experimental dnsping experiment.
Package dnsping is the experimental dnsping experiment.
experiment/example
Package example contains a simple example experiment.
Package example contains a simple example experiment.
experiment/fbmessenger
Package fbmessenger contains the Facebook Messenger network experiment.
Package fbmessenger contains the Facebook Messenger network experiment.
experiment/hhfm
Package hhfm contains the HTTP Header Field Manipulation network experiment.
Package hhfm contains the HTTP Header Field Manipulation network experiment.
experiment/hirl
Package hirl contains the HTTP Invalid Request Line network experiment.
Package hirl contains the HTTP Invalid Request Line network experiment.
experiment/httphostheader
Package httphostheader contains the HTTP host header network experiment.
Package httphostheader contains the HTTP host header network experiment.
experiment/ndt7
Package ndt7 contains the ndt7 network experiment.
Package ndt7 contains the ndt7 network experiment.
experiment/psiphon
Package psiphon implements the psiphon network experiment.
Package psiphon implements the psiphon network experiment.
experiment/quicping
Package quicping implements the quicping network experiment.
Package quicping implements the quicping network experiment.
experiment/riseupvpn
Package riseupvpn contains the RiseupVPN network experiment.
Package riseupvpn contains the RiseupVPN network experiment.
experiment/run
Package run contains code to run other experiments.
Package run contains code to run other experiments.
experiment/signal
Package signal contains the Signal network experiment.
Package signal contains the Signal network experiment.
experiment/simplequicping
Package simplequicping is the experimental simplequicping experiment.
Package simplequicping is the experimental simplequicping experiment.
experiment/sniblocking
Package sniblocking contains the SNI blocking network experiment.
Package sniblocking contains the SNI blocking network experiment.
experiment/stunreachability
Package stunreachability contains the STUN reachability experiment.
Package stunreachability contains the STUN reachability experiment.
experiment/tcpping
Package tcpping is the experimental tcpping experiment.
Package tcpping is the experimental tcpping experiment.
experiment/telegram
Package telegram contains the Telegram network experiment.
Package telegram contains the Telegram network experiment.
experiment/tlsping
Package tlsping is the experimental tlsping experiment.
Package tlsping is the experimental tlsping experiment.
experiment/tlstool
Package tlstool contains a TLS tool that we are currently using for running quick and dirty experiments.
Package tlstool contains a TLS tool that we are currently using for running quick and dirty experiments.
experiment/tlstool/internal
Package internal contains the implementation of tlstool.
Package internal contains the implementation of tlstool.
experiment/tor
Package tor contains the tor experiment.
Package tor contains the tor experiment.
experiment/torsf
Package torsf contains the torsf experiment.
Package torsf contains the torsf experiment.
experiment/urlgetter
Package urlgetter implements a nettest that fetches a URL.
Package urlgetter implements a nettest that fetches a URL.
experiment/vanillator
Package vanillator contains the vanilla_tor experiment.
Package vanillator contains the vanilla_tor experiment.
experiment/webconnectivity
Package webconnectivity implements OONI's Web Connectivity experiment.
Package webconnectivity implements OONI's Web Connectivity experiment.
experiment/webconnectivity/internal
Package internal contains internal code.
Package internal contains internal code.
experiment/whatsapp
Package whatsapp contains the WhatsApp network experiment.
Package whatsapp contains the WhatsApp network experiment.
geolocate
Package geolocate implements IP lookup, resolver lookup, and geolocation.
Package geolocate implements IP lookup, resolver lookup, and geolocation.
mockable
Package mockable contains mockable objects
Package mockable contains mockable objects
netx
Package netx contains code to perform network measurements.
Package netx contains code to perform network measurements.
probeservices
Package probeservices contains code to contact OONI probe services.
Package probeservices contains code to contact OONI probe services.
probeservices/testorchestra
Package testorchestra helps with testing the OONI orchestra API.
Package testorchestra helps with testing the OONI orchestra API.
sessionresolver
Package sessionresolver contains the resolver used by the session.
Package sessionresolver contains the resolver used by the session.
experiment
webconnectivity
Package webconnectivity implements the web_connectivity experiment.
Package webconnectivity implements the web_connectivity experiment.
Package fsx contains io/fs extensions.
Package fsx contains io/fs extensions.
Package geoipx contains code to use the embedded MaxMind-like databases.
Package geoipx contains code to use the embedded MaxMind-like databases.
Package httpapi contains code for calling HTTP APIs.
Package httpapi contains code for calling HTTP APIs.
Package httpx contains http extensions.
Package httpx contains http extensions.
Package humanize is like dustin/go-humanize.
Package humanize is like dustin/go-humanize.
Package kvstore implements model.KeyValueStore.
Package kvstore implements model.KeyValueStore.
legacy
assetsdir
Package assetsdir contains code to cleanup the assets dir.
Package assetsdir contains code to cleanup the assets dir.
Package logx contains logging extensions
Package logx contains logging extensions
Package measurex contains measurement extensions.
Package measurex contains measurement extensions.
Package measurexlite contains measurement extensions.
Package measurexlite contains measurement extensions.
Package mlablocate contains a locate.measurementlab.net client implementing v1 of the locate API.
Package mlablocate contains a locate.measurementlab.net client implementing v1 of the locate API.
Package mlablocatev2 implements m-lab locate services API v2.
Package mlablocatev2 implements m-lab locate services API v2.
Package model contains the shared interfaces and data structures.
Package model contains the shared interfaces and data structures.
mocks
Package mocks contains mocks for internal/model interfaces.
Package mocks contains mocks for internal/model interfaces.
Package multierror contains code to manage multiple errors.
Package multierror contains code to manage multiple errors.
Package netxlite contains network extensions.
Package netxlite contains network extensions.
filtering
Package filtering allows to implement self-censorship.
Package filtering allows to implement self-censorship.
quictesting
Package quictesting contains code useful to test QUIC.
Package quictesting contains code useful to test QUIC.
Package oonirun contains code to run OONI experiments.
Package oonirun contains code to run OONI experiments.
Package platform allows you to obtain the platform name.
Package platform allows you to obtain the platform name.
Package ptx contains code to use pluggable transports.
Package ptx contains code to use pluggable transports.
Package randx contains math/rand extensions.
Package randx contains math/rand extensions.
Package registry contains a registry of all the available experiments.
Package registry contains a registry of all the available experiments.
Package runtimex contains runtime extensions.
Package runtimex contains runtime extensions.
Package shellx runs external commands.
Package shellx runs external commands.
Package stuninput contains stun targets as well as code to format such targets according to various conventions.
Package stuninput contains stun targets as well as code to format such targets according to various conventions.
Package testingx contains code useful for testing.
Package testingx contains code useful for testing.
Package torlogs contains code to read tor logs.
Package torlogs contains code to read tor logs.
Package tracex performs measurements using tracing.
Package tracex performs measurements using tracing.
Package tunnel allows to create tunnels to speak with OONI backends and other services.
Package tunnel allows to create tunnels to speak with OONI backends and other services.
mocks
Package mocks contains mocks for tunnel.
Package mocks contains mocks for tunnel.
tutorial
experiment/torsf/chapter01
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
experiment/torsf/chapter02
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
generator
Command generator generates or re-generates the tutorial chapters.
Command generator generates or re-generates the tutorial chapters.
measurex/chapter01
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
measurex/chapter02
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
measurex/chapter03
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
measurex/chapter04
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
measurex/chapter05
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
measurex/chapter06
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
measurex/chapter07
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
measurex/chapter08
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
measurex/chapter09
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
measurex/chapter10
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
measurex/chapter11
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
measurex/chapter12
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
measurex/chapter13
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
measurex/chapter14
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
netxlite/chapter01
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
netxlite/chapter02
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
netxlite/chapter03
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
netxlite/chapter04
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
netxlite/chapter05
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
netxlite/chapter06
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
netxlite/chapter07
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
netxlite/chapter08
-=-=- StartHere -=-=-
-=-=- StartHere -=-=-
Package version contains version information
Package version contains version information

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL