#server #quake-world #quake

masterstat

Get server addresses from QuakeWorld master servers

4 releases

0.1.3 May 4, 2024
0.1.2 Apr 25, 2024
0.1.1 Apr 25, 2024
0.1.0 Apr 25, 2024

#4 in #quake-world

MIT license

11KB
178 lines

masterstat Test crates docs.rs

Get server addresses from QuakeWorld master servers.

Installation

cargo add masterstat

Usage

Get server addresses from a single master server

use std::time::Duration;

let master = "master.quakeworld.nu:27000";
let timeout = Some(Duration::from_secs(2));

match masterstat::server_addresses(&master, timeout) {
    Ok(addresses) => { println!("found {} server addresses", addresses.len()) },
    Err(e) => { eprintln!("error: {}", e); }
}

Get server addresses from multiple master servers (async, in parallel)

use std::time::Duration;

async fn test() {
  let masters = ["master.quakeworld.nu:27000", "master.quakeservers.net:27000"];
  let timeout = Some(Duration::from_secs(2));
  let server_addresses = masterstat::server_addresses_from_many(&masters, timeout).await?;
}

See also

Dependencies

~3.5–10MB
~90K SLoC