azalea icon indicating copy to clipboard operation
azalea copied to clipboard

socks5 support

Open 1zun4 opened this issue 7 months ago • 3 comments

Introduces socks5 support to azalea. I am using this myself and it works well. Fixes https://github.com/azalea-rs/azalea/issues/98

Might not be ideally implemented.

1zun4 avatar Nov 29 '23 18:11 1zun4

Thank you for writing this!

I think most of the functions that take in Proxy as an argument (Client::join, ping_server, Connection::new, ClientBuilder::start, Swarm::add, Swarm::add_with_exponential_backoff) should be split into separate functions to keep them simple since it's a lot more common for the user to not be using a proxy (and because I might want to add a feature gate to optionally disable the socks5-impl dependency in the future). For example Connection::new could be split into new(address: &SocketAddr), new_with_proxy(address: &SocketAddr, proxy: Option<Proxy>), and new_from_stream(stream: TcpStream).

I completely agree with your suggestion to split the functions that take a Proxy as an argument into separate functions for simplicity, such as adding a feature gate to optionally disable the socks5-impl dependency.

I initially implemented it in a quick-and-dirty manner for the sake of expediency, but your feedback is spot-on. Expect these changes soon.

1zun4 avatar Nov 30 '23 04:11 1zun4

I don't mean to bother you, but do you still plan on finishing up this PR? If not then I'd be willing to finish it myself.

mat-1 avatar Dec 15 '23 17:12 mat-1

I don't mean to bother you, but do you still plan on finishing up this PR? If not then I'd be willing to finish it myself.

Go ahead. I was going to, but I don't have enough time at the moment.

1zun4 avatar Dec 15 '23 21:12 1zun4

Merged in https://github.com/azalea-rs/azalea/commit/353eda21ac8280213edcec3823cc3bd77fe17c44 :)

I did a few changes: separating the socks5 and non-socks5 functions, making it easier to set which proxy a bot will use and removing the randomization, and generally cleaning it up a little so things like setting a custom join address for a bot and its proxy is set from a single options struct

mat-1 avatar Apr 20 '24 03:04 mat-1