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.
14 lines
279 B
Go
14 lines
279 B
Go
package cache
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/coredns/coredns/plugin/pkg/fuzz"
|
|
)
|
|
|
|
// Fuzz fuzzes cache.
|
|
func Fuzz(data []byte) int {
|
|
c := &Cache{pcap: defaultCap, ncap: defaultCap, pttl: maxTTL, nttl: maxNTTL, prefetch: 0, duration: 1 * time.Minute}
|
|
|
|
return fuzz.Do(c, data)
|
|
}
|