diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2025-12-11 22:47:16 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-11 22:47:16 -0600 |
| commit | 4a66f002c276a57e028e9456f6800b0b3c248885 (patch) | |
| tree | f87cbdc51c09d497548f972b9b1633ceb7606443 /azalea-client/src/client.rs | |
| parent | ff1e28f88e93ba83cf76569b5613445b841efd45 (diff) | |
| download | azalea-drasl-4a66f002c276a57e028e9456f6800b0b3c248885.tar.xz | |
Add options to request Mojang sessionserver with a proxy (#293)
* add options to request mojang sessionserver with a socks5 proxy
* update changelog
* rename auth_proxy to sessionserver_proxy
Diffstat (limited to 'azalea-client/src/client.rs')
| -rw-r--r-- | azalea-client/src/client.rs | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs index 18a54125..970d8da0 100644 --- a/azalea-client/src/client.rs +++ b/azalea-client/src/client.rs @@ -121,14 +121,39 @@ impl StartClientOpts { connect_opts: ConnectOpts { address, resolved_address, - proxy: None, + server_proxy: None, + sessionserver_proxy: None, }, event_sender, } } - pub fn proxy(mut self, proxy: Proxy) -> Self { - self.connect_opts.proxy = Some(proxy); + /// Configure the SOCKS5 proxy used for connecting to the server and for + /// authenticating with Mojang. + /// + /// To configure these separately, for example to only use the proxy for the + /// Minecraft server and not for authentication, you may use + /// [`Self::server_proxy`] and [`Self::sessionserver_proxy`] individually. + pub fn proxy(self, proxy: Proxy) -> Self { + self.server_proxy(proxy.clone()).sessionserver_proxy(proxy) + } + /// Configure the SOCKS5 proxy that will be used for connecting to the + /// Minecraft server. + /// + /// To avoid errors on servers with the "prevent-proxy-connections" option + /// set, you should usually use [`Self::proxy`] instead. + /// + /// Also see [`Self::sessionserver_proxy`]. + pub fn server_proxy(mut self, proxy: Proxy) -> Self { + self.connect_opts.server_proxy = Some(proxy); + self + } + /// Configure the SOCKS5 proxy that this bot will use for authenticating the + /// server join with Mojang's API. + /// + /// Also see [`Self::proxy`] and [`Self::server_proxy`]. + pub fn sessionserver_proxy(mut self, proxy: Proxy) -> Self { + self.connect_opts.sessionserver_proxy = Some(proxy); self } } |
