summaryrefslogtreecommitdiff
path: root/prober
diff options
context:
space:
mode:
authorMDK <[email protected]>2023-06-26 15:58:04 +0800
committerMDK <[email protected]>2023-06-26 15:58:04 +0800
commit38be845348f138b70b7a6e6f623bdfbc7a918171 (patch)
treef4f68979aeab4c0fa7b8c74c3c3f66e0abc3554e /prober
parentb59fbce07cef9ae72e8d1f2804f58de2c1fa8d4f (diff)
finish upstream subcommand
Diffstat (limited to 'prober')
-rw-r--r--prober/rdns_prober.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/prober/rdns_prober.go b/prober/rdns_prober.go
index 08d500c..8fae0e3 100644
--- a/prober/rdns_prober.go
+++ b/prober/rdns_prober.go
@@ -24,8 +24,7 @@ func retrieve_ip(pool chan string, filename string) {
cnt := 0
f, err := os.Open(filename)
if err != nil {
- fmt.Printf("cannot open file %s\n", filename)
- return
+ panic(err)
}
fmt.Println("sending msg ...")
reader := bufio.NewReader(f)
@@ -104,7 +103,7 @@ func store_data(pool chan Data, wg *sync.WaitGroup) {
wg.Done()
}
-func Get_upstream_file(filename string, prober_num int) {
+func Get_upstream_file(filename string, output string, prober_num int) {
dataset = map[string][]string{}
ip_pool := make(chan string, 500)
data_pool := make(chan Data, 200)
@@ -117,7 +116,7 @@ func Get_upstream_file(filename string, prober_num int) {
probe_tasks.Wait()
close(data_pool)
store_task.Wait()
- utils.OutputJSON(dataset)
+ utils.OutputJSON(dataset, output)
}
func Get_upstream_ip(ip string) {
@@ -129,5 +128,5 @@ func Get_upstream_ip(ip string) {
temp = append(temp, rdns)
}
dataset[data.target] = temp
- utils.OutputJSON(dataset)
+ utils.OutputJSON(dataset, "-")
}