Compare commits

...

4 Commits

Author SHA1 Message Date
github-actions
62119247b2 Update README.md with new tag v0.0.5-20250517095024
Some checks failed
创建IPv6检测的前缀 / fetch-ipv6-prefixes (push) Has been cancelled
2025-05-17 09:50:25 +00:00
spiritlhl
d98eb4a823
fix: 追踪失败时不再进行ASN解析 2025-05-17 17:44:31 +08:00
spiritlhl
dc1df70982
fix: 追踪失败时不再进行ASN解析 2025-05-17 17:44:07 +08:00
spiritlhl
92f4236606
fix: 修复错误的调用 2025-05-17 17:42:24 +08:00
3 changed files with 5 additions and 3 deletions

View File

@ -74,7 +74,7 @@ rm -rf /usr/bin/backtrace
## 在Golang中使用
```
go get github.com/oneclickvirt/backtrace@v0.0.5-20250413040820
go get github.com/oneclickvirt/backtrace@v0.0.5-20250517095024
```
## 概览图

View File

@ -70,6 +70,7 @@ 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

View File

@ -85,15 +85,16 @@ 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.Ipv4Names[i], "v4"); len(tryAltIPs) > 0 {
if tryAltIPs := tryAlternativeIPs(model.Ipv6Names[i], "v6"); len(tryAltIPs) > 0 {
for _, altIP := range tryAltIPs {
if model.EnableLoger {
Logger.Info(fmt.Sprintf("尝试备选IP %s 追踪 %s", altIP, model.Ipv4Names[i]))
Logger.Info(fmt.Sprintf("尝试备选IP %s 追踪 %s", altIP, model.Ipv6Names[i]))
}
hops, err = Trace(net.ParseIP(altIP))
if err == nil && len(hops) > 0 {