MCPcopy Create free account
hub / github.com/PuerNya/git-proxy / loadDomainListData

Function loadDomainListData

main.go:389–418  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

387}
388
389func loadDomainListData() error {
390 reader, err := NewFileReader(domainListPath)
391 if err != nil {
392 return err
393 }
394 var domainList []string
395 var needBreak bool
396 for {
397 if needBreak {
398 break
399 }
400 select {
401 case <-reader.CloseSignal:
402 needBreak = true
403 continue
404 case line := <-reader.LineChan:
405 if net.ParseIP(line) != nil {
406 continue
407 }
408 domainList = append(domainList, line)
409 }
410 }
411 if len(domainList) > 0 {
412 AcceptDomain = domainList
413 log.Info("Custom accept domain list loaded")
414 } else {
415 log.Warn("Custom accept domain list is empty")
416 }
417 return nil
418}
419
420func loadBlackList() (*fswatch.Watcher, error) {
421 err := loadBlackListData()

Callers 1

loadDomainListFunction · 0.85

Calls 1

NewFileReaderFunction · 0.85

Tested by

no test coverage detected