aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs
index 12d2cdb..895bded 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -5,18 +5,18 @@ pub mod config;
use anyhow::bail;
use azalea_protocol::{
packets::{
- handshaking::{client_intention_packet::ClientIntentionPacket, ServerboundHandshakePacket},
+ handshake::{ServerboundHandshakePacket, ServerboundIntention},
login::ServerboundLoginPacket,
- ClientIntention, ConnectionProtocol,
+ ClientIntention,
},
read::read_packet,
write::write_packet,
};
-use bytes::BytesMut;
use config::Config;
use log::{error, info, warn};
use std::{
fs::read_to_string,
+ io::Cursor,
sync::{Arc, RwLock},
};
use tokio::{
@@ -70,7 +70,7 @@ async fn run() -> anyhow::Result<!> {
}
async fn handle_client(config: Arc<Config>, sock: TcpStream) -> Result<(), anyhow::Error> {
- let mut buf = BytesMut::new();
+ let mut buf = Cursor::new(Vec::new());
sock.set_nodelay(true)?;
let (mut downstream_reader, downstream_writer) = sock.into_split();
@@ -83,7 +83,7 @@ async fn handle_client(config: Arc<Config>, sock: TcpStream) -> Result<(), anyho
.await?;
let upstream_handshake = match handshake {
- ServerboundHandshakePacket::ClientIntention(p) => {
+ ServerboundHandshakePacket::Intention(p) => {
info!(
"new client (version={}, intent={:?})",
p.protocol_version, p.intention
@@ -134,7 +134,7 @@ async fn handle_client(config: Arc<Config>, sock: TcpStream) -> Result<(), anyho
let (upstream_reader, mut upstream_writer) = upstream.into_split();
write_packet(
- &ServerboundHandshakePacket::ClientIntention(upstream_handshake),
+ &ServerboundHandshakePacket::Intention(upstream_handshake),
&mut upstream_writer,
None,
&mut None,
@@ -181,7 +181,7 @@ async fn handle_status_intent(
let (upstream_reader, mut upstream_writer) = upstream.into_split();
write_packet(
- &ServerboundHandshakePacket::ClientIntention(ClientIntentionPacket {
+ &ServerboundHandshakePacket::Intention(ServerboundIntention {
protocol_version: config.protocol,
hostname: config.backend.ip().to_string(),
port: config.backend.port(),