release 0.1.1

This commit is contained in:
wyhaya
2019-12-04 16:55:06 +08:00
parent eca31fec3e
commit d424098fdf
4 changed files with 17 additions and 16 deletions

12
Cargo.lock generated
View File

@@ -2,7 +2,7 @@
# It is not intended for manual editing.
[[package]]
name = "ace"
version = "0.0.2"
version = "0.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -540,7 +540,7 @@ dependencies = [
[[package]]
name = "tokio"
version = "0.2.1"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bytes 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -578,13 +578,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "updns"
version = "0.1.1"
dependencies = [
"ace 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ace 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -626,7 +626,7 @@ dependencies = [
]
[metadata]
"checksum ace 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e021d9548a20c4e74f88b5cff290ba225565e3404afcffdc6b275395128a140"
"checksum ace 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "42d6302f03bbae8544fb07d9ab94bfbe2a5dbaadc857749d9fad959b55f13069"
"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d"
"checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee"
"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba"
@@ -693,7 +693,7 @@ dependencies = [
"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f"
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
"checksum tokio 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "beeef686ef92a222de07e089f455d9f8478bbba9651718f9e4b276babe829082"
"checksum tokio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2e765bf9f550bd9b8a970633ca3b56b8120c4b6c5dcbe26a93744cb02fee4b17"
"checksum tokio-macros 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d5795a71419535c6dcecc9b6ca95bdd3c2d6142f7e8343d7beb9923f129aa87e"
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"

View File

@@ -18,10 +18,10 @@ keywords = [
]
[dependencies]
ace = "0.0.2"
ace = "0.0.3"
dirs = "2.0.2"
futures = "0.3.1"
lazy_static = "1.4.0"
regex = "1.3.1"
time = "0.1.42"
tokio = {version = "0.2.1", features = ["fs", "io-util", "macros", "net", "stream", "time"]}
tokio = {version = "0.2.2", features = ["fs", "io-util", "macros", "net", "stream", "time"]}

View File

@@ -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 {

View File

@@ -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