internal

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: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHTTPStatusCode          = errors.New("oohelper: http status code indicates failure")
	ErrUnsupportedURLScheme    = errors.New("oohelper: unsupported URL scheme")
	ErrUnsupportedExplicitPort = errors.New("oohelper: unsupported explicit port")
	ErrEmptyURL                = errors.New("oohelper: empty server and/or target URL")
	ErrInvalidURL              = errors.New("oohelper: cannot parse URL")
	ErrCannotCreateRequest     = errors.New("oohelper: cannot create HTTP request")
	ErrCannotParseJSONReply    = errors.New("oohelper: cannot parse JSON reply")
)

The following errors may be returned by this implementation.

Functions

func MakeTCPEndpoints

func MakeTCPEndpoints(URL *url.URL, addrs []string) ([]string, error)

MakeTCPEndpoints constructs the list of TCP endpoints to send to the Web Connectivity test helper.

Types

type CtrlResponse

type CtrlResponse = model.THResponse

CtrlResponse is the type of response returned by the test helper.

type OOClient

type OOClient struct {
	// HTTPClient is the HTTP client to use.
	HTTPClient model.HTTPClient

	// Resolver is the resolver to user.
	Resolver Resolver
}

OOClient is a client for the OONI Web Connectivity test helper.

func (OOClient) Do

func (oo OOClient) Do(ctx context.Context, config OOConfig) (*CtrlResponse, error)

Do sends a measurement request to the Web Connectivity test helper and receives the corresponding response.

type OOConfig

type OOConfig struct {
	// ServerURL is the URL of the test helper server.
	ServerURL string

	// TargetURL is the URL that we want to measure.
	TargetURL string
}

OOConfig contains configuration for the client.

type Resolver

type Resolver interface {
	LookupHost(ctx context.Context, hostname string) ([]string, error)
}

Resolver resolves domain names.

Jump to

Keyboard shortcuts

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