From 80a75288d217155b9a35055dfd8f0fedbe6bbcd6 Mon Sep 17 00:00:00 2001 From: tsosunchia <59512455+tsosunchia@users.noreply.github.com> Date: Thu, 2 Jun 2022 20:38:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B1=E4=BA=8E9.0.0.0/8=20=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A11.0.0.0/8=E5=A4=A7=E9=87=8F=E7=94=A8=E4=BA=8E?= =?UTF-8?q?=E5=85=B6=E4=BB=96IDC=E4=B8=9A=E5=8A=A1=EF=BC=8C=E5=9B=A0?= =?UTF-8?q?=E6=AD=A4=E6=B8=85=E9=99=A4=E7=89=B9=E6=AE=8A=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- printer/printer.go | 6 +++--- printer/tableprinter.go | 11 ++++++----- trace/temp_printer.go | 6 +++--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/printer/printer.go b/printer/printer.go index 7fe30cf..2474027 100644 --- a/printer/printer.go +++ b/printer/printer.go @@ -52,11 +52,11 @@ func formatIpGeoData(ip string, data *ipgeo.IPGeoData) string { // TODO: 判断阿里云和腾讯云内网,数据不足,有待进一步完善 // TODO: 移动IDC判断到Hop.fetchIPData函数,减少API调用 if strings.HasPrefix(ip, "9.") { - res = append(res, "局域网", "腾讯云") + res = append(res, "LAN Address", "") } else if strings.HasPrefix(ip, "11.") { - res = append(res, "局域网", "阿里云") + res = append(res, "LAN Address", "") } else if data.Country == "" { - res = append(res, "局域网") + res = append(res, "LAN Address") } else { // 有些IP的归属信息为空,这个时候将ISP的信息填入 if data.Owner == "" { diff --git a/printer/tableprinter.go b/printer/tableprinter.go index 46c748b..7708b02 100644 --- a/printer/tableprinter.go +++ b/printer/tableprinter.go @@ -2,9 +2,10 @@ package printer import ( "fmt" - "github.com/xgadget-lab/nexttrace/ipgeo" "strings" + "github.com/xgadget-lab/nexttrace/ipgeo" + "github.com/xgadget-lab/nexttrace/trace" "github.com/fatih/color" @@ -73,16 +74,16 @@ func tableDataGenerator(h trace.Hop) *rowData { Hop: fmt.Sprint(h.TTL), IP: IP, Latency: lantency, - Country: "局域网", - Owner: "腾讯云", + Country: "LAN Address", + Owner: "", } } else if strings.HasPrefix(IP, "11.") { return &rowData{ Hop: fmt.Sprint(h.TTL), IP: IP, Latency: lantency, - Country: "局域网", - Owner: "阿里云", + Country: "LAN Address", + Owner: "", } } diff --git a/trace/temp_printer.go b/trace/temp_printer.go index d067adf..752b350 100644 --- a/trace/temp_printer.go +++ b/trace/temp_printer.go @@ -39,11 +39,11 @@ func formatIpGeoData(ip string, data *ipgeo.IPGeoData) string { // TODO: 判断阿里云和腾讯云内网,数据不足,有待进一步完善 // TODO: 移动IDC判断到Hop.fetchIPData函数,减少API调用 if strings.HasPrefix(ip, "9.") { - res = append(res, "局域网", "腾讯云") + res = append(res, "LAN Address", "") } else if strings.HasPrefix(ip, "11.") { - res = append(res, "局域网", "阿里云") + res = append(res, "LAN Address", "") } else if data.Country == "" { - res = append(res, "局域网") + res = append(res, "LAN Address") } else { // 有些IP的归属信息为空,这个时候将ISP的信息填入 if data.Owner == "" {