fix: delay

This commit is contained in:
Larvan2 2024-01-21 23:37:22 +08:00
parent c64e1a005e
commit dccab90843

View File

@ -181,13 +181,20 @@ func convertProxies(proxies []C.Proxy, uiSubtitlePattern *regexp2.Regexp) []*Pro
} }
} }
} }
testURL := "https://www.gstatic.com/generate_204"
for k := range p.ExtraDelayHistories() {
if len(k) > 0 {
testURL = k
break
}
}
result = append(result, &Proxy{ result = append(result, &Proxy{
Name: name, Name: name,
Title: strings.TrimSpace(title), Title: strings.TrimSpace(title),
Subtitle: strings.TrimSpace(subtitle), Subtitle: strings.TrimSpace(subtitle),
Type: p.Type().String(), Type: p.Type().String(),
Delay: int(p.LastDelayForTestUrl("https://www.gstatic.com/generate_204")), Delay: int(p.LastDelayForTestUrl(testURL)),
}) })
} }
return result return result
@ -213,12 +220,20 @@ func collectProviders(providers []provider.ProxyProvider, uiSubtitlePattern *reg
} }
} }
testURL := "https://www.gstatic.com/generate_204"
for k := range px.ExtraDelayHistories() {
if len(k) > 0 {
testURL = k
break
}
}
result = append(result, &Proxy{ result = append(result, &Proxy{
Name: name, Name: name,
Title: strings.TrimSpace(title), Title: strings.TrimSpace(title),
Subtitle: strings.TrimSpace(subtitle), Subtitle: strings.TrimSpace(subtitle),
Type: px.Type().String(), Type: px.Type().String(),
Delay: int(px.LastDelayForTestUrl("https://www.gstatic.com/generate_204")), Delay: int(px.LastDelayForTestUrl(testURL)),
}) })
} }
} }