mirror of
				https://github.com/coredns/coredns.git
				synced 2025-11-03 02:33:21 -05:00 
			
		
		
		
	This adds an online dnssec middleware. The middleware will sign responses on the fly. Negative responses are signed with NSEC black lies.
		
			
				
	
	
		
			21 lines
		
	
	
		
			511 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			511 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package test
 | 
						|
 | 
						|
import (
 | 
						|
	"io/ioutil"
 | 
						|
	"os"
 | 
						|
	"testing"
 | 
						|
)
 | 
						|
 | 
						|
// TempFile will create a temporary file on disk and returns the name and a cleanup function to remove it later.
 | 
						|
func TempFile(t *testing.T, dir, content string) (string, func(), error) {
 | 
						|
	f, err := ioutil.TempFile(dir, "go-test-tmpfile")
 | 
						|
	if err != nil {
 | 
						|
		return "", nil, err
 | 
						|
	}
 | 
						|
	if err := ioutil.WriteFile(f.Name(), []byte(content), 0644); err != nil {
 | 
						|
		return "", nil, err
 | 
						|
	}
 | 
						|
	rmFunc := func() { os.Remove(f.Name()) }
 | 
						|
	return f.Name(), rmFunc, nil
 | 
						|
}
 |