Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct { Ip net.IP Raw []byte Meta *ResultMeta Data []*ResultData Statistic *ResultStatistic }
Result struct
func Once ¶
Ping the given net.IP once
Example ¶
Example of Once function
package main import ( "fmt" "net" "github.com/xellio/tools/ping" ) func main() { ip := net.ParseIP("8.8.8.8") res, err := ping.Once(ip) if err != nil { fmt.Println(err) } fmt.Println(res.Meta.String()) }
Output: PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
type ResultData ¶
type ResultData struct { IcmpSeq int Ttl int Time float64 // contains filtered or unexported fields }
Struct for storing data information in Result.Data
type ResultMeta ¶
type ResultMeta struct { Host string Ip net.IP Bytes string // contains filtered or unexported fields }
Struct for storing meta information in Result.Meta
type ResultStatistic ¶
type ResultStatistic struct { PacketCount int ReceivedCount int PacketLossPercent float64 Time float64 RTT *ResultStatisticRTT // contains filtered or unexported fields }
Struct for storing statistic information in Result.Statistic
func (*ResultStatistic) String ¶
func (s *ResultStatistic) String() string
Returns r.Statistic as string
type ResultStatisticRTT ¶
type ResultStatisticRTT struct { Min float64 Avg float64 Max float64 MDev float64 // contains filtered or unexported fields }
Struct for storing round trip times (RTT)
func (*ResultStatisticRTT) String ¶
func (rtt *ResultStatisticRTT) String() string
Returns r.Statistic.RTT as string
Click to show internal directories.
Click to hide internal directories.