crossbario / autobahn-java

WebSocket & WAMP in Java for Android and Java 8
https://crossbar.io/autobahn
MIT License
1.52k stars 427 forks source link

Support connection through SOCKS5 #531

Open om26er opened 2 years ago

om26er commented 2 years ago

Autobahn Java should be able to connect to crossbar over SOCKS5. Our Java websocket implementation internally uses the Java Socket class, which supports passing a Proxy object.

I have briefly played with it and it seems I was able to connect to Crossbar using SOCKS5 proxy from autobahn-java with a few lines of code.

If you @oberstet agree, we can add initial support to our websocket implementation.

The user API would only need to provide an instance of a Proxy object (that we define), which supports 4 paramets

The last two can be optional if a proxy supports anonymous connection.

michedsa commented 2 years ago

Hi, can you explain how you did?

om26er commented 2 years ago

@michedsa I haven't had the time to implement it but I did play with it at the time I reported this issue. Basically the change needs to happen at the underlying TCP socket level, mostly here https://github.com/crossbario/autobahn-java/blob/6ab8a3f389c9d46706fd7a41434b0f3ea01d3642/autobahn/src/main/java/io/crossbar/autobahn/websocket/WebSocketConnection.java#L127

I was able to connect to a crossbar instance using SOCKS5.