compile but not works propertly

This commit is contained in:
2022-09-19 22:22:09 +02:00
commit 8266ef59e0
36 changed files with 938 additions and 0 deletions

31
src/main.rs Normal file
View File

@@ -0,0 +1,31 @@
use std::net::{TcpListener, TcpStream};
use std::io::prelude::*;
mod client;
fn main() {
let listener = TcpListener::bind("127.0.0.1:25567").unwrap();
let mut buf: [u8; 128] = [1; 128];
for stream in listener.incoming() {
//stream.unwrap().write(buf);
match stream {
Ok(mut stream) => {
/*println!("Go!");
stream.write("test succes/n".as_bytes());
stream.read(&mut buf);
stream.flush();*/
println!("Go!");
let leng = stream.read(&mut buf).unwrap();
buf[(buf[0]-1) as usize] += 2;
let mut sstream = TcpStream::connect("127.0.0.1:25565").unwrap();
sstream.write(&buf[.. leng]);
let c1 = client::Client::new(stream,sstream, &buf);
c1.to_string();
c1.start_proxy().0.join();
c1.start_proxy().1.join();
},
Err(_e) => println!("{}",_e),
}
}
}