aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-05-30 14:44:48 -1300
committermat <git@matdoes.dev>2025-05-30 14:44:48 -1300
commite37524899eef8a0034faee35cef4bbf1ba779a7d (patch)
tree5afe343086db2a9ebc78fe0a6987b9325286cc66 /azalea-protocol
parentae4b1e85e669bc882d158509ef1eda46c6b2a72e (diff)
downloadazalea-drasl-e37524899eef8a0034faee35cef4bbf1ba779a7d.tar.xz
formatting: merge imports
Diffstat (limited to 'azalea-protocol')
-rw-r--r--azalea-protocol/examples/handshake_proxy.rs3
-rw-r--r--azalea-protocol/src/connect.rs49
-rw-r--r--azalea-protocol/src/read.rs16
3 files changed, 40 insertions, 28 deletions
diff --git a/azalea-protocol/examples/handshake_proxy.rs b/azalea-protocol/examples/handshake_proxy.rs
index 0161258a..cfe4af52 100644
--- a/azalea-protocol/examples/handshake_proxy.rs
+++ b/azalea-protocol/examples/handshake_proxy.rs
@@ -25,8 +25,7 @@ use tokio::{
io::{self, AsyncWriteExt},
net::{TcpListener, TcpStream},
};
-use tracing::Level;
-use tracing::{error, info, warn};
+use tracing::{Level, error, info, warn};
const LISTEN_ADDR: &str = "127.0.0.1:25566";
const PROXY_ADDR: &str = "127.0.0.1:25565";
diff --git a/azalea-protocol/src/connect.rs b/azalea-protocol/src/connect.rs
index bd8cf115..5268554d 100644
--- a/azalea-protocol/src/connect.rs
+++ b/azalea-protocol/src/connect.rs
@@ -1,29 +1,40 @@
//! Connect to remote servers/clients.
-use std::fmt::{self, Debug, Display};
-use std::io::{self, Cursor};
-use std::marker::PhantomData;
-use std::net::SocketAddr;
-
-use azalea_auth::game_profile::GameProfile;
-use azalea_auth::sessionserver::{ClientSessionServerError, ServerSessionServerError};
+use std::{
+ fmt::{self, Debug, Display},
+ io::{self, Cursor},
+ marker::PhantomData,
+ net::SocketAddr,
+};
+
+use azalea_auth::{
+ game_profile::GameProfile,
+ sessionserver::{ClientSessionServerError, ServerSessionServerError},
+};
use azalea_crypto::{Aes128CfbDec, Aes128CfbEnc};
use thiserror::Error;
-use tokio::io::{AsyncWriteExt, BufStream};
-use tokio::net::TcpStream;
-use tokio::net::tcp::{OwnedReadHalf, OwnedWriteHalf, ReuniteError};
+use tokio::{
+ io::{AsyncWriteExt, BufStream},
+ net::{
+ TcpStream,
+ tcp::{OwnedReadHalf, OwnedWriteHalf, ReuniteError},
+ },
+};
use tracing::{error, info};
use uuid::Uuid;
-use crate::packets::ProtocolPacket;
-use crate::packets::config::{ClientboundConfigPacket, ServerboundConfigPacket};
-use crate::packets::game::{ClientboundGamePacket, ServerboundGamePacket};
-use crate::packets::handshake::{ClientboundHandshakePacket, ServerboundHandshakePacket};
-use crate::packets::login::c_hello::ClientboundHello;
-use crate::packets::login::{ClientboundLoginPacket, ServerboundLoginPacket};
-use crate::packets::status::{ClientboundStatusPacket, ServerboundStatusPacket};
-use crate::read::{ReadPacketError, deserialize_packet, read_raw_packet, try_read_raw_packet};
-use crate::write::{serialize_packet, write_raw_packet};
+use crate::{
+ packets::{
+ ProtocolPacket,
+ config::{ClientboundConfigPacket, ServerboundConfigPacket},
+ game::{ClientboundGamePacket, ServerboundGamePacket},
+ handshake::{ClientboundHandshakePacket, ServerboundHandshakePacket},
+ login::{ClientboundLoginPacket, ServerboundLoginPacket, c_hello::ClientboundHello},
+ status::{ClientboundStatusPacket, ServerboundStatusPacket},
+ },
+ read::{ReadPacketError, deserialize_packet, read_raw_packet, try_read_raw_packet},
+ write::{serialize_packet, write_raw_packet},
+};
pub struct RawReadConnection {
pub read_stream: OwnedReadHalf,
diff --git a/azalea-protocol/src/read.rs b/azalea-protocol/src/read.rs
index 422d7f7a..433a2718 100644
--- a/azalea-protocol/src/read.rs
+++ b/azalea-protocol/src/read.rs
@@ -1,23 +1,25 @@
//! Read packets from a stream.
-use std::backtrace::Backtrace;
-use std::sync::LazyLock;
-use std::{env, io};
use std::{
+ backtrace::Backtrace,
+ env,
fmt::Debug,
+ io,
io::{Cursor, Read},
+ sync::LazyLock,
};
-use azalea_buf::AzaleaReadVar;
-use azalea_buf::BufReadError;
+use azalea_buf::{AzaleaReadVar, BufReadError};
use azalea_crypto::Aes128CfbDec;
use flate2::read::ZlibDecoder;
use futures::StreamExt;
use futures_lite::future;
use thiserror::Error;
use tokio::io::AsyncRead;
-use tokio_util::bytes::Buf;
-use tokio_util::codec::{BytesCodec, FramedRead};
+use tokio_util::{
+ bytes::Buf,
+ codec::{BytesCodec, FramedRead},
+};
use tracing::trace;
use crate::packets::ProtocolPacket;