From 5b132baada7899816ae4c5cc9100906483df92f9 Mon Sep 17 00:00:00 2001 From: PinkP4nther <0x0090@protonmail.com> Date: Thu, 7 Oct 2021 15:33:51 -0700 Subject: [PATCH] Blocking callbacks can now access the handler structure as mutable. v0.4.3. --- Cargo.toml | 2 +- README.md | 2 ++ src/lib.rs | 4 ++-- src/tcp.rs | 1 - 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 279aa77..b2fbb5e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sslrelay" -version = "0.4.2" +version = "0.4.3" authors = ["PinkP4nther @Pink_P4nther"] edition = "2018" description = "A TCP relay library for relaying/modifying/spoofing TCP traffic by implementing callback code." diff --git a/README.md b/README.md index dd20c27..a549960 100644 --- a/README.md +++ b/README.md @@ -22,4 +22,6 @@ Then use this library to continuously rewrite or display decrypted network traff 10/06/2021 | v0.4.2 | Added documentation. +10/07/2021 | v0.4.3 | Blocking callbacks now pass self as a mutable reference. This can allow the developer to create structures that can be accessed every stream write ONLY in the BLOCKING callback. The self object is refreshed per TCP connection. Separate TCP connections can not touch eachothers data. + More updates/ideas to come.. I think.. \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 7c9f8b7..4a527d7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -191,9 +191,9 @@ pub enum CallbackRet { /// Callback functions a user may or may not implement. pub trait HandlerCallbacks { - fn ds_b_callback(&self, _in_data: Vec) -> CallbackRet {CallbackRet::Relay(_in_data)} + fn ds_b_callback(&mut self, _in_data: Vec) -> CallbackRet {CallbackRet::Relay(_in_data)} fn ds_nb_callback(&self, _in_data: Vec){} - fn us_b_callback(&self, _in_data: Vec) -> CallbackRet {CallbackRet::Relay(_in_data)} + fn us_b_callback(&mut self, _in_data: Vec) -> CallbackRet {CallbackRet::Relay(_in_data)} fn us_nb_callback(&self, _in_data: Vec){} } diff --git a/src/tcp.rs b/src/tcp.rs index 1d12d20..99d0592 100644 --- a/src/tcp.rs +++ b/src/tcp.rs @@ -128,7 +128,6 @@ impl {