mirror of
https://github.com/nxtrace/NTrace-core.git
synced 2025-08-12 06:26:39 +00:00
update: 完善table显示,对阿里云、腾讯云内网的识别
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user