Added Callback return types.
This commit is contained in:
parent
32d5555004
commit
953ff1fda5
4 changed files with 82 additions and 20 deletions
12
src/lib.rs
12
src/lib.rs
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue