add proxy support

This commit is contained in:
sad 2024-03-11 22:14:29 -06:00
parent e20cb7e996
commit d74d8184c3
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG Key ID: 28D3A882F3E6AD02

View File

@ -62,35 +62,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("Error establishing TLS connection: {}", e); println!("Error establishing TLS connection: {}", e);
} }
} }
//handler(tls_stream, config).await.unwrap();
}, },
Err(e) => { Err(e) => {
println!("Error connecting to proxy: {}", e); println!("Error connecting to proxy: {}", e);
} }
} }
//let tls_stream = tls_exec(&config, tcp_stream).await
//handler(tls_stream, config).await.unwrap();
} else { } else {
let tcp_stream = TcpStream::connect(server).await.expect("Error connecting to server"); let tcp_stream = TcpStream::connect(server).await.expect("Error connecting to server");
let tls_stream = tls_exec(&config, tcp_stream).await.expect("Error establishing TLS connection"); let tls_stream = tls_exec(&config, tcp_stream).await.expect("Error establishing TLS connection");
handler(tls_stream, config).await.unwrap(); handler(tls_stream, config).await.unwrap();
} }
//let tcp_stream = TcpStream::connect(format!("{}:{}", config.server, config.port)).await;
//println!("Connected to {}!", format!("{}:{}", config.server, config.port).green());
//println!("Establishing TLS connection...");
//if let Ok(tcp_stream) = TcpStream::connect(format!("{}:{}", config.server, config.port)).await {
// println!("TCP connection established!");
// let mut tls_stream = tls_exec(&config, Some(tcp_stream)).await.unwrap();
// println!("TLS connection established!");
// tls_stream.flush().await.unwrap();
//} else {
// println!("TCP connection failed!");
//};
//let mut tls_stream = tls_exec(&config, Some(tcp_stream.unwrap())).await.unwrap();
//println!("TLS connection established!");
//tls_stream.flush().await.unwrap();
//handler(tls_stream, config).await.unwrap();
} else { } else {
println!("Non-SSL connection not implemented."); println!("Non-SSL connection not implemented.");
} }
@ -135,8 +116,6 @@ async fn proxy_exec(config: &Config) -> Result<TcpStream, Box<dyn std::error::Er
}; };
let tcp_stream = tcp_stream.into_inner(); let tcp_stream = tcp_stream.into_inner();
// ok(tcp_stream)
//Ok(tcp_stream<TcpStream>)
Ok(tcp_stream) Ok(tcp_stream)
} }