release 0.1.1
This commit is contained in:
@@ -80,6 +80,9 @@ impl Hosts {
|
||||
}
|
||||
|
||||
// domain match
|
||||
const TEXT: &str = "abcdefghijklmnopqrstuvwxyz0123456789-.";
|
||||
const WILDCARD: &str = "abcdefghijklmnopqrstuvwxyz0123456789-.*";
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Host(MatchMode);
|
||||
|
||||
@@ -107,13 +110,11 @@ impl Host {
|
||||
}
|
||||
|
||||
fn is_text(domain: &str) -> bool {
|
||||
const ALLOW: &str = "abcdefghijklmnopqrstuvwxyz0123456789-.";
|
||||
domain.chars().all(|item| ALLOW.chars().any(|c| item == c))
|
||||
domain.chars().all(|item| TEXT.chars().any(|c| item == c))
|
||||
}
|
||||
|
||||
fn is_wildcard(domain: &str) -> bool {
|
||||
const ALLOW: &str = "abcdefghijklmnopqrstuvwxyz0123456789-.*";
|
||||
domain.chars().all(|item| ALLOW.chars().any(|c| item == c))
|
||||
domain.chars().all(|item| WILDCARD.chars().any(|c| item == c))
|
||||
}
|
||||
|
||||
pub fn is_match(&self, domain: &str) -> bool {
|
||||
|
||||
@@ -40,10 +40,10 @@ impl Watch {
|
||||
return true;
|
||||
}
|
||||
} else if a.is_err() && b.is_err() {
|
||||
let left = a.as_ref().err().unwrap();
|
||||
let right = b.as_ref().err().unwrap();
|
||||
if left.kind() == right.kind() && left.raw_os_error() == right.raw_os_error() {
|
||||
return true;
|
||||
if let (Some(left), Some(right)) = (a.as_ref().err(), b.as_ref().err()) {
|
||||
if left.kind() == right.kind() && left.raw_os_error() == right.raw_os_error() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
false
|
||||
|
||||
Reference in New Issue
Block a user