Trait trillium_proxy::Connector
[−]pub trait Connector: 'static + Clone + Send + Sync {
type Transport: 'static + AsyncRead + AsyncWrite + Unpin + Send + Sync;
type Config: Debug + Default + Send + Sync + Clone;
fn peer_addr(transport: &Self::Transport) -> Result<SocketAddr, Error>;
fn connect<'life0, 'life1, 'async_trait>(
url: &'life0 Url,
config: &'life1 Self::Config
) -> Pin<Box<dyn Future<Output = Result<Self::Transport, Error>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn spawn<Fut>(future: Fut)
where
Fut: 'static + Future + Send,
<Fut as Future>::Output: Send;
}
Expand description
Interface for runtime and tls adapters for the trillium client
See
trillium_client
for more
information on usage.
Required Associated Types
Required Methods
fn peer_addr(transport: &Self::Transport) -> Result<SocketAddr, Error>
fn peer_addr(transport: &Self::Transport) -> Result<SocketAddr, Error>
A SocketAddr representation of the other side of this connection
fn connect<'life0, 'life1, 'async_trait>(
url: &'life0 Url,
config: &'life1 Self::Config
) -> Pin<Box<dyn Future<Output = Result<Self::Transport, Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn connect<'life0, 'life1, 'async_trait>(
url: &'life0 Url,
config: &'life1 Self::Config
) -> Pin<Box<dyn Future<Output = Result<Self::Transport, Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Initiate a connection to the provided url, using the configuration.
Async trait signature:
ⓘ
async fn connect(url: &Url, config: &Self::Config) -> std::io::Result<Self::Transport>;
fn spawn<Fut>(future: Fut)where
Fut: 'static + Future + Send,
<Fut as Future>::Output: Send,
fn spawn<Fut>(future: Fut)where
Fut: 'static + Future + Send,
<Fut as Future>::Output: Send,
Spawn and detach a task on the runtime. Although this may seem unrelated to the purpose of a tcp connector, it is required as a workaround for the absence of async drop in order to enable keepalive connection pooling. TLS implementations that wrap a runtime implementation should call through to the inner spawn.