mirror of
https://github.com/oneclickvirt/backtrace.git
synced 2025-06-07 12:04:47 +08:00
Compare commits
No commits in common. "62119247b2c2d92505d77145ab7688495606fdbe" and "ca7c0f4a06f14151f925032b2ea2aec3fa08112f" have entirely different histories.
62119247b2
...
ca7c0f4a06
@ -74,7 +74,7 @@ rm -rf /usr/bin/backtrace
|
||||
## 在Golang中使用
|
||||
|
||||
```
|
||||
go get github.com/oneclickvirt/backtrace@v0.0.5-20250517095024
|
||||
go get github.com/oneclickvirt/backtrace@v0.0.5-20250413040820
|
||||
```
|
||||
|
||||
## 概览图
|
||||
|
@ -70,7 +70,6 @@ func trace(ch chan Result, i int) {
|
||||
Logger.Error(fmt.Sprintf("追踪 %s (%s) 失败: %v", model.Ipv4Names[i], model.Ipv4s[i], err))
|
||||
}
|
||||
ch <- Result{i, s}
|
||||
return
|
||||
}
|
||||
asns := extractIpv4ASNsFromHops(hops, model.EnableLoger)
|
||||
// 如果没有找到ASN,尝试备选IP
|
||||
|
@ -85,16 +85,15 @@ func traceIPv6(ch chan Result, i int, offset int) {
|
||||
Logger.Warn(fmt.Sprintf("%s (%s) 检测不到回程路由节点的IP地址", model.Ipv6Names[i], model.Ipv6s[i]))
|
||||
}
|
||||
ch <- Result{i + offset, s}
|
||||
return
|
||||
}
|
||||
asns := extractIpv6ASNsFromHops(hops, model.EnableLoger)
|
||||
// 如果没有找到ASN,尝试备选IP
|
||||
if len(asns) == 0 {
|
||||
// 尝试从IcmpTargets获取备选IP
|
||||
if tryAltIPs := tryAlternativeIPs(model.Ipv6Names[i], "v6"); len(tryAltIPs) > 0 {
|
||||
if tryAltIPs := tryAlternativeIPs(model.Ipv4Names[i], "v4"); len(tryAltIPs) > 0 {
|
||||
for _, altIP := range tryAltIPs {
|
||||
if model.EnableLoger {
|
||||
Logger.Info(fmt.Sprintf("尝试备选IP %s 追踪 %s", altIP, model.Ipv6Names[i]))
|
||||
Logger.Info(fmt.Sprintf("尝试备选IP %s 追踪 %s", altIP, model.Ipv4Names[i]))
|
||||
}
|
||||
hops, err = Trace(net.ParseIP(altIP))
|
||||
if err == nil && len(hops) > 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user