-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathHosts_embed.go
More file actions
39 lines (23 loc) · 580 Bytes
/
Hosts_embed.go
File metadata and controls
39 lines (23 loc) · 580 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package insights
import "antispam/structs"
import "embed"
import "strings"
//go:embed hosts/*.hosts
var embedded_Hosts embed.FS
func init() {
Hosts = structs.NewHostMap()
files, err1 := embedded_Hosts.ReadDir("hosts")
if err1 == nil {
for _, file := range files {
name := file.Name()
buffer, err2 := embedded_Hosts.ReadFile("hosts/"+name)
if err2 == nil {
lines := strings.Split(strings.TrimSpace(string(buffer)), "\n")
for l := 0; l < len(lines); l++ {
line := strings.TrimSpace(lines[l])
Hosts.AddDomain(line)
}
}
}
}
}