|
|
@ -2,11 +2,10 @@ |
|
|
|
// SPDX-FileCopyrightText: 2023 Denis Drakhnia <numas13@gmail.com>
|
|
|
|
// SPDX-FileCopyrightText: 2023 Denis Drakhnia <numas13@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
use std::fmt; |
|
|
|
use std::fmt; |
|
|
|
use std::io::{self, Cursor}; |
|
|
|
use std::io; |
|
|
|
use std::ops::Deref; |
|
|
|
use std::ops::Deref; |
|
|
|
use std::str; |
|
|
|
use std::str; |
|
|
|
|
|
|
|
|
|
|
|
use byteorder::{ReadBytesExt, LE}; |
|
|
|
|
|
|
|
use log::debug; |
|
|
|
use log::debug; |
|
|
|
use thiserror::Error; |
|
|
|
use thiserror::Error; |
|
|
|
|
|
|
|
|
|
|
@ -57,8 +56,8 @@ impl<'a> Packet<'a> { |
|
|
|
|
|
|
|
|
|
|
|
Ok(Self::QueryServers(region, Filter(filter))) |
|
|
|
Ok(Self::QueryServers(region, Filter(filter))) |
|
|
|
} |
|
|
|
} |
|
|
|
[b'q', 0xff, tail @ ..] => { |
|
|
|
[b'q', 0xff, b0, b1, b2, b3] => { |
|
|
|
let challenge = Cursor::new(tail).read_u32::<LE>()?; |
|
|
|
let challenge = u32::from_le_bytes([*b0, *b1, *b2, *b3]); |
|
|
|
Ok(Self::Challenge(Some(challenge))) |
|
|
|
Ok(Self::Challenge(Some(challenge))) |
|
|
|
} |
|
|
|
} |
|
|
|
[b'0', b'\n', tail @ ..] => { |
|
|
|
[b'0', b'\n', tail @ ..] => { |
|
|
|