pub struct Destination {
pub hash: DestHash,
pub dest_type: DestinationType,
pub direction: Direction,
pub app_name: String,
pub aspects: Vec<String>,
pub identity_hash: Option<IdentityHash>,
pub public_key: Option<[u8; 64]>,
pub group_key: Option<Vec<u8>>,
pub proof_strategy: ProofStrategy,
}Expand description
A network destination (endpoint) for sending or receiving packets.
This is a pure data struct with no behavior — all operations
(register, announce, send) are methods on RnsNode.
Fields§
§hash: DestHashComputed destination hash.
dest_type: DestinationTypeType: Single, Group, or Plain.
direction: DirectionDirection: In (receiving) or Out (sending).
app_name: StringApplication name (e.g. “echo_app”).
aspects: Vec<String>Aspects (e.g. [“echo”, “request”]).
identity_hash: Option<IdentityHash>Identity hash of the owner (for SINGLE destinations).
public_key: Option<[u8; 64]>Full public key (64 bytes) of the remote peer (for OUT SINGLE destinations).
group_key: Option<Vec<u8>>Symmetric key for GROUP destinations (32 or 64 bytes).
proof_strategy: ProofStrategyHow to handle proofs for incoming packets.
Implementations§
Source§impl Destination
impl Destination
Sourcepub fn single_in(
app_name: &str,
aspects: &[&str],
identity_hash: IdentityHash,
) -> Self
pub fn single_in( app_name: &str, aspects: &[&str], identity_hash: IdentityHash, ) -> Self
Create an inbound SINGLE destination (for receiving encrypted packets).
identity_hash is the local identity that owns this destination.
Sourcepub fn single_out(
app_name: &str,
aspects: &[&str],
recalled: &AnnouncedIdentity,
) -> Self
pub fn single_out( app_name: &str, aspects: &[&str], recalled: &AnnouncedIdentity, ) -> Self
Create an outbound SINGLE destination (for sending encrypted packets).
recalled contains the remote peer’s identity data (from announce/recall).
Sourcepub fn plain(app_name: &str, aspects: &[&str]) -> Self
pub fn plain(app_name: &str, aspects: &[&str]) -> Self
Create a PLAIN destination (unencrypted, no identity).
Sourcepub fn group(app_name: &str, aspects: &[&str]) -> Self
pub fn group(app_name: &str, aspects: &[&str]) -> Self
Create a GROUP destination (symmetric encryption with pre-shared key).
No identity needed — the hash is based only on app_name + aspects, same as PLAIN. All members sharing the same key can encrypt/decrypt.
Sourcepub fn create_keys(&mut self)
pub fn create_keys(&mut self)
Generate a new random 64-byte symmetric key (AES-256) for this GROUP destination.
Sourcepub fn load_private_key(&mut self, key: Vec<u8>) -> Result<(), GroupKeyError>
pub fn load_private_key(&mut self, key: Vec<u8>) -> Result<(), GroupKeyError>
Load an existing symmetric key for this GROUP destination.
Key must be 32 bytes (AES-128) or 64 bytes (AES-256).
Sourcepub fn get_private_key(&self) -> Option<&[u8]>
pub fn get_private_key(&self) -> Option<&[u8]>
Retrieve the symmetric key bytes, if set.
Sourcepub fn encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>, GroupKeyError>
pub fn encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>, GroupKeyError>
Encrypt plaintext using this destination’s GROUP key.
Sourcepub fn decrypt(&self, ciphertext: &[u8]) -> Result<Vec<u8>, GroupKeyError>
pub fn decrypt(&self, ciphertext: &[u8]) -> Result<Vec<u8>, GroupKeyError>
Decrypt ciphertext using this destination’s GROUP key.
Sourcepub fn set_proof_strategy(self, strategy: ProofStrategy) -> Self
pub fn set_proof_strategy(self, strategy: ProofStrategy) -> Self
Set the proof strategy for this destination.
Trait Implementations§
Source§impl Clone for Destination
impl Clone for Destination
Source§fn clone(&self) -> Destination
fn clone(&self) -> Destination
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for Destination
impl RefUnwindSafe for Destination
impl Send for Destination
impl Sync for Destination
impl Unpin for Destination
impl UnsafeUnpin for Destination
impl UnwindSafe for Destination
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> InterfaceConfigData for Twhere
T: Send + 'static,
impl<T> InterfaceConfigData for Twhere
T: Send + 'static,
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