hirl

package
v3.23.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 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 (
	// 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) 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.

func (*SummaryKeys) Anomaly added in v3.21.0

func (sk *SummaryKeys) Anomaly() bool

Anomaly implements model.MeasurementSummaryKeys.

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.

func (*TestKeys) MeasurementSummaryKeys added in v3.21.0

func (tk *TestKeys) MeasurementSummaryKeys() model.MeasurementSummaryKeys

MeasurementSummaryKeys implements model.MeasurementSummaryKeysProvider.

Jump to

Keyboard shortcuts

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