Documentation
¶
Index ¶
- type ProbeResponseUDPv4
- type ProbeUDPv4
- type UDPv4
- func (d UDPv4) ListenFor(rconn *ipv4.RawConn, howLong time.Duration) ([]probes.ProbeResponse, error)
- func (d UDPv4) Match(sent []probes.Probe, received []probes.ProbeResponse) results.Results
- func (d UDPv4) SendReceive() ([]probes.Probe, []probes.ProbeResponse, error)
- func (d UDPv4) Traceroute() (*payload.NetworkPath, error)
- func (d *UDPv4) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProbeResponseUDPv4 ¶
type ProbeResponseUDPv4 struct {
// header, payload and timestamp are expected to be passed at object creation
Header *ipv4.Header
// the IPv4 payload (expected ICMP -> IP -> UDP)
Payload []byte
// Addr is the IP address of the response sender
Addr net.IP
// time the packet is received at
Timestamp time.Time
// contains filtered or unexported fields
}
ProbeResponseUDPv4 represents a received probe response with its metadata
func (*ProbeResponseUDPv4) ICMP ¶
func (pr *ProbeResponseUDPv4) ICMP() *inet.ICMP
ICMP returns the ICMP layer of the probe response. If not decoded yet, will return nil.
func (*ProbeResponseUDPv4) InnerIP ¶
func (pr *ProbeResponseUDPv4) InnerIP() *ipv4.Header
InnerIP returns the inner IP layer of the probe response. If not decoded yet, will return nil.
func (*ProbeResponseUDPv4) InnerUDP ¶
func (pr *ProbeResponseUDPv4) InnerUDP() *inet.UDP
InnerUDP returns the UDP layer of the probe. If not decoded yet, will return nil.
func (*ProbeResponseUDPv4) Matches ¶
func (pr *ProbeResponseUDPv4) Matches(pi probes.Probe) bool
Matches returns true if this probe response matches the given probe. Both probes must have been already validated with Validate, this function may panic otherwise.
func (*ProbeResponseUDPv4) Validate ¶
func (pr *ProbeResponseUDPv4) Validate() error
Validate verifies that the probe response has the expected structure, and returns an error if not
type ProbeUDPv4 ¶
type ProbeUDPv4 struct {
Data []byte
// time the packet is sent at
Timestamp time.Time
// local address of the packet sender
LocalAddr net.IP
// contains filtered or unexported fields
}
ProbeUDPv4 represents a sent probe packet with its metadata
func (ProbeUDPv4) IP ¶
func (p ProbeUDPv4) IP() *ipv4.Header
IP returns the IP header of the probe. If not decoded yet, will return nil.
func (ProbeUDPv4) UDP ¶
func (p ProbeUDPv4) UDP() *inet.UDP
UDP returns the payload of the IP header of the probe. If not decoded yet, will return nil.
func (*ProbeUDPv4) Validate ¶
func (p *ProbeUDPv4) Validate() error
Validate verifies that the probe has the expected structure, and returns an error if not
type UDPv4 ¶
type UDPv4 struct {
TargetHostname string
TargetIP net.IP
SrcPort uint16
DstPort uint16
UseSrcPort bool
NumPaths uint16
MinTTL uint8
MaxTTL uint8
Delay time.Duration
Timeout time.Duration
// TODO implement broken nat detection
BrokenNAT bool
}
UDPv4 is a probe type based on IPv4 and UDP
func (UDPv4) ListenFor ¶
func (d UDPv4) ListenFor(rconn *ipv4.RawConn, howLong time.Duration) ([]probes.ProbeResponse, error)
ListenFor waits for ICMP packets until the timeout expires
func (UDPv4) Match ¶
Match compares the sent and received packets and finds the matching ones. It returns a Results structure.
func (UDPv4) SendReceive ¶
SendReceive sends all the packets to the target address, respecting the configured inter-packet delay
func (UDPv4) Traceroute ¶
func (d UDPv4) Traceroute() (*payload.NetworkPath, error)
Traceroute sends the probes and returns a Results structure or an error