mirror of
				https://github.com/coredns/coredns.git
				synced 2025-11-03 18:53:13 -05:00 
			
		
		
		
	
		
			
	
	
		
			24 lines
		
	
	
		
			387 B
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			24 lines
		
	
	
		
			387 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| 
								 | 
							
								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)
							 | 
						||
| 
								 | 
							
								}
							 |