mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-18 09:35:50 +00:00
[Protocol] Enable the use of Ipv6 addresses (#41)
Replace usages of Ipv4Addr with IpAddr which allows the use of either Ipv4 or Ipv6. This patch essentially consists of running: "sed -i 's/Ipv4Addr/IpAddr/g' src/**/*.rs examples/*" and fixing the errors.
This commit is contained in:
parent
e620398615
commit
3f654e0dfd
60 changed files with 155 additions and 162 deletions
|
|
@ -30,7 +30,7 @@ use bzip2_rs::decoder::Decoder;
|
|||
|
||||
use crate::protocols::valve::Packet;
|
||||
use std::collections::HashMap;
|
||||
use std::net::Ipv4Addr;
|
||||
use std::net::IpAddr;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[allow(dead_code)] //remove this later on
|
||||
|
|
@ -125,7 +125,7 @@ pub(crate) struct ValveProtocol {
|
|||
static PACKET_SIZE: usize = 6144;
|
||||
|
||||
impl ValveProtocol {
|
||||
pub fn new(address: &Ipv4Addr, port: u16, timeout_settings: Option<TimeoutSettings>) -> GDResult<Self> {
|
||||
pub fn new(address: &IpAddr, port: u16, timeout_settings: Option<TimeoutSettings>) -> GDResult<Self> {
|
||||
let socket = UdpSocket::new(address, port)?;
|
||||
socket.apply_timeout(timeout_settings)?;
|
||||
|
||||
|
|
@ -412,7 +412,7 @@ impl ValveProtocol {
|
|||
/// (GatherSettings::[default](GatheringSettings::default),
|
||||
/// TimeoutSettings::[default](TimeoutSettings::default)).
|
||||
pub fn query(
|
||||
address: &Ipv4Addr,
|
||||
address: &IpAddr,
|
||||
port: u16,
|
||||
engine: Engine,
|
||||
gather_settings: Option<GatheringSettings>,
|
||||
|
|
@ -429,7 +429,7 @@ pub fn query(
|
|||
}
|
||||
|
||||
fn get_response(
|
||||
address: &Ipv4Addr,
|
||||
address: &IpAddr,
|
||||
port: u16,
|
||||
engine: Engine,
|
||||
gather_settings: GatheringSettings,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue