pub struct LookupRequest {
pub request_id: u64,
pub target: NodeAddr,
pub origin: NodeAddr,
pub origin_coords: TreeCoordinate,
pub ttl: u8,
pub min_mtu: u16,
}Expand description
Request to discover a node’s coordinates.
Routed through the spanning tree via bloom-filter-guided forwarding. Each transit node forwards only to tree peers whose bloom filter contains the target. TTL limits propagation depth.
Fields§
§request_id: u64Unique request identifier.
target: NodeAddrNode we’re looking for.
origin: NodeAddrWho’s asking (for response routing).
origin_coords: TreeCoordinateOrigin’s coordinates (for return path).
ttl: u8Remaining propagation hops.
min_mtu: u16Minimum transport MTU the origin requires for a viable route. 0 means no requirement.
Implementations§
Source§impl LookupRequest
impl LookupRequest
Sourcepub fn new(
request_id: u64,
target: NodeAddr,
origin: NodeAddr,
origin_coords: TreeCoordinate,
ttl: u8,
min_mtu: u16,
) -> Self
pub fn new( request_id: u64, target: NodeAddr, origin: NodeAddr, origin_coords: TreeCoordinate, ttl: u8, min_mtu: u16, ) -> Self
Create a new lookup request.
Sourcepub fn generate(
target: NodeAddr,
origin: NodeAddr,
origin_coords: TreeCoordinate,
ttl: u8,
min_mtu: u16,
) -> Self
pub fn generate( target: NodeAddr, origin: NodeAddr, origin_coords: TreeCoordinate, ttl: u8, min_mtu: u16, ) -> Self
Generate a new request with a random ID.
Sourcepub fn forward(&mut self) -> bool
pub fn forward(&mut self) -> bool
Decrement TTL for forwarding.
Returns false if TTL was already 0.
Sourcepub fn can_forward(&self) -> bool
pub fn can_forward(&self) -> bool
Check if this request can still be forwarded.
Sourcepub fn encode(&self) -> Vec<u8> ⓘ
pub fn encode(&self) -> Vec<u8> ⓘ
Encode as wire format (includes msg_type byte).
Format: [0x30][request_id:8][target:16][origin:16][ttl:1][min_mtu:2]
[origin_coords_cnt:2][origin_coords:16×n]
Sourcepub fn decode(payload: &[u8]) -> Result<Self, ProtocolError>
pub fn decode(payload: &[u8]) -> Result<Self, ProtocolError>
Decode from wire format (after msg_type byte has been consumed).
Trait Implementations§
Source§impl Clone for LookupRequest
impl Clone for LookupRequest
Source§fn clone(&self) -> LookupRequest
fn clone(&self) -> LookupRequest
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 LookupRequest
impl RefUnwindSafe for LookupRequest
impl Send for LookupRequest
impl Sync for LookupRequest
impl Unpin for LookupRequest
impl UnsafeUnpin for LookupRequest
impl UnwindSafe for LookupRequest
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,
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