diff --git a/src/main.rs b/src/main.rs index ea31c87..a121ace 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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; diff --git a/src/policy.rs b/src/policy.rs index 914c1cb..1074b2b 100644 --- a/src/policy.rs +++ b/src/policy.rs @@ -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