pub struct ReachabilityInfo {
pub addresses: Vec<SocketAddr>,
pub nat_type: Option<String>,
pub can_receive_direct: Option<bool>,
pub is_relay: Option<bool>,
pub is_coordinator: Option<bool>,
pub reachable_via: Vec<MachineId>,
pub relay_candidates: Vec<MachineId>,
}Expand description
Summarises the connectivity properties of a discovered agent.
Built from a DiscoveredAgent and used to decide which connection
strategy to attempt.
Fields§
§addresses: Vec<SocketAddr>Agent’s known addresses.
nat_type: Option<String>NAT type reported by the agent (e.g. “FullCone”, “Symmetric”).
None when the agent has not yet reported NAT information.
This is informational only. Connection strategy should not infer direct reachability from NAT type alone.
can_receive_direct: Option<bool>Whether the agent can receive direct inbound connections.
None when not reported.
is_relay: Option<bool>Whether the agent advertises relay service capability.
None when not reported.
is_coordinator: Option<bool>Whether the agent advertises coordinator capability.
None when not reported.
reachable_via: Vec<MachineId>Coordinator machines through which the advertising peer is reachable.
Prefer these when can_receive_direct == Some(false) — the peer has
explicitly named who can hole-punch for them.
relay_candidates: Vec<MachineId>Relay machines the peer proposes as a fallback.
Implementations§
Source§impl ReachabilityInfo
impl ReachabilityInfo
Sourcepub fn from_discovered(agent: &DiscoveredAgent) -> Self
pub fn from_discovered(agent: &DiscoveredAgent) -> Self
Build from a DiscoveredAgent.
Sourcepub fn from_discovered_machine(machine: &DiscoveredMachine) -> Self
pub fn from_discovered_machine(machine: &DiscoveredMachine) -> Self
Build from a DiscoveredMachine.
Sourcepub fn likely_direct(&self) -> bool
pub fn likely_direct(&self) -> bool
Returns true if the remote agent has observer-verified direct reachability.
Sourcepub fn should_attempt_direct(&self) -> bool
pub fn should_attempt_direct(&self) -> bool
Returns true if it is still worth attempting a direct connection.
Unknown reachability should still get a direct probe, especially for new networks where the first nodes have not yet accumulated observations.
Sourcepub fn needs_coordination(&self) -> bool
pub fn needs_coordination(&self) -> bool
Returns true if coordinated NAT traversal may be needed to connect.
Any agent that is not positively known to be directly reachable may still need coordination after direct attempts are exhausted.
Sourcepub fn is_coordinator(&self) -> bool
pub fn is_coordinator(&self) -> bool
Returns true if the agent advertises coordinator capability.
Trait Implementations§
Source§impl Clone for ReachabilityInfo
impl Clone for ReachabilityInfo
Source§fn clone(&self) -> ReachabilityInfo
fn clone(&self) -> ReachabilityInfo
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ReachabilityInfo
impl RefUnwindSafe for ReachabilityInfo
impl Send for ReachabilityInfo
impl Sync for ReachabilityInfo
impl Unpin for ReachabilityInfo
impl UnsafeUnpin for ReachabilityInfo
impl UnwindSafe for ReachabilityInfo
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more