whatsapp

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: GPL-3.0 Imports: 11 Imported by: 1

Documentation

Overview

Package whatsapp contains the WhatsApp network experiment.

See https://github.com/ooni/spec/blob/master/nettests/ts-018-whatsapp.md.

Index

Constants

View Source
const (
	// RegistrationServiceURL is the URL used by WhatsApp registration service
	RegistrationServiceURL = "https://v.whatsapp.net/v2/register"

	// WebHTTPSURL is WhatsApp web's HTTPS URL
	WebHTTPSURL = "https://web.whatsapp.com/"
)

Variables

View Source
var (
	// 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
)

Functions

func NewExperimentMeasurer

func NewExperimentMeasurer() model.ExperimentMeasurer

NewExperimentMeasurer creates a new ExperimentMeasurer.

func NewLoader added in v0.37.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 *whatsapp.Config.

Types

type Config

type Config struct{}

Config contains the experiment config.

type Measurer

type Measurer struct {
	// Getter is an optional getter to be used for testing.
	Getter urlgetter.MultiGetter
}

Measurer performs the measurement

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

type SummaryKeys

type SummaryKeys struct {
	RegistrationServerBlocking bool `json:"registration_server_blocking"`
	WebBlocking                bool `json:"whatsapp_web_blocking"`
	EndpointsBlocking          bool `json:"whatsapp_endpoints_blocking"`
	IsAnomaly                  bool `json:"-"`
}

SummaryKeys contains summary keys for this experiment.

func (*SummaryKeys) Anomaly added in v0.28.0

func (sk *SummaryKeys) Anomaly() bool

Anomaly implements model.MeasurementSummaryKeys.

type Target added in v0.37.0

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

	// URL is the input URL.
	URL string
}

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

func (*Target) Category added in v0.37.0

func (t *Target) Category() string

Category implements model.ExperimentTarget.

func (*Target) Country added in v0.37.0

func (t *Target) Country() string

Country implements model.ExperimentTarget.

func (*Target) Input added in v0.37.0

func (t *Target) Input() string

Input implements model.ExperimentTarget.

func (*Target) Options added in v0.37.0

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

Options implements model.ExperimentTarget.

func (*Target) String added in v0.37.0

func (t *Target) String() string

String implements model.ExperimentTarget.

type TestKeys

type TestKeys struct {
	urlgetter.TestKeys
	RegistrationServerFailure        *string        `json:"registration_server_failure"`
	RegistrationServerStatus         string         `json:"registration_server_status"`
	WhatsappEndpointsBlocked         []string       `json:"whatsapp_endpoints_blocked"`
	WhatsappEndpointsDNSInconsistent []string       `json:"whatsapp_endpoints_dns_inconsistent"`
	WhatsappEndpointsStatus          string         `json:"whatsapp_endpoints_status"`
	WhatsappWebFailure               *string        `json:"whatsapp_web_failure"`
	WhatsappWebStatus                string         `json:"whatsapp_web_status"`
	WhatsappEndpointsCount           map[string]int `json:"-"`
	WhatsappHTTPSFailure             *string        `json:"-"`
}

TestKeys contains the experiment results

func NewTestKeys

func NewTestKeys() *TestKeys

NewTestKeys returns a new instance of the test keys.

func (*TestKeys) ComputeWebStatus

func (tk *TestKeys) ComputeWebStatus()

ComputeWebStatus sets the web status fields.

func (*TestKeys) MeasurementSummaryKeys added in v0.28.0

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

MeasurementSummaryKeys implements model.MeasurementSummaryKeysProvider.

func (*TestKeys) Update

func (tk *TestKeys) Update(v urlgetter.MultiOutput)

Update updates the TestKeys using the given MultiOutput result.

Jump to

Keyboard shortcuts

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