New configuration method. Version 0.6.0. Examples updated to new configuration method. Configuration files removed.
This commit is contained in:
parent
32645a48c3
commit
61217ed351
8 changed files with 91 additions and 160 deletions
|
|
@ -1,4 +1,4 @@
|
|||
use sslrelay::{self, ConfigType, RelayConfig, HandlerCallbacks, CallbackRet, TCPDataType};
|
||||
use sslrelay::{self, RelayConfig, HandlerCallbacks, CallbackRet, TCPDataType, TLSConfig};
|
||||
|
||||
// Handler object
|
||||
#[derive(Clone)] // Must have Clone trait implemented.
|
||||
|
|
@ -38,17 +38,20 @@ fn main() {
|
|||
// Create new SSLRelay object
|
||||
let mut relay = sslrelay::SSLRelay::new(
|
||||
Handler,
|
||||
ConfigType::Conf(RelayConfig {
|
||||
RelayConfig {
|
||||
downstream_data_type: TCPDataType::TLS,
|
||||
upstream_data_type: TCPDataType::TLS,
|
||||
bind_host: "0.0.0.0".to_string(),
|
||||
bind_port: "443".to_string(),
|
||||
remote_host: "remote.com".to_string(),
|
||||
remote_port: "443".to_string(),
|
||||
ssl_private_key_path: Some("./remote.com.key".to_string()),
|
||||
ssl_cert_path: Some("./remote.com.crt".to_string()),
|
||||
})
|
||||
tls_config: TLSConfig::FILE{
|
||||
certificate_path: "./tls.crt".to_string(),
|
||||
private_key_path: "./tls.key".to_string(),
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
// Start listening
|
||||
relay.start();
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
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"
|
||||
downstream_data_type = "tls"
|
||||
upstream_data_type = "tls"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
use sslrelay::{self, ConfigType, HandlerCallbacks, CallbackRet};
|
||||
use sslrelay::{self, TLSConfig, TCPDataType, RelayConfig, HandlerCallbacks, CallbackRet};
|
||||
|
||||
// Handler object
|
||||
#[derive(Clone)] // Must have Clone trait implemented.
|
||||
|
|
@ -38,7 +38,21 @@ impl HandlerCallbacks for Handler {
|
|||
fn main() {
|
||||
|
||||
// Create new SSLRelay object
|
||||
let mut relay = sslrelay::SSLRelay::new(Handler, ConfigType::Default);
|
||||
let mut relay = sslrelay::SSLRelay::new(
|
||||
Handler,
|
||||
RelayConfig {
|
||||
downstream_data_type: TCPDataType::TLS,
|
||||
upstream_data_type: TCPDataType::TLS,
|
||||
bind_host: "0.0.0.0".to_string(),
|
||||
bind_port: "443".to_string(),
|
||||
remote_host: "remote.com".to_string(),
|
||||
remote_port: "443".to_string(),
|
||||
tls_config: TLSConfig::FILE{
|
||||
certificate_path: "./tls.crt".to_string(),
|
||||
private_key_path: "./tls.key".to_string(),
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
// Start listening
|
||||
relay.start();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue