mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2025-03-04 10:24:40 +01:00
Factorize
This commit is contained in:
parent
24a9539d08
commit
b7dfdb1372
1 changed files with 5 additions and 5 deletions
|
@ -181,20 +181,20 @@ func (plugin *PluginBlockNameResponse) Eval(pluginsState *PluginsState, msg *dns
|
||||||
answers := msg.Answer
|
answers := msg.Answer
|
||||||
for _, answer := range answers {
|
for _, answer := range answers {
|
||||||
header := answer.Header()
|
header := answer.Header()
|
||||||
var target string
|
|
||||||
var err error
|
|
||||||
if header.Class != dns.ClassINET {
|
if header.Class != dns.ClassINET {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
var target string
|
||||||
if header.Rrtype == dns.TypeCNAME {
|
if header.Rrtype == dns.TypeCNAME {
|
||||||
target, err = NormalizeQName(answer.(*dns.CNAME).Target)
|
target = answer.(*dns.CNAME).Target
|
||||||
} else if header.Rrtype == dns.TypeSVCB && answer.(*dns.SVCB).Priority == 0 {
|
} else if header.Rrtype == dns.TypeSVCB && answer.(*dns.SVCB).Priority == 0 {
|
||||||
target, err = NormalizeQName(answer.(*dns.SVCB).Target)
|
target = answer.(*dns.SVCB).Target
|
||||||
} else if header.Rrtype == dns.TypeSVCB && answer.(*dns.HTTPS).Priority == 0 {
|
} else if header.Rrtype == dns.TypeSVCB && answer.(*dns.HTTPS).Priority == 0 {
|
||||||
target, err = NormalizeQName(answer.(*dns.HTTPS).Target)
|
target = answer.(*dns.HTTPS).Target
|
||||||
} else {
|
} else {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
target, err := NormalizeQName(target)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue