adds ability to read hosts.txt if no file is specified on the command line, using defaults if hosts.txt is missing
This commit is contained in:
+9
-2
@@ -21,7 +21,6 @@ const SECONDS_IN_MINUTE: u32 = 60;
|
||||
const SECONDS_IN_HOUR: u32 = SECONDS_IN_MINUTE * 60;
|
||||
const SECONDS_IN_DAY: u32 = SECONDS_IN_HOUR * 24;
|
||||
|
||||
|
||||
pub fn duration_to_string(to_convert: Duration) -> String {
|
||||
let mut total_seconds = to_convert.as_secs() as u32;
|
||||
let mut working_string = String::new();
|
||||
@@ -169,7 +168,15 @@ impl PPState {
|
||||
let settings = AppSettings::parse();
|
||||
|
||||
print!("Prep to load targets...");
|
||||
let mut targets = PPState::build_targets_from_file(settings.ping_host_file);
|
||||
let file_to_check = match settings.ping_host_file {
|
||||
None => {
|
||||
PathBuf::from("./hosts.txt")
|
||||
}
|
||||
Some(actual) => {
|
||||
actual
|
||||
}
|
||||
};
|
||||
let mut targets = PPState::build_targets_from_file(Some(file_to_check));
|
||||
|
||||
// channel to send requests to ping
|
||||
let (ping_response_sender, ping_response_listener) = mpsc::channel::<PingResult>();
|
||||
|
||||
Reference in New Issue
Block a user