Merge pull request #35 in DNS/adguard-dns from bugfix/343 to master
* commit '119d38fa8e8b5c5193fe20ad215a6daac833354b': Add trace() for debugging coredns -- don't try to be smart and replace 127.0.0.1 with NXDOMAIN yet -- need research on that first Fix 'index out of range' panic when adding a filter URL that has empty line in contents web UI -- Fix description of hosts rule syntax, it's other way around
This commit is contained in:
commit
afd1fe21f6
|
@ -44,7 +44,7 @@ export default class UserRules extends Component {
|
|||
domain and all its subdomains
|
||||
</li>
|
||||
<li>
|
||||
<code>example.org 127.0.0.1</code> - AdGuard DNS will now return
|
||||
<code>127.0.0.1 example.org</code> - AdGuard DNS will now return
|
||||
127.0.0.1 address for the example.org domain (but not its subdomains).
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
|
15
helpers.go
15
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())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue