Structured example folder
This commit is contained in:
parent
a879755865
commit
556c396727
3 changed files with 2 additions and 2 deletions
|
|
@ -6,4 +6,4 @@ edition = "2018"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
sslrelay = {path = "../SSLRelay-lib"}
|
sslrelay = {path = "../../"}
|
||||||
|
|
|
||||||
44
examples/basic/src/main.rs
Normal file
44
examples/basic/src/main.rs
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
use sslrelay::{self, ConfigType, HandlerCallbacks};
|
||||||
|
|
||||||
|
|
||||||
|
// Handler object
|
||||||
|
struct Handler;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Callback traits that can be used to read or inject data
|
||||||
|
into data upstream or downstream.
|
||||||
|
*/
|
||||||
|
impl HandlerCallbacks for Handler {
|
||||||
|
|
||||||
|
// Request non blocking callback
|
||||||
|
fn req_nb_callback(&self, _in_data: Vec<u8>) {
|
||||||
|
println!("[+] Request Non Blocking CallBack!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Request blocking callback
|
||||||
|
fn req_b_callback(&self, _in_data: &mut Vec<u8>) {
|
||||||
|
println!("[+] Request Blocking CallBack!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Response non blocking callback
|
||||||
|
fn res_nb_callback(&self, _in_data: Vec<u8>) {
|
||||||
|
println!("[+] Response Non Blocking CallBack!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Response blocking callback
|
||||||
|
fn res_b_callback(&self, _in_data: &mut Vec<u8>) {
|
||||||
|
println!("[+] Response Blocking CallBack!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
|
||||||
|
// Create new SSLRelay object
|
||||||
|
let mut relay = sslrelay::SSLRelay::new(Handler);
|
||||||
|
|
||||||
|
// Load Configuration
|
||||||
|
relay.load_config(ConfigType::Default);
|
||||||
|
|
||||||
|
// Start listening
|
||||||
|
relay.start();
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue