update
Some checks failed
ci/woodpecker/push/build Pipeline failed

This commit is contained in:
JMARyA 2024-12-29 20:13:15 +01:00
parent f657a61d55
commit 4ce2a0ceaf
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
7 changed files with 83 additions and 21 deletions

18
src/blacklist.rs Normal file
View file

@ -0,0 +1,18 @@
pub fn check_blacklist(domain: &str) -> bool {
let blacklist_raw = std::env::var("BLACKLIST_DOMAINS").unwrap_or_default();
if blacklist_raw.is_empty() {
return false;
}
let blacklist: Vec<&str> = blacklist_raw.split(',').collect();
for domain_regex in blacklist {
let rgx = regex::Regex::new(domain_regex).unwrap();
if rgx.is_match(domain) {
return true;
}
}
return false;
}