Remove debug prints
This commit is contained in:
parent
f5e4a421bb
commit
e9cf447586
5 changed files with 11 additions and 217 deletions
20
src/main.rs
20
src/main.rs
|
|
@ -10,7 +10,7 @@ use policy::CompiledPolicies;
|
|||
use rand::Rng;
|
||||
use realm_syscall::socket2::TcpKeepalive;
|
||||
use regex::bytes::Regex;
|
||||
use std::{io::Write, net::SocketAddr, time::Duration};
|
||||
use std::{net::SocketAddr, time::Duration};
|
||||
use tokio::{
|
||||
io::{AsyncWriteExt, ReadBuf},
|
||||
net::{TcpSocket, TcpStream},
|
||||
|
|
@ -100,25 +100,19 @@ async fn main() {
|
|||
.await
|
||||
.is_err()
|
||||
{
|
||||
println!("peek timeout");
|
||||
// Peek timeout
|
||||
return;
|
||||
}
|
||||
|
||||
let mut stdout = std::io::stdout();
|
||||
stdout.write_all(&buf).unwrap();
|
||||
stdout.flush().unwrap();
|
||||
println!();
|
||||
|
||||
let mut header_line_iter = HeaderLineIterator::new(&buf);
|
||||
let Some(first_line) = header_line_iter.next() else {
|
||||
println!("Not HTTP, or too long line");
|
||||
// Not HTTP, or too long line
|
||||
return;
|
||||
};
|
||||
|
||||
let mut action = config.default_action;
|
||||
for policy_group in policy_groups.iter() {
|
||||
if let Some(policy) = policy_group.evaluate(first_line) {
|
||||
println!("Applying policy {}", policy.name);
|
||||
action = policy.action;
|
||||
break;
|
||||
}
|
||||
|
|
@ -160,12 +154,8 @@ async fn main() {
|
|||
req_ip,
|
||||
config.challenge_timeout,
|
||||
);
|
||||
allow = dbg!(valid_challenge)
|
||||
&& dbg!(challenge::check_challenge(
|
||||
req_challenge,
|
||||
req_proof,
|
||||
TARGET_ZEROS
|
||||
));
|
||||
allow = valid_challenge
|
||||
&& challenge::check_challenge(req_challenge, req_proof, TARGET_ZEROS);
|
||||
}
|
||||
|
||||
if allow {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue