[Protocol] Replace IpAddr with SocketAddr in protocols (#44)

* [Crate] Replace IpAddr with SocketAddr in protocols

* [Crate] Remove usage of address.to_string in socket

* [Crate] Update CHANGELOG.md
This commit is contained in:
CosminPerRam 2023-06-02 01:06:24 +03:00 committed by GitHub
parent 596d15df78
commit e0830bdae5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
70 changed files with 215 additions and 286 deletions

View file

@ -1,4 +1,4 @@
use std::net::IpAddr;
use std::net::{IpAddr, SocketAddr};
use crate::protocols::types::TimeoutSettings;
use crate::protocols::valve::{Engine, Environment, Server, ValveProtocol};
use crate::GDResult;
@ -48,7 +48,7 @@ pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<Response> {
}
pub fn query_with_timeout(address: &IpAddr, port: Option<u16>, timeout_settings: TimeoutSettings) -> GDResult<Response> {
let mut client = ValveProtocol::new(address, port.unwrap_or(5478), Some(timeout_settings))?;
let mut client = ValveProtocol::new(&SocketAddr::new(*address, port.unwrap_or(5478)), Some(timeout_settings))?;
let mut buffer = client.get_request_data(
&Engine::GoldSrc(true),
0,