Commit Graph

3578 Commits

Author SHA1 Message Date
Rafael Dantas Justo ab77ae6734 Remove the TLS fallback strategy
After some thoughts, I realized that the fallback should be made by who is
using the client, as it will need to change the port (from 853 to 53). This
would also remove from the library the complexity of storing the recursive
nameservers that aren't working well with TLS (draft-ietf-dprive-dns-over-tls,
section 3.1).

See #297
2016-01-08 07:28:05 -02:00
Rafael Dantas Justo 1c62bb2781 Remove the TLS fallback strategy
After some thoughts, I realized that the fallback should be made by who is
using the client, as it will need to change the port (from 853 to 53). This
would also remove from the library the complexity of storing the recursive
nameservers that aren't working well with TLS (draft-ietf-dprive-dns-over-tls,
section 3.1).

Resolves #297
2016-01-07 13:36:36 -02:00
Rafael Dantas Justo 020f925824 Change low level read/write for TLS connection
As tlc.Conn is just a TCP connection after the handshake, we will modify the
TCP functions to work with an io.Reader/io.Writer parameter instead of a
net.TCPConn so we can reuse them.

See #297
2016-01-07 13:27:07 -02:00
Rafael Dantas Justo 124839738d Fallback to normal connection if TLS fails
As described in document draft-ietf-dprive-dns-over-tls [1] we should fallback
to normal connection (without TLS) if there's any error with the TLS
connection.

See #297

[1] http://tools.ietf.org/html/draft-ietf-dprive-dns-over-tls-02
2016-01-04 10:49:20 -02:00
Rafael Dantas Justo ce3e1286f2 TLS connection must be via TCP
See #297
2016-01-04 10:46:14 -02:00
Rafael Dantas Justo 72d475a8fe Allow changing the default TLS configuration
When starting a TLS connection in some environments, we usually disabled some
certificates checks to allow tests with self-signed certificates. To disable
this checks we need to change some TLS parameters when starting a connection,
and for that we need to inject this parameters in the API.

Now the Client will also have an attribute for the TLS configuration
parameters. For future refactories, we could change the TLS attribute from bool
to a struct that would store the "Enable" flag and the configuration.

See #297
2016-01-04 10:30:39 -02:00
Rafael Dantas Justo 0d866c924c Add option in client to allow DNS over TLS
We should allow the client to send requests to a recursive DNS server using a
encrypted connection. This is proposed on the document
draft-ietf-dprive-dns-over-tls [1].

For now we didn't allow the API user to change the TLS configuration (using
defaults). We also need to add the intelligence to fallback to normal DNS when
the TLS connection fails (as described in the draft).

See #297

