Function caracat::builder::build_udp

source ·
pub fn build_udp(
    packet: &mut Packet<'_>,
    target_checksum: u16,
    src_port: u16,
    dst_port: u16
)
Expand description

Build the UDP header and payload.

In the UDP header, the source and destination ports are used for per-flow load-balancing. We use those for encoding the flow ID, and we encode the timestamp in the checksum (which doesn’t affect the flow ID). The TTL is encoded in the payload length, in addition to the TTL field in the IP header. The payload is all zeros, except two bytes used to ensure that the custom checksum is valid.