diff --git a/rama-haproxy/src/client/layer.rs b/rama-haproxy/src/client/layer.rs index d0d44410..727f2fd5 100644 --- a/rama-haproxy/src/client/layer.rs +++ b/rama-haproxy/src/client/layer.rs @@ -8,7 +8,7 @@ use rama_core::{ use rama_net::{ client::{ConnectorService, EstablishedClientConnection}, forwarded::Forwarded, - stream::{SocketInfo, Stream}, + stream::{Socket, SocketInfo, Stream}, }; use tokio::io::AsyncWriteExt; @@ -208,7 +208,7 @@ impl Clone for HaProxyService { impl Service for HaProxyService where - S: ConnectorService>, + S: ConnectorService>, P: Send + 'static, State: Clone + Send + Sync + 'static, Request: Send + 'static, @@ -221,12 +221,8 @@ where ctx: Context, req: Request, ) -> Result { - let EstablishedClientConnection { - ctx, - req, - mut conn, - addr, - } = self.inner.connect(ctx, req).await.map_err(Into::into)?; + let EstablishedClientConnection { ctx, req, mut conn } = + self.inner.connect(ctx, req).await.map_err(Into::into)?; let src = ctx .get::() @@ -236,12 +232,13 @@ where OpaqueError::from_display("PROXY client (v1): missing src socket address") })?; - let addresses = match (src.ip(), addr.ip()) { + let peer_addr = conn.peer_addr()?; + let addresses = match (src.ip(), peer_addr.ip()) { (IpAddr::V4(src_ip), IpAddr::V4(dst_ip)) => { - v1::Addresses::new_tcp4(src_ip, dst_ip, src.port(), addr.port()) + v1::Addresses::new_tcp4(src_ip, dst_ip, src.port(), peer_addr.port()) } (IpAddr::V6(src_ip), IpAddr::V6(dst_ip)) => { - v1::Addresses::new_tcp6(src_ip, dst_ip, src.port(), addr.port()) + v1::Addresses::new_tcp6(src_ip, dst_ip, src.port(), peer_addr.port()) } (_, _) => { return Err(OpaqueError::from_display( @@ -255,12 +252,7 @@ where .await .context("PROXY client (v1): write addresses")?; - Ok(EstablishedClientConnection { - ctx, - req, - conn, - addr, - }) + Ok(EstablishedClientConnection { ctx, req, conn }) } } @@ -275,7 +267,7 @@ where P: protocol::Protocol + Send + 'static, State: Clone + Send + Sync + 'static, Request: Send + 'static, - T: Stream + Unpin, + T: Stream + Socket + Unpin, { type Response = EstablishedClientConnection; type Error = BoxError; @@ -285,12 +277,8 @@ where ctx: Context, req: Request, ) -> Result { - let EstablishedClientConnection { - ctx, - req, - mut conn, - addr, - } = self.inner.serve(ctx, req).await.map_err(Into::into)?; + let EstablishedClientConnection { ctx, req, mut conn } = + self.inner.serve(ctx, req).await.map_err(Into::into)?; let src = ctx .get::() @@ -300,16 +288,17 @@ where OpaqueError::from_display("PROXY client (v2): missing src socket address") })?; - let builder = match (src.ip(), addr.ip()) { + let peer_addr = conn.peer_addr()?; + let builder = match (src.ip(), peer_addr.ip()) { (IpAddr::V4(src_ip), IpAddr::V4(dst_ip)) => v2::Builder::with_addresses( v2::Version::Two | v2::Command::Proxy, P::v2_protocol(), - v2::IPv4::new(src_ip, dst_ip, src.port(), addr.port()), + v2::IPv4::new(src_ip, dst_ip, src.port(), peer_addr.port()), ), (IpAddr::V6(src_ip), IpAddr::V6(dst_ip)) => v2::Builder::with_addresses( v2::Version::Two | v2::Command::Proxy, P::v2_protocol(), - v2::IPv6::new(src_ip, dst_ip, src.port(), addr.port()), + v2::IPv6::new(src_ip, dst_ip, src.port(), peer_addr.port()), ), (_, _) => { return Err(OpaqueError::from_display( @@ -334,12 +323,7 @@ where .await .context("PROXY client (v2): write header")?; - Ok(EstablishedClientConnection { - ctx, - req, - conn, - addr, - }) + Ok(EstablishedClientConnection { ctx, req, conn }) } } @@ -402,8 +386,58 @@ mod tests { use super::*; use rama_core::{Layer, service::service_fn}; use rama_net::forwarded::{ForwardedElement, NodeId}; - use std::convert::Infallible; - use tokio_test::io::Builder; + use std::{convert::Infallible, net::SocketAddr, pin::Pin}; + use tokio::io::{AsyncRead, AsyncWrite}; + use tokio_test::io::{Builder, Mock}; + + struct SocketConnection { + conn: Mock, + socket: SocketAddr, + } + + impl Socket for SocketConnection { + fn local_addr(&self) -> std::io::Result { + Ok(self.socket) + } + + fn peer_addr(&self) -> std::io::Result { + Ok(self.socket) + } + } + + impl AsyncWrite for SocketConnection { + fn poll_write( + mut self: std::pin::Pin<&mut Self>, + cx: &mut std::task::Context<'_>, + buf: &[u8], + ) -> std::task::Poll> { + Pin::new(&mut self.conn).poll_write(cx, buf) + } + + fn poll_flush( + mut self: std::pin::Pin<&mut Self>, + cx: &mut std::task::Context<'_>, + ) -> std::task::Poll> { + Pin::new(&mut self.conn).poll_flush(cx) + } + + fn poll_shutdown( + mut self: std::pin::Pin<&mut Self>, + cx: &mut std::task::Context<'_>, + ) -> std::task::Poll> { + Pin::new(&mut self.conn).poll_shutdown(cx) + } + } + + impl AsyncRead for SocketConnection { + fn poll_read( + mut self: Pin<&mut Self>, + cx: &mut std::task::Context<'_>, + buf: &mut tokio::io::ReadBuf<'_>, + ) -> std::task::Poll> { + Pin::new(&mut self.conn).poll_read(cx, buf) + } + } #[tokio::test] async fn test_v1_tcp() { @@ -467,8 +501,10 @@ mod tests { Ok::<_, Infallible>(EstablishedClientConnection { ctx, req, - conn: Builder::new().write(expected_line.as_bytes()).build(), - addr: target_addr.parse().unwrap(), + conn: SocketConnection { + socket: target_addr.parse().unwrap(), + conn: Builder::new().write(expected_line.as_bytes()).build(), + }, }) })); svc.serve(input_ctx, ()).await.unwrap(); @@ -533,8 +569,10 @@ mod tests { Ok::<_, Infallible>(EstablishedClientConnection { ctx, req, - conn: Builder::new().build(), - addr: target_addr.parse().unwrap(), + conn: SocketConnection { + socket: target_addr.parse().unwrap(), + conn: Builder::new().build(), + }, }) })); assert!(svc.serve(input_ctx, ()).await.is_err()); @@ -556,8 +594,10 @@ mod tests { Ok::<_, Infallible>(EstablishedClientConnection { ctx, req, - conn: Builder::new().build(), - addr: target_addr.parse().unwrap(), + conn: SocketConnection { + socket: target_addr.parse().unwrap(), + conn: Builder::new().build(), + }, }) })); assert!(svc.serve(input_ctx, ()).await.is_err()); @@ -591,14 +631,16 @@ mod tests { Ok::<_, Infallible>(EstablishedClientConnection { ctx, req, - conn: Builder::new() - .write(&[ - b'\r', b'\n', b'\r', b'\n', b'\0', b'\r', b'\n', b'Q', b'U', b'I', - b'T', b'\n', 0x21, 0x11, 0, 13, 127, 0, 0, 1, 192, 168, 1, 1, 0, - 80, 1, 187, 42, - ]) - .build(), - addr: "192.168.1.1:443".parse().unwrap(), + conn: SocketConnection { + socket: "192.168.1.1:443".parse().unwrap(), + conn: Builder::new() + .write(&[ + b'\r', b'\n', b'\r', b'\n', b'\0', b'\r', b'\n', b'Q', b'U', + b'I', b'T', b'\n', 0x21, 0x11, 0, 13, 127, 0, 0, 1, 192, 168, + 1, 1, 0, 80, 1, 187, 42, + ]) + .build(), + }, }) }, )); @@ -633,14 +675,16 @@ mod tests { Ok::<_, Infallible>(EstablishedClientConnection { ctx, req, - conn: Builder::new() - .write(&[ - b'\r', b'\n', b'\r', b'\n', b'\0', b'\r', b'\n', b'Q', b'U', b'I', - b'T', b'\n', 0x21, 0x12, 0, 13, 127, 0, 0, 1, 192, 168, 1, 1, 0, - 80, 1, 187, 42, - ]) - .build(), - addr: "192.168.1.1:443".parse().unwrap(), + conn: SocketConnection { + socket: "192.168.1.1:443".parse().unwrap(), + conn: Builder::new() + .write(&[ + b'\r', b'\n', b'\r', b'\n', b'\0', b'\r', b'\n', b'Q', b'U', + b'I', b'T', b'\n', 0x21, 0x12, 0, 13, 127, 0, 0, 1, 192, 168, + 1, 1, 0, 80, 1, 187, 42, + ]) + .build(), + }, }) }, )); @@ -675,18 +719,21 @@ mod tests { Ok::<_, Infallible>(EstablishedClientConnection { ctx, req, - conn: Builder::new() - .write(&[ - b'\r', b'\n', b'\r', b'\n', b'\0', b'\r', b'\n', b'Q', b'U', b'I', - b'T', b'\n', 0x21, 0x21, 0, 37, 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, - 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x09, 0x87, 0x65, 0x43, 0x21, 0x43, - 0x21, 0x87, 0x65, 0xba, 0x09, 0xfe, 0xdc, 0xcd, 0xef, 0x90, 0xab, - 0x56, 0x78, 0x12, 0x34, 0, 80, 1, 187, 42, - ]) - .build(), - addr: "[4321:8765:ba09:fedc:cdef:90ab:5678:1234]:443" - .parse() - .unwrap(), + conn: SocketConnection { + socket: "[4321:8765:ba09:fedc:cdef:90ab:5678:1234]:443" + .parse() + .unwrap(), + conn: Builder::new() + .write(&[ + b'\r', b'\n', b'\r', b'\n', b'\0', b'\r', b'\n', b'Q', b'U', + b'I', b'T', b'\n', 0x21, 0x21, 0, 37, 0x12, 0x34, 0x56, 0x78, + 0x90, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x09, 0x87, 0x65, + 0x43, 0x21, 0x43, 0x21, 0x87, 0x65, 0xba, 0x09, 0xfe, 0xdc, + 0xcd, 0xef, 0x90, 0xab, 0x56, 0x78, 0x12, 0x34, 0, 80, 1, 187, + 42, + ]) + .build(), + }, }) }, )); @@ -721,18 +768,21 @@ mod tests { Ok::<_, Infallible>(EstablishedClientConnection { ctx, req, - conn: Builder::new() - .write(&[ - b'\r', b'\n', b'\r', b'\n', b'\0', b'\r', b'\n', b'Q', b'U', b'I', - b'T', b'\n', 0x21, 0x22, 0, 37, 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, - 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x09, 0x87, 0x65, 0x43, 0x21, 0x43, - 0x21, 0x87, 0x65, 0xba, 0x09, 0xfe, 0xdc, 0xcd, 0xef, 0x90, 0xab, - 0x56, 0x78, 0x12, 0x34, 0, 80, 1, 187, 42, - ]) - .build(), - addr: "[4321:8765:ba09:fedc:cdef:90ab:5678:1234]:443" - .parse() - .unwrap(), + conn: SocketConnection { + socket: "[4321:8765:ba09:fedc:cdef:90ab:5678:1234]:443" + .parse() + .unwrap(), + conn: Builder::new() + .write(&[ + b'\r', b'\n', b'\r', b'\n', b'\0', b'\r', b'\n', b'Q', b'U', + b'I', b'T', b'\n', 0x21, 0x22, 0, 37, 0x12, 0x34, 0x56, 0x78, + 0x90, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x09, 0x87, 0x65, + 0x43, 0x21, 0x43, 0x21, 0x87, 0x65, 0xba, 0x09, 0xfe, 0xdc, + 0xcd, 0xef, 0x90, 0xab, 0x56, 0x78, 0x12, 0x34, 0, 80, 1, 187, + 42, + ]) + .build(), + }, }) }, )); @@ -798,8 +848,10 @@ mod tests { Ok::<_, Infallible>(EstablishedClientConnection { ctx, req, - conn: Builder::new().build(), - addr: target_addr.parse().unwrap(), + conn: SocketConnection { + socket: target_addr.parse().unwrap(), + conn: Builder::new().build(), + }, }) })); assert!(svc.serve(input_ctx.clone(), ()).await.is_err()); @@ -810,8 +862,10 @@ mod tests { Ok::<_, Infallible>(EstablishedClientConnection { ctx, req, - conn: Builder::new().build(), - addr: target_addr.parse().unwrap(), + conn: SocketConnection { + socket: target_addr.parse().unwrap(), + conn: Builder::new().build(), + }, }) })); assert!(svc.serve(input_ctx, ()).await.is_err()); @@ -833,8 +887,10 @@ mod tests { Ok::<_, Infallible>(EstablishedClientConnection { ctx, req, - conn: Builder::new().build(), - addr: target_addr.parse().unwrap(), + conn: SocketConnection { + socket: target_addr.parse().unwrap(), + conn: Builder::new().build(), + }, }) })); assert!(svc.serve(input_ctx.clone(), ()).await.is_err()); @@ -845,8 +901,10 @@ mod tests { Ok::<_, Infallible>(EstablishedClientConnection { ctx, req, - conn: Builder::new().build(), - addr: target_addr.parse().unwrap(), + conn: SocketConnection { + socket: target_addr.parse().unwrap(), + conn: Builder::new().build(), + }, }) })); assert!(svc.serve(input_ctx.clone(), ()).await.is_err()); diff --git a/rama-http-backend/src/client/conn.rs b/rama-http-backend/src/client/conn.rs index 4fbb8102..55cd8131 100644 --- a/rama-http-backend/src/client/conn.rs +++ b/rama-http-backend/src/client/conn.rs @@ -70,7 +70,6 @@ where #[cfg(not(any(feature = "rustls", feature = "boring")))] req, conn, - addr, } = self.inner.connect(ctx, req).await.map_err(Into::into)?; #[cfg(any(feature = "rustls", feature = "boring"))] @@ -120,7 +119,6 @@ where ctx, req, conn: svc, - addr, }) } Version::HTTP_11 | Version::HTTP_10 | Version::HTTP_09 => { @@ -139,7 +137,6 @@ where ctx, req, conn: svc, - addr, }) } version => Err(OpaqueError::from_display(format!( diff --git a/rama-http-backend/src/client/mod.rs b/rama-http-backend/src/client/mod.rs index c26a77cb..40bcc37a 100644 --- a/rama-http-backend/src/client/mod.rs +++ b/rama-http-backend/src/client/mod.rs @@ -164,7 +164,7 @@ where // so that the other end can read it... This might however give issues in // case switching http versions requires more work than version. If so, // your first place will be to check here and/or in the [`HttpConnector`]. - let EstablishedClientConnection { ctx, req, conn, .. } = connector + let EstablishedClientConnection { ctx, req, conn } = connector .connect(ctx, req) .await .map_err(|err| OpaqueError::from_boxed(err).with_context(|| uri.to_string()))?; diff --git a/rama-http-backend/src/client/proxy/layer/proxy_connector/service.rs b/rama-http-backend/src/client/proxy/layer/proxy_connector/service.rs index 5319824b..fe5421ee 100644 --- a/rama-http-backend/src/client/proxy/layer/proxy_connector/service.rs +++ b/rama-http-backend/src/client/proxy/layer/proxy_connector/service.rs @@ -147,33 +147,21 @@ where tracing::trace!( "http proxy connector: no proxy required or set: proceed with direct connection" ); - let EstablishedClientConnection { - ctx, - req, - conn, - addr, - } = established_conn; + let EstablishedClientConnection { ctx, req, conn } = established_conn; return Ok(EstablishedClientConnection { ctx, req, conn: Either::A(conn), - addr, }); }; } }; // and do the handshake otherwise... - let EstablishedClientConnection { - ctx, - req, - conn, - addr, - } = established_conn; + let EstablishedClientConnection { ctx, req, conn } = established_conn; tracing::trace!( authority = %transport_ctx.authority, - proxy_addr = %addr, "http proxy connector: connected to proxy", ); @@ -190,7 +178,6 @@ where ctx, req, conn: Either::A(conn), - addr, }); } @@ -214,14 +201,12 @@ where tracing::trace!( authority = %transport_ctx.authority, - proxy_addr = %addr, "http proxy connector: connected to proxy: ready secure request", ); Ok(EstablishedClientConnection { ctx, req, conn: Either::B(conn), - addr, }) } } diff --git a/rama-net/src/client/conn.rs b/rama-net/src/client/conn.rs index ea83597a..867b2538 100644 --- a/rama-net/src/client/conn.rs +++ b/rama-net/src/client/conn.rs @@ -1,5 +1,5 @@ use rama_core::{Context, Service, error::BoxError}; -use std::{fmt, future::Future, net::SocketAddr}; +use std::{fmt, future::Future}; /// The established connection to a server returned for the http client to be used. pub struct EstablishedClientConnection { @@ -9,8 +9,6 @@ pub struct EstablishedClientConnection { pub req: Request, /// The established connection stream/service/... to the server. pub conn: S, - /// The target address connected to. - pub addr: SocketAddr, } impl fmt::Debug @@ -21,7 +19,6 @@ impl fmt::Debug .field("ctx", &self.ctx) .field("req", &self.req) .field("conn", &self.conn) - .field("addr", &self.addr) .finish() } } @@ -34,7 +31,6 @@ impl Clone ctx: self.ctx.clone(), req: self.req.clone(), conn: self.conn.clone(), - addr: self.addr, } } } diff --git a/rama-net/src/stream/layer/tracker/outgoing.rs b/rama-net/src/stream/layer/tracker/outgoing.rs index 24d2cd6c..9881ce8e 100644 --- a/rama-net/src/stream/layer/tracker/outgoing.rs +++ b/rama-net/src/stream/layer/tracker/outgoing.rs @@ -59,21 +59,12 @@ where ctx: Context, req: Request, ) -> Result { - let EstablishedClientConnection { - mut ctx, - req, - conn, - addr, - } = self.inner.connect(ctx, req).await?; + let EstablishedClientConnection { mut ctx, req, conn } = + self.inner.connect(ctx, req).await?; let conn = BytesRWTracker::new(conn); let handle = conn.handle(); ctx.insert(handle); - Ok(EstablishedClientConnection { - ctx, - req, - conn, - addr, - }) + Ok(EstablishedClientConnection { ctx, req, conn }) } } diff --git a/rama-tcp/src/client/service/connector.rs b/rama-tcp/src/client/service/connector.rs index d76e0cdc..9bf0dae4 100644 --- a/rama-tcp/src/client/service/connector.rs +++ b/rama-tcp/src/client/service/connector.rs @@ -107,7 +107,7 @@ where .map_err(Into::into)?; if let Some(proxy) = ctx.get::() { - let (conn, addr) = crate::client::tcp_connect( + let (conn, _addr) = crate::client::tcp_connect( &ctx, proxy.authority.clone(), true, @@ -116,12 +116,7 @@ where ) .await .context("tcp connector: conncept to proxy")?; - return Ok(EstablishedClientConnection { - ctx, - req, - conn, - addr, - }); + return Ok(EstablishedClientConnection { ctx, req, conn }); } let transport_ctx = ctx @@ -143,16 +138,11 @@ where } let authority = transport_ctx.authority.clone(); - let (conn, addr) = + let (conn, _addr) = crate::client::tcp_connect(&ctx, authority, false, self.dns.clone(), connector) .await .context("tcp connector: connect to server")?; - Ok(EstablishedClientConnection { - ctx, - req, - conn, - addr, - }) + Ok(EstablishedClientConnection { ctx, req, conn }) } } diff --git a/rama-tls/src/boring/client/connector.rs b/rama-tls/src/boring/client/connector.rs index 2552bee6..cb8ac7b8 100644 --- a/rama-tls/src/boring/client/connector.rs +++ b/rama-tls/src/boring/client/connector.rs @@ -229,12 +229,8 @@ where ctx: Context, req: Request, ) -> Result { - let EstablishedClientConnection { - mut ctx, - req, - conn, - addr, - } = self.inner.connect(ctx, req).await.map_err(Into::into)?; + let EstablishedClientConnection { mut ctx, req, conn } = + self.inner.connect(ctx, req).await.map_err(Into::into)?; let transport_ctx = ctx .get_or_try_insert_with_ctx(|ctx| req.try_ref_into_transport_ctx(ctx)) @@ -260,7 +256,6 @@ where conn: AutoTlsStream { inner: AutoTlsStreamData::Plain { inner: conn }, }, - addr, }); } @@ -282,7 +277,6 @@ where conn: AutoTlsStream { inner: AutoTlsStreamData::Secure { inner: stream }, }, - addr, }) } } @@ -303,12 +297,8 @@ where ctx: Context, req: Request, ) -> Result { - let EstablishedClientConnection { - mut ctx, - req, - conn, - addr, - } = self.inner.connect(ctx, req).await.map_err(Into::into)?; + let EstablishedClientConnection { mut ctx, req, conn } = + self.inner.connect(ctx, req).await.map_err(Into::into)?; let transport_ctx = ctx .get_or_try_insert_with_ctx(|ctx| req.try_ref_into_transport_ctx(ctx)) @@ -328,12 +318,7 @@ where let (conn, negotiated_params) = self.handshake(connector_data, host, conn).await?; ctx.insert(negotiated_params); - Ok(EstablishedClientConnection { - ctx, - req, - conn, - addr, - }) + Ok(EstablishedClientConnection { ctx, req, conn }) } } @@ -351,12 +336,8 @@ where ctx: Context, req: Request, ) -> Result { - let EstablishedClientConnection { - mut ctx, - req, - conn, - addr, - } = self.inner.connect(ctx, req).await.map_err(Into::into)?; + let EstablishedClientConnection { mut ctx, req, conn } = + self.inner.connect(ctx, req).await.map_err(Into::into)?; let host = match ctx .get::() @@ -375,7 +356,6 @@ where conn: AutoTlsStream { inner: AutoTlsStreamData::Plain { inner: conn }, }, - addr, }); } }; @@ -391,7 +371,6 @@ where conn: AutoTlsStream { inner: AutoTlsStreamData::Secure { inner: stream }, }, - addr, }) } } diff --git a/rama-tls/src/rustls/client/connector.rs b/rama-tls/src/rustls/client/connector.rs index bc509be5..bf15fe5e 100644 --- a/rama-tls/src/rustls/client/connector.rs +++ b/rama-tls/src/rustls/client/connector.rs @@ -231,12 +231,8 @@ where ctx: Context, req: Request, ) -> Result { - let EstablishedClientConnection { - mut ctx, - req, - conn, - addr, - } = self.inner.connect(ctx, req).await.map_err(Into::into)?; + let EstablishedClientConnection { mut ctx, req, conn } = + self.inner.connect(ctx, req).await.map_err(Into::into)?; let transport_ctx = ctx .get_or_try_insert_with_ctx(|ctx| req.try_ref_into_transport_ctx(ctx)) .map_err(|err| { @@ -261,7 +257,6 @@ where conn: AutoTlsStream { inner: AutoTlsStreamData::Plain { inner: conn }, }, - addr, }); } @@ -290,7 +285,6 @@ where conn: AutoTlsStream { inner: AutoTlsStreamData::Secure { inner: stream }, }, - addr, }) } } @@ -311,12 +305,8 @@ where ctx: Context, req: Request, ) -> Result { - let EstablishedClientConnection { - mut ctx, - req, - conn, - addr, - } = self.inner.connect(ctx, req).await.map_err(Into::into)?; + let EstablishedClientConnection { mut ctx, req, conn } = + self.inner.connect(ctx, req).await.map_err(Into::into)?; let transport_ctx = ctx .get_or_try_insert_with_ctx(|ctx| req.try_ref_into_transport_ctx(ctx)) @@ -336,12 +326,7 @@ where let (conn, negotiated_params) = self.handshake(connector_data, server_host, conn).await?; ctx.insert(negotiated_params); - Ok(EstablishedClientConnection { - ctx, - req, - conn, - addr, - }) + Ok(EstablishedClientConnection { ctx, req, conn }) } } @@ -359,12 +344,8 @@ where ctx: Context, req: Request, ) -> Result { - let EstablishedClientConnection { - mut ctx, - req, - conn, - addr, - } = self.inner.connect(ctx, req).await.map_err(Into::into)?; + let EstablishedClientConnection { mut ctx, req, conn } = + self.inner.connect(ctx, req).await.map_err(Into::into)?; let server_host = match ctx .get::() @@ -383,7 +364,6 @@ where conn: AutoTlsStream { inner: AutoTlsStreamData::Plain { inner: conn }, }, - addr, }); } }; @@ -399,7 +379,6 @@ where conn: AutoTlsStream { inner: AutoTlsStreamData::Secure { inner: conn }, }, - addr, }) } } diff --git a/tests/integration/examples/example_tests/tls_boring_dynamic_certs.rs b/tests/integration/examples/example_tests/tls_boring_dynamic_certs.rs index 0e81fdcb..eabd60ef 100644 --- a/tests/integration/examples/example_tests/tls_boring_dynamic_certs.rs +++ b/tests/integration/examples/example_tests/tls_boring_dynamic_certs.rs @@ -178,8 +178,7 @@ where TlsConnector::auto(tcp_connector).with_connector_data(tls_connector_data), ); - let EstablishedClientConnection { ctx, req, conn, .. } = - connector.connect(ctx, req).await?; + let EstablishedClientConnection { ctx, req, conn } = connector.connect(ctx, req).await?; // Extra logic to extract certificates let params = ctx.get::().unwrap();