nettests

package
v3.16.0-alpha Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var All = map[string]Group{
	"websites": {
		Label: "Websites",
		Nettests: []Nettest{
			WebConnectivity{},
		},
		UnattendedOK: true,
	},
	"performance": {
		Label: "Performance",
		Nettests: []Nettest{
			Dash{},
			NDT{},
		},

		UnattendedOK: false,
	},
	"middlebox": {
		Label: "Middleboxes",
		Nettests: []Nettest{
			HTTPInvalidRequestLine{},
			HTTPHeaderFieldManipulation{},
		},
		UnattendedOK: true,
	},
	"im": {
		Label: "Instant Messaging",
		Nettests: []Nettest{
			FacebookMessenger{},
			Telegram{},
			WhatsApp{},
			Signal{},
		},
		UnattendedOK: true,
	},
	"circumvention": {
		Label: "Circumvention Tools",
		Nettests: []Nettest{
			Psiphon{},
			Tor{},
		},
		UnattendedOK: true,
	},
	"experimental": {
		Label: "Experimental Nettests",
		Nettests: []Nettest{
			DNSCheck{},
			STUNReachability{},
			TorSf{},
			VanillaTor{},
		},
		UnattendedOK: true,
	},
}

All contains all the nettests that can be run by the user

Functions

func RunGroup

func RunGroup(config RunGroupConfig) error

RunGroup runs a group of nettests according to the specified config.

Types

type Controller

type Controller struct {
	Probe   *ooni.Probe
	Session *engine.Session

	// InputFiles optionally contains the names of the input
	// files to read inputs from (only for nettests that take
	// inputs, of course)
	InputFiles []string

	// Inputs contains inputs to be tested. These are specified
	// using the command line using the --input flag.
	Inputs []string

	// RunType contains the run_type hint for the CheckIn API. If
	// not set, the underlying code defaults to model.RunTypeTimed.
	RunType model.RunType
	// contains filtered or unexported fields
}

Controller is passed to the run method of every Nettest each nettest instance has one controller

func NewController

func NewController(
	nt Nettest, probe *ooni.Probe, res *database.Result, sess *engine.Session) *Controller

NewController creates a nettest controller

func (*Controller) BuildAndSetInputIdxMap added in v3.13.0

func (c *Controller) BuildAndSetInputIdxMap(
	sess db.Session, testlist []model.OOAPIURLInfo) ([]string, error)

BuildAndSetInputIdxMap takes in input a list of URLs in the format returned by the check-in API (i.e., model.URLInfo) and performs the following actions:

1. inserts each URL into the database;

2. builds a list of bare URLs to be tested;

3. registers a mapping between each URL and an index and stores it into the controller.

Arguments:

- sess is the database in which to register the URL;

- testlist is the result from the check-in API (or possibly a manually constructed list when applicable, e.g., for dnscheck until we have an API for serving its input).

Results:

- on success, a list of strings containing URLs to test;

- on failure, an error.

func (*Controller) OnProgress

func (c *Controller) OnProgress(perc float64, msg string)

OnProgress should be called when a new progress event is available.

func (*Controller) Run

func (c *Controller) Run(builder model.ExperimentBuilder, inputs []string) error

Run runs the selected nettest using the related experiment with the specified inputs.

This function will continue to run in most cases but will immediately halt if something's wrong with the file system.

func (*Controller) SetNettestIndex

func (c *Controller) SetNettestIndex(i, n int)

SetNettestIndex is used to set the current nettest index and total nettest count to compute a different progress percentage.

type DNSCheck added in v3.7.0

type DNSCheck struct{}

DNSCheck nettest implementation.

func (DNSCheck) Run added in v3.7.0

func (n DNSCheck) Run(ctl *Controller) error

Run starts the nettest.

type Dash

type Dash struct {
}

Dash test implementation

func (Dash) Run

func (d Dash) Run(ctl *Controller) error

Run starts the test

type FacebookMessenger

type FacebookMessenger struct {
}

FacebookMessenger test implementation

func (FacebookMessenger) Run

func (h FacebookMessenger) Run(ctl *Controller) error

Run starts the test

type Group

type Group struct {
	Label        string
	Nettests     []Nettest
	UnattendedOK bool
}

Group is a group of nettests

type HTTPHeaderFieldManipulation

type HTTPHeaderFieldManipulation struct {
}

HTTPHeaderFieldManipulation test implementation

func (HTTPHeaderFieldManipulation) Run

Run starts the test

type HTTPInvalidRequestLine

type HTTPInvalidRequestLine struct {
}

HTTPInvalidRequestLine test implementation

func (HTTPInvalidRequestLine) Run

Run starts the test

type NDT

type NDT struct {
}

NDT test implementation. We use v7 of NDT since 2020-03-12.

func (NDT) Run

func (n NDT) Run(ctl *Controller) error

Run starts the test

type Nettest

type Nettest interface {
	Run(*Controller) error
}

Nettest interface. Every Nettest should implement this.

type Psiphon

type Psiphon struct {
}

Psiphon test implementation

func (Psiphon) Run

func (h Psiphon) Run(ctl *Controller) error

Run starts the test

type RiseupVPN

type RiseupVPN struct {
}

RiseupVPN test implementation

func (RiseupVPN) Run

func (h RiseupVPN) Run(ctl *Controller) error

Run starts the test

type RunGroupConfig

type RunGroupConfig struct {
	GroupName  string
	InputFiles []string
	Inputs     []string
	Probe      *ooni.Probe
	RunType    model.RunType // hint for check-in API
}

RunGroupConfig contains the settings for running a nettest group.

type STUNReachability added in v3.7.0

type STUNReachability struct{}

STUNReachability nettest implementation.

func (STUNReachability) Run added in v3.7.0

func (n STUNReachability) Run(ctl *Controller) error

Run starts the nettest.

type Signal added in v3.6.0

type Signal struct{}

Signal nettest implementation.

func (Signal) Run added in v3.6.0

func (h Signal) Run(ctl *Controller) error

Run starts the nettest.

type Telegram

type Telegram struct {
}

Telegram test implementation

func (Telegram) Run

func (h Telegram) Run(ctl *Controller) error

Run starts the test

type Tor

type Tor struct {
}

Tor test implementation

func (Tor) Run

func (h Tor) Run(ctl *Controller) error

Run starts the test

type TorSf added in v3.14.0

type TorSf struct {
}

TorSf test implementation

func (TorSf) Run added in v3.14.0

func (h TorSf) Run(ctl *Controller) error

Run starts the test

type VanillaTor added in v3.15.0

type VanillaTor struct {
}

VanillaTor test implementation

func (VanillaTor) Run added in v3.15.0

func (h VanillaTor) Run(ctl *Controller) error

Run starts the test

type WebConnectivity

type WebConnectivity struct{}

WebConnectivity test implementation

func (WebConnectivity) Run

func (n WebConnectivity) Run(ctl *Controller) error

Run starts the test

type WhatsApp

type WhatsApp struct {
}

WhatsApp test implementation

func (WhatsApp) Run

func (h WhatsApp) Run(ctl *Controller) error

Run starts the test

Jump to

Keyboard shortcuts

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