Added Callback return types.

This commit is contained in:
PinkP4nther 2021-09-16 02:11:49 -07:00
commit 953ff1fda5
4 changed files with 82 additions and 20 deletions

View file

@ -22,9 +22,9 @@ pub struct RelayConfig {
}
pub trait HandlerCallbacks {
fn ds_b_callback(&self, _in_data: &mut Vec<u8>){}
fn ds_b_callback(&self, _in_data: Vec<u8>) -> CallbackRet {CallbackRet::Relay(_in_data)}
fn ds_nb_callback(&self, _in_data: Vec<u8>){}
fn us_b_callback(&self, _in_data: &mut Vec<u8>){}
fn us_b_callback(&self, _in_data: Vec<u8>) -> CallbackRet {CallbackRet::Relay(_in_data)}
fn us_nb_callback(&self, _in_data: Vec<u8>){}
}
@ -35,6 +35,14 @@ pub enum ConfigType<T> {
Default,
}
#[derive(Debug)]
pub enum CallbackRet {
Relay(Vec<u8>),// Relay data
Spoof(Vec<u8>),// Skip relaying and send data back
Shutdown,// Shutdown TCP connection
Freeze,// Dont send data (pretend as if stream never was recieved)
}
#[derive(Clone)]
pub struct SSLRelay<H>
where