pub struct TlsClientHelloReader { /* private fields */ }Expand description
TLS ClientHello reader with incremental parsing support
This struct manages reading and parsing TLS ClientHello messages incrementally, handling cases where the ClientHello arrives in multiple TCP packets.
§Example
use huginn_net_tls::TlsClientHelloReader;
let mut reader = TlsClientHelloReader::new();
// Add bytes incrementally
reader.add_bytes(&[0x16, 0x03, 0x01, 0x00, 0x4a]);
reader.add_bytes(&[/* more bytes */]);
if let Some(signature) = reader.get_signature() {
println!("Got TLS signature");
}Implementations§
Source§impl TlsClientHelloReader
impl TlsClientHelloReader
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new TLS ClientHello reader
§Returns
A new TlsClientHelloReader instance ready to process TLS ClientHello data
Sourcepub fn add_bytes(
&mut self,
data: &[u8],
) -> Result<Option<Signature>, HuginnNetTlsError>
pub fn add_bytes( &mut self, data: &[u8], ) -> Result<Option<Signature>, HuginnNetTlsError>
Add bytes to the buffer and attempt to parse ClientHello
This method handles incremental data arrival, parsing the ClientHello as soon as enough data is available.
§Parameters
data: New bytes to add to the buffer
§Returns
Ok(Some(Signature))if ClientHello was successfully parsedOk(None)if more data is needed or signature already parsedErr(HuginnNetTlsError)if parsing fails
Sourcepub fn get_signature(&self) -> Option<&Signature>
pub fn get_signature(&self) -> Option<&Signature>
Get the parsed signature if available
§Returns
Some(Signature)if signature has been parsedNoneif signature not yet available
Sourcepub fn signature_parsed(&self) -> bool
pub fn signature_parsed(&self) -> bool
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Reset the reader to process a new ClientHello
Clears the buffer and resets parsing state, allowing the reader to be reused.
Sourcepub fn buffer_len(&self) -> usize
pub fn buffer_len(&self) -> usize
Get the current buffer size
Returns the number of bytes currently accumulated in the buffer.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TlsClientHelloReader
impl RefUnwindSafe for TlsClientHelloReader
impl Send for TlsClientHelloReader
impl Sync for TlsClientHelloReader
impl Unpin for TlsClientHelloReader
impl UnsafeUnpin for TlsClientHelloReader
impl UnwindSafe for TlsClientHelloReader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more