pub struct FourTuple {
pub remote: SocketAddr,
pub local_ip: Option<IpAddr>,
}Expand description
Identifies a network path by the combination of remote and local addresses
Including the local ensures good behavior when the host has multiple IP addresses on the same subnet and zero-length connection IDs are in use or when multipath is enabled and multiple paths exist with the same remote, but different local IP interfaces.
Fields§
§remote: SocketAddrThe remote side of this tuple
local_ip: Option<IpAddr>The local side of this tuple.
The socket is irrelevant for our intents and purposes:
When we send, we can only specify the src_ip, not the source port.
So even if we track the port, we won’t be able to make use of it.
Implementations§
Source§impl FourTuple
impl FourTuple
Sourcepub fn is_probably_same_path(&self, other: &Self) -> bool
pub fn is_probably_same_path(&self, other: &Self) -> bool
Returns whether we think the other address probably represents the same path as ours.
If we have a local IP set, then we’re exact and only match if the 4-tuples are exactly equal. If we don’t have a local IP set, then we only check the remote addresses for equality.
Sourcepub fn update_local_if_same_remote(&mut self, other: &Self) -> bool
pub fn update_local_if_same_remote(&mut self, other: &Self) -> bool
Updates this tuple’s local address iff
- it was unset before,
- the other tuple has the same remote, and
- the other tuple has a local address set.
Returns whether this and the other remote are now fully equal.
Trait Implementations§
impl Copy for FourTuple
impl Eq for FourTuple
impl StructuralPartialEq for FourTuple
Auto Trait Implementations§
impl Freeze for FourTuple
impl RefUnwindSafe for FourTuple
impl Send for FourTuple
impl Sync for FourTuple
impl Unpin for FourTuple
impl UnwindSafe for FourTuple
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.