From a74e6c177e0c92582f3d50c882e8fee4b6d18fca Mon Sep 17 00:00:00 2001 From: spiritlhl <103393591+spiritLHLS@users.noreply.github.com> Date: Tue, 5 Aug 2025 17:14:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8C=BA=E5=88=86=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E6=8E=A5=E5=85=A5=E5=92=8C=E9=97=B4=E6=8E=A5=E6=8E=A5=E5=85=A5?= =?UTF-8?q?=E7=9A=84Tier1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bgptools/pop.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/bgptools/pop.go b/bgptools/pop.go index ef54bc5..9e38074 100644 --- a/bgptools/pop.go +++ b/bgptools/pop.go @@ -42,19 +42,16 @@ type PoPResult struct { Result string } -// retryConfig 重试配置 type retryConfig struct { maxRetries int timeouts []time.Duration } -// 默认重试配置:3次重试,超时时间分别为3s、4s、5s var defaultRetryConfig = retryConfig{ maxRetries: 2, timeouts: []time.Duration{5 * time.Second, 6 * time.Second}, } -// executeWithRetry 执行带重试的HTTP请求 func executeWithRetry(client *req.Client, url string, config retryConfig) (*req.Response, error) { var lastErr error for attempt := 0; attempt < config.maxRetries; attempt++ { @@ -88,10 +85,12 @@ func getISPAbbr(asn, name string) string { func getISPType(asn string, tier1 bool, direct bool) string { switch { - case tier1 && model.Tier1Global[asn] != "": + case tier1 && direct && model.Tier1Global[asn] != "": return "Tier1 Global" - case model.Tier1Regional[asn] != "": + case tier1 && direct && model.Tier1Regional[asn] != "": return "Tier1 Regional" + case tier1 && !direct: + return "Tier1 Indirect" case model.Tier2[asn] != "": return "Tier2" case model.ContentProviders[asn] != "": @@ -343,7 +342,6 @@ func GetPoPInfo(ip string) (*PoPResult, error) { if ip == "" { return nil, fmt.Errorf("IP address cannot be empty") } - svgPath, err := getSVGPath(ip) if err != nil { return nil, fmt.Errorf("获取SVG路径失败: %w", err)