mirror of
https://github.com/oneclickvirt/backtrace.git
synced 2025-06-06 03:24:46 +08:00
Compare commits
4 Commits
ca7c0f4a06
...
62119247b2
Author | SHA1 | Date | |
---|---|---|---|
![]() |
62119247b2 | ||
![]() |
d98eb4a823 | ||
![]() |
dc1df70982 | ||
![]() |
92f4236606 |
@ -74,7 +74,7 @@ rm -rf /usr/bin/backtrace
|
|||||||
## 在Golang中使用
|
## 在Golang中使用
|
||||||
|
|
||||||
```
|
```
|
||||||
go get github.com/oneclickvirt/backtrace@v0.0.5-20250413040820
|
go get github.com/oneclickvirt/backtrace@v0.0.5-20250517095024
|
||||||
```
|
```
|
||||||
|
|
||||||
## 概览图
|
## 概览图
|
||||||
|
@ -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))
|
Logger.Error(fmt.Sprintf("追踪 %s (%s) 失败: %v", model.Ipv4Names[i], model.Ipv4s[i], err))
|
||||||
}
|
}
|
||||||
ch <- Result{i, s}
|
ch <- Result{i, s}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
asns := extractIpv4ASNsFromHops(hops, model.EnableLoger)
|
asns := extractIpv4ASNsFromHops(hops, model.EnableLoger)
|
||||||
// 如果没有找到ASN,尝试备选IP
|
// 如果没有找到ASN,尝试备选IP
|
||||||
|
@ -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]))
|
Logger.Warn(fmt.Sprintf("%s (%s) 检测不到回程路由节点的IP地址", model.Ipv6Names[i], model.Ipv6s[i]))
|
||||||
}
|
}
|
||||||
ch <- Result{i + offset, s}
|
ch <- Result{i + offset, s}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
asns := extractIpv6ASNsFromHops(hops, model.EnableLoger)
|
asns := extractIpv6ASNsFromHops(hops, model.EnableLoger)
|
||||||
// 如果没有找到ASN,尝试备选IP
|
// 如果没有找到ASN,尝试备选IP
|
||||||
if len(asns) == 0 {
|
if len(asns) == 0 {
|
||||||
// 尝试从IcmpTargets获取备选IP
|
// 尝试从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 {
|
for _, altIP := range tryAltIPs {
|
||||||
if model.EnableLoger {
|
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))
|
hops, err = Trace(net.ParseIP(altIP))
|
||||||
if err == nil && len(hops) > 0 {
|
if err == nil && len(hops) > 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user