HandshakeProtocol

Trait HandshakeProtocol 

Source
pub trait HandshakeProtocol:
    Send
    + Sync
    + 'static {
    // Required methods
    fn create_request(&self, from: PeerId, to: PeerId, now: u64) -> Vec<u8> ;
    fn verify_request(
        &self,
        data: Vec<u8>,
        expected_from: PeerId,
        expected_to: PeerId,
        now: u64,
    ) -> Result<(), String>;
    fn create_response(&self, from: PeerId, to: PeerId, now: u64) -> Vec<u8> ;
    fn verify_response(
        &self,
        data: Vec<u8>,
        expected_from: PeerId,
        expected_to: PeerId,
        now: u64,
    ) -> Result<(), String>;
}

Required Methods§

Source

fn create_request(&self, from: PeerId, to: PeerId, now: u64) -> Vec<u8>

Source

fn verify_request( &self, data: Vec<u8>, expected_from: PeerId, expected_to: PeerId, now: u64, ) -> Result<(), String>

Source

fn create_response(&self, from: PeerId, to: PeerId, now: u64) -> Vec<u8>

Source

fn verify_response( &self, data: Vec<u8>, expected_from: PeerId, expected_to: PeerId, now: u64, ) -> Result<(), String>

Implementors§