client

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

client implements the pingmesh request generator

Index

Constants

View Source
const (
	// HTML markers delimit peer location in response body
	ServedFromPrefix = "<p>Served from "
	ServedFromSuffix = "\n"
	// JSON markers for /peers API response body
	SrvLocPrefix = `"SrvLoc": "`
	SrvLocSuffix = `"`

	HttpUnknown = 502
	LocUnknown  = "unknown"
)

Variables

View Source
var (
	PingPeerPaths = []string{
		"/v1/peers",
		"/v1/ping",
		"/v1/addpeer",
	}
)

Functions

func FetchURL added in v0.2.5

func FetchURL(rawurl, rmtIP string) *pt.PingTimes

FetchURL makes an HTTP request to the given URL, reads and discards the response body, and returns a PingTimes object with detailed timing information from the fetch. NOTE: the location handling is different from perftest! The caller does not pass in a location, instead location is parsed from the response body and returned in pt.Location.

func GetIPs added in v0.3.1

func GetIPs(hostname string) []net.IP

func HostNoPort added in v0.2.5

func HostNoPort(addr string) string

func IsPingmeshPeer added in v0.3.1

func IsPingmeshPeer(path string) bool

func LocationFromEnv added in v0.2.5

func LocationFromEnv() string

LocationFromEnv returns the current location from environment variables: REP_LOCATION, if defined; otherwise REP_CITY "," REP_COUNTRY, if defined; otherwise "" (empty string)

func MakePeerAddr added in v0.3.1

func MakePeerAddr(scheme, host, rmtIP string) (newhost, peerAddr string)

func ParseURL added in v0.2.5

func ParseURL(uri string) *url.URL

Parse the uri argument and return URL object for it, or nil on failure.

Types

This section is empty.

Jump to

Keyboard shortcuts

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