mirror of
https://github.com/edu4rdshl/rusolver.git
synced 2026-07-17 23:24:55 +00:00
Performance improvement.
DNS queries with a dot [.] at the end of the domain are cheaper, this small but significant change results in an important performance improvement. Signed-off-by: Edu4rdSHL <edu4rdshl@protonmail.com>
This commit is contained in:
parent
41e80a944b
commit
5d0443a678
1 changed files with 24 additions and 21 deletions
15
src/main.rs
15
src/main.rs
|
|
@ -158,13 +158,15 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
buffer.lines().map(str::to_owned).collect()
|
||||
};
|
||||
|
||||
futures::stream::iter(hosts.into_iter().map(|host| {
|
||||
let resolver_fut = resolvers.ipv4_lookup(host.clone());
|
||||
let trustable_resolver_fut = trustable_resolver.ipv4_lookup(host.clone());
|
||||
stream::iter(hosts)
|
||||
.map(|host| {
|
||||
let resolver_fut = resolvers.ipv4_lookup(host.clone() + ".");
|
||||
let trustable_resolver_fut = trustable_resolver.ipv4_lookup(host.clone() + ".");
|
||||
let wildcard_ips = wildcard_ips.clone();
|
||||
|
||||
async move {
|
||||
if let Ok(ip) = resolver_fut.await {
|
||||
let mut ips = HashSet::new();
|
||||
if let Ok(ip) = resolver_fut.await {
|
||||
if disable_double_check {
|
||||
ips = ip
|
||||
.into_iter()
|
||||
|
|
@ -176,17 +178,18 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
.map(|x| x.to_string())
|
||||
.collect::<HashSet<String>>();
|
||||
}
|
||||
}
|
||||
if show_ip_adress && !ips.iter().all(|ip| wildcard_ips.contains(ip)) {
|
||||
println!("{};{:?}", host, ips)
|
||||
} else if !ips.iter().all(|ip| wildcard_ips.contains(ip)) {
|
||||
println!("{}", host)
|
||||
}
|
||||
}
|
||||
}
|
||||
}))
|
||||
})
|
||||
.buffer_unordered(threads)
|
||||
.collect::<Vec<()>>()
|
||||
.await;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue