hirl

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package hirl contains the HTTP Invalid Request Line network experiment.

See https://github.com/ooni/spec/blob/master/nettests/ts-007-http-invalid-request-line.md

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoAvailableTestHelpers is emitted when there are no available test helpers.
	ErrNoAvailableTestHelpers = errors.New("no available helpers")

	// ErrInvalidHelperType is emitted when the helper type is invalid.
	ErrInvalidHelperType = errors.New("invalid helper type")

	// ErrNoMeasurementMethod is emitted when Measurer.Methods is empty.
	ErrNoMeasurementMethod = errors.New("no configured measurement method")
)

Functions

func NewExperimentMeasurer

func NewExperimentMeasurer(config Config) model.ExperimentMeasurer

NewExperimentMeasurer creates a new ExperimentMeasurer.

func RunMethod

func RunMethod(ctx context.Context, config RunMethodConfig)

RunMethod runs the specific method using the given config and context

Types

type Config

type Config struct{}

Config contains the experiment config.

type Measurer

type Measurer struct {
	Config  Config
	Methods []Method
}

Measurer performs the measurement.

func (Measurer) ExperimentName

func (m Measurer) ExperimentName() string

ExperimentName implements ExperimentMeasurer.ExperiExperimentName.

func (Measurer) ExperimentVersion

func (m Measurer) ExperimentVersion() string

ExperimentVersion implements ExperimentMeasurer.ExperimentVersion.

func (Measurer) GetSummaryKeys

func (m Measurer) GetSummaryKeys(measurement *model.Measurement) (interface{}, error)

GetSummaryKeys implements model.ExperimentMeasurer.GetSummaryKeys.

func (Measurer) Run

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

Run implements ExperimentMeasurer.Run.

type Method

type Method interface {
	Name() string
	Run(ctx context.Context, config MethodConfig)
}

Method is one of the methods implemented by this experiment.

type MethodConfig

type MethodConfig struct {
	Address string
	Logger  model.Logger
	Out     chan<- MethodResult
}

MethodConfig contains the settings for a specific measuring method.

type MethodResult

type MethodResult struct {
	Err       error
	Name      string
	Received  legacymodel.ArchivalMaybeBinaryData
	Sent      string
	Tampering bool
}

MethodResult is the result of one of the methods implemented by this experiment.

type RunMethodConfig

type RunMethodConfig struct {
	MethodConfig
	Name        string
	NewDialer   func(config netx.Config) model.Dialer
	RequestLine string
}

RunMethodConfig contains the config for RunMethod

type SummaryKeys

type SummaryKeys struct {
	IsAnomaly bool `json:"-"`
}

SummaryKeys contains summary keys for this experiment.

Note that this structure is part of the ABI contract with ooniprobe therefore we should be careful when changing it.

type TestKeys

type TestKeys struct {
	FailureList   []*string                             `json:"failure_list"`
	Received      []legacymodel.ArchivalMaybeBinaryData `json:"received"`
	Sent          []string                              `json:"sent"`
	TamperingList []bool                                `json:"tampering_list"`
	Tampering     bool                                  `json:"tampering"`
}

TestKeys contains the experiment test keys.

Jump to

Keyboard shortcuts

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