mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-31 10:13:14 -04:00 
			
		
		
		
	Add middleware/dnssec (#133)
This adds an online dnssec middleware. The middleware will sign responses on the fly. Negative responses are signed with NSEC black lies.
This commit is contained in:
		
							
								
								
									
										23
									
								
								middleware/dnssec/cache.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								middleware/dnssec/cache.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| package dnssec | ||||
|  | ||||
| import ( | ||||
| 	"hash/fnv" | ||||
| 	"strconv" | ||||
|  | ||||
| 	"github.com/miekg/dns" | ||||
| ) | ||||
|  | ||||
| // Key serializes the RRset and return a signature cache key. | ||||
| func key(rrs []dns.RR) string { | ||||
| 	h := fnv.New64() | ||||
| 	buf := make([]byte, 256) | ||||
| 	for _, r := range rrs { | ||||
| 		off, err := dns.PackRR(r, buf, 0, nil, false) | ||||
| 		if err == nil { | ||||
| 			h.Write(buf[:off]) | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	i := h.Sum64() | ||||
| 	return strconv.FormatUint(i, 10) | ||||
| } | ||||
		Reference in New Issue
	
	Block a user