Documentation
¶
Index ¶
- Constants
- func CompareProbeResponse(a, b ProbeResponse) int
- func ICMPAnnot(pkt_typ int, typ, code byte) string
- func ICMPDesc(pkt_typ int, typ, code byte) string
- func ResolveName(name string) ([]ipref.IP, error)
- func ReverseResolve(ip ipref.IP, no_names bool) (name string)
- type PktBuf
- type ProbePacket
- type ProbeResponse
- type ProbeResponseCommon
- type ProbeResponseICMP
- type ProbeResponseIPREF
- type ProbeResponseStatus
- type Prober
- func (p *Prober) Destroy()
- func (p *Prober) Init(local, target ipref.IP) error
- func (p *Prober) Listen(first_timeout, second_timeout, overdue_timeout time.Duration, all, single bool) ([]ProbeResponse, error)
- func (p *Prober) SendProbePackets(ttl byte, seq int, n int) error
- func (p *Prober) StartProbe()
Constants ¶
View Source
const ( // ICMPv4 types ICMPv4_ECHO_REPLY = 0 ICMPv4_DEST_UNREACH = 3 ICMPv4_SOURCE_QUENCH = 4 ICMPv4_REDIRECT = 5 ICMPv4_ECHO_REQUEST = 8 ICMPv4_TIME_EXCEEDED = 11 // ICMPv4 codes for ICMPv4_DEST_UNREACH ICMPv4_NET_UNREACH = 0 ICMPv4_HOST_UNREACH = 1 ICMPv4_PROT_UNREACH = 2 // protocol unreachable ICMPv4_PORT_UNREACH = 3 ICMPv4_FRAG_NEEDED = 4 ICMPv4_NET_UNKNOWN = 6 ICMPv4_HOST_UNKNOWN = 7 ICMPv4_ADMIN_PROHIB = 13 // communication administratively prohibited // ICMPv4 codes for ICMPv4_TIME_EXCEEDED ICMPv4_EXC_TTL = 0 ICMPv4_EXC_FRAG = 1 // fragment reassembly time exceeded // ICMPv6 types ICMPv6_DEST_UNREACH = 1 ICMPv6_PACKET_TOO_BIG = 2 ICMPv6_TIME_EXCEEDED = 3 ICMPv6_ECHO_REQUEST = 128 // code = 0 ICMPv6_ECHO_REPLY = 129 // code = 0 // ICMPv6 codes for ICMPv6_DEST_UNREACH ICMPv6_NET_UNREACH = 0 ICMPv6_ADMIN_PROHIB = 1 ICMPv6_HOST_UNREACH = 3 ICMPv6_PORT_UNREACH = 4 // ICMPv6 codes for ICMPv6_TIME_EXCEEDED ICMPv6_EXC_TTL = 0 // hop limit exceeded ICMPv6_EXC_FRAG = 1 // IPREF_ICMP types IPREF_ICMP_ECHO_REPLY = 0 IPREF_ICMP_DEST_UNREACH = 3 IPREF_ICMP_ECHO_REQUEST = 8 IPREF_ICMP_TIME_EXCEEDED = 11 // IPREF_ICMP codes for IPREF_ICMP_DEST_UNREACH IPREF_ICMP_NET_UNREACH = 0 IPREF_ICMP_HOST_UNREACH = 1 IPREF_ICMP_PORT_UNREACH = 2 IPREF_ICMP_FRAG_NEEDED = 4 IPREF_ICMP_ADMIN_PROHIB = 13 // IPREF_ICMP codes for IPREF_ICMP_TIME_EXCEEDED IPREF_ICMP_EXC_TTL = 0 IPREF_ICMP_EXC_FRAG = 1 )
View Source
const ( ICMP = 1 // Same protocol number used by IPv4 and IPREF TCP = 6 UDP = 17 ECHO = 7 DISCARD = 9 IPv6_HOP_OPT = 0 // IPv6 hop-by-hop options extension header IPv6_FRAG_EXT = 44 // IPv6 fragment extension header ICMPv6 = 58 IPv6_NO_NEXT = 59 IPREF_PORT = 1045 IPREF_LOCAL_PORT = 1046 IPREF_HDR_MIN_LEN = 4 + 4 + 4 + 4 + 4 IPREF_HDR_MAX_LEN = 4 + 8 + 16 + 16 + 16 + 16 // IPv4 header offests IP_VER = 0 IPv4_DSCP = 1 IPv4_LEN = 2 IPv4_ID = 4 IPv4_FRAG = 6 IPv4_TTL = 8 IPv4_PROTO = 9 IPv4_CSUM = 10 IPv4_SRC = 12 IPv4_DST = 16 IPv4_HDR_MIN_LEN = 20 // IPv6 header offsets IPv6_PLD_LEN = 4 IPv6_NEXT = 6 IPv6_TTL = 7 IPv6_SRC = 8 IPv6_DST = 24 IPv6_HDR_MIN_LEN = 40 // IPv6 fragment extension header offsets IPv6_FRAG_NEXT = 0 IPv6_FRAG_RES1 = 1 IPv6_FRAG_OFF = 2 IPv6_FRAG_IDENT = 4 IPv6_FRAG_HDR_LEN = 8 // UDP offsets UDP_SPORT = 0 UDP_DPORT = 2 UDP_LEN = 4 UDP_CSUM = 6 UDP_HDR_LEN = 8 // TCP offsets TCP_SPORT = 0 TCP_DPORT = 2 TCP_CSUM = 16 // ICMP offsets ICMP_TYPE = 0 ICMP_CODE = 1 ICMP_CSUM = 2 ICMP_BODY = 4 ICMP_MTU = 6 ICMP_DATA = 8 )
View Source
const ( PKT_IPREF = iota + 1 PKT_IPv4 PKT_IPv6 )
Variables ¶
This section is empty.
Functions ¶
func CompareProbeResponse ¶
func CompareProbeResponse(a, b ProbeResponse) int
Types ¶
type ProbePacket ¶
type ProbeResponse ¶
type ProbeResponse interface {
Clone() ProbeResponse
GetProbeResponseCommon() *ProbeResponseCommon
}
func MergeProbeResponses ¶
func MergeProbeResponses(responses []ProbeResponse, clear_orig_packet bool, diff_protos bool) (merged []ProbeResponse)
type ProbeResponseCommon ¶
type ProbeResponseCommon struct {
ProbePacket
Since []time.Duration
SrcIP ipref.IP
ProbeResponseStatus
}
type ProbeResponseICMP ¶
type ProbeResponseICMP struct {
ProbeResponseCommon
}
func (*ProbeResponseICMP) Clone ¶
func (res *ProbeResponseICMP) Clone() ProbeResponse
func (*ProbeResponseICMP) GetProbeResponseCommon ¶
func (res *ProbeResponseICMP) GetProbeResponseCommon() *ProbeResponseCommon
type ProbeResponseIPREF ¶
type ProbeResponseIPREF struct {
ProbeResponseCommon
SrcIpRef ipref.IpRef
DstIpRef ipref.IpRef
}
func (*ProbeResponseIPREF) Clone ¶
func (res *ProbeResponseIPREF) Clone() ProbeResponse
func (*ProbeResponseIPREF) GetProbeResponseCommon ¶
func (res *ProbeResponseIPREF) GetProbeResponseCommon() *ProbeResponseCommon
type ProbeResponseStatus ¶
type Prober ¶
type Prober struct {
Local, Target ipref.IP // read-only
// contains filtered or unexported fields
}
func (*Prober) Listen ¶
func (p *Prober) Listen(first_timeout, second_timeout, overdue_timeout time.Duration, all, single bool) ([]ProbeResponse, error)
Not re-entrant. Timeout is time elapsed since last packet sent.
Packets received beyond 'overdue_timeout' are ignored.
If 'all', then return once a response is received for all probe packets.
If 'single', then return once a single response is received.
func (*Prober) SendProbePackets ¶
Can be called during p.Listen(). Not re-entrant.
Click to show internal directories.
Click to hide internal directories.