mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 16:24:19 -04:00
Remove the word middleware (#1067)
* Rename middleware to plugin first pass; mostly used 'sed', few spots where I manually changed text. This still builds a coredns binary. * fmt error * Rename AddMiddleware to AddPlugin * Readd AddMiddleware to remain backwards compat
This commit is contained in:
53
plugin/dnssec/rrsig.go
Normal file
53
plugin/dnssec/rrsig.go
Normal file
@@ -0,0 +1,53 @@
|
||||
package dnssec
|
||||
|
||||
import "github.com/miekg/dns"
|
||||
|
||||
// newRRSIG return a new RRSIG, with all fields filled out, except the signed data.
|
||||
func (k *DNSKEY) newRRSIG(signerName string, ttl, incep, expir uint32) *dns.RRSIG {
|
||||
sig := new(dns.RRSIG)
|
||||
|
||||
sig.Hdr.Rrtype = dns.TypeRRSIG
|
||||
sig.Algorithm = k.K.Algorithm
|
||||
sig.KeyTag = k.keytag
|
||||
sig.SignerName = signerName
|
||||
sig.Hdr.Ttl = ttl
|
||||
sig.OrigTtl = origTTL
|
||||
|
||||
sig.Inception = incep
|
||||
sig.Expiration = expir
|
||||
|
||||
return sig
|
||||
}
|
||||
|
||||
type rrset struct {
|
||||
qname string
|
||||
qtype uint16
|
||||
}
|
||||
|
||||
// rrSets returns rrs as a map of RRsets. It skips RRSIG and OPT records as those don't need to be signed.
|
||||
func rrSets(rrs []dns.RR) map[rrset][]dns.RR {
|
||||
m := make(map[rrset][]dns.RR)
|
||||
|
||||
for _, r := range rrs {
|
||||
if r.Header().Rrtype == dns.TypeRRSIG || r.Header().Rrtype == dns.TypeOPT {
|
||||
continue
|
||||
}
|
||||
|
||||
if s, ok := m[rrset{r.Header().Name, r.Header().Rrtype}]; ok {
|
||||
s = append(s, r)
|
||||
m[rrset{r.Header().Name, r.Header().Rrtype}] = s
|
||||
continue
|
||||
}
|
||||
|
||||
s := make([]dns.RR, 1, 3)
|
||||
s[0] = r
|
||||
m[rrset{r.Header().Name, r.Header().Rrtype}] = s
|
||||
}
|
||||
|
||||
if len(m) > 0 {
|
||||
return m
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
const origTTL = 3600
|
||||
Reference in New Issue
Block a user