pub mod error; pub mod handshake; // pub mod field; // pub mod transactions; use crate::error::HotlineError; use crate::handshake::accept_handshake; use std::net::TcpStream; /// Get the stream and act as a server. If you want to act as a client, you /// will have to write your own handler. /// /// # Errors /// /// Returns error if handshake fails or stream I/O fails pub fn handle_client(mut stream: TcpStream) -> Result<(), HotlineError> { let handshake_request = accept_handshake(&mut stream)?; eprintln!( "Handshake successful with sub_protocol_id: 0x{:08X}, sub_version: {}", handshake_request.sub_protocol_id, handshake_request.sub_version ); Ok(()) }