diff --git a/client/src/components/Filters/UserRules.js b/client/src/components/Filters/UserRules.js
index c748c3bc..bfd87b89 100644
--- a/client/src/components/Filters/UserRules.js
+++ b/client/src/components/Filters/UserRules.js
@@ -44,7 +44,7 @@ export default class UserRules extends Component {
domain and all its subdomains
- example.org 127.0.0.1
- AdGuard DNS will now return
+ 127.0.0.1 example.org
- AdGuard DNS will now return
127.0.0.1 address for the example.org domain (but not its subdomains).
diff --git a/control.go b/control.go
index 45b339af..340f8479 100644
--- a/control.go
+++ b/control.go
@@ -1148,7 +1148,7 @@ func (filter *filter) update(now time.Time) (bool, error) {
d := dnsfilter.New()
for _, line := range lines {
line = strings.TrimSpace(line)
- if line[0] == '!' {
+ if len(line) > 0 && line[0] == '!' {
if m := filterTitle.FindAllStringSubmatch(line, -1); len(m) > 0 && len(m[0]) >= 2 && !seenTitle {
log.Printf("Setting filter title to %s\n", m[0][1])
filter.Name = m[0][1]
diff --git a/coredns_plugin/coredns_plugin.go b/coredns_plugin/coredns_plugin.go
index 78c9bb9a..0000156c 100644
--- a/coredns_plugin/coredns_plugin.go
+++ b/coredns_plugin/coredns_plugin.go
@@ -384,7 +384,8 @@ func (p *plug) serveDNSInternal(ctx context.Context, w dns.ResponseWriter, r *dn
// is it in hosts?
if val, ok := p.hosts[host]; ok {
// it is, if it's a loopback host, reply with NXDOMAIN
- if val.IsLoopback() {
+ // TODO: research if it's better than 127.0.0.1
+ if false && val.IsLoopback() {
rcode, err := writeNXdomain(ctx, w, r)
if err != nil {
return rcode, dnsfilter.Result{}, err
diff --git a/helpers.go b/helpers.go
index a7e60f77..f28b9ea7 100644
--- a/helpers.go
+++ b/helpers.go
@@ -3,6 +3,7 @@ package main
import (
"bufio"
"errors"
+ "fmt"
"io"
"net/http"
"path"
@@ -246,3 +247,17 @@ func _Func() string {
f := runtime.FuncForPC(pc[0])
return path.Base(f.Name())
}
+
+func trace(format string, args ...interface{}) {
+ pc := make([]uintptr, 10) // at least 1 entry needed
+ runtime.Callers(2, pc)
+ f := runtime.FuncForPC(pc[0])
+ var buf strings.Builder
+ buf.WriteString(fmt.Sprintf("%s(): ", path.Base(f.Name())))
+ text := fmt.Sprintf(format, args...)
+ buf.WriteString(text)
+ if len(text) == 0 || text[len(text)-1] != '\n' {
+ buf.WriteRune('\n')
+ }
+ fmt.Print(buf.String())
+}