tlsmiddlebox

package
v3.31.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Overview

Package tlsmiddlebox implements the tlsmiddlebox experiment

Spec: https://github.com/ooni/spec/blob/master/nettests/ts-037-tlsmiddlebox.md.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoInput indicates that no input was provided
	ErrNoInput = errors.New("no input provided")

	// ErrInputIsNotAnURL indicates that the input is not an URL.
	ErrInputIsNotAnURL = errors.New("input is not an URL")

	// ErrUnsupportedInput indicates that the input URL scheme is unsupported.
	ErrUnsupportedInput = errors.New("unsupported input scheme, input scheme must be https")

	// ErrInputRequired indicates that no richer-input target was provided.
	ErrInputRequired = targetloading.ErrInputRequired

	// ErrInvalidInputType indicates that the richer-input target has the wrong type.
	ErrInvalidInputType = targetloading.ErrInvalidInputType
)

ClientIDs to map configurable inputs to uTLS fingerprints We use a non-zero index to map to each ClientID

Functions

func LookupASN added in v3.31.0

func LookupASN(ip string, dbPath string) (asn uint, org string, err error)

LookupASN maps [ip] to an AS number and an AS organization name.

func LookupCC added in v3.31.0

func LookupCC(ip string, dbPath string) (cc string, err error)

LookupCC maps [ip] to a country code.

func NewDialerTTLWrapper

func NewDialerTTLWrapper() model.Dialer

NewDialerTTLWrapper returns a wrapped Dialer via dialerTTLWrapper

func NewLoader added in v3.31.0

func NewLoader(loader *targetloading.Loader, gopts any) model.ExperimentTargetLoader

NewLoader constructs a new model.ExperimentTargetLoader instance.

This function PANICS if options is not an instance of *tlsmiddlebox.Config.

Types

type CompleteTrace

type CompleteTrace struct {
	Address       string               `json:"address"`
	TCPTraceroute *IterativeTraceroute `json:"tcp_traceroute"`
	ControlTrace  *IterativeTrace      `json:"control_trace"`
	TargetTrace   *IterativeTrace      `json:"target_trace"`
}

CompleteTrace records the result of the network trace using a control SNI and a target SNI

type Config

type Config struct {
	// ResolverURL is the default DoH resolver
	ResolverURL string `json:"resolver_url" ooni:"URL for DoH resolver"`

	// SNIPass is the SNI value we don't expect to be blocked
	SNIControl string `json:"sni_control" ooni:"control SNI value for testhelper"`

	// Delay is the delay between each iteration (in milliseconds).
	Delay int64 `json:"delay" ooni:"delay between consecutive iterations"`

	// MaxTTL is the default number of interations we trace
	MaxTTL int64 `json:"maximum_ttl" ooni:"maximum TTL value to iterate upto"`

	// TestHelper is the testhelper host for iterative tracing
	TestHelper string `json:"test_helper" ooni:"testhelper URL to use for tracing"`

	// ClientId is the client fingerprint to use
	ClientId int64 `json:"client_id" ooni:"ClientHello fingerprint to use"`

	// PrivacyMode is whether the user only wants to reveal AS and country information or city-level geolocation and /24 prefix information with respect to traceroutes
	PrivacyMode string `json:"privacy_mode" ooni:"privacy mode to use for traceroutes"`
}

Config contains the experiment configuration.

type ICMPIteration added in v3.31.0

type ICMPIteration struct {
	TTL       int                             `json:"ttl"`
	ICMPError *model.ArchivalICMPErrorMessage `json:"icmp_error"`
}

ICMPIteration is a single ICMP error message associated with a TTL-limited probe when used for traceroute

type Iteration

type Iteration struct {
	TTL       int                                     `json:"ttl"`
	Handshake *model.ArchivalTLSOrQUICHandshakeResult `json:"handshake"`
}

Iteration is a single network iteration with variable TTL

type IterativeTrace

type IterativeTrace struct {
	SNI        string       `json:"server_name"`
	Iterations []*Iteration `json:"iterations"`
	// contains filtered or unexported fields
}

Trace is an iterative trace for the corresponding servername and address

type IterativeTraceroute added in v3.31.0

type IterativeTraceroute struct {
	SNI        string           `json:"server_name"`
	Iterations []*ICMPIteration `json:"iterations"`
	// contains filtered or unexported fields
}

IterativeTraceroute is an iterative traceroute towards the address

type Measurer

type Measurer struct {
	// contains filtered or unexported fields
}

Measurer performs the measurement.

func NewExperimentMeasurer

func NewExperimentMeasurer() *Measurer

NewExperimentMeasurer creates a new ExperimentMeasurer.

func (*Measurer) DNSLookup

func (m *Measurer) DNSLookup(ctx context.Context, index int64, zeroTime time.Time,
	logger model.Logger, domain string, tk *TestKeys, config *Config) ([]string, error)

DNSLookup performs a DNS Lookup for the passed domain

func (*Measurer) ExperimentName

func (m *Measurer) ExperimentName() string

ExperimentName implements ExperimentMeasurer.ExperimentName.

func (*Measurer) ExperimentVersion

func (m *Measurer) ExperimentVersion() string

ExperimentVersion implements ExperimentMeasurer.ExperimentVersion.

func (*Measurer) Run

func (m *Measurer) Run(ctx context.Context, args *model.ExperimentArgs) error

Run implements ExperimentMeasurer.Run.

func (*Measurer) TCPConnect

func (m *Measurer) TCPConnect(ctx context.Context, index int64, zeroTime time.Time,
	logger model.Logger, address string, tk *TestKeys) error

TCPConnect performs a TCP connect to filter working addresses

func (*Measurer) TLSTrace

func (m *Measurer) TLSTrace(ctx context.Context, index int64, zeroTime time.Time, logger model.Logger,
	address string, targetSNI string, trace *CompleteTrace, config *Config)

TLSTrace performs tracing using control and target SNI

func (*Measurer) TraceAddress

func (m *Measurer) TraceAddress(ctx context.Context, index int64, zeroTime time.Time, logger model.Logger,
	address string, sni string, tk *TestKeys, wg *sync.WaitGroup, config *Config) error

TraceAddress measures a single address after the DNSLookup

type Target added in v3.31.0

type Target struct {
	// Config contains the configuration.
	Config *Config

	// URL is the input URL.
	URL string
	// contains filtered or unexported fields
}

Target is a richer-input target that this experiment should measure.

func (*Target) Category added in v3.31.0

func (t *Target) Category() string

Category implements model.ExperimentTarget.

func (*Target) Country added in v3.31.0

func (t *Target) Country() string

Country implements model.ExperimentTarget.

func (*Target) Input added in v3.31.0

func (t *Target) Input() string

Input implements model.ExperimentTarget.

func (*Target) Options added in v3.31.0

func (t *Target) Options() []string

Options implements model.ExperimentTarget.

func (*Target) String added in v3.31.0

func (t *Target) String() string

String implements model.ExperimentTarget.

type TestKeys

type TestKeys struct {
	Queries        []*model.ArchivalDNSLookupResult  `json:"queries"`
	TCPConnect     []*model.ArchivalTCPConnectResult `json:"tcp_connect"`
	IterativeTrace []*CompleteTrace                  `json:"iterative_trace"`
	// contains filtered or unexported fields
}

TestKeys contains the experiment results

func NewTestKeys

func NewTestKeys() *TestKeys

NewTestKeys creates new tlsmiddlebox TestKeys

Jump to

Keyboard shortcuts

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