1use rand::Rng;
2
3#[derive(Debug)]
5pub(crate) struct ExecuteResponse {
6 pub(crate) response_id: i32,
7 pub(crate) response_type: i32,
8 pub(crate) response_body: String,
9}
10
11#[derive(Debug)]
13pub struct AuthRequest {
14 pub id: usize,
15 pub request_type: u8,
16 pub password: String,
17}
18
19impl AuthRequest {
20 pub fn new(password: String) -> Self {
22 Self {
23 id: rand::thread_rng().gen::<usize>(),
24 request_type: 3,
25 password,
26 }
27 }
28}
29
30#[derive(Debug)]
32pub struct AuthResponse {
33 pub id: isize,
34 pub response_type: u8,
35}
36
37impl AuthResponse {
38 pub fn is_success(&self) -> bool {
40 self.id != -1
41 }
42}
43
44#[derive(Debug)]
46pub struct RCONRequest {
47 pub id: usize,
48 pub request_type: u8,
49 pub body: String,
50}
51
52impl RCONRequest {
53 pub fn new(body: String) -> Self {
54 Self {
55 id: rand::thread_rng().gen::<usize>(),
56 request_type: 2,
57 body,
58 }
59 }
60}
61
62#[derive(Debug)]
64pub struct RCONResponse {
65 pub id: isize,
66 pub response_type: u8,
67 pub body: String,
68}