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(
&self,
initial: Duration,
max: Duration,
retransmits: u32,
final_retransmit_timeout: Duration,
)
pub fn set_request_retransmits( &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(&self) -> Stream
pub fn add_stream(&self) -> Stream
Add a new Stream to this agent
§Examples
Add a Stream
let agent = Agent::default();
let s = agent.add_stream();Sourcepub fn close(&self, now: Instant)
pub fn close(&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(&self, transport: TransportType, addr: Address)
pub fn add_stun_server(&self, transport: TransportType, addr: Address)
Add a STUN server by address and transport to use for gathering potential candidates
Sourcepub fn poll(&self, now: Instant) -> AgentPoll
pub fn poll(&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(&self, now: Instant) -> Option<AgentTransmit>
pub fn poll_transmit(&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.