Created
April 18, 2023 23:58
-
-
Save carlosm27/ce1a0f1ebdb2cec38d6b7621d68063f9 to your computer and use it in GitHub Desktop.
Tunnel function
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 characters
| 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(()) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment