Documentation
¶
Index ¶
- Variables
- type Host
- func (h *Host) Close()
- func (h *Host) Command(cmd string)
- func (h *Host) Pause()
- func (h *Host) PrintStats()
- func (h *Host) RecordEvent(t time.Time, rtt time.Duration, updown int, err error, msg string, arg string)
- func (h *Host) ResetStats()
- func (h *Host) Run()
- func (h *Host) SetInterval(d time.Duration)
- func (h *Host) String() string
- type HostCallbackFunc
- type Pinger
- type Rtt
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrHostExists = errors.New("host already exists")
View Source
var ErrHostNotExist = errors.New("host does not exist")
Functions ¶
This section is empty.
Types ¶
type Host ¶
type Host struct {
Address string
IsUp bool
UpDown int // >1 up <-1 down 0=unknown
PacketsSent int
PacketsReceived int
Changes int // number of up->down or down->up transitions
UpTime time.Duration // total amount of time host has been up
DownTime time.Duration // total amount of time host has been down
Interval time.Duration // time between pings
MaxRTT time.Duration // rtt greater than this value will declare a host down
Timeout time.Duration // wait this long at most for a pong
LastRTT time.Duration // latest RTT value
Stats f64stat.Stat // RTT stats. min/ave/max/sdev
C chan string // channel to send command to the pinger go routine
//ltDown time.Time // time of start of last DOWN
//downCount int // number of missed pongs
DownThreshold int // number of missed pongs to declare host down
History []*Rtt // RTT and message history
HistoryMax int // Maximum size of history
// contains filtered or unexported fields
}
func (*Host) PrintStats ¶
func (h *Host) PrintStats()
func (*Host) RecordEvent ¶ added in v1.1.2
func (*Host) ResetStats ¶
func (h *Host) ResetStats()
func (*Host) SetInterval ¶
type HostCallbackFunc ¶
type Pinger ¶
type Pinger struct {
Bind4 string
Bind6 string
PayloadSize uint16
Interval time.Duration // default ping interval
MaxRTT time.Duration // default host down threshold
DownThreshold int // number of missed pongs to declare host down
HistoryMax int // maximum size of history. 0=off
// contains filtered or unexported fields
}
func (*Pinger) AddHost ¶
func (p *Pinger) AddHost(addr string, fx HostCallbackFunc) (h *Host, err error)
func (*Pinger) RemoveHost ¶
Click to show internal directories.
Click to hide internal directories.