Uplink

Struct Uplink 

Source
pub struct Uplink { /* private fields */ }
Expand description

An individual network uplink.

Implementations§

Source

pub fn new(config: UplinkConfig, numeric_id: u16) -> Self

Create a new uplink.

Source

pub fn id(&self) -> &UplinkId

Get the uplink ID.

Source

pub fn numeric_id(&self) -> u16

Get the numeric ID (for packet headers).

Source

pub fn config(&self) -> &UplinkConfig

Get the configuration.

Source

pub fn state(&self) -> UplinkState

Get current state.

Source

pub fn health(&self) -> UplinkHealth

Get health status.

Source

pub fn is_usable(&self) -> bool

Check if uplink is usable.

Source

pub fn priority_score(&self) -> u32

Get the priority score.

Source

pub fn rtt(&self) -> Duration

Get smoothed RTT.

Source

pub fn bandwidth(&self) -> Bandwidth

Get current bandwidth estimate.

Source

pub fn loss_ratio(&self) -> f64

Get packet loss ratio.

Source

pub fn stats(&self) -> TrafficStats

Get traffic statistics.

Source

pub fn cwnd(&self) -> u32

Get congestion window.

Source

pub fn in_flight(&self) -> u32

Get in-flight packet count.

Source

pub fn can_send(&self) -> bool

Check if congestion window allows sending.

Source

pub fn set_transport(&self, transport: Arc<dyn Transport>)

Set the transport.

Source

pub fn get_transport(&self) -> Option<Arc<dyn Transport>>

Get the transport (cloned Arc).

Source

pub fn set_noise_session(&self, session: NoiseSession)

Set the noise session.

Source

pub async fn send_raw(&self, data: &[u8]) -> Result<usize>

Send raw data through the transport (no encryption).

Source

pub async fn send_encrypted(&self, data: &[u8]) -> Result<usize>

Send encrypted data through the transport. Returns the number of bytes sent (original data size).

Source

pub async fn recv(&self, buf: &mut [u8]) -> Result<usize>

Receive data from transport.

Source

pub async fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr)>

Receive data from transport with source address.

Source

pub fn decrypt(&self, ciphertext: &[u8]) -> Result<Vec<u8>>

Decrypt received data.

Source

pub fn is_noise_ready(&self) -> bool

Check if the noise session is ready for transport.

Source

pub fn encrypt(&self, data: &[u8]) -> Result<Vec<u8>>

Encrypt data (get ciphertext without sending).

Source

pub fn write_handshake(&self, payload: &[u8]) -> Result<Vec<u8>>

Write handshake message.

Source

pub fn read_handshake(&self, message: &[u8]) -> Result<Vec<u8>>

Read handshake message.

Source

pub fn set_connection_state(&self, state: ConnectionState)

Update connection state.

Source

pub fn record_send(&self, bytes: usize)

Record a successful send.

Source

pub fn record_recv(&self, bytes: usize)

Record a successful receive.

Source

pub fn record_rtt(&self, rtt: Duration)

Record an RTT measurement.

Source

pub fn record_loss(&self)

Record a packet loss.

Source

pub fn record_failure(&self, error: &str)

Record a failure.

Source

pub fn record_success(&self)

Record a successful operation (resets failure counter).

Source

pub fn periodic_update(&self)

Periodic update (call from timer).

Source

pub fn quality_metrics(&self) -> QualityMetrics

Get quality metrics.

Source

pub fn connection_params(&self) -> ConnectionParams

Get comprehensive connection parameters for throughput optimization. This provides all metrics needed to make intelligent routing decisions.

Source

pub fn send_bandwidth(&self) -> Bandwidth

Get send bandwidth.

Source

pub fn recv_bandwidth(&self) -> Bandwidth

Get receive bandwidth.

Source

pub fn rtt_variance(&self) -> Duration

Get RTT variance (jitter).

Source

pub fn is_natted(&self) -> bool

Check if this uplink is behind NAT.

Source

pub fn nat_type(&self) -> NatType

Get the NAT type detected on this uplink.

Source

pub fn external_addr(&self) -> Option<SocketAddr>

Get the external address (after NAT translation).

Source

pub fn nat_detection_state(&self) -> NatDetectionState

Get NAT detection state for advanced operations.

Source

pub fn update_nat_state<F, R>(&self, f: F) -> R
where F: FnOnce(&mut UplinkNatState) -> R,

Update NAT state with access to mutable reference.

Source

pub fn reset_nat_state(&self)

Reset NAT detection state.

Trait Implementations§

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,