aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugin/chaos/chaos.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugin/chaos/chaos.go b/plugin/chaos/chaos.go
index 42b1fb3f0..f4d758a7b 100644
--- a/plugin/chaos/chaos.go
+++ b/plugin/chaos/chaos.go
@@ -3,7 +3,9 @@ package chaos
import (
"context"
+ "math/rand"
"os"
+ "time"
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/request"
@@ -34,8 +36,10 @@ func (c Chaos) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
default:
return plugin.NextOrFailure(c.Name(), c.Next, ctx, w, r)
case "authors.bind.":
- for _, a := range c.Authors {
- m.Answer = append(m.Answer, &dns.TXT{Hdr: hdr, Txt: []string{a}})
+ rnd := rand.New(rand.NewSource(time.Now().Unix()))
+
+ for _, i := range rnd.Perm(len(c.Authors)) {
+ m.Answer = append(m.Answer, &dns.TXT{Hdr: hdr, Txt: []string{c.Authors[i]}})
}
case "version.bind.", "version.server.":
m.Answer = []dns.RR{&dns.TXT{Hdr: hdr, Txt: []string{c.Version}}}