pub struct LinkHandshake { /* private fields */ }Expand description
One end of a link handshake in progress.
Implementations§
Source§impl LinkHandshake
impl LinkHandshake
Sourcepub fn initiator(
local: &LocalMachine,
peer: MachineIdentity,
) -> Result<Self, LinkHandshakeError>
pub fn initiator( local: &LocalMachine, peer: MachineIdentity, ) -> Result<Self, LinkHandshakeError>
The end that sends the first message, expecting peer to answer.
§Errors
A peer key that is not an Ed25519 point, or a Noise setup refusal.
Sourcepub fn responder(
local: &LocalMachine,
peer: MachineIdentity,
) -> Result<Self, LinkHandshakeError>
pub fn responder( local: &LocalMachine, peer: MachineIdentity, ) -> Result<Self, LinkHandshakeError>
The end that waits for the first message, expecting it from peer.
§Errors
A peer key that is not an Ed25519 point, or a Noise setup refusal.
Sourcepub fn write(&mut self, out: &mut [u8]) -> Result<usize, LinkHandshakeError>
pub fn write(&mut self, out: &mut [u8]) -> Result<usize, LinkHandshakeError>
Writes the next handshake message into out, returning its length.
§Errors
A buffer too small, or a message out of turn.
Sourcepub fn read(&mut self, message: &[u8]) -> Result<(), LinkHandshakeError>
pub fn read(&mut self, message: &[u8]) -> Result<(), LinkHandshakeError>
Reads the peer’s handshake message.
§Errors
PeerNotTheExpectedMachine when the message does not authenticate
against the static key this end expected; framing otherwise.
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Whether both messages of KK have been exchanged.
Sourcepub fn finish(self) -> Result<LinkTransport, LinkHandshakeError>
pub fn finish(self) -> Result<LinkTransport, LinkHandshakeError>
The transport the finished handshake keyed, bound to the proved peer.
§Errors
NotFinished before both messages were exchanged.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for LinkHandshake
impl !UnwindSafe for LinkHandshake
impl Freeze for LinkHandshake
impl Send for LinkHandshake
impl Sync for LinkHandshake
impl Unpin for LinkHandshake
impl UnsafeUnpin for LinkHandshake
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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