Added constructor for ProtocolConnection

This commit is contained in:
Kyler 2024-05-31 16:28:47 -06:00
parent 300c3c2c13
commit 271dadae0f
1 changed files with 14 additions and 0 deletions

View File

@ -62,6 +62,20 @@ pub struct ProtocolConnection<'a> {
}
impl<'a> ProtocolConnection<'a> {
pub fn new(
stream_read: &'a mut OwnedReadHalf,
stream_write: &'a mut OwnedWriteHalf,
) -> Self {
ProtocolConnection {
stream_read,
stream_write,
rsa_private_key: None,
rsa_public_key: None,
aes_encryption_key: None,
verify_token: None,
}
}
pub async fn read_data(&mut self) -> Result<Vec<u8>> {
match self.aes_encryption_key {
Some(aes_key) => {