update: 优化逻辑,废弃 realtime 参数

This commit is contained in:
sjlleo
2022-05-27 21:27:26 +08:00
parent a42c5e3734
commit 2239942bb7

24
main.go
View File

@@ -25,7 +25,6 @@ var maxHops = fSet.Int("m", 30, "Set the max number of hops (max TTL to be reach
var dataOrigin = fSet.String("d", "LeoMoeAPI", "Choose IP Geograph Data Provider [LeoMoeAPI, IP.SB, IPInfo, IPInsight, IPAPI.com]")
var rdnsenable = fSet.Bool("rdns", false, "Set whether rDNS will be display")
var routePath = fSet.Bool("report", false, "Route Path")
var realtimePrint = fSet.Bool("realtime", false, "Output trace results in runtime")
var tablePrint = fSet.Bool("table", false, "Output trace results as table")
var ver = fSet.Bool("V", false, "Check Version")
@@ -105,25 +104,14 @@ func main() {
log.Fatalln(err)
}
if (*tcpSYNFlag && *udpPackageFlag) || *tablePrint {
printer.TracerouteTablePrinter(res)
} else if *tcpSYNFlag || *udpPackageFlag {
printer.TraceroutePrinter(res)
}
if *routePath {
// 如果为TCP SYN也打印路由跟踪结果
if *tcpSYNFlag {
printer.TracerouteTablePrinter(res)
}
r := reporter.New(res, ip.String())
r.Print()
return
}
if m == trace.ICMPTrace && *tablePrint {
printer.TracerouteTablePrinter(res)
}
if m == trace.TCPTrace || m == trace.UDPTrace {
if *realtimePrint {
printer.TraceroutePrinter(res)
} else {
printer.TracerouteTablePrinter(res)
}
}
}