aboutsummaryrefslogtreecommitdiff
path: root/src/proxy.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/proxy.rs')
-rw-r--r--src/proxy.rs9
1 files changed, 8 insertions, 1 deletions
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<Proxy>) {
}
};
- 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");