Skip to main content

WebRtcCarrier

Trait WebRtcCarrier 

Source
pub trait WebRtcCarrier: Send + Sync {
    // Required method
    fn stun_servers<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Vec<SocketAddr>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn now(&self) -> Instant { ... }
    fn bind_addr(&self) -> Option<SocketAddr> { ... }
    fn port_mapper(&self) -> Arc<dyn SessionPortMapper> ⓘ { ... }
    fn mapping_description(&self) -> &str { ... }
    fn bind_session<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _identity: &'life1 OpenOk,
        _peer: [u8; 32],
        _handle: &'life2 WebRtcHandle,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

What a carrier must supply to run the shared WebRTC answerer.

Wire protocol, str0m session, DataChannel framing, and HTTP/WS tunnels are shared. Only ICE environment and session bookkeeping stay carrier-owned.

Required Methods§

Source

fn stun_servers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Vec<SocketAddr>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

STUN server addresses used while gathering (no TURN).

Provided Methods§

Source

fn now(&self) -> Instant

Instant used for str0m and ICE timers.

Source

fn bind_addr(&self) -> Option<SocketAddr>

Optional forced bind for the answerer’s ICE UDP sockets.

Source

fn port_mapper(&self) -> Arc<dyn SessionPortMapper> ⓘ

IPv4 session-port mapper (UPnP / carrier portmap). Default: unavailable.

Source

fn mapping_description(&self) -> &str

Description string passed to SessionPortMapper::map.

Source

fn bind_session<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _identity: &'life1 OpenOk, _peer: [u8; 32], _handle: &'life2 WebRtcHandle, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Called after the handle is created and before the answerer runs.

Carriers bind the handle into a session registry (revocation / replace). Return false to abort without answering.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§