mirror of
https://github.com/YGGverse/htcount.git
synced 2026-03-31 17:15:37 +00:00
fix ignore-host filter
This commit is contained in:
parent
4cb9e816fd
commit
976c11410f
1 changed files with 8 additions and 5 deletions
13
src/main.rs
13
src/main.rs
|
|
@ -37,19 +37,22 @@ fn main() -> anyhow::Result<()> {
|
||||||
|
|
||||||
let mut index: HashMap<String, usize> = HashMap::with_capacity(argument.capacity);
|
let mut index: HashMap<String, usize> = HashMap::with_capacity(argument.capacity);
|
||||||
|
|
||||||
for line in reader.lines() {
|
'l: for line in reader.lines() {
|
||||||
let host = line?
|
let host = line?
|
||||||
.split_whitespace()
|
.split_whitespace()
|
||||||
.next()
|
.next()
|
||||||
.map(|s| s.into())
|
.map(|s| s.into())
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
if argument.ignore_host.contains(&host) {
|
for h in &argument.ignore_host {
|
||||||
if is_debug_d {
|
if h == &host {
|
||||||
debug::info(format!("Host `{host}` ignored by settings"))
|
if is_debug_d {
|
||||||
|
debug::info(format!("Host `{h}` ignored by settings"))
|
||||||
|
}
|
||||||
|
continue 'l;
|
||||||
}
|
}
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
index.entry(host).and_modify(|c| *c += 1).or_insert(1);
|
index.entry(host).and_modify(|c| *c += 1).or_insert(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue