From 3869fd622f7515e934979478c439626981f0cd8a Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 23 Oct 2022 22:59:38 -0500 Subject: write some more docs for az-protocol --- azalea-protocol/src/resolver.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'azalea-protocol/src/resolver.rs') diff --git a/azalea-protocol/src/resolver.rs b/azalea-protocol/src/resolver.rs index eb081c3f..b3455a59 100755 --- a/azalea-protocol/src/resolver.rs +++ b/azalea-protocol/src/resolver.rs @@ -1,6 +1,6 @@ -use crate::{ServerAddress, ServerIpAddress}; +use crate::ServerAddress; use async_recursion::async_recursion; -use std::net::IpAddr; +use std::net::{IpAddr, SocketAddr}; use thiserror::Error; use trust_dns_resolver::{ config::{ResolverConfig, ResolverOpts}, @@ -18,13 +18,10 @@ pub enum ResolverError { /// Resolve a Minecraft server address into an IP address and port. /// If it's already an IP address, it's returned as-is. #[async_recursion] -pub async fn resolve_address(address: &ServerAddress) -> Result { +pub async fn resolve_address(address: &ServerAddress) -> Result { // If the address.host is already in the format of an ip address, return it. if let Ok(ip) = address.host.parse::() { - return Ok(ServerIpAddress { - ip, - port: address.port, - }); + return Ok(SocketAddr::new(ip, address.port)); } // we specify Cloudflare instead of the default resolver because trust_dns_resolver has an issue on Windows where it's really slow using the default resolver @@ -56,8 +53,8 @@ pub async fn resolve_address(address: &ServerAddress) -> Result