Browse Source

Remove byteorder dependency

ipv6
Denis Drakhnia 12 months ago
parent
commit
33429dddc9
  1. 7
      Cargo.lock
  2. 1
      Cargo.toml
  3. 7
      src/client.rs

7
Cargo.lock generated

@ -35,12 +35,6 @@ version = "3.14.0" @@ -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" @@ -94,7 +88,6 @@ name = "hlmaster"
version = "0.1.0"
dependencies = [
"bitflags",
"byteorder",
"chrono",
"fastrand",
"getopts",

1
Cargo.toml

@ -15,7 +15,6 @@ thiserror = "1.0.49" @@ -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]

7
src/client.rs

@ -2,11 +2,10 @@ @@ -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> { @@ -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 @ ..] => {

Loading…
Cancel
Save