[1] http://tools.ietf.org/html/draft-ietf-dprive-dns-over-tls-02
2016-01-04 10:05:29 -02:00
Miek Gieben 1756430e42 Merge pull request #299 from shawnps/patch-2
fix typos
2016-01-04 07:36:02 +00:00
Shawn Smith a5c6567b61 fix typos 2016-01-04 12:16:50 +09:00
Miek Gieben aed88e096f Remove the duplicate word length from the comment 2015-12-31 08:17:21 +00:00
Miek Gieben 0aa2579353 Merge pull request #298 from shawnps/patch-1
Fix typos
2015-12-31 08:16:30 +00:00
Shawn Smith 94231e71fe Fix typos 2015-12-31 14:16:30 +09:00
Miek Gieben c2d8398a25 Merge pull request #296 from vbatts/doc-fix
doc: example shows a conditional with non-bool
2015-12-22 19:00:42 +00:00
Vincent Batts 774b109199 doc: example shows a conditional with non-bool
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2015-12-22 12:04:16 -05:00
Miek Gieben 75e6e86cc6 Merge pull request #288 from leavengood/master
Set UDP conn to non-blocking on Linux to fix Shutdown()
2015-12-02 10:57:14 +00: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
Miek Gieben 7e2a67cadb Merge pull request #287 from andrewtj/atj-issue286
Fix for issue 286 - panic after closing ResponseWriter in server handler
2015-11-26 13:50:10 +00:00
Andrew Tunnell-Jones 3062dcb751 Check server TCP conn exists before reading
w.tcp could be nil if the conn has been closed by a handler.
2015-11-26 08:10:55 +00:00
Andrew Tunnell-Jones cfa72d0862 Test closing TCP ResponseWriter in a handler 2015-11-26 08:04:38 +00:00
Miek Gieben d274557152 Merge pull request #281 from LevenLabs/master
Instead of removing all RRs on Truncated, attempt to unpack
2015-11-02 11:51:50 +00:00
Miek Gieben 497abb0c48 README: add section about maintenance
Say how we deal with backward compat and what we "guarantee" for
Go DNS.
2015-11-02 07:52:41 +00:00
James Hartig 2d2c2ebcfc Instead of removing all RRs on Truncated, attempt to unpack 2015-11-01 15:51:09 -05:00
Miek Gieben 6a1556664f Merge pull request #283 from bboreham/spin-less
Only re-try AcceptTCP() if the error is temporary
2015-10-30 21:51:19 +00:00
Bryan Boreham e54a6cf1bc Only re-try AcceptTCP() if the error is temporary 2015-10-30 17:08:27 +00:00
Miek Gieben adeb323cbc Merge pull request #277 from FiloSottile/typeToRR
Expose TypeToRR
2015-10-17 16:19:22 +01:00
Filippo Valsorda 023972bb19 Expose TypeToRR 2015-10-16 23:36:49 +01:00
Miek Gieben dfefa36553 Merge pull request #274 from FiloSottile/filippo/generate
Generate programmatically per-type code, including .len() and .copy()
2015-10-08 12:58:09 +01:00
Miek Gieben fe4ec22b6b Merge pull request #275 from dbriemann/namesmith
adding project using miekg/dns to README projects list
2015-10-08 10:39:27 +01:00
David Linus Briemann 606e7a3d43 adding project using miekg/dns to README projects list 2015-10-08 11:26:47 +02:00
Miek Gieben ead33b75f6 Merge pull request #267 from sekimura/govet
tidyup a little with the latest golang.org/x/tools/cmd/vet
2015-10-07 20:36:46 +01:00
Filippo Valsorda ff2b0714db types_generate: use 1.5 static analysis packages 2015-10-07 18:24:55 +01:00
Miek Gieben 9b18c47669 Merge pull request #271 from FiloSottile/filippo/test_timeout
Refactor server shutdown to call Close() on conn and sync on srv.started
2015-10-07 13:47:31 +01:00
Filippo Valsorda 190e718ea2 Add comments to types_generate.go, move result to ztypes.go 2015-10-07 12:57:24 +01:00
Filippo Valsorda 25846488f9 Apply per-type code generation to .copy()
This fixes bugs in MB and CNAME.copy() (using sprintName for copying),
IPSECKEY (missed copyIP) and OPT (partially, Options was not copied as
slice; EDNS0 objects themselves are still pointers).
2015-10-07 05:51:36 +01:00
Filippo Valsorda d4a4e089d0 Generate programmatically per-type code, including .len()
This process probably fixes a bug in NSAPPTR.len(), after a similar one was
found in HINFO.len().

This should also make it easier to make changes to these functions, and
check their correctness.

Generate the code by running "go generate".
2015-10-07 05:48:12 +01: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
Filippo Valsorda a58e9c7a9e Refactor server shutdown to call Close() on conn and sync on srv.started
Remove the necessity for the hackish (and unreliable) fake packet.
Fix a couple races and unclutter the start/stop internal state.
2015-10-07 00:13:40 +01:00
Filippo Valsorda 7463496b65 Travis: add -v to go test to catch stalling tests 2015-10-07 00:13:40 +01:00
Miek Gieben 691455cf79 Merge pull request #272 from tsenart/master
client: SetReadDeadline after write, before read
2015-10-06 13:06:17 +01:00
Tomás Senart 56b3ff5401 client: SetReadDeadline after write, before read
The current code sets the read deadline at the same time as the write
deadline. If the write nearly times out but doesn't, the read timeout
can fire before the read happens within the specified deadline.
2015-10-06 13:34:20 +02:00
Miek Gieben 373b848617 HINFO does not need downcasing for DNSSEC
See the comment from Andrew:
https://github.com/miekg/dns/pull/270#issuecomment-145696618
2015-10-06 07:59:47 +01:00
Masayoshi Sekimura ae0cb9ccb6 deleting a dot to retrigger travis CI 2015-10-05 20:14:57 -07:00
Miek Gieben dea25f3332 Merge pull request #270 from FiloSottile/filippo/hinfo
Fix (*HINFO).len() and HINFO canonicalization in rawSignatureData
2015-10-05 15:32:23 +01:00
Filippo Valsorda e9635cc83b Fix (*HINFO).len() and HINFO canonicalization in rawSignatureData 2015-10-05 14:37:42 +01:00
Miek Gieben 9a6a6448f5 Merge pull request #268 from giskarda/master
Update ParseZone() documentation
2015-10-05 13:28:55 +01:00
Riccardo Setti dd135484c5 Update ParseZone() documentation 2015-10-05 11:31:26 +01:00
Masa Sekimura 7dfd5c04dd fix a stupid mistake "undefined: zone" 2015-09-30 09:42:47 -07:00
Masa Sekimura a9a71b9628 gofmt and revert unnecessary changes 2015-09-30 09:08:17 -07:00