83 Commits

Author SHA1 Message Date
Rafael Dantas Justo
6fe70412bc Add option in server to allow DNS over TLS
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
2016-01-08 11:26:13 -02:00
Ryan Leavengood
7b51cba64a Set UDP conn to non-blocking on Linux to fix Shutdown()
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.
2015-12-01 17:15:42 -05:00
Miek Gieben
f520760857 Lowercase all error msg from the tests 2015-11-26 14:12:38 +00:00
Miek Gieben
9e23f0c96e Fix data race 2015-11-26 14:03:51 +00:00
Andrew Tunnell-Jones
cfa72d0862 Test closing TCP ResponseWriter in a handler 2015-11-26 08:04:38 +00:00
Filippo Valsorda
e6885e3677 Set high timeouts in server_test.go not to fail on slow boxes and catch deadlocks 2015-10-07 00:13:40 +01:00
Miek Gieben
9bf52083d1 golint fixes 2015-08-23 08:03:13 +01:00
James DeFelice
8255b4a03f update docs; replace "data frame" refs with "raw message" 2015-08-06 17:55:37 -04:00
James DeFelice
e148c23156 add docs and example for DNS frame read/write decorators 2015-08-04 09:04:40 -04:00
Michael Haro
dddcd696ba Check that the query ID matches the answer ID.
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.
2015-05-05 23:00:16 -07:00
Michael Haro
7f051930ff Use %v as the format arg for errors 2015-02-26 00:49:59 -08:00
Michael Haro
2fb2a25e84 More test clean up
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)
2015-02-25 22:14:21 -08:00
Michael Haro
f995f1aff3 Convert tests from being t.Log(..) then t.Fail() to just t.Error(...) as
t.Error(...) does both and makes it more clear which messages are errors
vs information log messages.
2015-02-23 17:43:07 -08:00
Michael Haro
9e96f28311 Fix problems noted by 'go vet' 2015-02-19 00:08:28 -08:00
Filippo Valsorda
17a90cfd68 Tests: fix TestShutdownTCP race using NotifyStartedFunc 2014-12-17 13:46:50 +00:00
Filippo Valsorda
e613ea6d07 Tests: silence a data race detected during server tests 2014-12-06 10:27:29 +00:00
Filippo Valsorda
ddb0b0f565 Tests: wait for the server to be started before proceeding 2014-12-06 10:27:29 +00:00
Miek Gieben
cd2048a15a Add Unsafe member to dns.Server
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.
2014-11-19 16:34:18 +00:00
Miek Gieben
5fc7e36983 go test -short
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.
2014-11-12 10:19:20 +00:00
Miek Gieben
d33af8db79 Update test and gofmt 2014-11-09 16:09:49 +00:00
Miek Gieben
d8da4d2fa7 Fix: drop requests with *cough* qr set.
Err, yeah.
2014-10-19 09:36:26 +00:00
Miek Gieben
0aa3021a83 Remove all copyright notices
Use the central COPYRIGHT file.
2014-09-11 20:57:37 +01:00
Alex Sergeyev
3489112d72 Addressed #115 (default mux should be cleaned after tests) 2014-08-30 09:45:30 -04:00
Alex Sergeyev
de77e9d14d Removed Goshed from RunXXXTestServer and...
only used it for shutdown tests where it makes sense.
2014-08-30 09:35:54 -04:00
Alex Sergeyev
c618657d9b Dealt with race condition detector warnings:
* 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
2014-08-29 14:10:05 -04:00
Alex Sergeyev
f735bb9dcb Changed how shutdown works...
Now stopXXX event will stop any reading on currently open
socket and terminate reading loop. No special client/server
message is required anymore.
2014-08-29 12:24:11 -04:00
Alex Sergeyev
87f8764f43 Added a comment about shutdown tests 2014-08-29 08:37:32 -04:00
Alex Sergeyev
32d6e5396e Continued removing Sleeping tests:
* 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....
2014-08-29 08:31:27 -04:00
Alex Sergeyev
4b21f37064 Proposed way of creating no-timeout tests and...
... fix for Server.Shutdown() function.
2014-08-28 23:11:49 -04:00
Miek Gieben
eed2b9aeec Fix Shutdown 2014-08-19 21:56:37 +01:00
Miek Gieben
f912994258 Don't relay on deadline to stop the server.
We just send ourselves an UDP or TCP packet so that the listener fails
through and picks up the quit bool send on the channel.
2014-08-19 21:46:00 +01:00
Miek Gieben
263a337674 Change test ports, stuff might still be running 2014-08-19 09:33:50 +00:00
Miek Gieben
6c631cd4ff Implement Shutdown()
This is working for TCP, but for UDP the Read does not honor the
deadline settings.
2014-08-19 09:25:41 +00:00
Miek Gieben
f5fe400c53 Lowercase all test output.
Add Shutdown tests as well
2014-08-19 08:39:04 +00:00
Miek Gieben
f3a6c86462 Implement Shutdown() call
And fix some tests to call Fatal().
2014-08-18 22:06:29 +01:00
Egon Elbre
dc06b3bde1 undo some changes 2014-07-17 20:48:28 +03:00
Egon Elbre
1d5e55d9b6 Fix: UDP serving on windows, UDP serving test paniced
Also, replaced t.Error/t.Fail with t.Fatal in some places.
2014-07-17 13:14:50 +03:00
Miek Gieben
28d936c032 disable ipv6 test until I know how to check for v6 conn. 2014-07-09 07:23:54 +01:00
Miek Gieben
d09d1781e8 Add v6 benchmarking test.
Mostly to exercise the v6 serving path (of which most lies in the
standard library). But it also is a good test of v6 functionality.
2014-07-08 14:15:08 +00:00
Miek Gieben
6f477021c0 Make race detector not fire on this simple test
Do the standard Lock()/modify/Unlock() dance.
2014-02-28 15:57:10 +00:00
Miek Gieben
09b05ded46 Remove external DNS dependency
This makes the test run 10x faster and does not require internet
access for running the tests.
2014-02-15 08:03:40 +00:00
Miek Gieben
e81b46d580 Add client.UDPsize
This allows a client to set a default UDPSize with resorting to EDNS0
headers 'n stuff.
2014-02-14 22:14:41 +00:00
Miek Gieben
3fca11e695 Add test to see that udp client is too large 2014-02-14 21:53:00 +00:00
Miek Gieben
dd35496669 dont care about padding for benchmark function 2014-01-29 07:56:21 +00:00
Miek Gieben
509a6ff9e2 Revert "Revert "Fix benchmark alignment""
This reverts commit b8e6bd45bea3a58e61b6018f13fdd899a84e8639.
2014-01-29 07:52:23 +00:00
Miek Gieben
b8e6bd45be Revert "Fix benchmark alignment"
This reverts commit 008dfb4ee81e8a0bf7cee3ee59dc87d5bc02aac7.
2014-01-28 22:43:57 +00:00
Alex Ciuba
008dfb4ee8 Fix benchmark alignment 2014-01-27 17:40:57 -05:00
Miek Gieben
560a1c65b0 update license in pool.go
remove some build lines as I have no idea what they are
supposed to be doing.
2014-01-06 10:00:25 +00:00
Andrew Tunnell-Jones
33c8fd7aec Test ServeMux's case folding 2013-12-14 09:44:36 +00:00
Miek Gieben
4c55d0d65f tweaks comment 2013-10-19 11:52:15 +01:00