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§
sourcefn max_send_bytes(&self) -> u32
fn max_send_bytes(&self) -> u32
Get the max pending send byte count limit.
sourcefn max_recv_bytes(&self) -> u32
fn max_recv_bytes(&self) -> u32
Get the max queued recv byte count limit.
sourcefn max_conn_count(&self) -> u32
fn max_conn_count(&self) -> u32
Get the max concurrent connection limit.
sourcefn max_conn_init(&self) -> Duration
fn max_conn_init(&self) -> Duration
Get the max init (connect) time for a connection.
sourcefn lair_client(&self) -> &LairClient
fn lair_client(&self) -> &LairClient
Request the lair client associated with this config.
sourcefn on_new_sig(&self, sig_url: Tx5Url, seed: SigStateSeed)
fn on_new_sig(&self, sig_url: Tx5Url, seed: SigStateSeed)
A request to open a new signal server connection.
sourcefn on_new_conn(&self, ice_servers: Arc<Value>, seed: ConnStateSeed)
fn on_new_conn(&self, ice_servers: Arc<Value>, seed: ConnStateSeed)
A request to open a new peer connection.
sourcefn on_conn_preflight(
&self,
rem_url: Tx5Url
) -> BoxFut<'static, Result<Option<Bytes>>>
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.
sourcefn on_conn_validate(
&self,
rem_url: Tx5Url,
preflight_data: Option<Bytes>
) -> BoxFut<'static, Result<()>>
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.