Documentation
¶
Index ¶
- Variables
- type Color
- type Context
- type HistoryBuffer
- type HistoryItem
- type InfinitePingOutput
- type InfinitePingRun
- type MeasurementStats
- type ParsedPingOutput
- type PingSummary
- type Printer
- func (p *Printer) AreaClear()
- func (p *Printer) AreaUpdate(content *string)
- func (p *Printer) Bold(s string) string
- func (p *Printer) BoldBackground(s string, color Color) string
- func (p *Printer) BoldColor(s string, color Color) string
- func (p *Printer) BoldForeground(s string, color Color) string
- func (p *Printer) Color(s string, color Color) string
- func (p *Printer) ColorBackground(s string, color Color) string
- func (p *Printer) ColorForeground(s string, color Color) string
- func (p *Printer) DisableStyling()
- func (p *Printer) ErrPrint(a ...any)
- func (p *Printer) ErrPrintf(format string, a ...any)
- func (p *Printer) ErrPrintln(a ...any)
- func (*Printer) FillLeft(s string, w int) string
- func (p *Printer) FillLeftAndColor(s string, w int, color Color) string
- func (*Printer) FillRight(s string, w int) string
- func (p *Printer) FillRightAndColor(s string, w int, color Color) string
- func (p *Printer) GetSize() (width, height int)
- func (p *Printer) Print(a ...any)
- func (p *Printer) Printf(format string, a ...any)
- func (p *Printer) Println(a ...any)
- func (p *Printer) ReadPassword() (string, error)
- type Viewer
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAllProbesFailed = errors.New("all probes failed")
Functions ¶
This section is empty.
Types ¶
type Color ¶ added in v1.3.0
type Color string
const ( ColorNone Color = "" FGBlack Color = "30" FGRed Color = "31" FGGreen Color = "32" FGYellow Color = "33" FGBlue Color = "34" FGMagenta Color = "35" FGCyan Color = "36" FGWhite Color = "37" FGBrightBlack Color = "90" FGBrightRed Color = "91" FGBrightGreen Color = "92" FGBrightYellow Color = "93" FGBrightBlue Color = "94" FGBrightMagenta Color = "95" FGBrightCyan Color = "96" FGBrightWhite Color = "97" BGBlack Color = "40" BGRed Color = "41" BGGreen Color = "42" BGYellow Color = "43" BGBlue Color = "44" BGMagenta Color = "45" BGCyan Color = "46" BGWhite Color = "47" BGBrightBlack Color = "100" BGBrightRed Color = "101" BGBrightGreen Color = "102" BGBrightYellow Color = "103" BGBrightBlue Color = "104" BGBrightMagenta Color = "105" BGBrightCyan Color = "106" BGBrightWhite Color = "107" )
type Context ¶ added in v1.2.1
type Context struct {
Cmd string
Target string
Targets []string
Comparison bool
From string
Limit int // Number of probes to use
Timeout int // Probe-side measurement timeout in seconds
CIMode bool // Determine whether the output should be in a format that is easy to parse by a CI tool
ToJSON bool // Determines whether the output should be in JSON format.
ToLatency bool // Determines whether the output should be only the stats of a measurement
Table bool // Display measurement results in a table
Packets int // Number of packets to send
Port uint16
Protocol string
Resolver string
QueryType string
Host string
Path string
Query string
Method string
Headers []string
Trace bool
Full bool // Full output
Infinite bool // Infinite flag
Ipv6 bool // IPv6 flag
Ipv4 bool // IPv4 flag
Head uint // Number of first measurements to show
Tail uint // Number of last measurements to show
APIMinInterval time.Duration // Minimum interval between API calls
IsLocationFromSession bool // Determine whether the previous location is used
RecordToSession bool // Record measurement to session history
TableOutputRows int
MeasurementsCreated int
History *HistoryBuffer // History of measurements
}
type HistoryBuffer ¶ added in v1.3.0
type HistoryBuffer struct {
Index int
Slice []*HistoryItem
}
func NewHistoryBuffer ¶ added in v1.3.0
func NewHistoryBuffer(size int) *HistoryBuffer
func (*HistoryBuffer) Capacity ¶ added in v1.3.0
func (h *HistoryBuffer) Capacity() int
func (*HistoryBuffer) Find ¶ added in v1.3.0
func (h *HistoryBuffer) Find(id string) *HistoryItem
func (*HistoryBuffer) Last ¶ added in v1.3.0
func (h *HistoryBuffer) Last() *HistoryItem
func (*HistoryBuffer) Push ¶ added in v1.3.0
func (h *HistoryBuffer) Push(m *HistoryItem)
func (*HistoryBuffer) ToString ¶ added in v1.3.0
func (h *HistoryBuffer) ToString(sep string) string
type HistoryItem ¶ added in v1.3.0
type HistoryItem struct {
Id string
Status globalping.MeasurementStatus
ProbeStatus []globalping.TestStatus
StartedAt time.Time
}
type InfinitePingOutput ¶ added in v1.6.0
type InfinitePingOutput struct {
Measurement *globalping.Measurement
// contains filtered or unexported fields
}
InfinitePingOutput contains one prepared redraw or batch of newly received packet lines.
type InfinitePingRun ¶ added in v1.6.0
type InfinitePingRun struct {
// contains filtered or unexported fields
}
InfinitePingRun is owned by the command loop. Rounds are registered in creation order; each update produces a snapshot that can be rendered without changing the run.
func NewInfinitePingRun ¶ added in v1.6.0
func (*InfinitePingRun) Add ¶ added in v1.6.0
func (r *InfinitePingRun) Add(id string, startedAt time.Time)
func (*InfinitePingRun) Summary ¶ added in v1.6.0
func (r *InfinitePingRun) Summary() *PingSummary
func (*InfinitePingRun) Update ¶ added in v1.6.0
func (r *InfinitePingRun) Update(m *globalping.Measurement, streamRawOutput bool, created int) (*InfinitePingOutput, error)
type MeasurementStats ¶ added in v1.2.1
type MeasurementStats struct {
Sent int // Number of packets sent
Rcv int // Number of packets received
Lost int // Number of packets lost
Loss float64 // Percentage of packets lost
Last float64 // Last RTT
Min float64 // Minimum RTT
Avg float64 // Average RTT
Max float64 // Maximum RTT
Mdev float64 // Mean deviation of RTT
Time float64 // Total time of measurement, in milliseconds
Tsum float64 // Total sum of RTT
Tsum2 float64 // Total sum of RTT squared
}
func NewMeasurementStats ¶ added in v1.2.1
func NewMeasurementStats() *MeasurementStats
type ParsedPingOutput ¶ added in v1.2.1
type ParsedPingOutput struct {
Header string
Hostname string
Address string
BytesOfData string
RawPacketLines []string
Timings []globalping.PingTiming
Stats *MeasurementStats
}
type PingSummary ¶ added in v1.6.0
type PingSummary struct {
Hostname string
Stats *MeasurementStats
}
type Printer ¶ added in v1.2.1
type Printer struct {
InReader io.Reader
OutWriter io.Writer
ErrWriter io.Writer
// contains filtered or unexported fields
}
func NewPrinter ¶ added in v1.2.1
func (*Printer) AreaUpdate ¶ added in v1.3.0
func (*Printer) BoldBackground ¶ added in v1.4.0
func (*Printer) BoldForeground ¶ added in v1.4.0
func (*Printer) ColorBackground ¶ added in v1.4.0
func (*Printer) ColorForeground ¶ added in v1.4.0
func (*Printer) DisableStyling ¶ added in v1.4.0
func (p *Printer) DisableStyling()
func (*Printer) ErrPrintln ¶ added in v1.4.0
func (*Printer) FillLeftAndColor ¶ added in v1.3.0
func (*Printer) FillRightAndColor ¶ added in v1.3.0
func (*Printer) ReadPassword ¶ added in v1.4.0
type Viewer ¶ added in v1.2.1
type Viewer interface {
OutputDefault(id string, measurement *globalping.Measurement, opts *globalping.MeasurementCreate)
OutputJSON(id string, measurement []byte)
OutputLatency(id string, measurement *globalping.Measurement) error
OutputInfinite(output *InfinitePingOutput) (string, error)
OutputTable(measurement *globalping.Measurement) (string, error)
OutputComparisonTable(first, second *globalping.Measurement) (string, error)
OutputLive(measurement *globalping.Measurement, opts *globalping.MeasurementCreate, w, h int)
OutputPingSummary(infiniteTableOutput string, summary *PingSummary)
}
Click to show internal directories.
Click to hide internal directories.