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

Function CheckDomainConnectivity

scanner.go:337–354  ·  view source on GitHub ↗

CheckDomainConnectivity 检查域名连通性 - 通过ping域名来测试

(domain string)

Source from the content-addressed store, hash-verified

335
336// CheckDomainConnectivity 检查域名连通性 - 通过ping域名来测试
337func CheckDomainConnectivity(domain string) bool {
338 if !scanControl.PingDomain {
339 return true // 如果未启用连通性测试,默认返回true
340 }
341
342 // 如果传入的是空域名或者是IP地址,则跳过ping测试
343 if domain == "" || net.ParseIP(domain) != nil {
344 return false // 非域名要通过ping来排除
345 }
346
347 // 验证域名格式
348 if !ValidateDomainName(domain) {
349 return false
350 }
351
352 // 使用ping命令测试域名连通性
353 return pingDomain(domain)
354}
355
356// pingDomain 使用ping命令测试域名连通性
357func pingDomain(domain string) bool {

Callers 1

IsRealityFeasibleMethod · 0.85

Calls 2

ValidateDomainNameFunction · 0.85
pingDomainFunction · 0.85

Tested by

no test coverage detected