Skip to content

Commit bc801ed

Browse files
author
Blake Jacobs
committed
you can now resolve with a list of dns resolvers and port scanning is optional
1 parent 77dcb9f commit bc801ed

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,6 @@ async fn main() -> std::io::Result<()> {
277277
// Define an asynchronous function named `send_url`. It takes in the following parameters:
278278
// - `tx`, a `spmc::Sender<Job>` which is a sender for a single-producer, multi-consumer channel.
279279
// - `ports`, a `String` representing a list of ports.
280-
// - `lines`, a `Vec<String>` representing a list of lines.
281280
// - `rate`, a `u32` representing the rate limit.
282281
async fn send_url(
283282
mut tx: spmc::Sender<Job>,
@@ -322,6 +321,7 @@ async fn send_url(
322321
}
323322
}
324323
} else {
324+
// Create a `Job` struct with the `host` field set to the current line
325325
// and the `ports` field set to the given `ports` string.
326326
let msg = Job {
327327
host: Some(line.to_string().clone()),

src/resolver/mod.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
// Import the necessary libraries
2-
use async_std::net::TcpStream; // Provides functionality for TCP networking
3-
// Rate limiting library
4-
use reqwest::{header::HeaderValue, redirect, Method, Request}; // HTTP client library
2+
use async_std::net::TcpStream; // Import the `TcpStream` struct from the `async_std::net` module to provide functionality for TCP networking
3+
use reqwest::{header::HeaderValue, redirect, Method, Request}; // Import the necessary types from the `reqwest` crate for HTTP client functionality
54
use std::{
6-
error::Error,
7-
net::{IpAddr, SocketAddr},
8-
time::Duration,
9-
}; // Standard library modules for error handling, networking, and time
10-
use tokio::sync::mpsc;
5+
error::Error, // Import the `Error` trait from the `std::error` module for error handling
6+
net::{IpAddr, SocketAddr}, // Import the `IpAddr` and `SocketAddr` structs from the `std::net` module for networking
7+
time::Duration, // Import the `Duration` struct from the `std::time` module for time-related functionality
8+
}; // Import various modules from the standard library for error handling, networking, and time
9+
use tokio::sync::mpsc; // Import the `mpsc` module from the `tokio::sync` crate for multi-producer, single-consumer communication primitives
1110

1211
// Import the `AsyncResolver` struct from the `hickory_resolver` crate
1312
use hickory_resolver::AsyncResolver;
1413

15-
use crate::{Job, JobResult};
14+
use crate::{Job, JobResult}; // Import the `Job` and `JobResult` types from the current crate
1615

1716
// Overall, this function is responsible for running a resolver asynchronously by receiving `Job` objects from the `rx` receiver and using the `resolver` to handle DNS resolution.
1817
pub async fn run_resolver(

0 commit comments

Comments
 (0)