pub struct FlowConfig { /* private fields */ }Expand description
Configuration for a flow.
Implementations§
Source§impl FlowConfig
impl FlowConfig
pub fn new( fake_body_mode: FakeBodyMode, fake_header_mode: FakeHeaderConfig, ) -> Self
Sourcepub fn random<AE: AsyncExecutor>(settings: &Settings<AE>) -> Self
pub fn random<AE: AsyncExecutor>(settings: &Settings<AE>) -> Self
Create a random flow configuration drawn from the default probability distributions.
- Headers: included with probability
FAKE_HEADER_PROBABILITY; if included, a random number of fields are packed to fill a length sampled from[FAKE_HEADER_LENGTH_MIN, FAKE_HEADER_LENGTH_MAX]. - Body: chosen by the
FAKE_BODY_WEIGHT_*settings (Empty / Random / Constant / Random{service}). InConstantmodepacket_lengthis sampled once at flow init from[FAKE_BODY_CONSTANT_LENGTH_MIN, FAKE_BODY_CONSTANT_LENGTH_MAX](clamped to[FAKE_BODY_LENGTH_MIN, mtu]) and then held constant for every packet in that flow — different flows get different constants, breaking the sharp single-mode wire-size spike that a global fixed-length Constant would produce.
Sourcepub fn max_overhead(&self) -> usize
pub fn max_overhead(&self) -> usize
Maximum bytes this flow config can prepend to a packet (fake header + worst-case fake body). Used to reserve before_capacity in packet buffers. Conservative for Constant mode.
Sourcepub fn max_user_payload(
&self,
mtu: usize,
crypto_overhead: usize,
tailer_len: usize,
) -> usize
pub fn max_user_payload( &self, mtu: usize, crypto_overhead: usize, tailer_len: usize, ) -> usize
Maximum user-data bytes per packet given MTU and the per-packet crypto/tailer overhead.
For Constant mode the wire size is fixed to packet_length, so the data budget is
min(packet_length, mtu) - (fake_header + crypto + tailer).
For other modes it is mtu - (fake_header + fake_body_max + crypto + tailer).
Trait Implementations§
Source§impl Clone for FlowConfig
impl Clone for FlowConfig
Source§fn clone(&self) -> FlowConfig
fn clone(&self) -> FlowConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for FlowConfig
impl RefUnwindSafe for FlowConfig
impl Send for FlowConfig
impl Sync for FlowConfig
impl Unpin for FlowConfig
impl UnsafeUnpin for FlowConfig
impl UnwindSafe for FlowConfig
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