MCPcopy Create free account
hub / github.com/V2RaySSR/RealityChecker / extractDomainsFromCSV

Function extractDomainsFromCSV

internal/cmd/csv.go:87–118  ·  view source on GitHub ↗

extractDomainsFromCSV 从CSV记录中提取域名

(records [][]string)

Source from the content-addressed store, hash-verified

85
86// extractDomainsFromCSV 从CSV记录中提取域名
87func extractDomainsFromCSV(records [][]string) []string {
88 var domains []string
89 domainSet := make(map[string]bool) // 用于去重
90
91 // 跳过标题行,从第二行开始处理
92 for i := 1; i < len(records); i++ {
93 if len(records[i]) < 3 {
94 continue
95 }
96
97 certDomain := strings.TrimSpace(records[i][2]) // CERT_DOMAIN列
98 if certDomain == "" {
99 continue
100 }
101
102 // 清理域名(移除引号等)
103 certDomain = strings.Trim(certDomain, "\"")
104
105 // 排除一些不需要的域名
106 if shouldExcludeDomain(certDomain) {
107 continue
108 }
109
110 // 去重
111 if !domainSet[certDomain] {
112 domains = append(domains, certDomain)
113 domainSet[certDomain] = true
114 }
115 }
116
117 return domains
118}
119
120// shouldExcludeDomain 判断是否应该排除某个域名
121func shouldExcludeDomain(domain string) bool {

Callers 1

executeCSVMethod · 0.85

Calls 1

shouldExcludeDomainFunction · 0.85

Tested by

no test coverage detected