diff --git a/crates/packet_inspector/Cargo.toml b/crates/packet_inspector/Cargo.toml index c6bf521..96612f1 100644 --- a/crates/packet_inspector/Cargo.toml +++ b/crates/packet_inspector/Cargo.toml @@ -7,6 +7,7 @@ description = "A simple Minecraft proxy for inspecting packets." [dependencies] anyhow = "1" clap = { version = "4.0.30", features = ["derive"] } +owo-colors = "3.5.0" regex = "1.6.0" tokio = { version = "1", features = ["full"] } tracing-subscriber = "0.3.16" diff --git a/crates/packet_inspector/src/main.rs b/crates/packet_inspector/src/main.rs index 0446a94..4dbaa75 100644 --- a/crates/packet_inspector/src/main.rs +++ b/crates/packet_inspector/src/main.rs @@ -7,6 +7,7 @@ use std::sync::Arc; use anyhow::bail; use clap::Parser; +use owo_colors::OwoColorize; use regex::Regex; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::tcp::{OwnedReadHalf, OwnedWriteHalf}; @@ -58,6 +59,7 @@ struct State { read: OwnedReadHalf, write: OwnedWriteHalf, buf: String, + style: owo_colors::Style, } impl State { @@ -104,7 +106,7 @@ impl State { } } - println!("{}", self.buf); + println!("{}", self.buf.style(self.style)); Ok(pkt) } @@ -164,6 +166,7 @@ async fn handle_connection(client: TcpStream, cli: Arc) -> anyhow::Result<( read: server_read, write: client_write, buf: String::new(), + style: owo_colors::Style::new().purple(), }; let mut c2s = State { @@ -173,6 +176,7 @@ async fn handle_connection(client: TcpStream, cli: Arc) -> anyhow::Result<( read: client_read, write: server_write, buf: String::new(), + style: owo_colors::Style::new().green(), }; let handshake: Handshake = c2s.rw_packet().await?;