locate

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: Apache-2.0 Imports: 11 Imported by: 6

Documentation

Overview

Package locate implements a client for the Locate API v2.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoAvailableServers = errors.New("no available M-Lab servers")

ErrNoAvailableServers is returned when there are no available servers. Batch clients should pause before scheduling a new request.

View Source
var ErrNoUserAgent = errors.New("client has no user-agent specified")

ErrNoUserAgent is returned when an empty user agent is used.

Functions

This section is empty.

Types

type Client

type Client struct {
	// HTTPClient performs all requests. Initialized to http.DefaultClient by
	// NewClient. You may override it for alternate settings.
	HTTPClient *http.Client

	// UserAgent is the mandatory user agent to be used. Also this
	// field is initialized by NewClient.
	UserAgent string

	// BaseURL is the base url used to contact the Locate API.
	// NewClient sets the BaseURL to the -locate.url flag.
	BaseURL *url.URL

	// Authorization is the optional VALUE to include in the HTTP
	// request as `Authorization: Bearer VALUE`. This value is
	// typically used by ndt7-client-go and possibly other tools for
	// the client-integration registration.
	Authorization string
}

Client is a client for contacting the Locate API. All fields are required.

func NewClient

func NewClient(userAgent string) *Client

NewClient creates a new Client instance. The userAgent must not be empty.

func (*Client) Nearest

func (c *Client) Nearest(ctx context.Context, service string) ([]v2.Target, error)

Nearest returns a slice of nearby mlab servers. Returns an error on failure.

Jump to

Keyboard shortcuts

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