From 82493dda4373d520a607f908ac51b6196f4330d4 Mon Sep 17 00:00:00 2001 From: sjlleo Date: Fri, 13 May 2022 12:06:45 +0800 Subject: [PATCH] =?UTF-8?q?Update:=20=E6=B7=BB=E5=8A=A0TODO=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- util/printer/printer.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/util/printer/printer.go b/util/printer/printer.go index e4e0579..d0c6fca 100644 --- a/util/printer/printer.go +++ b/util/printer/printer.go @@ -38,6 +38,7 @@ func hopPrinter(hopIndex uint16, ip net.IP, v2 methods.TracerouteHop, c chan uin ptr, err := net.LookupAddr(ip_str) + // TODO: 判断 err 返回,并且在CLI终端提示错误 if dataOrigin == "LeoMoeAPI" { iPGeoData, _ = ipgeo.LeoIP(ip_str) } else if dataOrigin == "IP.SB" { @@ -58,6 +59,7 @@ func hopPrinter(hopIndex uint16, ip net.IP, v2 methods.TracerouteHop, c chan uin iPGeoData.Owner = iPGeoData.Isp } + // TODO: 判断阿里云和腾讯云内网,数据不足,有待进一步完善 if strings.Index(ip_str, "9.31.") == 0 || strings.Index(ip_str, "11.72.") == 0 { fmt.Printf("\t%-15s %.2fms * 局域网, 腾讯云\n", v2.Address, v2.RTT.Seconds()*1000) c <- hopIndex @@ -90,6 +92,7 @@ func hopPrinter(hopIndex uint16, ip net.IP, v2 methods.TracerouteHop, c chan uin return } + // TODO: if嵌套太多,很多重复判断,代码有待优化 if iPGeoData.Prov != "" && iPGeoData.City == "" { // Province Only if err != nil {