pub trait AsyncProxy {
type OutputStream: AsyncRead + AsyncWrite;
type ErrorKind;
type ConnParams;
// Required methods
fn connect<'life0, 'async_trait>(
&'life0 mut self,
params: Self::ConnParams,
) -> Pin<Box<dyn Future<Output = Result<Self::OutputStream, Self::ErrorKind>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn write_buffer<'life0, 'life1, 'async_trait>(
&'life0 mut self,
buffer: &'life1 [u8],
stream: Self::OutputStream,
) -> Pin<Box<dyn Future<Output = Result<Self::OutputStream, Self::ErrorKind>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn read_buffer<'life0, 'life1, 'async_trait>(
&'life0 mut self,
buffer: &'life1 mut [u8],
stream: Self::OutputStream,
) -> Pin<Box<dyn Future<Output = Result<Self::OutputStream, Self::ErrorKind>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn drop_stream<'life0, 'async_trait>(
&'life0 mut self,
stream: Self::OutputStream,
) -> Pin<Box<dyn Future<Output = Result<(), Self::ErrorKind>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
This trait comes as an abstraction over proxy protocols. Each protocol serves own methods to establish connection between a proxy, you, and the destanation service. The same applies to I/O and closing the established connection
Required Associated Types§
Required Methods§
Sourcefn connect<'life0, 'async_trait>(
&'life0 mut self,
params: Self::ConnParams,
) -> Pin<Box<dyn Future<Output = Result<Self::OutputStream, Self::ErrorKind>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect<'life0, 'async_trait>(
&'life0 mut self,
params: Self::ConnParams,
) -> Pin<Box<dyn Future<Output = Result<Self::OutputStream, Self::ErrorKind>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Connects to the destanation through proxy
Sourcefn write_buffer<'life0, 'life1, 'async_trait>(
&'life0 mut self,
buffer: &'life1 [u8],
stream: Self::OutputStream,
) -> Pin<Box<dyn Future<Output = Result<Self::OutputStream, Self::ErrorKind>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write_buffer<'life0, 'life1, 'async_trait>(
&'life0 mut self,
buffer: &'life1 [u8],
stream: Self::OutputStream,
) -> Pin<Box<dyn Future<Output = Result<Self::OutputStream, Self::ErrorKind>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Writes the buffer to the destanation
Sourcefn read_buffer<'life0, 'life1, 'async_trait>(
&'life0 mut self,
buffer: &'life1 mut [u8],
stream: Self::OutputStream,
) -> Pin<Box<dyn Future<Output = Result<Self::OutputStream, Self::ErrorKind>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_buffer<'life0, 'life1, 'async_trait>(
&'life0 mut self,
buffer: &'life1 mut [u8],
stream: Self::OutputStream,
) -> Pin<Box<dyn Future<Output = Result<Self::OutputStream, Self::ErrorKind>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reads buffer from the destanation
Sourcefn drop_stream<'life0, 'async_trait>(
&'life0 mut self,
stream: Self::OutputStream,
) -> Pin<Box<dyn Future<Output = Result<(), Self::ErrorKind>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn drop_stream<'life0, 'async_trait>(
&'life0 mut self,
stream: Self::OutputStream,
) -> Pin<Box<dyn Future<Output = Result<(), Self::ErrorKind>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Drops the proxy stream