update: 完善table显示,对阿里云、腾讯云内网的识别

This commit is contained in:
sjlleo
2022-05-14 08:28:00 +08:00
parent d92a1e10d3
commit e62575beba

View File

@@ -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)