Closed TheBlindM closed 1 year ago
Take socks5 for example, it is probably like this
# https://github.com/dizda/fast-socks5/blob/master/examples/client.rs
let socks5_stream = Socks5Stream::connect("127.0.0.1:1080", "1.1.1.1", 22, config).await?;
let session = AsyncSession::new(socks5_stream, None);
But the HTTP tunnel is more complicated, and there is no easy-to-use library.
Okay, but I suggest adding this feature
Lolita @.***
------------------ 原始邮件 ------------------ 发件人: "bk-rs/ssh-rs" @.>; 发送时间: 2023年8月27日(星期天) 上午9:50 @.>; @.**@.>; 主题: Re: [bk-rs/ssh-rs] How to set up an HTTP or socket proxy (Issue #42)
Take socks5 for example, it is probably like this
But the HTTP tunnel is more complicated, and there is no easy-to-use library.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
Take socks5 for example, it is probably like this
# https://github.com/dizda/fast-socks5/blob/master/examples/client.rs let socks5_stream = Socks5Stream::connect("127.0.0.1:1080", "1.1.1.1", 22, config).await?; let session = AsyncSession::new(socks5_stream, None);
But the HTTP tunnel is more complicated, and there is no easy-to-use library.
Examples provided
Let socks5_stream=Socks5Stream:: connect ("127.0.0.1:1080", "1.1.1.1", 22, config). wait?; Let session=AsyncSession:: new (socks5_stream, None)
It's not like
AsyncSession:<AsyncIoTcpStream>
Same usage
Oh, I haven't tested it, so it probably won't work. If the following does not work, it basically does not work
# https://github.com/dizda/fast-socks5/blob/master/examples/client.rs
let socks5_stream = Socks5Stream::connect("127.0.0.1:1080", "1.1.1.1", 22, config).await?;
let session = AsyncSession::new(socks5_stream.get_socket(), None);
/*
async-ssh2-lite = { version = "0.4", features = ["tokio"] }
fast-socks5 = { version = "0.8" }
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
*/
use async_ssh2_lite::AsyncSession;
use fast_socks5::client::{Config, Socks5Stream};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = Config::default();
let socks5_stream =
Socks5Stream::connect("127.0.0.1:1080", "1.1.1.1".into(), 22, config).await?;
let tcp_stream = socks5_stream.get_socket();
let mut session = AsyncSession::new(tcp_stream, None)?;
session.handshake().await?;
session.userauth_agent_with_try_next("root").await?;
println!("{}", session.authenticated());
Ok(())
}
How to set up an HTTP or socket proxy