pub struct NodeCandidate {
pub node_id: PublicKey,
pub eth_address: Address,
pub region_hint: Option<Region>,
pub multiaddrs: Bytes,
}Expand description
A node the client may fetch from, distilled from a registry NodeInfo.
Dialing is by node_id; the registry-published multiaddrs ride along as
iroh direct-address hints so a reachable peer connects without a relay (see
module docs and NodeCandidate::dial_addrs).
Serializable so the resolved set can be projected into [crate::PeerStore]
identity records and reloaded from the store when the registry is
unreachable (ADR 012 § Bootstrap step 4).
That encoding is a private implementation detail of the peer store, not
a stable format: the JSON keys are the field names, and the bytes are
codec-dependent (iroh renders PublicKey as z-base-32 under a
human-readable codec and as raw bytes otherwise).
Fields§
§node_id: PublicKeyiroh endpoint id — dialed via discovery, never needs an explicit addr.
eth_address: AddressThe node’s Ethereum address — the --provider-address discovery derives
(the channel is opened/reused against it and the slash_sig verified
against it).
region_hint: Option<Region>The node’s self-attested region (ADR 030), used for locality-aware
selection. None when the node registered without one, or with a code
outside Region’s accepted set.
An unrecognized code parses to None and sorts into the “rest” bucket
rather than dropping the candidate: CapacityBond permits any string up
to 16 bytes and ADR 030 § Cross-ADR Impact explicitly declines to
tighten it, so rejecting a node over a purely advisory field would be
stricter than the source of truth and would silently shrink the
fetchable set. Parsing at this boundary is what makes the derived Eq
above correct and keeps an unbounded operator-submitted string off the
peer-store read path (#1348).
multiaddrs: BytesThe node’s registry-published, packed multiaddrs field
(pack_multiaddrs framing), decoded on demand by Self::dial_addrs
into iroh direct-address hints. Self-attested and additive: it can only
add a direct dial path, never gate one. Carried through the peer store,
so a candidate rebuilt on a registry outage keeps the last-seen addresses
and can dial a reachable peer directly, without iroh discovery.
Implementations§
Source§impl NodeCandidate
impl NodeCandidate
Sourcepub fn dial_addrs(&self) -> Vec<SocketAddr>
pub fn dial_addrs(&self) -> Vec<SocketAddr>
Registry-published direct dial addresses, decoded leniently from the
packed on-chain multiaddrs field for use as iroh direct-address hints
(ADR 001 § Node Discovery). Empty when the node published none or the
field is malformed. A returned address is only ever one dial path among
discovery and the relay fallback, so a stale entry loses the path race
but never fails the connection.
Trait Implementations§
Source§impl Clone for NodeCandidate
impl Clone for NodeCandidate
Source§impl Debug for NodeCandidate
impl Debug for NodeCandidate
Source§impl<'de> Deserialize<'de> for NodeCandidate
impl<'de> Deserialize<'de> for NodeCandidate
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for NodeCandidate
Source§impl PartialEq for NodeCandidate
impl PartialEq for NodeCandidate
Source§impl Serialize for NodeCandidate
impl Serialize for NodeCandidate
impl StructuralPartialEq for NodeCandidate
Auto Trait Implementations§
impl !Freeze for NodeCandidate
impl RefUnwindSafe for NodeCandidate
impl Send for NodeCandidate
impl Sync for NodeCandidate
impl Unpin for NodeCandidate
impl UnsafeUnpin for NodeCandidate
impl UnwindSafe for NodeCandidate
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<'de, T> BorrowedRpcObject<'de> for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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