-
Notifications
You must be signed in to change notification settings - Fork 84
Closed
Description
I am trying to connect MbedTls to the ureq's newest TLSConnector.
My WIP (does not compile) is at:
https://github.com/AnimaGUS-minerva/ureq/tree/mbedtls-2/examples/mbedtls-req
I pass the desired tcp_stream into establish(), and return a Box that has the dyn ReadWrite trait:
impl TlsConnector for MbedTlsConnector {
fn connect(
&self,
dns_name: &str,
tcp_stream: TcpStream,
) -> Result<Box<dyn ReadWrite>, Error> {
let ctx = self.context.lock().unwrap();
match ctx.establish(tcp_stream, None) {
I need to implement a socket routine for this, returning the same tcp_stream as before, but the obvious method of calling context.io() isn't going to work, because it return dyn Any, and I think that I need a dyn ReadWrite.
impl ReadWrite for MbedTlsConnector {
fn socket(&self) -> Option<&TcpStream> {
let ctx = self.context.lock().unwrap();
Some(&(ctx.io() as TcpStream))
}
}
Looking for advice here. Maybe the wrapper establish()/io() should change?
Or what?
Metadata
Metadata
Assignees
Labels
No labels