Documentation ¶
Overview ¶
This file code is based on https://github.com/go-ping/ping
Index ¶
- Constants
- type MultiPing
- type PingClient
- type PingData
- func (pr *PingData) Add(hosts ...netip.Addr)
- func (pr *PingData) Append(data *PingData)
- func (pr *PingData) Count() int
- func (pr *PingData) Del(hosts ...netip.Addr)
- func (pr *PingData) Dump(w io.Writer, title ...string)
- func (pr *PingData) Flush()
- func (pr *PingData) Get(ip netip.Addr) (PingStats, bool)
- func (pr *PingData) Iterate(callback func(ip netip.Addr, val PingStats))
- func (pr *PingData) Reset()
- type PingStats
- type Pinger
- type ProtocolVersion
Constants ¶
View Source
const ( ProtocolIpv4 = ProtocolVersion(4) ProtocolIpv6 = ProtocolVersion(6) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MultiPing ¶
type MultiPing struct { sync.RWMutex // Timeout specifies a timeout before ping exits, regardless of how many // packets have been received. Default is 1s. Timeout time.Duration // Tracker: Used to uniquely identify packet when non-priviledged Tracker int64 // contains filtered or unexported fields }
type PingClient ¶
type PingClient interface {
PingProcess(pr *PingData)
}
Unified interface to process ping data
type PingData ¶
type PingData struct {
// contains filtered or unexported fields
}
Ping data. Holds host information and ping statistics. Use Add, Get and Iterate functions. No internal logic will be exposed.
func NewPingData ¶
func NewPingData() *PingData
type PingStats ¶
type PingStats struct {
// contains filtered or unexported fields
}
A single host ping statistics
type Pinger ¶
type Pinger struct { // Size of packet being sent Size int // Tracker: Used to uniquely identify packet when non-priviledged Tracker int64 // contains filtered or unexported fields }
Pinger represents a packet sender.
func (*Pinger) Privileged ¶
Privileged returns whether pinger is running in privileged mode.
func (*Pinger) SetPrivileged ¶
SetPrivileged sets the type of ping pinger will send. false means pinger will send an "unprivileged" UDP ping. true means pinger will send a "privileged" raw ICMP ping. NOTE: setting to true requires that it be run with super-user privileges.
type ProtocolVersion ¶
type ProtocolVersion int
Click to show internal directories.
Click to hide internal directories.