Trait tx5::Config

source ·
pub trait Config: 'static + Send + Sync {
    // Required methods
    fn max_send_bytes(&self) -> u32;
    fn max_recv_bytes(&self) -> u32;
    fn max_conn_count(&self) -> u32;
    fn max_conn_init(&self) -> Duration;
    fn metrics(&self) -> &Registry;
    fn lair_client(&self) -> &LairClient;
    fn lair_tag(&self) -> &Arc<str>;
    fn on_new_sig(&self, sig_url: Tx5Url, seed: SigStateSeed);
    fn on_new_conn(&self, ice_servers: Arc<Value>, seed: ConnStateSeed);
    fn on_conn_preflight(
        &self,
        rem_url: Tx5Url
    ) -> BoxFut<'static, Result<Option<Bytes>>>;
    fn on_conn_validate(
        &self,
        rem_url: Tx5Url,
        preflight_data: Option<Bytes>
    ) -> BoxFut<'static, Result<()>>;
}
Expand description

Tx5 config trait.

Required Methods§

source

fn max_send_bytes(&self) -> u32

Get the max pending send byte count limit.

source

fn max_recv_bytes(&self) -> u32

Get the max queued recv byte count limit.

source

fn max_conn_count(&self) -> u32

Get the max concurrent connection limit.

source

fn max_conn_init(&self) -> Duration

Get the max init (connect) time for a connection.

source

fn metrics(&self) -> &Registry

Request the prometheus registry used by this config.

source

fn lair_client(&self) -> &LairClient

Request the lair client associated with this config.

source

fn lair_tag(&self) -> &Arc<str>

Request the lair tag associated with this config.

source

fn on_new_sig(&self, sig_url: Tx5Url, seed: SigStateSeed)

A request to open a new signal server connection.

source

fn on_new_conn(&self, ice_servers: Arc<Value>, seed: ConnStateSeed)

A request to open a new peer connection.

source

fn on_conn_preflight( &self, rem_url: Tx5Url ) -> BoxFut<'static, Result<Option<Bytes>>>

Provide a chance to send preflight handshake data to be received in the on_conn_validate hook on the remote side. You may also return any Err(_) to cancel the connection even before sending preflight data.

source

fn on_conn_validate( &self, rem_url: Tx5Url, preflight_data: Option<Bytes> ) -> BoxFut<'static, Result<()>>

Provide as async chance to validate/accept/reject a connection before any events related to that connection are published. This hook is triggered for both outgoing and incoming connections. Return Ok(()) to accept the connection, or any Err(_) to reject.

Trait Implementations§

source§

impl Debug for dyn Config + Send + Sync + 'static

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Implementors§