Log action

This commit is contained in:
Pascal Engélibert 2025-04-19 16:29:25 +02:00
commit 0257bdc212
2 changed files with 12 additions and 0 deletions

View file

@ -120,6 +120,7 @@ async fn main() {
for policy_group in policy_groups.iter() {
if let Some(policy) = policy_group.evaluate(first_line) {
action = policy.action;
log::debug!("{} {}", policy.action.to_str(), policy.name);
break;
}
}
@ -169,6 +170,7 @@ async fn main() {
);
}
}
log::debug!(" Challenge={:?}, Allow={:?}", valid_challenge, allow);
if allow {
do_proxy(config.pass_addr, client_stream).await;

View file

@ -19,6 +19,16 @@ impl std::str::FromStr for Action {
}
}
impl Action {
pub fn to_str(self) -> &'static str {
match self {
Action::Allow => "Allow",
Action::Challenge => "Challenge",
Action::Drop => "Drop",
}
}
}
#[derive(Clone, Debug)]
pub struct Policy {
// Will be used when we add log