pub struct NatId(pub u16);Expand description
NAT identifier calculated from checksum difference.
When a NAT rewrites a packet (changing IP/port), the UDP checksum changes. The NAT ID is the difference between the received and sent checksums. If the NAT ID changes between hops, NAT was detected at that hop.
Tuple Fields§
§0: u16Implementations§
Source§impl NatId
impl NatId
Sourcepub fn from_checksums(sent_checksum: u16, received_checksum: u16) -> Self
pub fn from_checksums(sent_checksum: u16, received_checksum: u16) -> Self
Calculate NAT ID from sent and received UDP checksums.
NAT ID = received_checksum - sent_checksum
If NAT rewrites the packet, the checksum changes and NAT ID will be non-zero. If NAT ID differs between hops, a NAT device exists at that point.
Trait Implementations§
impl Copy for NatId
impl Eq for NatId
impl StructuralPartialEq for NatId
Auto Trait Implementations§
impl Freeze for NatId
impl RefUnwindSafe for NatId
impl Send for NatId
impl Sync for NatId
impl Unpin for NatId
impl UnwindSafe for NatId
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.