-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
32 lines (25 loc) · 790 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
#include <thread>
#include <string>
#include "include/argh.h"
#include "include/TracerouteRunner.h"
int main(int argc, char** argv) {
argh::parser locate_route(argc, argv);
if(locate_route[{"-h", "--help"}]) {
std::cout << "locateroute - Get location information of the traceroute hops\n\n";
std::cout << "USAGE: \n\t locateroute [ip or domain name]\n";
std::cout << "FLAGS: \n\t -h, --help Display Help\n";
} else {
if(locate_route(1)) {
std::string url = locate_route[1];
auto *t = new TracerouteRunner(url);
std::thread t1(&TracerouteRunner::fetch_results, t);
std::thread t2(&TracerouteRunner::print_output, t);
t1.join();
t2.join();
} else {
std::cout << "Enter ip address or domain name" << std::endl;
}
}
return 0;
}