added client type reporting and detection for the servers and clients to
handle different client types differently in the future.
This commit is contained in:
1 parent
9b29c20c7e
commit
2fefa8daa8
3 files changed
+24
-4
No files matched your search
@@ -37,6 +37,7 @@ pub struct Client {
|
||||
last_check: Instant,
|
||||
remove: bool,
|
||||
name: String,
|
||||
victim: bool,
|
||||
}
|
||||
|
||||
pub struct Server {
|
||||
@@ -184,6 +185,12 @@ where
|
||||
}
|
||||
let msg = String::from_utf8_lossy(&buf[..n]);
|
||||
if msg.contains("HELLO") {
|
||||
let mut victim = false;
|
||||
if let Some((_, ctype)) = msg.split_once("|") {
|
||||
if ctype.contains("victim") {
|
||||
victim = true;
|
||||
}
|
||||
}
|
||||
let mut connected = false;
|
||||
let mut id = 0;
|
||||
if let Ok(mut lock) = server.lock() {
|
||||
@@ -200,6 +207,7 @@ where
|
||||
last_check: Instant::now(),
|
||||
remove: false,
|
||||
name: String::new(),
|
||||
victim,
|
||||
};
|
||||
connected = true;
|
||||
id = new_client.id.clone();
|
||||
|
||||
Reference in new issue
Block a user