pub struct LookupResponse {
pub request_id: u64,
pub target: NodeAddr,
pub path_mtu: u16,
pub target_coords: TreeCoordinate,
pub proof: Signature,
}Expand description
Response to a lookup request with target’s coordinates.
Routed back to the origin using the origin_coords from the request.
Fields§
§request_id: u64Echoed request identifier.
target: NodeAddrThe target node.
path_mtu: u16Minimum transport MTU along the response path.
Initialized to u16::MAX by the target. Each transit node applies
path_mtu = path_mtu.min(outgoing_link_mtu) when forwarding.
NOT included in the proof signature (transit annotation).
target_coords: TreeCoordinateTarget’s coordinates in the tree.
proof: SignatureProof that target authorized this response (signature over request).
Implementations§
Source§impl LookupResponse
impl LookupResponse
Sourcepub fn new(
request_id: u64,
target: NodeAddr,
target_coords: TreeCoordinate,
proof: Signature,
) -> Self
pub fn new( request_id: u64, target: NodeAddr, target_coords: TreeCoordinate, proof: Signature, ) -> Self
Create a new lookup response.
path_mtu is initialized to u16::MAX by the target; transit
nodes reduce it as they forward.
Sourcepub fn proof_bytes(
request_id: u64,
target: &NodeAddr,
target_coords: &TreeCoordinate,
) -> Vec<u8> ⓘ
pub fn proof_bytes( request_id: u64, target: &NodeAddr, target_coords: &TreeCoordinate, ) -> Vec<u8> ⓘ
Get the bytes that should be signed as proof.
Format: request_id (8) || target (16) || coords_encoding (2 + 16×n)
Sourcepub fn encode(&self) -> Vec<u8> ⓘ
pub fn encode(&self) -> Vec<u8> ⓘ
Encode as wire format (includes msg_type byte).
Format: [0x31][request_id:8][target:16][path_mtu:2][target_coords_cnt:2][target_coords:16×n][proof:64]
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 LookupResponse
impl Clone for LookupResponse
Source§fn clone(&self) -> LookupResponse
fn clone(&self) -> LookupResponse
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 LookupResponse
impl RefUnwindSafe for LookupResponse
impl Send for LookupResponse
impl Sync for LookupResponse
impl Unpin for LookupResponse
impl UnsafeUnpin for LookupResponse
impl UnwindSafe for LookupResponse
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