Code Upload
This commit is contained in:
commit
a879755865
9 changed files with 949 additions and 0 deletions
9
examples/basic/Cargo.toml
Normal file
9
examples/basic/Cargo.toml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[package]
|
||||
name = "basic"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
sslrelay = {path = "../SSLRelay-lib"}
|
||||
44
examples/basic/main.rs
Normal file
44
examples/basic/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();
|
||||
}
|
||||
7
examples/basic/relay_config.toml
Normal file
7
examples/basic/relay_config.toml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
bind_host = "0.0.0.0"
|
||||
bind_port = "443"
|
||||
ssl_private_key_path = "./remote.com.key"
|
||||
ssl_cert_path = "./remote.com.crt"
|
||||
remote_host = "remote.com"
|
||||
remote_port = "443"
|
||||
verbose_level = "2"
|
||||
Loading…
Add table
Add a link
Reference in a new issue