aboutsummaryrefslogtreecommitdiff
path: root/src/message/handshake/init.rs
diff options
context:
space:
mode:
authorMax Audron <audron@cocaine.farm>2021-01-04 18:38:31 +0100
committerMax Audron <audron@cocaine.farm>2021-01-04 18:38:31 +0100
commit0b7c6cf0b129799110d3ef0118e1f2b5697a2068 (patch)
tree9bbb49c7af7feb6fc1aff497e0d577fe31ef11ed /src/message/handshake/init.rs
parentWIP: function api (diff)
parentadd example program: quasselproxy (diff)
Merge branch 'client'
Diffstat (limited to 'src/message/handshake/init.rs')
-rw-r--r--src/message/handshake/init.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/message/handshake/init.rs b/src/message/handshake/init.rs
index e4c0fa9..b4604b6 100644
--- a/src/message/handshake/init.rs
+++ b/src/message/handshake/init.rs
@@ -2,6 +2,7 @@ use crate::Deserialize;
use crate::Serialize;
/// The first few bytes sent to the core to initialize the connection and setup if we want to use tls and compression
+#[derive(Clone, Debug)]
pub struct Init {
pub tls: bool,
pub compression: bool,
@@ -37,7 +38,15 @@ impl Init {
handshake |= 0x02;
}
- return handshake.serialize().unwrap();
+ // Select Protocol 2: Datastream
+
+ let mut init: Vec<u8> = vec![];
+
+ // Add handshake and protocol to our buffer
+ init.extend(handshake.serialize().unwrap());
+ init.extend(crate::message::Protocol::Datastream.serialize());
+
+ return init;
}
pub fn parse(buf: &[u8]) -> Self {