Ver Fonte

Update to generate a zone

Signed-off-by: Antoine Tenart <antoine.tenart@ack.tf>
Antoine Tenart há 5 anos atrás
pai
commit
96ac444c4a
1 ficheiros alterados com 14 adições e 10 exclusões
  1. 14 10
      main.go

+ 14 - 10
main.go

@@ -14,22 +14,31 @@ var (
 		"https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts",
 		"https://mirror1.malwaredomains.com/files/justdomains",
 		"http://sysctl.org/cameleon/hosts",
-		"https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist",
 		"https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt",
 		"https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt",
 		"https://hosts-file.net/ad_servers.txt",
+		"https://raw.github.com/r4vi/block-the-eu-cookie-shit-list/master/filterlist.txt",
 	}
-
 	invalid = []string{
 		"localhost", "localhost.localdomain", "local", "broadcasthost",
 		"ip6-localhost", "ip6-loopback", "ip6-localnet",
 		"ip6-mcastprefix", "ip6-allnodes", "ip6-allrouters",
 		"ip6-allhosts",
 	}
-	zone_file = "blacklist.txt"
+	soa = `$TTL 1
+@ IN SOA localhost. root.localhost. (
+	0	; serial
+	2w	; refresh
+	2w	; retry
+	2w	; expiry
+	2w )	; negative cache ttl
+@ IN NS localhost.
+@ IN A 0.0.0.0
+`
 )
 
 func main() {
+	fmt.Print(soa)
 	fmt.Print(generateList())
 }
 
@@ -75,7 +84,7 @@ func sanitize(records string) string {
 	var sanitized []string
 
 	for _, line := range strings.Split(records, "\n") {
-		ip, domain, err := parse_record(line)
+		_, domain, err := parse_record(line)
 		if err != nil {
 			continue
 		}
@@ -90,12 +99,7 @@ func sanitize(records string) string {
 			continue
 		}
 
-		// Unify the records
-		if ip != "127.0.0.1" {
-			ip = "127.0.0.1"
-		}
-
-		sanitized = append(sanitized, ip + " " + domain)
+		sanitized = append(sanitized, domain + "\tCNAME\t.")
 	}
 
 	return strings.Join(sanitized, "\n")