Use :0 for loopback testing. This is more portable between testing environments.
Add testRR that calls NewRR and throws error away - apply it everywhere where needed.
It seems only Go 1.9 can deal with :0 being used. Disable 1.8 in travis.
Move some of them to Errorf and friends, but most of them are just
gone: This make go test -v actually readable.
Remove a bunch of test that used ipv6 on localhost as this does not work
on Travis.
* adds tests for shutdown bind port
* closes file descriptors in for udp on linux
* adds sleep after shutdown in test
* minimizes defer usages
* reduces sleep time
* replaces sleep with notify channel
after starting DNS server
We should allow the server to receive requests of an encrypted connection. This
is proposed on the document draft-ietf-dprive-dns-over-tls [1].
Now it is possible to initialize the DNS server to listen with TLS using
"tcp-tls" value in network parameter of ListenAndServe function, or passing a
listener initialized with tls.Listen to ActivateAndServe.
There's also an option in Server type to change the TLS confirguration, to
inform the certificates that are going to be used, or to change any other
desired option of tls.Config.
See #297
[1] http://tools.ietf.org/html/draft-ietf-dprive-dns-over-tls-02
The call to conn.File() causes Go to call dup() and then set the resulting FD
to be blocking. This sets the FD back to non-blocking, allowing Shutdown() to
work properly.
Fixes#279.
Reduce some code duplication by making Exchange() use Client.Exchange().
When performing an Exchange if the query ID does not match the answer ID
return an error. Also add a test for this condition.
Remove trailing \n from t.Log and t.Error messages as it's unnecessary.
In some instances, combine multiple t.Error()s into one
To provide more consistency across the tests, rename e to err and use %v
as the format arg for errors.
Replace Logf and Errorf with Log and Error when it made sense. For
example t.Errorf("%v", err) to t.Error(err)
This stops it from checking if the incoming requests have the QR bit
unset, so be careful when enabling this. This can be useful in
combination with mDNS.
Also the check for only 1 question in the question section is relaxed
to be "at least one", even without setting Unsafe!
Also update TestServingResponse to test for Unsafe vs not using Unsafe.
Added a bunch a long running test function to the list of skipped
tests when giving -short to go test. Tests are bascially *all*
DNSSEC key generation tests and 1 serving test.
PASS
ok github.com/miekg/dns 0.782s
Compared to 13+ s, so quite a bit faster.
* stopped obvious race condition with replacing handler in
ServingLargeResponses test
* lowered probability of other race conditions with test code
while test server is yet activating
* fixed errmessage in Shutdown
* incorporated @miekg suggestions on switch vs if
* for now moved reaction to stopXXX channel messages until
after the packet is responded to avoid client timeout in
Shutdown (causing 2 sec. hanged thread)
Still not great how the abort logic is implemented....