Skip to main content

Tailer

Struct Tailer 

Source
pub struct Tailer<T: IdentityType> { /* private fields */ }
Expand description

Tailer view (16 + TYPHOON_ID_LENGTH bytes total). Zero-copy view into a DynamicByteBuffer containing tailer metadata. All field access reads directly from the underlying buffer.

Layout:

  • FG (flags): 1 byte - packet type flags
  • CD (code): 1 byte - client type or return code
  • TM (time): 4 bytes - next_in delay in milliseconds
  • PN (packet number): 8 bytes - timestamp (4) + incremental (4)
  • PL (payload length): 2 bytes - length of encrypted payload
  • ID (identity): TYPHOON_ID_LENGTH bytes - client UUID

Implementations§

Source§

impl<T: IdentityType> Tailer<T>

Source

pub fn new(buffer: DynamicByteBuffer) -> Self

Wrap an existing buffer as a tailer view. No data is copied. The buffer must contain at least Self::len() bytes.

Source

pub fn validated(buffer: DynamicByteBuffer, body_len: usize) -> Option<Self>

Construct a tailer view from a received buffer and validate it against the accompanying body length. Unlike Tailer::new, this constructor never expands the buffer via the pool — receive paths must supply a slice whose length is already at least Self::len().

Source

pub fn data( buffer: DynamicByteBuffer, identity: &T, payload_length: u16, packet_number: u64, ) -> Self

Write a data packet tailer into the buffer.

Source

pub fn health_check( buffer: DynamicByteBuffer, identity: &T, next_in: u32, packet_number: u64, ) -> Self

Write a health check packet tailer into the buffer.

Source

pub fn shadowride( buffer: DynamicByteBuffer, identity: &T, payload_length: u16, next_in: u32, packet_number: u64, ) -> Self

Write a shadowride packet tailer (data + health check) into the buffer.

Source

pub fn handshake( buffer: DynamicByteBuffer, identity: &T, code: u8, next_in: u32, packet_number: u64, body_len: u16, ) -> Self

Write a handshake packet tailer into the buffer. body_len is the length of the handshake body (excluding tailer), allowing receivers to strip any fake header/body prefix before parsing the handshake data.

Source

pub fn decoy( buffer: DynamicByteBuffer, identity: &T, packet_number: u64, ) -> Self

Write a decoy packet tailer into the buffer.

Source

pub fn debug_probe( buffer: DynamicByteBuffer, identity: &T, ref_num: u8, send_time_ms: u32, sequence: u32, phase: u32, payload_len: u16, ) -> Self

Write a debug probe tailer into the buffer.

Field semantics in debug mode:

  • FG: DATA flag (same as data packets so probes blend in).
  • CD: ref_num — rolling reference number (0–255) uniquely identifying this probe.
  • TM: send_time_ms — lower 32 bits of the Unix send timestamp in milliseconds.
  • PN: sequence << 32 | phase — global sequence number and debug phase identifier.
  • PL: payload_len — length of the probe payload.
Source

pub fn termination( buffer: DynamicByteBuffer, identity: &T, code: ReturnCode, packet_number: u64, ) -> Self

Write a termination packet tailer into the buffer.

Source

pub fn flags(&self) -> PacketFlags

Source

pub fn code(&self) -> u8

Source

pub fn time(&self) -> u32

Source

pub fn packet_number(&self) -> u64

Source

pub fn payload_length(&self) -> u16

Source

pub fn identity(&self) -> T

Source

pub fn timestamp(&self) -> u32

Extract timestamp from packet number (upper 32 bits).

Source

pub fn incremental(&self) -> u32

Extract incremental number from packet number (lower 32 bits).

Source

pub fn return_code(&self) -> ReturnCode

Get return code from code field.

Source

pub fn debug_ref_num(&self) -> u8

Debug: rolling reference number from the CD field (0–255).

Source

pub fn debug_send_time(&self) -> u32

Debug: send timestamp in milliseconds from the TM field (lower 32 bits of Unix time).

Source

pub fn debug_sequence(&self) -> u32

Debug: global probe sequence number from the upper 32 bits of the PN field.

Source

pub fn debug_phase(&self) -> u32

Debug: phase identifier from the lower 32 bits of the PN field. 0 = reachability, 1 = return time, 2 = throughput.

Source

pub fn buffer(&self) -> &DynamicByteBuffer

Get the underlying buffer.

Source

pub fn into_buffer(self) -> DynamicByteBuffer

Consume the tailer view and return the underlying buffer.

Source

pub fn set_flags(&self, flags: PacketFlags)

Source

pub fn set_code(&self, code: u8)

Source

pub fn set_time(&self, time: u32)

Source

pub fn set_packet_number_raw(&self, pn: u64)

Source

pub fn set_packet_number(&self, timestamp: u32, incremental: u32)

Set packet number from timestamp and incremental counter.

Source

pub fn set_packet_number_now(&self, incremental: u32)

Set packet number using current timestamp and given incremental.

Source

pub fn set_payload_length(&self, len: u16)

Source

pub fn set_identity(&self, identity: &T)

Source

pub fn get_payload_length(buffer: &DynamicByteBuffer) -> u16

Source

pub fn get_identity(buffer: &DynamicByteBuffer) -> T

Extract identity from a raw tailer buffer.

Source

pub fn len() -> usize

Trait Implementations§

Source§

impl<T: IdentityType> Clone for Tailer<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: IdentityType> Debug for Tailer<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult

Formats the value using the given formatter. Read more
Source§

impl<T: IdentityType + PartialEq> PartialEq for Tailer<T>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for Tailer<T>

§

impl<T> !Sync for Tailer<T>

§

impl<T> Freeze for Tailer<T>

§

impl<T> Send for Tailer<T>

§

impl<T> Unpin for Tailer<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Tailer<T>

§

impl<T> UnwindSafe for Tailer<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V