@@ -27,8 +27,8 @@ func RealtimePrinter(res *trace.Result, ttl int) {
27
27
multiWriter := io .MultiWriter (os .Stdout , f )
28
28
log .SetOutput (multiWriter )
29
29
log .SetFlags (0 )
30
- var res_str string
31
- res_str += fmt .Sprintf ("%-2d " , ttl + 1 )
30
+ var resStr string
31
+ resStr += fmt .Sprintf ("%-2d " , ttl + 1 )
32
32
33
33
// 去重
34
34
var latestIP string
@@ -56,28 +56,28 @@ func RealtimePrinter(res *trace.Result, ttl int) {
56
56
}
57
57
58
58
if latestIP == "" {
59
- res_str += fmt .Sprintf ("%s\n " , "*" )
60
- log .Print (res_str )
59
+ resStr += fmt .Sprintf ("%s\n " , "*" )
60
+ log .Print (resStr )
61
61
return
62
62
}
63
63
64
64
var blockDisplay = false
65
65
for ip , v := range tmpMap {
66
66
if blockDisplay {
67
- res_str += fmt .Sprintf ("%4s" , "" )
67
+ resStr += fmt .Sprintf ("%4s" , "" )
68
68
}
69
69
if net .ParseIP (ip ).To4 () == nil {
70
- res_str += fmt .Sprintf ("%-25s " , ip )
70
+ resStr += fmt .Sprintf ("%-25s " , ip )
71
71
} else {
72
- res_str += fmt .Sprintf ("%-15s " , ip )
72
+ resStr += fmt .Sprintf ("%-15s " , ip )
73
73
}
74
74
75
75
i , _ := strconv .Atoi (v [0 ])
76
76
77
77
if res.Hops [ttl ][i ].Geo .Asnumber != "" {
78
- res_str += fmt .Sprintf ("AS%-7s" , res.Hops [ttl ][i ].Geo .Asnumber )
78
+ resStr += fmt .Sprintf ("AS%-7s" , res.Hops [ttl ][i ].Geo .Asnumber )
79
79
} else {
80
- res_str += fmt .Sprintf (" %-8s" , "*" )
80
+ resStr += fmt .Sprintf (" %-8s" , "*" )
81
81
}
82
82
83
83
if net .ParseIP (ip ).To4 () != nil {
@@ -89,7 +89,7 @@ func RealtimePrinter(res *trace.Result, ttl int) {
89
89
if whoisFormat [0 ] != "" {
90
90
whoisFormat [0 ] = "[" + whoisFormat [0 ] + "]"
91
91
}
92
- res_str += fmt .Sprintf ("%-16s" , whoisFormat [0 ])
92
+ resStr += fmt .Sprintf ("%-16s" , whoisFormat [0 ])
93
93
}
94
94
95
95
if res.Hops [ttl ][i ].Geo .Country == "" {
@@ -98,19 +98,19 @@ func RealtimePrinter(res *trace.Result, ttl int) {
98
98
99
99
if net .ParseIP (ip ).To4 () != nil {
100
100
101
- res_str += fmt .Sprintf (" %s %s %s %s %-6s\n %-39s " , res.Hops [ttl ][i ].Geo .Country , res.Hops [ttl ][i ].Geo .Prov , res.Hops [ttl ][i ].Geo .City , res.Hops [ttl ][i ].Geo .District , res.Hops [ttl ][i ].Geo .Owner , res.Hops [ttl ][i ].Hostname )
101
+ resStr += fmt .Sprintf (" %s %s %s %s %-6s\n %-39s " , res.Hops [ttl ][i ].Geo .Country , res.Hops [ttl ][i ].Geo .Prov , res.Hops [ttl ][i ].Geo .City , res.Hops [ttl ][i ].Geo .District , res.Hops [ttl ][i ].Geo .Owner , res.Hops [ttl ][i ].Hostname )
102
102
} else {
103
- res_str += fmt .Sprintf (" %s %s %s %s %-6s\n %-35s " , res.Hops [ttl ][i ].Geo .Country , res.Hops [ttl ][i ].Geo .Prov , res.Hops [ttl ][i ].Geo .City , res.Hops [ttl ][i ].Geo .District , res.Hops [ttl ][i ].Geo .Owner , res.Hops [ttl ][i ].Hostname )
103
+ resStr += fmt .Sprintf (" %s %s %s %s %-6s\n %-35s " , res.Hops [ttl ][i ].Geo .Country , res.Hops [ttl ][i ].Geo .Prov , res.Hops [ttl ][i ].Geo .City , res.Hops [ttl ][i ].Geo .District , res.Hops [ttl ][i ].Geo .Owner , res.Hops [ttl ][i ].Hostname )
104
104
}
105
105
106
106
for j := 1 ; j < len (v ); j ++ {
107
107
if len (v ) == 2 || j == 1 {
108
- res_str += v [j ]
108
+ resStr += v [j ]
109
109
} else {
110
- res_str += fmt .Sprintf ("/ %s" , v [j ])
110
+ resStr += fmt .Sprintf ("/ %s" , v [j ])
111
111
}
112
112
}
113
- log .Print (res_str )
113
+ log .Print (resStr )
114
114
blockDisplay = true
115
115
}
116
116
}
0 commit comments