From 573aaf2a8ccdb6c8c917b2d88a39c9c8103f64ef Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Mon, 27 Jan 2025 16:55:41 +0100 Subject: Add compatibility middleware --- src/proxy.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/proxy.rs') diff --git a/src/proxy.rs b/src/proxy.rs index 2551015..2798df3 100644 --- a/src/proxy.rs +++ b/src/proxy.rs @@ -42,6 +42,7 @@ use std::thread::{sleep, spawn, JoinHandle}; use std::time::Duration; use crate::configuration::Proxy; +use crate::middleware::MIDDLEWARE; /// A proxy server that listens for plaintext connections and forwards them /// via TLS. @@ -226,7 +227,13 @@ fn handle_client(client_stream: TcpStream, configuration: &Arc) { } }; - let debug_str = String::from_utf8_lossy(&buffer[..bytes_read]) + let mut command = buffer[..bytes_read].to_vec(); + + for middleware in MIDDLEWARE { + command = middleware(&command); + } + + let debug_str = String::from_utf8_lossy(&command) .replace('\n', "\\n") .replace('\r', "\\r") .replace('\t', "\\t"); -- cgit