Documentation
¶
Index ¶
- Variables
- type Client
- type DNSTimings
- type HTTPTimings
- type Locations
- type Measurement
- type MeasurementCreate
- type MeasurementCreateError
- type MeasurementCreateResponse
- type MeasurementOptions
- type MeasurementStatus
- type PingStats
- type PingTiming
- type ProbeDetails
- type ProbeMeasurement
- type ProbeResult
- type QueryOptions
- type RequestOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var ( API_URL = "https://api.globalping.io/v1/measurements" API_MIN_INTERVAL = 500 * time.Millisecond )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
CreateMeasurement(measurement *MeasurementCreate) (*MeasurementCreateResponse, bool, error)
GetMeasurement(id string) (*Measurement, error)
GetMeasurementRaw(id string) ([]byte, error)
}
type DNSTimings ¶
type DNSTimings struct {
Total float64 `json:"total"` // The total query time in milliseconds.
}
func DecodeDNSTimings ¶
func DecodeDNSTimings(timings json.RawMessage) (*DNSTimings, error)
type HTTPTimings ¶
type HTTPTimings struct {
Total int `json:"total"` // The total HTTP request time
DNS int `json:"dns"` // The time required to perform the DNS lookup.
TCP int `json:"tcp"` // The time from performing the DNS lookup to establishing the TCP connection.
TLS int `json:"tls"` // The time from establishing the TCP connection to establishing the TLS session.
FirstByte int `json:"firstByte"` // The time from establishing the TCP/TLS connection to the first response byte.
Download int `json:"download"` // The time from the first byte to downloading the whole response.
}
func DecodeHTTPTimings ¶
func DecodeHTTPTimings(timings json.RawMessage) (*HTTPTimings, error)
type Measurement ¶
type Measurement struct {
ID string `json:"id"`
Type string `json:"type"`
Status MeasurementStatus `json:"status"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
Target string `json:"target"`
ProbesCount int `json:"probesCount"`
Results []ProbeMeasurement `json:"results"`
}
type MeasurementCreate ¶
type MeasurementCreateError ¶
type MeasurementOptions ¶
type MeasurementOptions struct {
Query *QueryOptions `json:"query,omitempty"`
Request *RequestOptions `json:"request,omitempty"`
Protocol string `json:"protocol,omitempty"`
Port int `json:"port,omitempty"`
Resolver string `json:"resolver,omitempty"`
Trace bool `json:"trace,omitempty"`
Packets int `json:"packets,omitempty"`
}
type MeasurementStatus ¶
type MeasurementStatus string
const ( StatusInProgress MeasurementStatus = "in-progress" StatusFailed MeasurementStatus = "failed" StatusOffline MeasurementStatus = "offline" StatusFinished MeasurementStatus = "finished" )
type PingStats ¶
type PingStats struct {
Min float64 `json:"min"` // The lowest rtt value.
Avg float64 `json:"avg"` // The average rtt value.
Max float64 `json:"max"` // The highest rtt value.
Total int `json:"total"` // The number of sent packets.
Rcv int `json:"rcv"` // The number of received packets.
Drop int `json:"drop"` // The number of dropped packets (total - rcv).
Loss float64 `json:"loss"` // The percentage of dropped packets.
Mdev float64 `json:"mdev"` // The mean deviation of the rtt values.
}
func DecodePingStats ¶
func DecodePingStats(stats json.RawMessage) (*PingStats, error)
type PingTiming ¶
type PingTiming struct {
RTT float64 `json:"rtt"` // The round-trip time for this packet.
TTL int `json:"ttl"` // The packet time-to-live value.
}
func DecodePingTimings ¶
func DecodePingTimings(timings json.RawMessage) ([]PingTiming, error)
type ProbeDetails ¶
type ProbeMeasurement ¶
type ProbeMeasurement struct {
Probe ProbeDetails `json:"probe"`
Result ProbeResult `json:"result"`
}
type ProbeResult ¶
type ProbeResult struct {
Status MeasurementStatus `json:"status"`
RawOutput string `json:"rawOutput"`
RawHeaders string `json:"rawHeaders"`
RawBody string `json:"rawBody"`
ResolvedAddress string `json:"resolvedAddress"`
ResolvedHostname string `json:"resolvedHostname"`
StatsRaw json.RawMessage `json:"stats,omitempty"`
TimingsRaw json.RawMessage `json:"timings,omitempty"`
}
type QueryOptions ¶
type QueryOptions struct {
Type string `json:"type,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.