Skip to content

Commit

Permalink
chore: proofreading check
Browse files Browse the repository at this point in the history
  • Loading branch information
fujiapple852 committed Jul 25, 2024
1 parent 10d52f9 commit 2838b52
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion crates/trippy-core/src/net/ipv4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ fn extract_udp_packet(ipv4: &Ipv4Packet<'_>) -> Result<(u16, u16, u16, u16, u16)
/// `TCP` packet header is a minimum of 20 bytes.
///
/// The `ICMP` packets we are extracting these from, such as `TimeExceeded`, only guarantee that 8
/// bytes of the original packet (plus the IP header) be returned and so we may not have a complete
/// bytes of the original packet (plus the IP header) be returned, and so we may not have a complete
/// TCP packet.
///
/// We therefore have to detect this situation and ensure we provide buffer a large enough for a
Expand Down
4 changes: 2 additions & 2 deletions crates/trippy-core/src/net/ipv6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl Ipv6 {
}
udp_send_socket.set_unicast_hops_v6(probe.ttl.0)?;
// Note that we set the port to be 0 in the remote `SocketAddr` as the target port is encoded in
// the `UDP` packet. If we (redundantly) set the target port here then the send will fail
// the `UDP` packet. If we (redundantly) set the target port here then the send_to will fail
// with `EINVAL`.
let remote_addr = SocketAddr::new(IpAddr::V6(self.dest_addr), 0);
udp_send_socket.send_to(udp.packet(), remote_addr)?;
Expand Down Expand Up @@ -445,7 +445,7 @@ fn extract_udp_packet(ipv6: &Ipv6Packet<'_>) -> Result<(u16, u16, u16, u16)> {
/// packet in one piece, link-specific fragmentation and reassembly must
/// be provided at a layer below IPv6."
///
/// The maximum packet size we allow is 1024 and so we can safely assume that the originating IPv6
/// The maximum packet size we allow is 1024, and so we can safely assume that the originating IPv6
/// packet being extracted will be at least as large as the minimum IPv6 packet size.
///
/// [rfc4443]: https://datatracker.ietf.org/doc/html/rfc4443#section-2.4
Expand Down
8 changes: 4 additions & 4 deletions crates/trippy-core/src/net/platform/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ mod address {
/// Discover the required byte ordering for the IPv4 header fields `total_length`, `flags` and
/// `fragment_offset`.
///
/// Linux accepts either network byte order or host byte order for the `total_length` field and
/// Linux accepts either network byte order or host byte order for the `total_length` field, and
/// so we skip the check and return network byte order unconditionally.
#[cfg(target_os = "linux")]
#[allow(clippy::unnecessary_wraps)]
Expand Down Expand Up @@ -64,11 +64,11 @@ mod address {

/// Attempt to send an `ICMP` packet to a local address.
///
/// The packet is actually of length `256` bytes but we set the `total_length` based on the
/// input provided so as to test if the OS rejects the attempt during the call to `send_to`.
/// The packet is actually of length `256` bytes, but we set the `total_length` based on the
/// input provided to test if the OS rejects the attempt during the call to `send_to`.
///
/// Note that this implementation will try to create an `IPPROTO_ICMP` socket and if that fails
/// it will fallback to creating an `IPPROTO_RAW` socket.
/// it will fall back to creating an `IPPROTO_RAW` socket.
#[cfg(not(target_os = "linux"))]
#[instrument(ret)]
fn test_send_local_ip4_packet(src_addr: Ipv4Addr, total_length: u16) -> Result<()> {
Expand Down
2 changes: 1 addition & 1 deletion crates/trippy-core/src/net/platform/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ mod adapter {
Self::retrieve_addresses(AF_INET6)
}

/// Return a iterator of `AdapterAddress` in this `Adapters`.
/// Return an iterator of `AdapterAddress` in this `Adapters`.
pub fn iter(&self) -> AdaptersIter<'_> {
AdaptersIter::new(self)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/trippy-dns/src/lazy_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ mod inner {
let now = SystemTime::now();
match &provider {
DnsProvider::DnsLookup => {
// we can't distinguish between a failed lookup or a genuine error and so we just
// we can't distinguish between a failed lookup or a genuine error, and so we just
// assume all failures are `DnsEntry::NotFound`.
match dns_lookup::lookup_addr(&addr) {
Ok(dns) => DnsEntry::Resolved(Resolved::Normal(addr, vec![dns]), now),
Expand Down
2 changes: 1 addition & 1 deletion crates/trippy-packet/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub type Result<T> = std::result::Result<T, Error>;
/// A packet error.
#[derive(Error, Debug, Eq, PartialEq)]
pub enum Error {
/// Attempting to create a packet with a insufficient buffer size.
/// Attempting to create a packet with an insufficient buffer size.
#[error("insufficient buffer for {0} packet, minimum={1}, provided={2}")]
InsufficientPacketBuffer(String, usize, usize),
}
10 changes: 5 additions & 5 deletions crates/trippy-packet/src/icmp_extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ pub mod extension_splitter {
_ => (icmp_payload, None),
}
} else if length > 0 {
// a 'compliant' ICMP extension padded to at least 128 octets
// a 'compliant' ICMP extension padded to at least 128 octets,
// so we trim the original datagram to rfc4884 length.
match icmp_payload.split_at(ICMP_ORIG_DATAGRAM_MIN_LENGTH) {
(payload, extension) if extension.len() >= MIN_HEADER => {
Expand Down Expand Up @@ -932,7 +932,7 @@ pub mod extension_splitter {
assert_eq!(extension, Some([0; 4].as_slice()));
}

// Test handling of an ICMP payload which has an rfc4884 length that
// Test handling of an ICMP payload which has a rfc4884 length that
// is longer than the original datagram.
//
// For such invalid packets we assume there is no extension.
Expand Down Expand Up @@ -1077,7 +1077,7 @@ pub mod extension_splitter {
assert_eq!(&buf[36..76], nested_echo.payload());
}

// This is an real example that was observed in the wild whilst testing.
// This is a real example that was observed in the wild whilst testing.
//
// It has a rfc4884 complaint `length` field set to be 17 and so has
// an original datagram if length 68 octet (17 * 4 = 68) but is padded
Expand Down Expand Up @@ -1148,7 +1148,7 @@ pub mod extension_splitter {
use crate::icmpv6::{IcmpCode, IcmpType};
use crate::ipv6::Ipv6Packet;

// Real IPv6 example with an rfc4884 length of 10 (10 * 8 = 80
// Real IPv6 example with a rfc4884 length of 10 (10 * 8 = 80
// octets).
//
// This example contain an MPLS extension stack which contains
Expand Down Expand Up @@ -1233,7 +1233,7 @@ pub mod extension_splitter {
assert!(mpls_stack_member_iter.next().is_none());
}

// Real Ipv6 example with an rfc4884 length of 16 (16 * 8 = 128
// Real Ipv6 example with a rfc4884 length of 16 (16 * 8 = 128
// octets for) but the total payload is only 84 octets and
// therefore this is a malformed packet.
//
Expand Down
2 changes: 1 addition & 1 deletion crates/trippy-packet/src/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const DESTINATION_PORT_OFFSET: usize = 2;
const LENGTH_OFFSET: usize = 4;
const CHECKSUM_OFFSET: usize = 6;

/// Represents an UDP Packet.
/// Represents a UDP Packet.
///
/// The internal representation is held in network byte order (big-endian) and all accessor methods
/// take and return data in host byte order, converting as necessary for the given architecture.
Expand Down
2 changes: 1 addition & 1 deletion crates/trippy-tui/src/report/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use comfy_table::{ContentArrangement, Table};
use itertools::Itertools;
use trippy_dns::Resolver;

/// Generate a markdown table report of trace data.
/// Generate a Markdown table report of trace data.
pub fn report_md<R: Resolver>(
info: &TraceInfo,
report_cycles: usize,
Expand Down

0 comments on commit 2838b52

Please sign in to comment.