From 4394d6078dcc277424913a3c1162dae4d3d67fe5 Mon Sep 17 00:00:00 2001 From: Niklas Date: Thu, 25 Feb 2021 13:24:57 +0100 Subject: [PATCH] changed regex for parsing host format --- internal/blacklist.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/blacklist.go b/internal/blacklist.go index 49ae789..446fb1c 100644 --- a/internal/blacklist.go +++ b/internal/blacklist.go @@ -86,12 +86,10 @@ func parseRawBlacklist(blacklist configBlacklist, raw string) []string { // parseHostFormat parse the string in the format of a hostfile func parseHostFormat(raw string) []string { finalList := make([]string, 0) - reg := regexp.MustCompile(`(?mi)^\s*(#*)\s*(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s+([a-zA-Z0-9\.\- ]+)$`) + reg := regexp.MustCompile(`(?m)^\s*(0\.0\.0\.0) ([a-zA-Z0-9-.]*)`) matches := reg.FindAllStringSubmatch(raw, -1) for _, match := range matches { - if match[1] != "#" { - finalList = append(finalList, dns.Fqdn(match[3])) - } + finalList = append(finalList, dns.Fqdn(match[2])) } return finalList