Update go module name

This commit is contained in:
zhshch2002
2022-05-11 20:38:11 +08:00
parent 6898e5d727
commit 53d16b74aa
4 changed files with 265 additions and 273 deletions

6
go.mod
View File

@@ -1,10 +1,10 @@
module traceroute
module github.com/xgadget-lab/nexttrace
go 1.18
require (
github.com/google/gopacket v1.1.19
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4
)
require golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005 // indirect
require golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect

12
go.sum
View File

@@ -6,17 +6,13 @@ golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPI
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 h1:b0LrWgu8+q7z4J+0Y3Umo5q1dL7NXBkKBWkaVkAq17E=
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA=
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005 h1:pDMpM2zh2MT0kHy037cKlSby2nEhD50SYqwQk76Nm40=
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

510
main.go
View File

@@ -1,43 +1,43 @@
package main
import (
"traceroute/methods"
"traceroute/methods/tcp"
"traceroute/methods/udp"
"os"
"net"
"time"
"fmt"
"net/http"
"io/ioutil"
"encoding/json"
"strconv"
"flag"
"strings"
"encoding/json"
"flag"
"fmt"
"github.com/xgadget-lab/nexttrace/methods"
"github.com/xgadget-lab/nexttrace/methods/tcp"
"github.com/xgadget-lab/nexttrace/methods/udp"
"io/ioutil"
"net"
"net/http"
"os"
"strconv"
"strings"
"time"
)
type IPGeoData struct {
Asnumber string `json:"asnumber"`
Country string `json:"country"`
Prov string `json:"prov"`
City string `json:"city"`
Country string `json:"country"`
Prov string `json:"prov"`
City string `json:"city"`
District string `json:"district"`
Owner string `json:"owner"`
Isp string `json:"isp"`
Owner string `json:"owner"`
Isp string `json:"isp"`
}
type IPInSightData struct {
IP string `json:"ip"`
Version string `json:"version"`
IsEuropeanUnion bool `json:"is_european_union"`
ContinentCode string `json:"continent_code"`
IddCode string `json:"idd_code"`
CountryCode string `json:"country_code"`
CountryName string `json:"country_name"`
RegionName string `json:"region_name"`
CityName string `json:"city_name"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
IP string `json:"ip"`
Version string `json:"version"`
IsEuropeanUnion bool `json:"is_european_union"`
ContinentCode string `json:"continent_code"`
IddCode string `json:"idd_code"`
CountryCode string `json:"country_code"`
CountryName string `json:"country_name"`
RegionName string `json:"region_name"`
CityName string `json:"city_name"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
}
type IPSBData struct {
@@ -78,286 +78,282 @@ var parallelRequests = flag.Int("r", 18, "Set ParallelRequests number. It should
var maxHops = flag.Int("m", 30, "Set the max number of hops (max TTL to be reached).")
var dataOrigin = flag.String("d", "LeoMoeAPI", "Choose IP Geograph Data Provider [LeoMoeAPI, IP.SB, IPInfo, IPInsight]")
func main() {
fmt.Println("NextTrace v0.0.5 Alpha \nOwO Organiztion Leo (leo.moe) & Vincent (vincent.moe)")
ip := domainLookUp(flagApply())
fmt.Println("NextTrace v0.0.5 Alpha \nOwO Organiztion Leo (leo.moe) & Vincent (vincent.moe)")
ip := domainLookUp(flagApply())
fmt.Println("IP Geo Data Provider: " + *dataOrigin)
fmt.Println("IP Geo Data Provider: " + *dataOrigin)
if (ip.String() == flagApply()) {
fmt.Printf("traceroute to %s, 30 hops max, 32 byte packets\n", ip.String())
} else {
fmt.Printf("traceroute to %s (%s), 30 hops max, 32 byte packets\n", ip.String(), flagApply())
}
if ip.String() == flagApply() {
fmt.Printf("traceroute to %s, 30 hops max, 32 byte packets\n", ip.String())
} else {
fmt.Printf("traceroute to %s (%s), 30 hops max, 32 byte packets\n", ip.String(), flagApply())
}
if (*tcpSYNFlag) {
tcpTraceroute := tcp.New(ip, methods.TracerouteConfig{
MaxHops: uint16(*maxHops),
NumMeasurements: uint16(*numMeasurements),
ParallelRequests: uint16(*parallelRequests),
Port: *port,
Timeout: time.Second / 2,
})
res, _ := tcpTraceroute.Start()
if *tcpSYNFlag {
tcpTraceroute := tcp.New(ip, methods.TracerouteConfig{
MaxHops: uint16(*maxHops),
NumMeasurements: uint16(*numMeasurements),
ParallelRequests: uint16(*parallelRequests),
Port: *port,
Timeout: time.Second / 2,
})
res, _ := tcpTraceroute.Start()
traceroutePrinter(ip, res)
} else {
if (*port == 80) {
*port = 53
}
udpTraceroute := udp.New(ip, true, methods.TracerouteConfig{
MaxHops: uint16(*maxHops),
NumMeasurements: uint16(*numMeasurements),
ParallelRequests: uint16(*parallelRequests),
Port: *port,
Timeout: 2 * time.Second,
})
res, _ := udpTraceroute.Start()
traceroutePrinter(ip, res)
} else {
if *port == 80 {
*port = 53
}
udpTraceroute := udp.New(ip, true, methods.TracerouteConfig{
MaxHops: uint16(*maxHops),
NumMeasurements: uint16(*numMeasurements),
ParallelRequests: uint16(*parallelRequests),
Port: *port,
Timeout: 2 * time.Second,
})
res, _ := udpTraceroute.Start()
traceroutePrinter(ip, res)
}
traceroutePrinter(ip, res)
}
}
func traceroutePrinter(ip net.IP, res *map[uint16][]methods.TracerouteHop) {
hopIndex := uint16(1)
for ; hopIndex <= 29 ; {
for k,v := range *res {
if (k == hopIndex) {
fmt.Print(k)
for _,v2 := range v {
ch := make(chan uint16)
go hopPrinter(hopIndex, ip, v2, ch)
hopIndex = <- ch
}
hopIndex = hopIndex + 1
break
}
}
}
hopIndex := uint16(1)
for hopIndex <= 29 {
for k, v := range *res {
if k == hopIndex {
fmt.Print(k)
for _, v2 := range v {
ch := make(chan uint16)
go hopPrinter(hopIndex, ip, v2, ch)
hopIndex = <-ch
}
hopIndex = hopIndex + 1
break
}
}
}
}
func flagApply() string{
flag.Parse()
ipArg := flag.Args()
if (flag.NArg() != 1) {
fmt.Println("Args Error\nUsage : ./bettertrace [-T] [-d <dataOrigin> ] [ -m <hops> ] [ -p <port> ] [ -q <probes> ] [ -r <parallelrequests> ] <hostname>")
os.Exit(2)
}
return ipArg[0]
func flagApply() string {
flag.Parse()
ipArg := flag.Args()
if flag.NArg() != 1 {
fmt.Println("Args Error\nUsage : ./bettertrace [-T] [-d <dataOrigin> ] [ -m <hops> ] [ -p <port> ] [ -q <probes> ] [ -r <parallelrequests> ] <hostname>")
os.Exit(2)
}
return ipArg[0]
}
func getIPGeoByIPInfo(ip string, c chan IPGeoData) {
resp, err := http.Get("https://ipinfo.io/" + ip + "?token=42764a944dabd0")
if err != nil {
fmt.Println(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
iPInfoData := &IPInfoData{}
err = json.Unmarshal(body,&iPInfoData)
if err != nil {
fmt.Println(err)
}
ipGeoData := IPGeoData{
Country: iPInfoData.Country,
City: iPInfoData.City,
Prov: iPInfoData.Region}
resp, err := http.Get("https://ipinfo.io/" + ip + "?token=42764a944dabd0")
if err != nil {
fmt.Println(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
c <- ipGeoData
iPInfoData := &IPInfoData{}
err = json.Unmarshal(body, &iPInfoData)
if err != nil {
fmt.Println(err)
}
ipGeoData := IPGeoData{
Country: iPInfoData.Country,
City: iPInfoData.City,
Prov: iPInfoData.Region}
c <- ipGeoData
}
func getIPGeoByIPSB(ip string, c chan IPGeoData) {
resp, err := http.Get("https://api.ip.sb/geoip/" + ip)
if err != nil {
fmt.Println(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
iPSBData := &IPSBData{}
err = json.Unmarshal(body,&iPSBData)
if err != nil {
fmt.Println("您当前出口IP被IP.SB视为风控IP请求被拒绝")
c <- IPGeoData{}
}
resp, err := http.Get("https://api.ip.sb/geoip/" + ip)
if err != nil {
fmt.Println(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
ipGeoData := IPGeoData{
Asnumber: strconv.Itoa(iPSBData.Asn),
Isp: iPSBData.Isp,
Country: iPSBData.Country,
City: iPSBData.City,
Prov: iPSBData.Region}
iPSBData := &IPSBData{}
err = json.Unmarshal(body, &iPSBData)
c <- ipGeoData
if err != nil {
fmt.Println("您当前出口IP被IP.SB视为风控IP请求被拒绝")
c <- IPGeoData{}
}
ipGeoData := IPGeoData{
Asnumber: strconv.Itoa(iPSBData.Asn),
Isp: iPSBData.Isp,
Country: iPSBData.Country,
City: iPSBData.City,
Prov: iPSBData.Region}
c <- ipGeoData
}
func getIPGeoByIPInsight(ip string, c chan IPGeoData) {
resp, err := http.Get("https://ipinsight.io/query?ip=" + ip)
if err != nil {
fmt.Println(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
iPInSightData := &IPInSightData{}
err = json.Unmarshal(body,&iPInSightData)
if err != nil {
fmt.Println(err)
}
ipGeoData := IPGeoData{
Country: iPInSightData.CountryName,
City: iPInSightData.CityName,
Prov: iPInSightData.RegionName}
resp, err := http.Get("https://ipinsight.io/query?ip=" + ip)
if err != nil {
fmt.Println(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
c <- ipGeoData
iPInSightData := &IPInSightData{}
err = json.Unmarshal(body, &iPInSightData)
if err != nil {
fmt.Println(err)
}
ipGeoData := IPGeoData{
Country: iPInSightData.CountryName,
City: iPInSightData.CityName,
Prov: iPInSightData.RegionName}
c <- ipGeoData
}
func getIPGeo(ip string, c chan IPGeoData) {
resp, err := http.Get("https://api.leo.moe/ip/?ip=" + ip)
if err != nil {
fmt.Println(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
ipGeoData := IPGeoData{}
err = json.Unmarshal(body,&ipGeoData)
if err != nil {
fmt.Println(err)
}
c <- ipGeoData
resp, err := http.Get("https://api.leo.moe/ip/?ip=" + ip)
if err != nil {
fmt.Println(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
ipGeoData := IPGeoData{}
err = json.Unmarshal(body, &ipGeoData)
if err != nil {
fmt.Println(err)
}
c <- ipGeoData
}
func domainLookUp(host string) net.IP {
ips, err := net.LookupIP(host)
if (err != nil) {
fmt.Println("Domain" + host + "Lookup Fail.")
os.Exit(1)
}
var ipSlice = []net.IP{}
ips, err := net.LookupIP(host)
if err != nil {
fmt.Println("Domain" + host + "Lookup Fail.")
os.Exit(1)
}
for _, ip := range ips {
ipSlice = append(ipSlice, ip)
}
if (len(ipSlice) == 1) {
return ipSlice[0]
} else {
fmt.Println("Please Choose the IP You Want To TraceRoute")
for i, ip := range ipSlice {
fmt.Printf("%d. %s\n",i, ip)
}
var index int
fmt.Printf("Your Option: ")
fmt.Scanln(&index)
if (index >= len(ipSlice) || index < 0) {
fmt.Println("Your Option is invalid")
os.Exit(3)
}
return ipSlice[index]
}
var ipSlice = []net.IP{}
for _, ip := range ips {
ipSlice = append(ipSlice, ip)
}
if len(ipSlice) == 1 {
return ipSlice[0]
} else {
fmt.Println("Please Choose the IP You Want To TraceRoute")
for i, ip := range ipSlice {
fmt.Printf("%d. %s\n", i, ip)
}
var index int
fmt.Printf("Your Option: ")
fmt.Scanln(&index)
if index >= len(ipSlice) || index < 0 {
fmt.Println("Your Option is invalid")
os.Exit(3)
}
return ipSlice[index]
}
}
func hopPrinter(hopIndex uint16, ip net.IP, v2 methods.TracerouteHop, c chan uint16) {
if (v2.Address == nil) {
fmt.Println("\t*")
} else {
ip_str := fmt.Sprintf("%s", v2.Address)
if v2.Address == nil {
fmt.Println("\t*")
} else {
ip_str := fmt.Sprintf("%s", v2.Address)
ptr, err := net.LookupAddr(ip_str)
ptr, err := net.LookupAddr(ip_str)
ch_b := make(chan IPGeoData)
ch_b := make(chan IPGeoData)
if (*dataOrigin == "LeoMoeAPI") {
go getIPGeo(ip_str, ch_b)
if *dataOrigin == "LeoMoeAPI" {
go getIPGeo(ip_str, ch_b)
} else if (*dataOrigin == "IP.SB") {
go getIPGeoByIPSB(ip_str, ch_b)
} else if *dataOrigin == "IP.SB" {
go getIPGeoByIPSB(ip_str, ch_b)
} else if (*dataOrigin == "IPInfo") {
go getIPGeoByIPInfo(ip_str, ch_b)
} else if *dataOrigin == "IPInfo" {
go getIPGeoByIPInfo(ip_str, ch_b)
} else if (*dataOrigin == "IPInsight") {
go getIPGeoByIPInsight(ip_str, ch_b)
} else if *dataOrigin == "IPInsight" {
go getIPGeoByIPInsight(ip_str, ch_b)
} else {
go getIPGeo(ip_str, ch_b)
}
iPGeoData := <-ch_b
} else {
go getIPGeo(ip_str, ch_b)
}
if (ip.String() == ip_str) {
hopIndex = 30
iPGeoData.Owner = iPGeoData.Isp
}
iPGeoData := <-ch_b
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
return
}
if ip.String() == ip_str {
hopIndex = 30
iPGeoData.Owner = iPGeoData.Isp
}
if (strings.Index(ip_str, "11.13.") == 0) {
fmt.Printf("\t%-15s %.2fms * 局域网, 阿里云\n", v2.Address, v2.RTT.Seconds()*1000)
c <- hopIndex
return
}
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
return
}
if strings.Index(ip_str, "11.13.") == 0 {
fmt.Printf("\t%-15s %.2fms * 局域网, 阿里云\n", v2.Address, v2.RTT.Seconds()*1000)
c <- hopIndex
return
}
if iPGeoData.Owner == "" {
iPGeoData.Owner = iPGeoData.Isp
}
if (iPGeoData.Owner == "") {
iPGeoData.Owner = iPGeoData.Isp
}
if iPGeoData.Asnumber == "" {
iPGeoData.Asnumber = "*"
} else {
iPGeoData.Asnumber = "AS" + iPGeoData.Asnumber
}
if (iPGeoData.Asnumber == "") {
iPGeoData.Asnumber = "*"
} else {
iPGeoData.Asnumber = "AS" + iPGeoData.Asnumber
}
if iPGeoData.District != "" {
iPGeoData.City = iPGeoData.City + ", " + iPGeoData.District
}
if (iPGeoData.District != "") {
iPGeoData.City = iPGeoData.City + ", " + iPGeoData.District
}
if iPGeoData.Country == "" {
fmt.Printf("\t%-15s %.2fms * 局域网\n", v2.Address, v2.RTT.Seconds()*1000)
c <- hopIndex
return
}
if (iPGeoData.Country == "") {
fmt.Printf("\t%-15s %.2fms * 局域网\n", v2.Address, v2.RTT.Seconds()*1000)
c <- hopIndex
return
}
if iPGeoData.Prov != "" && iPGeoData.City == "" {
// Province Only
if err != nil {
fmt.Printf("\t%-15s %.2fms %s %s, %s, %s\n", v2.Address, v2.RTT.Seconds()*1000, iPGeoData.Asnumber, iPGeoData.Country, iPGeoData.Prov, iPGeoData.Owner)
} else {
fmt.Printf("\t%-15s (%s) %.2fms %s %s, %s, %s\n", ptr[0], v2.Address, v2.RTT.Seconds()*1000, iPGeoData.Asnumber, iPGeoData.Country, iPGeoData.Prov, iPGeoData.Owner)
}
} else if iPGeoData.Prov == "" && iPGeoData.City == "" {
if (iPGeoData.Prov != "" && iPGeoData.City == "") {
// Province Only
if err != nil {
fmt.Printf("\t%-15s %.2fms %s %s, %s, %s\n",v2.Address, v2.RTT.Seconds()*1000, iPGeoData.Asnumber, iPGeoData.Country, iPGeoData.Prov, iPGeoData.Owner)
} else {
fmt.Printf("\t%-15s (%s) %.2fms %s %s, %s, %s\n",ptr[0], v2.Address, v2.RTT.Seconds()*1000, iPGeoData.Asnumber, iPGeoData.Country, iPGeoData.Prov, iPGeoData.Owner)
}
} else if (iPGeoData.Prov == "" && iPGeoData.City == "") {
if err != nil {
fmt.Printf("\t%-15s %.2fms %s %s, %s, %s 骨干网\n", v2.Address, v2.RTT.Seconds()*1000, iPGeoData.Asnumber, iPGeoData.Country, iPGeoData.Owner, iPGeoData.Owner)
} else {
fmt.Printf("\t%-15s (%s) %.2fms %s %s, %s, %s 骨干网\n", ptr[0], v2.Address, v2.RTT.Seconds()*1000, iPGeoData.Asnumber, iPGeoData.Country, iPGeoData.Owner, iPGeoData.Owner)
}
} else {
if err != nil {
fmt.Printf("\t%-15s %.2fms %s %s, %s, %s 骨干网\n",v2.Address, v2.RTT.Seconds()*1000, iPGeoData.Asnumber, iPGeoData.Country, iPGeoData.Owner, iPGeoData.Owner)
} else {
fmt.Printf("\t%-15s (%s) %.2fms %s %s, %s, %s 骨干网\n",ptr[0], v2.Address, v2.RTT.Seconds()*1000, iPGeoData.Asnumber, iPGeoData.Country, iPGeoData.Owner, iPGeoData.Owner)
}
} else {
if err != nil {
fmt.Printf("\t%-15s %.2fms %s %s, %s, %s, %s\n",v2.Address, v2.RTT.Seconds()*1000, iPGeoData.Asnumber, iPGeoData.Country, iPGeoData.Prov, iPGeoData.City, iPGeoData.Owner)
} else {
fmt.Printf("\t%-15s (%s) %.2fms %s %s, %s, %s, %s\n",ptr[0], v2.Address, v2.RTT.Seconds()*1000, iPGeoData.Asnumber, iPGeoData.Country, iPGeoData.Prov, iPGeoData.City, iPGeoData.Owner)
}
}
}
c <- hopIndex
if err != nil {
fmt.Printf("\t%-15s %.2fms %s %s, %s, %s, %s\n", v2.Address, v2.RTT.Seconds()*1000, iPGeoData.Asnumber, iPGeoData.Country, iPGeoData.Prov, iPGeoData.City, iPGeoData.Owner)
} else {
fmt.Printf("\t%-15s (%s) %.2fms %s %s, %s, %s, %s\n", ptr[0], v2.Address, v2.RTT.Seconds()*1000, iPGeoData.Asnumber, iPGeoData.Country, iPGeoData.Prov, iPGeoData.City, iPGeoData.Owner)
}
}
}
c <- hopIndex
}

View File

@@ -3,11 +3,11 @@ package tcp
import (
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
"traceroute/listener_channel"
"traceroute/methods"
"traceroute/parallel_limiter"
"traceroute/signal"
"traceroute/util"
"github.com/xgadget-lab/nexttrace/listener_channel"
"github.com/xgadget-lab/nexttrace/methods"
"github.com/xgadget-lab/nexttrace/parallel_limiter"
"github.com/xgadget-lab/nexttrace/signal"
"github.com/xgadget-lab/nexttrace/util"
"golang.org/x/net/context"
"golang.org/x/net/icmp"
"golang.org/x/net/ipv4"