This commit is contained in:
2025-08-15 20:15:49 +02:00
parent fa985a69c5
commit 918898558a
4 changed files with 25 additions and 18 deletions
+3 -5
View File
@@ -1,15 +1,13 @@
use std::io::{Read, Write};
use rustls::Stream;
pub mod server;
pub mod tls;
pub fn request(gateway: &str, addr: &str) -> String {
// Send a request to the gateway and provide the IP address and request
let (mut conn, mut tcp) = tls::mask_tls(gateway).unwrap();
let mut tls = Stream::new(&mut conn, &mut tcp);
tls.write_all(format!("ROUTE {addr}").as_bytes()).unwrap();
let mut tls = rustls::Stream::new(&mut conn, &mut tcp);
tls.write_all(format!("ROUTE {addr}\nGET / HTTP/1.1").as_bytes())
.unwrap();
let mut resp = Vec::new();
tls.read_to_end(&mut resp).unwrap();
String::from_utf8_lossy(&resp).to_string()