Skip to content

Commit

Permalink
update: 优化逻辑,废弃 realtime 参数
Browse files Browse the repository at this point in the history
  • Loading branch information
sjlleo committed May 27, 2022
1 parent a42c5e3 commit f320fd6
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -105,25 +104,14 @@ func main() {
log.Fatalln(err)
}

if *routePath {
// 如果为TCP SYN,也打印路由跟踪结果
if *tcpSYNFlag {
printer.TracerouteTablePrinter(res)
}
r := reporter.New(res, ip.String())
r.Print()
return
}

if m == trace.ICMPTrace && *tablePrint {
if (*tcpSYNFlag && *udpPackageFlag) || *tablePrint {
printer.TracerouteTablePrinter(res)
} else if *tcpSYNFlag || *udpPackageFlag {
printer.TraceroutePrinter(res)
}

if m == trace.TCPTrace || m == trace.UDPTrace {
if *realtimePrint {
printer.TraceroutePrinter(res)
} else {
printer.TracerouteTablePrinter(res)
}
if *routePath {
r := reporter.New(res, ip.String())
r.Print()
}
}

0 comments on commit f320fd6

Please sign in to comment.