feat: Add support for legacy markers in ParseManagedBlock to ensure backward compatibility
This commit is contained in:
+6
-2
@@ -17,13 +17,17 @@ func ParseManagedBlock(lines []string) (prefix, managed, postfix []string, hasMa
|
||||
endCount := 0
|
||||
|
||||
for i, line := range lines {
|
||||
if strings.Contains(line, "ekDNSHelper <<-> START CONFIG") {
|
||||
// Recognise both current and legacy markers so that hosts files
|
||||
// written by the old "DNSHelper" binary are parsed correctly.
|
||||
if strings.Contains(line, "ekDNSHelper <<-> START CONFIG") ||
|
||||
strings.Contains(line, "DNSHelper <<-> START CONFIG") {
|
||||
startCount++
|
||||
if startIdx == -1 {
|
||||
startIdx = i
|
||||
}
|
||||
}
|
||||
if strings.Contains(line, "ekDNSHelper <->> END CONFIG") {
|
||||
if strings.Contains(line, "ekDNSHelper <->> END CONFIG") ||
|
||||
strings.Contains(line, "DNSHelper <->> END CONFIG") {
|
||||
endCount++
|
||||
if endIdx == -1 {
|
||||
endIdx = i
|
||||
|
||||
Reference in New Issue
Block a user