276 Commits

Author SHA1 Message Date
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
James Hartig
2d2c2ebcfc Instead of removing all RRs on Truncated, attempt to unpack 2015-11-01 15:51:09 -05: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
3c158e6e74 Correct set srv.started to false on error
Unlock the lock and set started to false when we return an error
during the startup.

Fixes #263
2015-09-23 22:00:38 +01:00
Miek Gieben
2f503031b0 Rename to ReadMsgHeader
Slightly more descriptive and remove the underscore of _DNSHeaderSize
and call is headerSize.
2015-07-03 09:31:53 +01:00
Alex Sergeyev
b0d6ff308e Fixed things found in code review (comments, semantics). 2015-07-02 22:42:02 -04:00
Alex Sergeyev
b625f190ce Not allocating 64K buffers for reading 2015-06-29 08:06:49 -04:00
Alex Sergeyev
53dfadf090 Shortened ReadMsg using ReadMsgBytes, added a constant. 2015-06-28 20:21:37 -04:00
Alex Sergeyev
2f3bcbd506 Added function for lazy message reading per #222 2015-06-28 20:21:37 -04:00
Alex Sergeyev
387c041985 Changed logic around reserving wire read buffer 2015-06-16 21:21:22 -04:00
Alex Sergeyev
416c39c6e9 Removed redundant code #220 2015-06-16 19:24:38 -04:00
Miek Gieben
031d041ced Merge pull request #209 from michaelharo/client
Cleanup Client.exchange
2015-05-07 07:28:34 +01:00
Michael Haro
32448f39cd Cleanup Client.exchange
Make Client's exchange function easier to read by moving timeout logic
into separate functions.

Start the timers closer to where they're used so that time from other
logic doesn't impact the deadlines.
2015-05-05 23:23:53 -07:00
Michael Haro
b9c528f99c Keep Exchange as it was, but still check ID. 2015-05-05 23:20:46 -07: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
Miek Gieben
6427527bba Check EDNS0 bufsize in Exchange()
In client.Exchange we *did* check for this size, to the same in the
function Exchange(). This bug surfaced in issue #184, this sort of
fixes it.

Closes #184.
2015-02-24 18:16:58 +00:00
Miek Gieben
67945c119e A bunch of golint fixes
The proposed vars names are a nono, because they break the API.
Things left: document each RR and zscan_rr.go has some funcky if-then-elses.
2015-02-19 09:58:33 +00:00
StalkR
fe160dfba4 minor clean ups: use time.Second instead of 1e9, do not reference ns as time.Duration is enough 2015-01-15 23:11:11 +01:00
Miek Gieben
0aa3021a83 Remove all copyright notices
Use the central COPYRIGHT file.
2014-09-11 20:57:37 +01:00
Miek Gieben
17c7921aa2 Documentation updates 2014-07-31 08:48:26 +00:00
Miek Gieben
0258525f20 Comment tweak 2014-02-14 22:47:53 +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
Marek Majkowski
2cfad667d7 msg.Copy() makes a deep-copy of the msg object
There was a copy function that did shallow copies of the msg
object. Export it and make it support proper deep copying.
2014-01-10 08:49:45 -08:00
Miek Gieben
52f9a59ac1 Cleanup singleFlight a bit 2014-01-08 10:10:39 +00:00
Miek Gieben
f094f37de3 Add shortbuf erorr too
Cleanup the pull request a bit.
2014-01-04 11:17:13 +00:00
Miek Gieben
b1f108f79c Simplify client TCP write.
Use the same patch as in the server.
2014-01-04 08:30:08 +00:00
Miek Gieben
451c12da09 typo 2013-12-30 16:46:53 +00:00
Miek Gieben
902ff847c8 Update Exchange documention about retries
Exchange does not fallback to tcp, nor will retry the query. Make
this more clear.
2013-12-27 07:48:30 +00:00
Miek Gieben
37a1ae569b Remove this tidbit of documentation
A nil client is wrong. Just remove the sentence instead of coming
up with something that is technically correct, but doesn't read
nicely.

Closes: #60
2013-11-21 13:27:20 +00:00
Miek Gieben
9b15d749d8 remove newline 2013-11-01 09:51:50 +00:00
Miek Gieben
81fb20e093 Actually make the conn 2013-11-01 09:50:55 +00:00
Miek Gieben
37c7c70289 Use the Dial and DialTimeout function internally 2013-11-01 09:42:55 +00:00
Miek Gieben
d789796e53 Add Dial and DialTimeout to the client api.
This is just to mimic net as much as possible.
2013-11-01 09:40:44 +00:00
Miek Gieben
717a8179f5 Use recommendation from RFC5966 and set idle timeout much lower 2013-10-19 22:00:17 +01:00
Miek Gieben
ed0b128bd2 Add some groundwork for implementing rfc5966 recommendations 2013-10-18 11:59:19 +00:00
Miek Gieben
4b1cacf2d2 Update the doc a little 2013-10-18 09:14:31 +00:00
Miek Gieben
86186e27e4 Just use Read 2013-10-12 18:47:11 +01:00
Miek Gieben
aa44c75b91 Merge net branch 2013-10-12 18:32:53 +01:00
Miek Gieben
68083bc956 Fix merge conflict from net branch 2013-10-12 17:59:46 +01:00
Miek Gieben
7691523300 Re-add ExchangeConn
ExchangeConn is back, but with a warning. Other various improvements.
2013-10-12 12:44:02 +01:00
Miek Gieben
97603e3f62 Readd ExchangeConn 2013-10-12 12:35:09 +01:00
Miek Gieben
77d78f3218 More xfr fixes, does not work yet 2013-10-11 22:34:04 +01:00
Miek Gieben
ca3c488ad8 Fix transfer 2013-10-11 16:36:37 +00:00
Miek Gieben
b987dc6246 More transfer stuff 2013-10-11 16:18:37 +00:00
Miek Gieben
403baeb73a Rework the transfers stuff 2013-10-02 20:35:13 +01:00
Eric Gavaletz
7f3472cc74 Patching to make compatible with appengine/socket.
The interface conversion from socket.Conn to net.UDPConn fails, but
since you can use a generic Read(b) in place of ReadFromUDP(b) it makes
sense to git rid of the conversion to net.UDPConn.  This change allows
the use of the client library for UDP DNS lookup using the
appengine/socket package's Conn.

For the same reasons the interface conversions for TCP connections were
also removed.
2013-10-02 11:41:26 -04:00
Miek Gieben
db3de29edc doc updates 2013-09-29 20:30:04 +01:00