Created
April 18, 2023 23:58
-
-
Save carlosm27/ce1a0f1ebdb2cec38d6b7621d68063f9 to your computer and use it in GitHub Desktop.
Revisions
-
carlosm27 created this gist
Apr 18, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ async fn tunnel(mut upgraded: Upgraded, addr: String) -> std::io::Result<()> { let mut server = TcpStream::connect(addr).await?; let (from_client, from_server) = tokio::io::copy_bidirectional(&mut upgraded, &mut server).await?; tracing::debug!( "client wrote {} bytes and received {} bytes", from_client, from_server ); Ok(()) }