Skip to content

Commit

Permalink
doc(net): improved doc comment for probe.rs module
Browse files Browse the repository at this point in the history
  • Loading branch information
fujiapple852 committed Mar 29, 2024
1 parent 58baf27 commit 94990f4
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/tracing/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,12 @@ pub enum ProbeResponseSeq {
Tcp(ProbeResponseSeqTcp),
}

/// The data in the response to an ICMP probe.
#[derive(Debug, Clone)]
pub struct ProbeResponseSeqIcmp {
/// The ICMP identifier.
pub identifier: u16,
/// The ICMP sequence number.
pub sequence: u16,
}

Expand All @@ -224,14 +227,39 @@ impl ProbeResponseSeqIcmp {
}
}

/// The data in the response to a UDP probe.
#[derive(Debug, Clone)]
pub struct ProbeResponseSeqUdp {
/// The IPv4 identifier.
///
/// This will be the sequence number for IPv4/Dublin.
pub identifier: u16,
/// The destination IP address.
///
/// This is used to validate the probe response matches the expected values.
pub dest_addr: IpAddr,
/// The source port.
///
/// This is used to validate the probe response matches the expected values.
pub src_port: u16,
/// The destination port.
///
/// This is used to validate the probe response matches the expected values.
pub dest_port: u16,
/// The UDP checksum.
///
/// This will contain the sequence number for IPv4 and IPv6 Paris.
pub checksum: u16,
/// The length of the UDP payload.
///
/// This payload length will be the sequence number (offset from the
/// initial sequence number) for IPv6 Dublin. Note that this length
/// does not include the length of the MAGIC payload prefix.
pub payload_len: u16,
/// Whether the response had the MAGIC payload prefix.
///
/// This will be true for IPv6 Dublin for probe responses which
/// originated from the tracer and is used to validate the probe response.
pub has_magic: bool,
}

Expand All @@ -257,10 +285,20 @@ impl ProbeResponseSeqUdp {
}
}

/// The data in the response to an TCP probe.
#[derive(Debug, Clone)]
pub struct ProbeResponseSeqTcp {
/// The destination IP address.
///
/// This is used to validate the probe response matches the expected values.
pub dest_addr: IpAddr,
/// The source port.
///
/// This is used to validate the probe response matches the expected values.
pub src_port: u16,
/// The destination port.
///
/// This is used to validate the probe response matches the expected values.
pub dest_port: u16,
}

Expand Down

0 comments on commit 94990f4

Please sign in to comment.