Documentation ¶
Overview ¶
Package icmp provides icmp enhanced methods based on the golang icmp package
Index ¶
- Constants
- func Avg(x, y float64) float64
- func IsIPv4(ip net.IP) bool
- func IsIPv6(ip net.IP) bool
- func Max(x, y float64) float64
- func Min(x, y float64) float64
- func NormalizeDuration(d string) string
- type Geo
- type HopResp
- type ICMPResp
- type MHopResp
- type Ping
- type Response
- type Stats
- type TCPOption
- type Trace
- func (i *Trace) Bind() error
- func (i *Trace) MRun() (chan HopResp, error)
- func (i *Trace) NextHop(hop int) HopResp
- func (i *Trace) Print()
- func (i *Trace) PrintPretty()
- func (i *Trace) Recv(id, seq int) (ICMPResp, error)
- func (i *Trace) Run(retry int) (chan []HopResp, error)
- func (i *Trace) Send(port int) (int, int, error)
- func (i *Trace) Sendv4(id, seq, rport int) error
- func (i *Trace) SetDeadLine() error
- func (i *Trace) SetReadDeadLine() error
- func (i *Trace) SetTTL(ttl int)
- func (i *Trace) SetWriteDeadLine() error
- func (i *Trace) TermUI() (string, error)
- type Whois
- type Widgets
Constants ¶
const ( // DefaultTXTimeout is socket send timeout DefaultTXTimeout int64 = 2000 // ProtocolIPv4ICMP is IANA ICMP IPv4 ProtocolIPv4ICMP = 1 // ProtocolIPv6ICMP is IANA ICMP IPv6 ProtocolIPv6ICMP = 58 // IPv4ICMPTypeEchoReply is ICMPv4 Echo Reply IPv4ICMPTypeEchoReply = 0 // IPv4ICMPTypeDestinationUnreachable is ICMPv4 Destination Unreachable IPv4ICMPTypeDestinationUnreachable = 3 // IPv4ICMPTypeTimeExceeded is ICMPv4 Time Exceeded IPv4ICMPTypeTimeExceeded = 11 // IPv6ICMPTypeEchoReply is ICMPv6 Echo Reply IPv6ICMPTypeEchoReply = 129 // IPv6ICMPTypeDestinationUnreachable is ICMPv6 Destination Unreachable IPv6ICMPTypeDestinationUnreachable = 1 //IPv6ICMPTypeTimeExceeded is ICMPv6 Time Exceeded IPv6ICMPTypeTimeExceeded = 3 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Geo ¶ added in v0.2.5
type Geo struct { // CountrySrc Geo country source CountrySrc string // CountryDst Geo country destination CountryDst string // CitySrc Geo country source CitySrc string // CityDst Geo country source CityDst string // Latitude Geo source LatSrc float64 // Latitude Geo destination LatDst float64 // Longitude Geo source LonSrc float64 // Longitude Geo destination LonDst float64 // Distance holds src to dst distance Distance float64 }
Geo represents IP Geo params
type HopResp ¶ added in v0.2.2
type HopResp struct {
// contains filtered or unexported fields
}
HopResp represents hop's response
type ICMPResp ¶ added in v0.2.4
type ICMPResp struct {
// contains filtered or unexported fields
}
ICMPResp represents ICMP response msg
type Ping ¶
Ping represents ping request
func NewPing ¶
NewPing creates a new ping object
func (*Ping) IsCIDR ¶ added in v0.2.3
IsCIDR returns true if target is CIDR
func (*Ping) PrintPretty ¶ added in v0.2.2
PrintPretty prints out the result pretty format
func (*Ping) Run ¶ added in v0.1.9
Run loops the ping and print it out
type Response ¶ added in v0.1.9
Response represent ping response
type Stats ¶ added in v0.2.4
type Stats struct {
// contains filtered or unexported fields
}
Stats represents statistic's fields
type TCPOption ¶ added in v0.2.6
type TCPOption struct {
// contains filtered or unexported fields
}
TCPOption represents TCP option
type Trace ¶
type Trace struct {
// contains filtered or unexported fields
}
Trace represents trace properties
func NewTrace ¶ added in v0.2.2
NewTrace creates new trace object
func (*Trace) MRun ¶ added in v0.2.4
MRun provides trace all hops in loop
func (*Trace) NextHop ¶ added in v0.2.2
NextHop pings the specific hop by set TTL
func (*Trace) Print ¶ added in v0.2.4
func (i *Trace) Print()
Print prints out trace result in normal or terminal mode
func (*Trace) PrintPretty ¶ added in v0.2.2
func (i *Trace) PrintPretty()
PrintPretty prints out trace result
func (*Trace) Recv ¶
Recv gets the replied icmp packet
func (*Trace) Run ¶
Run provides trace based on the other methods
func (*Trace) Send ¶
Send tries to send ICMP/UDP IPv4/IPv6 packet
func (*Trace) Sendv4 ¶ added in v0.2.6
Send tries to send ICMP/UDP IPv4 packet
func (*Trace) SetDeadLine ¶ added in v0.2.2
SetDeadLine sets tx/rx timeout
func (*Trace) SetReadDeadLine ¶ added in v0.2.2
SetReadDeadLine sets rx timeout
func (*Trace) SetWriteDeadLine ¶ added in v0.2.2
SetWriteDeadLine sets tx timeout
type Whois ¶ added in v0.2.2
type Whois struct {
// contains filtered or unexported fields
}
Whois represents prefix info from RIPE