pub struct RemoteAddrDemux {
remote_addr_index: HashMap<SocketAddr, TransportSessionKey>,
remote_addrs_by_session: BTreeMap<TransportSessionKey, Vec<SocketAddr>>,
local_ice_ufrag_index: HashMap<String, TransportSessionKey>,
local_ice_ufrag_by_session: BTreeMap<TransportSessionKey, String>,
remote_candidate_addr_index: HashMap<SocketAddr, Vec<TransportSessionKey>>,
remote_candidate_addrs_by_session: BTreeMap<TransportSessionKey, Vec<SocketAddr>>,
}Expand description
Bidirectional demux indexes for worker-local UDP ingress recovery.
Fields§
§remote_addr_index: HashMap<SocketAddr, TransportSessionKey>learned UDP source tuple to session pin
remote_addrs_by_session: BTreeMap<TransportSessionKey, Vec<SocketAddr>>reverse lookup for learned UDP source tuple cleanup
local_ice_ufrag_index: HashMap<String, TransportSessionKey>local ICE ufrag to session recovery hint
local_ice_ufrag_by_session: BTreeMap<TransportSessionKey, String>reverse lookup for replacing or removing a session local ICE ufrag
remote_candidate_addr_index: HashMap<SocketAddr, Vec<TransportSessionKey>>signaled remote candidate address to possible sessions
remote_candidate_addrs_by_session: BTreeMap<TransportSessionKey, Vec<SocketAddr>>reverse lookup for candidate hint cleanup after renegotiation or teardown
Implementations§
Source§impl RemoteAddrDemux
impl RemoteAddrDemux
Sourcepub fn session_key_for_remote_addr(
&self,
source_addr: SocketAddr,
) -> Option<&TransportSessionKey>
pub fn session_key_for_remote_addr( &self, source_addr: SocketAddr, ) -> Option<&TransportSessionKey>
returns the session currently pinned to a UDP source tuple
this is a hot-path hint for cached ingress routing
callers must still re-check the packet with Rtc::accepts() before
feeding it into a session because ICE state can move after the pin was
learned
Sourcepub fn remember_remote_addr(
&mut self,
source_addr: SocketAddr,
session_key: &TransportSessionKey,
) -> bool
pub fn remember_remote_addr( &mut self, source_addr: SocketAddr, session_key: &TransportSessionKey, ) -> bool
pins a UDP source tuple to the session that just accepted traffic
returns true when the visible mapping changed
remapping a tuple also removes it from the previous session reverse
index so session teardown can later clean every learned tuple with one
key
Sourcepub(super) fn session_for_local_ufrag(
&self,
local_ice_ufrag: &str,
) -> Option<&TransportSessionKey>
pub(super) fn session_for_local_ufrag( &self, local_ice_ufrag: &str, ) -> Option<&TransportSessionKey>
returns the session advertised by a local ICE ufrag
this index is used to narrow STUN recovery when the USERNAME attribute
names the local fragment
the returned session is still only a candidate for Rtc::accepts()
Sourcepub(super) fn remember_local_ice_ufrag(
&mut self,
local_ice_ufrag: &str,
session_key: &TransportSessionKey,
) -> bool
pub(super) fn remember_local_ice_ufrag( &mut self, local_ice_ufrag: &str, session_key: &TransportSessionKey, ) -> bool
replaces the local ICE ufrag registered for a session
each session owns at most one local ufrag
each local ufrag maps to at most one session
returning false means the existing mapping already expressed that
contract
Sourcepub fn candidates_for_src_addr(
&self,
source_addr: SocketAddr,
) -> Option<&[TransportSessionKey]>
pub fn candidates_for_src_addr( &self, source_addr: SocketAddr, ) -> Option<&[TransportSessionKey]>
Returns sessions whose signaled candidates match the observed source.
Candidate addresses are weaker than learned source pins because every
session advertising the address remains a candidate. Rtc::accepts()
remains the ownership authority.
Sourcepub fn replace_remote_candidates<I>(
&mut self,
session_key: &TransportSessionKey,
candidate_addrs: I,
)where
I: IntoIterator<Item = SocketAddr>,
pub fn replace_remote_candidates<I>(
&mut self,
session_key: &TransportSessionKey,
candidate_addrs: I,
)where
I: IntoIterator<Item = SocketAddr>,
replaces all signaled remote candidate addresses for one session
this is called after answer application when str0m has updated the candidate set old hints are removed first so recovery cannot keep probing a session through candidates that no longer belong to it
Sourcepub(super) fn forget_remote_addr(&mut self, source_addr: SocketAddr)
pub(super) fn forget_remote_addr(&mut self, source_addr: SocketAddr)
removes one learned UDP source tuple pin after cached Rtc::accepts() rejection
Sourcepub(super) fn forget_user_remote_addrs(
&mut self,
session_key: &TransportSessionKey,
)
pub(super) fn forget_user_remote_addrs( &mut self, session_key: &TransportSessionKey, )
removes every learned UDP source tuple when its session is removed
Sourcepub(super) fn forget_user_local_ice_ufrag(
&mut self,
session_key: &TransportSessionKey,
)
pub(super) fn forget_user_local_ice_ufrag( &mut self, session_key: &TransportSessionKey, )
removes the local ICE ufrag recovery hint for a session
Sourcepub(super) fn forget_user_remote_candidates(
&mut self,
session_key: &TransportSessionKey,
)
pub(super) fn forget_user_remote_candidates( &mut self, session_key: &TransportSessionKey, )
removes all remote candidate recovery hints owned by a session
candidate address indexes can contain several sessions for one address cleanup removes only the target session from each fanout list and drops empty address entries afterward
fn remove_remote_addr( &mut self, session_key: &TransportSessionKey, source_addr: SocketAddr, )
Trait Implementations§
Source§impl Debug for RemoteAddrDemux
impl Debug for RemoteAddrDemux
Source§impl Default for RemoteAddrDemux
impl Default for RemoteAddrDemux
Source§fn default() -> RemoteAddrDemux
fn default() -> RemoteAddrDemux
Auto Trait Implementations§
impl Freeze for RemoteAddrDemux
impl RefUnwindSafe for RemoteAddrDemux
impl Send for RemoteAddrDemux
impl Sync for RemoteAddrDemux
impl Unpin for RemoteAddrDemux
impl UnsafeUnpin for RemoteAddrDemux
impl UnwindSafe for RemoteAddrDemux
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more