mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-18 09:35:50 +00:00
[Crate] Changed all address &str to &Ipv4Addr
This commit is contained in:
parent
a69896f737
commit
e620398615
65 changed files with 171 additions and 93 deletions
|
|
@ -4,6 +4,7 @@ use gamedig::protocols::valve;
|
|||
use gamedig::protocols::valve::Engine;
|
||||
use gamedig::{aliens, aoc, arma2oa, ase, asrd, avorion, bat1944, bb2, bf1942, bm, bo, ccure, cosu, cs, cscz, csgo, css, dod, dods, doi, dst, ffow, gm, hl2dm, hldms, ins, insmic, inss, l4d, l4d2, mc, ohd, onset, pz, ror2, rust, sc, sdtd, ss, tf, tf2, tfc, ts, unturned, ut, vr, GDResult, cw};
|
||||
use std::env;
|
||||
use std::net::Ipv4Addr;
|
||||
|
||||
fn main() -> GDResult<()> {
|
||||
let args: Vec<String> = env::args().collect();
|
||||
|
|
@ -19,7 +20,7 @@ fn main() -> GDResult<()> {
|
|||
return Ok(());
|
||||
}
|
||||
|
||||
let ip = args[2].as_str();
|
||||
let ip = &args[2].as_str().parse::<Ipv4Addr>().unwrap();
|
||||
let port = match args.len() == 4 {
|
||||
false => {
|
||||
if args[1].starts_with("_") {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use gamedig::games::mc;
|
|||
fn main() {
|
||||
// or Some(<port>), None is the default protocol port (which is 25565 for java
|
||||
// and 19132 for bedrock)
|
||||
let response = mc::query("127.0.0.1", None);
|
||||
let response = mc::query(&"127.0.0.1".parse().unwrap(), None);
|
||||
|
||||
match response {
|
||||
Err(error) => println!("Couldn't query, error: {}", error),
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
use gamedig::games::tf2;
|
||||
|
||||
fn main() {
|
||||
let response = tf2::query("127.0.0.1", None); // or Some(27015), None is the default protocol port (which is 27015)
|
||||
let response = tf2::query(&"127.0.0.1".parse().unwrap(), None);
|
||||
// or Some(27015), None is the default protocol port (which is 27015)
|
||||
|
||||
match response {
|
||||
// Result type, must check what it is...
|
||||
Err(error) => println!("Couldn't query, error: {}", error),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue