parent
f657a61d55
commit
4ce2a0ceaf
7 changed files with 83 additions and 21 deletions
18
src/blacklist.rs
Normal file
18
src/blacklist.rs
Normal 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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue