diff options
| author | mat <git@matdoes.dev> | 2025-11-21 22:53:38 +0100 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-11-21 22:53:38 +0100 |
| commit | 6930966aabf9b49fb6a0dc8b61076fa3f1abc298 (patch) | |
| tree | 52bd3e48c96f0898d0dce494044fbb40915da73f /azalea-client/src | |
| parent | f464f0152a6450fafc86e1dc993b90e12e395fe7 (diff) | |
| download | azalea-drasl-6930966aabf9b49fb6a0dc8b61076fa3f1abc298.tar.xz | |
refactor resolve_address
Diffstat (limited to 'azalea-client/src')
| -rw-r--r-- | azalea-client/src/client.rs | 10 | ||||
| -rw-r--r-- | azalea-client/src/ping.rs | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs index e0902779..20e1cb3b 100644 --- a/azalea-client/src/client.rs +++ b/azalea-client/src/client.rs @@ -23,7 +23,7 @@ use azalea_protocol::{ ServerAddress, connect::Proxy, packets::{Packet, game::ServerboundGamePacket}, - resolver, + resolve, }; use azalea_world::{Instance, InstanceContainer, InstanceName, MinecraftEntityId, PartialInstance}; use bevy_app::{App, AppExit, Plugin, PluginsState, SubApp, Update}; @@ -88,8 +88,8 @@ pub struct Client { /// An error that happened while joining the server. #[derive(Error, Debug)] pub enum JoinError { - #[error("{0}")] - Resolver(#[from] resolver::ResolverError), + #[error(transparent)] + Resolver(#[from] resolve::ResolveError), #[error("The given address could not be parsed into a ServerAddress")] InvalidAddress, } @@ -173,7 +173,7 @@ impl Client { address: impl TryInto<ServerAddress>, ) -> Result<(Self, mpsc::UnboundedReceiver<Event>), JoinError> { let address: ServerAddress = address.try_into().map_err(|_| JoinError::InvalidAddress)?; - let resolved_address = resolver::resolve_address(&address).await?; + let resolved_address = resolve::resolve_address(&address).await?; let (tx, rx) = mpsc::unbounded_channel(); let client = Self::start_client(StartClientOpts::new( @@ -192,7 +192,7 @@ impl Client { proxy: Proxy, ) -> Result<(Self, mpsc::UnboundedReceiver<Event>), JoinError> { let address: ServerAddress = address.try_into().map_err(|_| JoinError::InvalidAddress)?; - let resolved_address = resolver::resolve_address(&address).await?; + let resolved_address = resolve::resolve_address(&address).await?; let (tx, rx) = mpsc::unbounded_channel(); let client = Self::start_client( diff --git a/azalea-client/src/ping.rs b/azalea-client/src/ping.rs index 8c4e2240..93018a82 100644 --- a/azalea-client/src/ping.rs +++ b/azalea-client/src/ping.rs @@ -16,14 +16,14 @@ use azalea_protocol::{ s_status_request::ServerboundStatusRequest, }, }, - resolver, + resolve, }; use thiserror::Error; #[derive(Error, Debug)] pub enum PingError { #[error("{0}")] - Resolver(#[from] resolver::ResolverError), + Resolver(#[from] resolve::ResolveError), #[error("{0}")] Connection(#[from] ConnectionError), #[error("{0}")] @@ -51,7 +51,7 @@ pub async fn ping_server( address: impl TryInto<ServerAddress>, ) -> Result<ClientboundStatusResponse, PingError> { let address: ServerAddress = address.try_into().map_err(|_| PingError::InvalidAddress)?; - let resolved_address = resolver::resolve_address(&address).await?; + let resolved_address = resolve::resolve_address(&address).await?; let conn = Connection::new(&resolved_address).await?; ping_server_with_connection(address, conn).await } @@ -62,7 +62,7 @@ pub async fn ping_server_with_proxy( proxy: Proxy, ) -> Result<ClientboundStatusResponse, PingError> { let address: ServerAddress = address.try_into().map_err(|_| PingError::InvalidAddress)?; - let resolved_address = resolver::resolve_address(&address).await?; + let resolved_address = resolve::resolve_address(&address).await?; let conn = Connection::new_with_proxy(&resolved_address, proxy).await?; ping_server_with_connection(address, conn).await } |
