Function librice::gathering::iface_udp_sockets
source · pub fn iface_udp_sockets(
) -> Result<impl Stream<Item = Result<UdpSocketChannel, Error>>, StunError>
Examples found in repository?
src/component.rs (line 128)
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
pub(crate) async fn gather_stream(
&self,
local_credentials: MessageIntegrityCredentials,
remote_credentials: MessageIntegrityCredentials,
stun_servers: Vec<(TransportType, SocketAddr)>,
) -> Result<impl Stream<Item = (Candidate, StunAgent)>, AgentError> {
let schannels = crate::gathering::iface_udp_sockets()?
.filter_map(move |s| async move { s.ok() })
.collect::<Vec<_>>()
.await;
let agents: Vec<_> = schannels
.iter()
.map(|channel| {
let agent = StunAgent::new(StunChannel::UdpAny(channel.clone()));
agent.set_local_credentials(local_credentials.clone());
agent.set_remote_credentials(remote_credentials.clone());
agent
})
.collect();
info!("retreived sockets");
Ok(crate::gathering::gather_component(
self.id,
agents,
stun_servers,
))
}