pub struct Agent { /* private fields */ }Expand description
An ICE agent as specified in RFC 8445
Implementations§
Source§impl Agent
impl Agent
Sourcepub fn builder() -> AgentBuilder
pub fn builder() -> AgentBuilder
Create a new AgentBuilder
Sourcepub fn timing_advance(&self) -> Duration
pub fn timing_advance(&self) -> Duration
The minimum amount of time between subsequent STUN requests sent.
This is known as the Ta value in the ICE specification.
The default value is 50ms.
Sourcepub fn set_timing_advance(&mut self, ta: Duration)
pub fn set_timing_advance(&mut self, ta: Duration)
Set the minimum amount of time between subsequent STUN requests sent.
This is known as the Ta value in the ICE specification.
The default value is 50ms.
Sourcepub fn set_request_retransmits(
&mut self,
initial: Duration,
max: Duration,
retransmits: u32,
final_retransmit_timeout: Duration,
)
pub fn set_request_retransmits( &mut self, initial: Duration, max: Duration, retransmits: u32, final_retransmit_timeout: Duration, )
Configure the default timeouts and retransmissions for each STUN request.
initial- the initial time between consecutive transmissions. If 0, or 1, then only a single request will be performed.max- the maximum amount of time between consecutive retransmits.retransmits- the total number of transmissions of the request.final_retransmit_timeout- the amount of time after the final transmission to wait for a response before considering the request as having timed out.
As specified in RFC 8489, initial_rto should be >= 500ms (unless specific information is
available on the RTT, max is Duration::MAX, retransmits has a default value of 7,
and last_retransmit_timeout should be 16 * initial_rto.
STUN transactions over TCP will only send a single request and have a timeout of the sum of the timeouts of a UDP transaction.
Sourcepub fn add_stream(&mut self) -> usize
pub fn add_stream(&mut self) -> usize
Add a new Stream to this agent
§Examples
Add a Stream
let mut agent = Agent::default();
let s = agent.add_stream();Sourcepub fn close(&mut self, now: Instant)
pub fn close(&mut self, now: Instant)
Close the agent loop. Applications should wait for Agent::poll to return
AgentPoll::Closed after calling this function.
Sourcepub fn controlling(&self) -> bool
pub fn controlling(&self) -> bool
The controlling state of this ICE agent. This value may change throughout the ICE negotiation process.
Sourcepub fn add_stun_server(&mut self, transport: TransportType, addr: SocketAddr)
pub fn add_stun_server(&mut self, transport: TransportType, addr: SocketAddr)
Add a STUN server by address and transport to use for gathering potential candidates
Sourcepub fn stun_servers(&self) -> &[(TransportType, SocketAddr)]
pub fn stun_servers(&self) -> &[(TransportType, SocketAddr)]
The current list of STUN servers used by this Agent
Sourcepub fn add_turn_server(&mut self, config: TurnConfig)
pub fn add_turn_server(&mut self, config: TurnConfig)
Add a TURN server by address, transport, and credentials to use for gathering potential candidates.
Sourcepub fn turn_servers(&self) -> &[TurnConfig]
pub fn turn_servers(&self) -> &[TurnConfig]
The current list of TURN servers used by this Agent
Sourcepub fn stream(&self, id: usize) -> Option<Stream<'_>>
pub fn stream(&self, id: usize) -> Option<Stream<'_>>
Get a Stream by id.
If the stream does not exist, then None will be returned.
Sourcepub fn mut_stream(&mut self, id: usize) -> Option<StreamMut<'_>>
pub fn mut_stream(&mut self, id: usize) -> Option<StreamMut<'_>>
Get a StreamMut by id. If the stream does not exist, then None will be returned.
Sourcepub fn poll(&mut self, now: Instant) -> AgentPoll
pub fn poll(&mut self, now: Instant) -> AgentPoll
Poll the Agent for further progress to be made. The returned value indicates what the
application needs to do.
Sourcepub fn poll_transmit(&mut self, now: Instant) -> Option<AgentTransmit>
pub fn poll_transmit(&mut self, now: Instant) -> Option<AgentTransmit>
Poll for a transmission to be performed.
If not-None, then the provided data must be sent to the peer from the provided socket address.