[Protocol] Add PROPRIETARY to protocol enumeration (#59)

* [Protocol] Add CUSTOM to protocol enumeration

* [Protocol] Rename CUSTOM to PROPRIETARY

* [Protocol] Rename struct to ProprietaryProtocol and do the same thing to generic response

* [Protocol] Revert proprietary change on generic response
This commit is contained in:
CosminPerRam 2023-06-26 23:52:40 +03:00 committed by GitHub
parent b368877031
commit c55254aaf6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 11 deletions

View file

@ -114,7 +114,7 @@ pub mod vr;
use crate::protocols::gamespy::GameSpyVersion;
use crate::protocols::quake::QuakeVersion;
use crate::protocols::types::CommonResponse;
use crate::protocols::types::{CommonResponse, ProprietaryProtocol};
use crate::protocols::{self, Protocol};
use crate::GDResult;
use std::net::{IpAddr, SocketAddr};
@ -172,8 +172,12 @@ pub fn query(game: &Game, address: &IpAddr, port: Option<u16>) -> GDResult<Box<d
QuakeVersion::Three => protocols::quake::three::query(&socket_addr, None).map(Box::new)?,
}
}
Protocol::TheShip => ts::query(address, port).map(Box::new)?,
Protocol::FFOW => ffow::query(address, port).map(Box::new)?,
Protocol::JC2MP => jc2mp::query(address, port).map(Box::new)?,
Protocol::PROPRIETARY(protocol) => {
match protocol {
ProprietaryProtocol::TheShip => ts::query(address, port).map(Box::new)?,
ProprietaryProtocol::FFOW => ffow::query(address, port).map(Box::new)?,
ProprietaryProtocol::JC2MP => jc2mp::query(address, port).map(Box::new)?,
}
}
})
}