pub enum WireMessage {
Control(ControlMessage),
EncryptedData {
message_type: u8,
payload: Vec<u8>,
},
}Expand description
Wrapper for wire messages with type prefix
Variants§
Implementations§
Source§impl WireMessage
impl WireMessage
Sourcepub fn encode_control(msg: &ControlMessage) -> Vec<u8> ⓘ
pub fn encode_control(msg: &ControlMessage) -> Vec<u8> ⓘ
Encode a control message to bytes
Sourcepub fn decode_control(data: &[u8]) -> Result<ControlMessage, Error>
pub fn decode_control(data: &[u8]) -> Result<ControlMessage, Error>
Decode a control message from bytes
Sourcepub fn encode_encrypted(message_type: u8, encrypted_payload: Vec<u8>) -> Vec<u8> ⓘ
pub fn encode_encrypted(message_type: u8, encrypted_payload: Vec<u8>) -> Vec<u8> ⓘ
Encode an encrypted data message to bytes (with type prefix) Format: [message_type: 1 byte][payload]
Sourcepub fn encode_encrypted_with_routing(
message_type: u8,
request_id: &str,
encrypted_payload: Vec<u8>,
) -> Vec<u8> ⓘ
pub fn encode_encrypted_with_routing( message_type: u8, request_id: &str, encrypted_payload: Vec<u8>, ) -> Vec<u8> ⓘ
Encode an encrypted data message with routing header Format: [message_type: 1 byte][request_id_len: 1 byte][request_id][encrypted_payload] This allows the relay to route responses without decrypting the payload
Trait Implementations§
Source§impl Clone for WireMessage
impl Clone for WireMessage
Source§fn clone(&self) -> WireMessage
fn clone(&self) -> WireMessage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for WireMessage
impl RefUnwindSafe for WireMessage
impl Send for WireMessage
impl Sync for WireMessage
impl Unpin for WireMessage
impl UnsafeUnpin for WireMessage
impl UnwindSafe for WireMessage
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
Mutably borrows from an owned value. Read more