oonitemplates

package
v3.11.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package oonitemplates contains templates for experiments.

Every experiment should possibly be based on code inside of this package. In the future we should perhaps unify the code in here with the code in oonidatamodel.

This has been forked from ooni/netx/x/porcelain because it was causing too much changes to keep this code in there.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DNSLookupConfig

type DNSLookupConfig struct {
	Beginning     time.Time
	Handler       modelx.Handler
	Hostname      string
	ServerAddress string
	ServerNetwork string
}

DNSLookupConfig contains DNSLookup settings.

type DNSLookupResults

type DNSLookupResults struct {
	TestKeys  Results
	Addresses []string
	Error     error
}

DNSLookupResults contains the results of a DNSLookup

func DNSLookup

func DNSLookup(
	ctx context.Context, config DNSLookupConfig,
) *DNSLookupResults

DNSLookup performs a DNS lookup.

type HTTPDoConfig

type HTTPDoConfig struct {
	Accept             string
	AcceptLanguage     string
	Beginning          time.Time
	Body               []byte
	DNSServerAddress   string
	DNSServerNetwork   string
	Handler            modelx.Handler
	InsecureSkipVerify bool
	Method             string
	ProxyFunc          func(*http.Request) (*url.URL, error)
	URL                string
	UserAgent          string

	// MaxEventsBodySnapSize controls the snap size that
	// we're using for bodies returned as modelx.Measurement.
	//
	// Same rules as modelx.MeasurementRoot.MaxBodySnapSize.
	MaxEventsBodySnapSize int64

	// MaxResponseBodySnapSize controls the snap size that
	// we're using for the HTTPDoResults.BodySnap.
	//
	// Same rules as modelx.MeasurementRoot.MaxBodySnapSize.
	MaxResponseBodySnapSize int64
}

HTTPDoConfig contains HTTPDo settings.

type HTTPDoResults

type HTTPDoResults struct {
	TestKeys   Results
	StatusCode int64
	Headers    http.Header
	BodySnap   []byte
	Error      error
}

HTTPDoResults contains the results of a HTTPDo

func HTTPDo

func HTTPDo(
	origCtx context.Context, config HTTPDoConfig,
) *HTTPDoResults

HTTPDo performs a HTTP request

type OBFS4ConnectConfig

type OBFS4ConnectConfig struct {
	Address          string
	Beginning        time.Time
	DNSServerAddress string
	DNSServerNetwork string
	Handler          modelx.Handler
	Params           goptlib.Args
	StateBaseDir     string
	Timeout          time.Duration
	// contains filtered or unexported fields
}

OBFS4ConnectConfig contains OBFS4Connect settings.

type OBFS4ConnectResults

type OBFS4ConnectResults struct {
	TestKeys Results
	Error    error
}

OBFS4ConnectResults contains the results of a OBFS4Connect

func OBFS4Connect

func OBFS4Connect(
	ctx context.Context, config OBFS4ConnectConfig,
) *OBFS4ConnectResults

OBFS4Connect performs a TCP connect.

type Results

type Results struct {
	Connects      []*modelx.ConnectEvent
	HTTPRequests  []*modelx.HTTPRoundTripDoneEvent
	NetworkEvents []*modelx.Measurement
	Resolves      []*modelx.ResolveDoneEvent
	TLSHandshakes []*modelx.TLSHandshakeDoneEvent
}

Results contains the results of every operation that we care about and information on the number of bytes received and sent. When counting the number of bytes sent and received, we do not take into account domain name resolutions performed using the system resolver. We estimated that using heuristics with MK but we currently don't have a good solution. TODO(bassosimone): this can be improved by emitting estimates when we know that we are using the system resolver, so we can pick up estimates here.

type TCPConnectConfig

type TCPConnectConfig struct {
	Address          string
	Beginning        time.Time
	DNSServerAddress string
	DNSServerNetwork string
	Handler          modelx.Handler
}

TCPConnectConfig contains TCPConnect settings.

type TCPConnectResults

type TCPConnectResults struct {
	TestKeys Results
	Error    error
}

TCPConnectResults contains the results of a TCPConnect

func TCPConnect

func TCPConnect(
	ctx context.Context, config TCPConnectConfig,
) *TCPConnectResults

TCPConnect performs a TCP connect.

type TLSConnectConfig

type TLSConnectConfig struct {
	Address            string
	Beginning          time.Time
	DNSServerAddress   string
	DNSServerNetwork   string
	Handler            modelx.Handler
	InsecureSkipVerify bool
	SNI                string
}

TLSConnectConfig contains TLSConnect settings.

type TLSConnectResults

type TLSConnectResults struct {
	TestKeys Results
	Error    error
}

TLSConnectResults contains the results of a TLSConnect

func TLSConnect

func TLSConnect(
	ctx context.Context, config TLSConnectConfig,
) *TLSConnectResults

TLSConnect performs a TLS connect.

Jump to

Keyboard shortcuts

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