internal

package
v3.10.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: BSD-3-Clause Imports: 15 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 = webconnectivity.ControlResponse

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

type OOClient

type OOClient struct {
	// HTTPClient is the HTTP client to use.
	HTTPClient *http.Client

	// Resolver is the resolver to user.
	Resolver netx.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.

Jump to

Keyboard shortcuts

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