MCPcopy Index your code
hub / github.com/MengMengCode/GetRealityDomain / DetectCDN

Function DetectCDN

scanner.go:312–334  ·  view source on GitHub ↗

DetectCDN 检测是否使用CDN(通用实现)

(domain string)

Source from the content-addressed store, hash-verified

310
311// DetectCDN 检测是否使用CDN(通用实现)
312func DetectCDN(domain string) bool {
313 // 首先检测Cloudflare
314 if DetectCloudflareCDN(domain) {
315 return true
316 }
317
318 // 常见CDN提供商的标识
319 cdnProviders := []string{
320 "cloudflare", "amazonaws", "fastly", "maxcdn", "keycdn",
321 "jsdelivr", "unpkg", "cdnjs", "bootstrapcdn", "fontawesome",
322 "akamai", "edgecast", "chinacache", "qiniu", "upyun",
323 }
324
325 // 简单的域名匹配检测
326 lowerDomain := strings.ToLower(domain)
327 for _, provider := range cdnProviders {
328 if strings.Contains(lowerDomain, provider) {
329 return true
330 }
331 }
332
333 return false
334}
335
336// CheckDomainConnectivity 检查域名连通性 - 通过ping域名来测试
337func CheckDomainConnectivity(domain string) bool {

Callers

nothing calls this directly

Calls 1

DetectCloudflareCDNFunction · 0.85

Tested by

no test coverage detected