Struct magic_wormhole::transit::Transit
source · [−]pub struct Transit {
pub skey: Key<TransitTxKey>,
pub rkey: Key<TransitRxKey>,
pub snonce: Nonce,
pub rnonce: Nonce,
/* private fields */
}Expand description
An established Transit connection.
While you can manually send and receive bytes over the TCP stream, this is not recommended as the transit protocol also specifies an encrypted record pipe that does all the hard work for you. See the provided methods.
Fields
skey: Key<TransitTxKey>Our key, used for sending
rkey: Key<TransitRxKey>Their key, used for receiving
snonce: NonceNonce for sending
rnonce: NonceNonce for receiving
We’ll count as receiver and track if messages come in in order
Implementations
sourceimpl Transit
impl Transit
sourcepub async fn receive_record(&mut self) -> Result<Box<[u8]>, TransitError>
pub async fn receive_record(&mut self) -> Result<Box<[u8]>, TransitError>
Receive and decrypt one message from the other side.
sourcepub async fn send_record(
&mut self,
plaintext: &[u8]
) -> Result<(), TransitError>
pub async fn send_record(
&mut self,
plaintext: &[u8]
) -> Result<(), TransitError>
Send an encrypted message to the other side
pub async fn flush(&mut self) -> Result<(), TransitError>
Auto Trait Implementations
impl RefUnwindSafe for Transit
impl Send for Transit
impl Sync for Transit
impl Unpin for Transit
impl UnwindSafe for Transit
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more