Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to combine async-socks5 with tungstenite? #37

Open
Praying opened this issue Mar 25, 2022 · 3 comments
Open

How to combine async-socks5 with tungstenite? #37

Praying opened this issue Mar 25, 2022 · 3 comments

Comments

@Praying
Copy link

Praying commented Mar 25, 2022

I need a proxy on websocket with tungstenite, and I don't know how to implement it with async-socks5, do you have any experience or example?

@Praying
Copy link
Author

Praying commented Mar 25, 2022

tokio-tungstenite is also ok

@ark0f
Copy link
Owner

ark0f commented Mar 25, 2022

do you have any experience

I have not, but I can guess it should look like this:

let stream = TcpStream::connect("my-proxy-server.com:54321").await?;
async_socks5::connect(&mut stream, ("your-ws-server.com", 80), None).await?;
let (ws_stream, _) = tokio_tungstenite::client_async("ws://your-ws-server.com:80", stream).await?;

@Praying
Copy link
Author

Praying commented Mar 25, 2022

do you have any experience

I have not, but I can guess it should look like this:

let stream = TcpStream::connect("my-proxy-server.com:54321").await?;
async_socks5::connect(&mut stream, ("your-ws-server.com", 80), None).await?;
let (ws_stream, _) = tokio_tungstenite::client_async("ws://your-ws-server.com:80", stream).await?;

I have try it, didn't work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants