mlablocatev2

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

Documentation

Overview

Package mlablocatev2 implements m-lab locate services API v2.

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyResponse = errors.New("mlablocatev2: empty response")

ErrEmptyResponse indicates that no hosts were returned

View Source
var ErrRequestFailed = errors.New("mlablocatev2: request failed")

ErrRequestFailed indicates that the response is not "200 Ok"

Functions

This section is empty.

Types

type Client

type Client struct {
	// HTTPClient is the MANDATORY http client to use
	HTTPClient model.HTTPClient

	// Hostname is the MANDATORY hostname of the mlablocate API.
	Hostname string

	// Logger is the MANDATORY logger to use.
	Logger model.Logger

	// Scheme is the MANDATORY scheme to use (http or https).
	Scheme string

	// UserAgent is the MANDATORY user-agent to use.
	UserAgent string
}

Client is a client for v2 of the locate services. Please use the NewClient factory to construct a new instance of client, otherwise you MUST fill all the fields marked as MANDATORY.

func NewClient

func NewClient(httpClient model.HTTPClient, logger model.Logger, userAgent string) *Client

NewClient creates a client for v2 of the locate services.

func (*Client) QueryDash

func (c *Client) QueryDash(ctx context.Context) ([]*DashResult, error)

QueryDash performs a v2 locate services query for dash.

func (*Client) QueryNDT7

func (c *Client) QueryNDT7(ctx context.Context) ([]*NDT7Result, error)

QueryNDT7 performs a v2 locate services query for ndt7.

type DashResult

type DashResult struct {
	// Hostname is an informative field containing the hostname
	// to which you're connected. Because there are access tokens,
	// you CANNOT use this field directly.
	Hostname string

	// Site is an informative field containing the site
	// to which the server belongs to.
	Site string

	// NegotiateURL is the HTTPS URL to be used for
	// performing the DASH negotiate operation. Note that this
	// URL typically includes the required access token.
	NegotiateURL string

	// BaseURL is the base URL used for the download and the
	// collect phases of dash. The token is only required during
	// the negotiate phase and we can otherwise use a base URL.
	BaseURL string
}

DashResult is the result of a v2 locate services query for dash.

type NDT7Result

type NDT7Result struct {
	// Hostname is an informative field containing the hostname
	// to which you're connected. Because there are access tokens,
	// you CANNOT use this field directly.
	Hostname string

	// Site is an informative field containing the site
	// to which the server belongs to.
	Site string

	// WSSDownloadURL is the WebSocket URL to be used for
	// performing a download over HTTPS. Note that the URL
	// typically includes the required access token.
	WSSDownloadURL string

	// WSSUploadURL is like WSSDownloadURL but for the upload.
	WSSUploadURL string
}

NDT7Result is the result of a v2 locate services query for ndt7.

Jump to

Keyboard shortcuts

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