Closed thrawn01 closed 1 year ago
mxresolv.Lookup() was not properly randomzing MX hosts returned in some situations.
mxresolv.Lookup()
mxresolv.SetDeterministic()
mockdns
r := rand.New(rand.NewSource())
rand.New()
mxresolv
math/rand
crypto/rand
// pkg: github.com/mailgun/holster/v4/mxresolv // BenchmarkShuffleWithNew // BenchmarkShuffleWithNew-10 61962 18434 ns/op 5376 B/op 1 allocs/op // BenchmarkShuffleGlobal // BenchmarkShuffleGlobal-10 65205 18480 ns/op 0 B/op 0 allocs/op
Purpose
mxresolv.Lookup()
was not properly randomzing MX hosts returned in some situations.Implementation
mxresolv.SetDeterministic()
to improve the quality of testingmockdns
for lookups instead of relying on actual DNS records on the internet.r := rand.New(rand.NewSource())
instead of the global source in the rand package.rand.New()
call.mxresolv
as it complained I was usingmath/rand
instead ofcrypto/rand