pub struct TransportParameters { /* private fields */ }
Expand description
Transport parameters used to negotiate connection-level preferences between peers
Implementations§
Source§impl TransportParameters
impl TransportParameters
Sourcepub fn nat_traversal_config(&self) -> Option<&NatTraversalConfig>
pub fn nat_traversal_config(&self) -> Option<&NatTraversalConfig>
Get the NAT traversal configuration for this connection
This is a public accessor method for tests and external code that need to examine the negotiated NAT traversal parameters.
Sourcepub fn supports_rfc_nat_traversal(&self) -> bool
pub fn supports_rfc_nat_traversal(&self) -> bool
Check if RFC-compliant NAT traversal frames are supported
Returns true if both endpoints support RFC NAT traversal
Sourcepub fn pqc_algorithms(&self) -> Option<&PqcAlgorithms>
pub fn pqc_algorithms(&self) -> Option<&PqcAlgorithms>
Get the PQC algorithms configuration for this connection
This is a public accessor method for tests and external code that need to examine the negotiated PQC algorithm support.
Source§impl TransportParameters
impl TransportParameters
Sourcepub fn read<R: Buf>(side: Side, r: &mut R) -> Result<Self, Error>
pub fn read<R: Buf>(side: Side, r: &mut R) -> Result<Self, Error>
Decode TransportParameters
from buffer
Sourcepub fn negotiated_nat_concurrency_limit(
&self,
local_config: &NatTraversalConfig,
) -> Option<u64>
pub fn negotiated_nat_concurrency_limit( &self, local_config: &NatTraversalConfig, ) -> Option<u64>
Negotiate effective NAT traversal concurrency limit for this connection
Returns the effective concurrency limit based on local and remote NAT traversal
configurations. For P2P connections where both peers have ServerSupport
,
returns the minimum of the two limits. For traditional client/server, returns
the server’s limit. Returns None
if NAT traversal is not configured.
§Examples
use ant_quic::VarInt;
use ant_quic::TransportParameters;
use ant_quic::NatTraversalConfig;
// P2P: Both peers have ServerSupport - use minimum
let local = NatTraversalConfig::ServerSupport {
concurrency_limit: VarInt::from_u32(10),
};
let mut remote_params = TransportParameters::default();
remote_params.nat_traversal = Some(NatTraversalConfig::ServerSupport {
concurrency_limit: VarInt::from_u32(5),
});
assert_eq!(remote_params.negotiated_nat_concurrency_limit(&local), Some(5));
Sourcepub fn supports_bidirectional_nat_traversal(&self) -> bool
pub fn supports_bidirectional_nat_traversal(&self) -> bool
Check if this connection supports bidirectional NAT traversal (P2P)
Returns true
if the remote peer sent ServerSupport
, indicating they
can accept NAT traversal path validation requests. This is used to detect
P2P connections where both peers have equal capabilities.
§Examples
use ant_quic::VarInt;
use ant_quic::TransportParameters;
use ant_quic::NatTraversalConfig;
let mut params = TransportParameters::default();
params.nat_traversal = Some(NatTraversalConfig::ServerSupport {
concurrency_limit: VarInt::from_u32(5),
});
assert!(params.supports_bidirectional_nat_traversal());
let mut client_params = TransportParameters::default();
client_params.nat_traversal = Some(NatTraversalConfig::ClientSupport);
assert!(!client_params.supports_bidirectional_nat_traversal());
Trait Implementations§
Source§impl Clone for TransportParameters
impl Clone for TransportParameters
Source§fn clone(&self) -> TransportParameters
fn clone(&self) -> TransportParameters
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for TransportParameters
impl Debug for TransportParameters
Source§impl PartialEq for TransportParameters
impl PartialEq for TransportParameters
impl Eq for TransportParameters
impl StructuralPartialEq for TransportParameters
Auto Trait Implementations§
impl Freeze for TransportParameters
impl RefUnwindSafe for TransportParameters
impl Send for TransportParameters
impl Sync for TransportParameters
impl Unpin for TransportParameters
impl UnwindSafe for TransportParameters
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.