6 releases
0.2.1 | Jan 30, 2021 |
---|---|
0.2.0-alpha.2 | Jan 30, 2021 |
0.1.2 | Jan 26, 2021 |
0.1.1 | Jan 24, 2021 |
0.1.0 | Jan 24, 2021 |
#475 in Games
25KB
493 lines
teestatus
Request info about teeworlds servers.
Example
use teestatus::*;
use std::net::UdpSocket;
fn main() {
env_logger::init();
let sock = UdpSocket::bind("0.0.0.0:0").expect("can't bind socket");
sock.connect("0.0.0.0:8303")
.expect("can't connect socket");
println!("info: {:#?}", ServerInfo::new(&sock).unwrap());
}
Example to fetch servers from a master server:
let master = MasterServer {
hostname: Cow::Borrowed("49.12.97.180"),
port: 8300,
};
let sock = UdpSocket::bind("0.0.0.0:0").expect("can't bind socket");
let servers = master.get_server_list(&sock).unwrap();
lib.rs
:
teestatus
Request info about teeworlds servers.
Example
use teestatus::*;
use std::net::UdpSocket;
env_logger::init();
let sock = UdpSocket::bind("0.0.0.0:0").expect("can't bind socket");
sock.connect("0.0.0.0:8303")
.expect("can't connect socket");
println!("info: {:#?}", ServerInfo::new(&sock).unwrap());
Example to fetch servers from a master server:
use teestatus::*;
use std::net::UdpSocket;
use std::borrow::Cow;
let master = MasterServer {
hostname: Cow::Borrowed("49.12.97.180"),
port: 8300,
};
let sock = UdpSocket::bind("0.0.0.0:0").expect("can't bind socket");
let servers = master.get_server_list(&sock).unwrap();
Dependencies
~0.8–1.5MB
~30K SLoC