This commit is contained in:
nora 2023-09-24 15:32:07 +02:00
parent a81438e7e3
commit 8f212576e5
3 changed files with 374 additions and 355 deletions

View file

@ -3,9 +3,11 @@ pub mod proto;
use std::{
fmt::Debug,
io::{self, BufWriter, Read, Write},
net::{TcpStream, ToSocketAddrs},
net::TcpStream,
};
use crate::proto::TLSPlaintext;
type Result<T, E = Error> = std::result::Result<T, E>;
pub struct ClientConnection {}
@ -54,7 +56,12 @@ impl ClientSetupConnection {
println!("hello!");
let out = proto::TLSPlaintext::read(stream.get_mut())?;
dbg!(out);
dbg!(&out);
if matches!(out, TLSPlaintext::Handshake { handshake } if handshake.is_hello_retry_request())
{
println!("hello retry request, the server doesnt like us :(");
}
// let res: proto::TLSPlaintext = proto::Value::read(&mut stream.get_mut())?;
// dbg!(res);
@ -76,7 +83,6 @@ pub enum ErrorKind {
impl From<io::Error> for Error {
fn from(value: io::Error) -> Self {
panic!("io error: {value}");
Self {
kind: ErrorKind::Io(value),
}
@ -85,7 +91,6 @@ impl From<io::Error> for Error {
impl From<ErrorKind> for Error {
fn from(value: ErrorKind) -> Self {
panic!("error: {value:?}");
Self { kind: value }
}
}