mirror of
				https://github.com/coredns/coredns.git
				synced 2025-11-04 03:03:14 -05:00 
			
		
		
		
	Fix file/fuzz.go build and docs in Makefile.fuzz Each plugin can add a fuzz.go to join the fuzzing craze. pkg/fuzz/do.go could be made a lot smarter, but is probably good enough for starters. $ make -f Makefile.fuzz <plugin> will build with go-fuzz-build and then execute a go-fuzz run. Each plugin's fuzz run uses a per-plugin directory to store the fuzz data.
		
			
				
	
	
		
			20 lines
		
	
	
		
			343 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			343 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package proxy
 | 
						|
 | 
						|
import (
 | 
						|
	"github.com/coredns/coredns/plugin/pkg/fuzz"
 | 
						|
 | 
						|
	"github.com/mholt/caddy"
 | 
						|
)
 | 
						|
 | 
						|
// Fuzz fuzzes proxy.
 | 
						|
func Fuzz(data []byte) int {
 | 
						|
	c := caddy.NewTestController("dns", "proxy . 8.8.8.8:53")
 | 
						|
	up, err := NewStaticUpstreams(&c.Dispenser)
 | 
						|
	if err != nil {
 | 
						|
		return 0
 | 
						|
	}
 | 
						|
	p := &Proxy{Upstreams: &up}
 | 
						|
 | 
						|
	return fuzz.Do(p, data)
 | 
						|
}
 |