MCPcopy
hub / github.com/txthinking/brook / ListHasDomain

Function ListHasDomain

list.go:32–61  ·  view source on GitHub ↗
(ds map[string]byte, domain string, c *cache.Cache)

Source from the content-addressed store, hash-verified

30)
31
32func ListHasDomain(ds map[string]byte, domain string, c *cache.Cache) bool {
33 if ds == nil {
34 return false
35 }
36 if c != nil {
37 any, ok := c.Get(domain)
38 if ok {
39 return any.(bool)
40 }
41 }
42 ss := strings.Split(domain, ".")
43 var s1 string
44 for i := len(ss) - 1; i >= 0; i-- {
45 if s1 == "" {
46 s1 = ss[i]
47 } else {
48 s1 = ss[i] + "." + s1
49 }
50 if _, ok := ds[s1]; ok {
51 if c != nil {
52 c.Set(domain, true, 24*time.Hour)
53 }
54 return true
55 }
56 }
57 if c != nil {
58 c.Set(domain, false, 24*time.Hour)
59 }
60 return false
61}
62
63func ListHasIP(c4, c6 []*net.IPNet, i net.IP, c *cache.Cache, geo []string) bool {
64 if c4 == nil && c6 == nil && len(geo) == 0 {

Callers 2

TouchBrookMethod · 0.92
TouchBrookMethod · 0.92

Calls 2

GetMethod · 0.80
SetMethod · 0.80

Tested by

no test coverage detected