Documentation ¶
Index ¶
- func CheckLatency(avgRtt, currentRtt time.Duration) bool
- func Checksum(data []byte) uint32
- func ChecksumToByte(csum uint32) []byte
- func ConstructURL(Http_scheme, DestHost, Http_path string, DestPort int) string
- func GeneratePayloadData(payLoadSize int) []byte
- func GetSleepTime(PacketStatus bool, Interval int, RTT time.Duration) time.Duration
- func IPSlideToString(IPSlide []string) string
- func ResolveDestHost(DestHost string) (DestAddr []net.IP, err error)
- func SetDFBit(conn *net.IPConn, df bool) error
- type InputVars
- type Packet
- type PacketDNS
- type PacketHTTP
- type PacketICMP
- type PacketTCP
- type Pinger
- type Statistics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckLatency ¶
Func - Check Latency. If the AvgRTT is over 10ms and current RTT > 2 * AvgRTT -> High_Latency
func ConstructURL ¶
Construct URL
func GeneratePayloadData ¶
Func - Generate Payload Date []byte
func GetSleepTime ¶
Func - Get Sleep Time
func IPSlideToString ¶
resonved IPs []string -> string
func ResolveDestHost ¶
Func - resolveDestHost
Types ¶
type InputVars ¶
type InputVars struct { Type string // Select one of these: tcp, icmp, http, dns Count int // Default is 0 which means nonstop till interruption. PayLoadSize int // Specific the payload. ICMP default payload is 24 bytes. TCP/HTTP/ICMP have no payload by default. Timeout int // default timeout is 4 seconds Interval int // Interval is the wait time between each packet send. Default is 1s. SourceHost string DestHost string DestPort int Http_path string Http_scheme string Http_method string Icmp_DF bool // ipv4 only Dns_query string Dns_queryType string Dns_Protocol string }
CLI Imput variables Struct
type Packet ¶
type Packet interface { GetStatus() bool GetRtt() time.Duration UpdateStatistics(s Statistics) GetType() string GetSendTime() time.Time }
Packet Interface
type PacketDNS ¶
type PacketDNS struct { Type string Status bool Seq int DestAddr string DestHost string SendTime time.Time RTT time.Duration Dns_query string Dns_queryType string Dns_protocol string Dns_response string // statistics PacketsRecv int PacketsSent int PacketLoss float64 MinRtt time.Duration MaxRtt time.Duration AvgRtt time.Duration // Status update AdditionalInfo string }
PacketDNS Struct
func DnsProbing ¶
func DnsProbing(Seq int, destHost string, Dns_query string, Dns_Protocol string, timeout int) (PacketDNS, error)
func DnsProbing
func (PacketDNS) GetSendTime ¶
func (*PacketDNS) UpdateStatistics ¶
func (pkt *PacketDNS) UpdateStatistics(s Statistics)
type PacketHTTP ¶
type PacketHTTP struct { Type string Status bool Seq int DestAddr string DestHost string DestPort int PayLoadSize int SendTime time.Time RTT time.Duration Http_path string Http_scheme string Http_response_code int Http_response string Http_method string // statistics PacketsRecv int PacketsSent int PacketLoss float64 MinRtt time.Duration MaxRtt time.Duration AvgRtt time.Duration // Status update AdditionalInfo string }
PacketHTTP Struct
func HttpProbing ¶
func HttpProbing(Seq int, destHost string, destPort int, Http_path string, Http_scheme string, Http_method string, timeout int) (PacketHTTP, error)
HttpProbing performs HTTP probing with the ability to choose HTTP methods and ignore certificate errors
func (PacketHTTP) GetRtt ¶
func (pkt PacketHTTP) GetRtt() time.Duration
func (PacketHTTP) GetSendTime ¶
func (pkt PacketHTTP) GetSendTime() time.Time
func (PacketHTTP) GetStatus ¶
func (pkt PacketHTTP) GetStatus() bool
func (PacketHTTP) GetType ¶
func (pkt PacketHTTP) GetType() string
func (*PacketHTTP) UpdateStatistics ¶
func (pkt *PacketHTTP) UpdateStatistics(s Statistics)
type PacketICMP ¶
type PacketICMP struct { Type string Status bool Seq int DestAddr string DestHost string PayLoadSize int SendTime time.Time RTT time.Duration Icmp_DF bool // statistics PacketsRecv int PacketsSent int PacketLoss float64 MinRtt time.Duration MaxRtt time.Duration AvgRtt time.Duration // Status update AdditionalInfo string }
PacketICMP Struct
func IcmpProbing ¶
func IcmpProbing(Seq int, destAddr string, desetHost string, PayLoadSize int, Icmp_DF bool, timeout int, payload []byte) (PacketICMP, error)
func: IcmpProbing
func (PacketICMP) GetRtt ¶
func (pkt PacketICMP) GetRtt() time.Duration
func (PacketICMP) GetSendTime ¶
func (pkt PacketICMP) GetSendTime() time.Time
func (PacketICMP) GetStatus ¶
func (pkt PacketICMP) GetStatus() bool
func (PacketICMP) GetType ¶
func (pkt PacketICMP) GetType() string
func (*PacketICMP) UpdateStatistics ¶
func (pkt *PacketICMP) UpdateStatistics(s Statistics)
type PacketTCP ¶
type PacketTCP struct { Type string Status bool Seq int DestAddr string DestHost string DestPort int PayLoadSize int SendTime time.Time RTT time.Duration // statistics PacketsRecv int PacketsSent int PacketLoss float64 MinRtt time.Duration MaxRtt time.Duration AvgRtt time.Duration // Status update AdditionalInfo string }
PacketTCP Struct
func TcpProbing ¶ added in v1.0.1
func TcpProbing(ctx *context.Context, Seq int, destAddr string, desetHost string, destPort int, PayLoadSize int) (PacketTCP, error)
func: tcpProbing
func (PacketTCP) GetSendTime ¶
func (*PacketTCP) UpdateStatistics ¶
func (pkt *PacketTCP) UpdateStatistics(s Statistics)
type Pinger ¶
type Pinger struct { // ************** General Fields ********************** // Input Vars InputVars InputVars // statistics Stat Statistics // statistics Mutex StatsMu sync.RWMutex // source IP details SourceAddr string SourceIpAddr net.IP // destination IP details DestAddr string DestIpAddr net.IP // OnSend is called when Pinger sends a packet (for future use only) OnSend func(Packet) // OnRecv is called when Pinger receives and processes a packet (for future use only) OnRecv func(Packet) // probeChan ProbeChan chan Packet }
Pinger Struct
func (*Pinger) Resolve ¶
Method (Pinger) - Resolve does the DNS lookup for the Pinger address and sets IP protocol.
func (*Pinger) UpdateStatistics ¶
Method (Pinger) - Update pinger statistics
type Statistics ¶
type Statistics struct { // PacketsRecv is the number of packets received. PacketsRecv int // PacketsSent is the number of packets sent. PacketsSent int // PacketLoss is the percentage of packets lost. PacketLoss float64 // MinRtt is the minimum round-trip time sent via this pinger. MinRtt time.Duration // MaxRtt is the maximum round-trip time sent via this pinger. MaxRtt time.Duration // AvgRtt is the average round-trip time sent via this pinger. AvgRtt time.Duration }
Statistics represent the stats of a currently running or finished pinger operation.
func (*Statistics) UpdatePacketLoss ¶
func (s *Statistics) UpdatePacketLoss()
Method (Statistics) - Update PacketLoss