pub struct Component { /* private fields */ }Implementations§
Source§impl Component
impl Component
Sourcepub fn state(&self) -> ComponentConnectionState
pub fn state(&self) -> ComponentConnectionState
Retrieve the current state of a Component
Sourcepub fn selected_pair(&self) -> Option<CandidatePair>
pub fn selected_pair(&self) -> Option<CandidatePair>
The CandidatePair this component has selected to send/receive data with. This will not
be valid until the Component has reached ComponentConnectionState::Connected
Sourcepub fn gather_candidates<'a, 'b>(
&self,
sockets: impl IntoIterator<Item = (TransportType, &'a Address)>,
turn_servers: impl IntoIterator<Item = (&'b Address, TurnConfig)>,
) -> Result<(), AgentError>
pub fn gather_candidates<'a, 'b>( &self, sockets: impl IntoIterator<Item = (TransportType, &'a Address)>, turn_servers: impl IntoIterator<Item = (&'b Address, TurnConfig)>, ) -> Result<(), AgentError>
Start gathering candidates for this component. The parent
Agent::poll is used to progress
the gathering.
Candidates will be generated as follows (if they succeed):
- A host candidate for each
sockets[i]. If TCP, then both an active and passive host candidate will be generated. - For each configured STUN server a reflexive candidate if different from any
other candidate produced. The local address for each STUN server connection will be one
of the entries provided in
sockets. - For each
turn_servers[i]a TURN allocation will be attempted and a relayed candidate produced on success. If you would like multiple options for relayed candidates, e.g. UDP, TCP, TCP/TLS, then provide each options as different entries in the provided Iterator. TheAddressfor each TURN server is the local address to communicate with the TURN server and should be different than any value provided throughsockets.
Sourcepub fn set_selected_pair(&self, pair: CandidatePair) -> Result<(), AgentError>
pub fn set_selected_pair(&self, pair: CandidatePair) -> Result<(), AgentError>
Set the pair that will be used to send/receive data. This will override the ICE negotiation chosen value.
Sourcepub fn send(
&self,
data: &[u8],
now: Instant,
) -> Result<AgentTransmit, AgentError>
pub fn send( &self, data: &[u8], now: Instant, ) -> Result<AgentTransmit, AgentError>
Send data to the peer using the selected pair. This will not succeed until the
Component has reached ComponentConnectionState::Connected
Trait Implementations§
impl Send for Component
impl Sync for Component
Auto Trait Implementations§
impl Freeze for Component
impl RefUnwindSafe for Component
impl Unpin for Component
impl UnsafeUnpin for Component
impl UnwindSafe for Component
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