sessions and muxer legs
This commit is contained in:
+13
-1
@@ -144,6 +144,10 @@ impl TlsBridge {
|
||||
) -> Result<Bytes, TlsError> {
|
||||
if let HandshakeMessage::Client { base, extensions } = client_msg {
|
||||
if base.session_id.len() != 32 {
|
||||
netrunner_logger::warn!(
|
||||
"❌ Auth failed: Expected 32 bytes SessionID, got {}. Client IP: ...",
|
||||
base.session_id.len()
|
||||
);
|
||||
return Err(TlsError::new(
|
||||
ErrorStage::Handshake("Invalid SessionID len"),
|
||||
ErrorAction::Drop,
|
||||
@@ -152,7 +156,15 @@ impl TlsBridge {
|
||||
}
|
||||
|
||||
let mut received_tag = [0u8; 16];
|
||||
received_tag.copy_from_slice(&base.session_id[16..32]);
|
||||
if base.session_id.len() >= 32 {
|
||||
received_tag.copy_from_slice(&base.session_id[16..32]);
|
||||
} else {
|
||||
return Err(TlsError::new(
|
||||
ErrorStage::Handshake("Short SessionID"),
|
||||
ErrorAction::Drop,
|
||||
Bytes::new(),
|
||||
));
|
||||
}
|
||||
|
||||
if !keys.verify_auth_tag(&received_tag) {
|
||||
netrunner_logger::warn!("Unauthorized ClientHello: Auth Tag mismatch");
|
||||
|
||||
@@ -25,7 +25,7 @@ impl Padding {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
pub(crate) enum FrameType {
|
||||
Connect = 0x00,
|
||||
Data = 0x01,
|
||||
@@ -33,6 +33,7 @@ pub(crate) enum FrameType {
|
||||
Heartbeat = 0x03,
|
||||
UdpConnect = 0x04,
|
||||
UdpData = 0x05,
|
||||
Handshake = 0x06,
|
||||
}
|
||||
#[derive(Copy, Clone)]
|
||||
pub(crate) struct FrameHeader {
|
||||
@@ -122,6 +123,9 @@ impl Parser for FrameHeader {
|
||||
0x01 => FrameType::Data,
|
||||
0x02 => FrameType::Close,
|
||||
0x03 => FrameType::Heartbeat,
|
||||
0x04 => FrameType::UdpConnect,
|
||||
0x05 => FrameType::UdpData,
|
||||
0x06 => FrameType::Handshake,
|
||||
_ => FrameType::Close,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user