Remove byteorder dependency

This commit is contained in:
Denis Drakhnia 2023-10-07 19:41:55 +03:00
parent 518f8363bb
commit 33429dddc9
3 changed files with 3 additions and 12 deletions

7
Cargo.lock generated
View File

@ -35,12 +35,6 @@ version = "3.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
[[package]]
name = "byteorder"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "cc"
version = "1.0.83"
@ -94,7 +88,6 @@ name = "hlmaster"
version = "0.1.0"
dependencies = [
"bitflags",
"byteorder",
"chrono",
"fastrand",
"getopts",

View File

@ -15,7 +15,6 @@ thiserror = "1.0.49"
getopts = "0.2.21"
log = "<0.4.19"
bitflags = "2.4"
byteorder = "1.4.3"
fastrand = "2.0.1"
[dependencies.chrono]

View File

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