From e62575beba8d15bc9707f64167661f20d46d3ea3 Mon Sep 17 00:00:00 2001 From: sjlleo Date: Sat, 14 May 2022 08:28:00 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E5=AE=8C=E5=96=84table=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=EF=BC=8C=E5=AF=B9=E9=98=BF=E9=87=8C=E4=BA=91=E3=80=81?= =?UTF-8?q?=E8=85=BE=E8=AE=AF=E4=BA=91=E5=86=85=E7=BD=91=E7=9A=84=E8=AF=86?= =?UTF-8?q?=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- util/printer/tableprinter.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/util/printer/tableprinter.go b/util/printer/tableprinter.go index 14f3993..ed7d57e 100644 --- a/util/printer/tableprinter.go +++ b/util/printer/tableprinter.go @@ -3,6 +3,7 @@ package printer import ( "fmt" "net" + "strings" "github.com/fatih/color" "github.com/rodaine/table" @@ -62,6 +63,24 @@ func tableDataGenerator(v2 methods.TracerouteHop, rdnsenable bool) *rowData { ipStr := v2.Address.String() + if strings.HasPrefix(ipStr, "9.") { + return &rowData{ + Hop: int64(v2.TTL), + IP: ipStr, + Latency: lantency, + Country: "局域网", + Owner: "腾讯云", + } + } else if strings.HasPrefix(ipStr, "11.") { + return &rowData{ + Hop: int64(v2.TTL), + IP: ipStr, + Latency: lantency, + Country: "局域网", + Owner: "阿里云", + } + } + // TODO: 判断 err 返回,并且在CLI终端提示错误 if dataOrigin == "LeoMoeAPI" { iPGeoData, err = ipgeo.LeoIP(ipStr)