From 1d3e9011575e4e27934e1f41cfe87096d5cd4eaa Mon Sep 17 00:00:00 2001 From: xuweiwei Date: Sat, 22 Jan 2022 07:05:11 +0800 Subject: [PATCH] plugin/file: optimize cname get rr by type (#5080) Signed-off-by: xuweiwei --- plugin/file/lookup.go | 2 +- plugin/file/rrutil/util.go | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/plugin/file/lookup.go b/plugin/file/lookup.go index 2318af1fa..f92cba66f 100644 --- a/plugin/file/lookup.go +++ b/plugin/file/lookup.go @@ -366,7 +366,7 @@ Redo: goto Redo } - targets := rrutil.CNAMEForType(elem.All(), qtype) + targets := elem.Type(qtype) if len(targets) > 0 { rrs = append(rrs, targets...) diff --git a/plugin/file/rrutil/util.go b/plugin/file/rrutil/util.go index 63e447196..564b82cd1 100644 --- a/plugin/file/rrutil/util.go +++ b/plugin/file/rrutil/util.go @@ -16,14 +16,3 @@ func SubTypeSignature(rrs []dns.RR, subtype uint16) []dns.RR { } return sigs } - -// CNAMEForType returns the RR that have the qtype from targets. -func CNAMEForType(rrs []dns.RR, qtype uint16) []dns.RR { - ret := []dns.RR{} - for _, target := range rrs { - if target.Header().Rrtype == qtype { - ret = append(ret, target) - } - } - return ret -}