[Crate] Changed all address &str to &Ipv4Addr

This commit is contained in:
CosminPerRam 2023-05-27 00:41:41 +03:00
parent a69896f737
commit e620398615
65 changed files with 171 additions and 93 deletions

View file

@ -30,6 +30,7 @@ use bzip2_rs::decoder::Decoder;
use crate::protocols::valve::Packet;
use std::collections::HashMap;
use std::net::Ipv4Addr;
#[derive(Debug)]
#[allow(dead_code)] //remove this later on
@ -124,7 +125,7 @@ pub(crate) struct ValveProtocol {
static PACKET_SIZE: usize = 6144;
impl ValveProtocol {
pub fn new(address: &str, port: u16, timeout_settings: Option<TimeoutSettings>) -> GDResult<Self> {
pub fn new(address: &Ipv4Addr, port: u16, timeout_settings: Option<TimeoutSettings>) -> GDResult<Self> {
let socket = UdpSocket::new(address, port)?;
socket.apply_timeout(timeout_settings)?;
@ -411,7 +412,7 @@ impl ValveProtocol {
/// (GatherSettings::[default](GatheringSettings::default),
/// TimeoutSettings::[default](TimeoutSettings::default)).
pub fn query(
address: &str,
address: &Ipv4Addr,
port: u16,
engine: Engine,
gather_settings: Option<GatheringSettings>,
@ -428,7 +429,7 @@ pub fn query(
}
fn get_response(
address: &str,
address: &Ipv4Addr,
port: u16,
engine: Engine,
gather_settings: GatheringSettings,