Commit Graph

306 Commits

Author SHA1 Message Date
Miek Gieben 2127b822dd Add comment about Systemd 2014-08-28 07:54:23 +00:00
Miek Gieben f0bd4137e2 Make Shutdown return error
This will be handy in feature, so that we can add a 1 second
timeout and then return failure.
2014-08-20 15:12:59 +00:00
Miek Gieben 01bbcbef60 Update documentation for Shutdown.
This completes issue #101.
Fixes #101
2014-08-19 22:08:13 +01: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 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 292c925c9f update documentation 2014-08-18 22:21:02 +01:00
Miek Gieben 0d300b1fce Add deadline to the listeners
Call this deadline to the listener will timeout and we will get to
so if the server should shutdown.
2014-08-18 22:14:29 +01:00
Miek Gieben f3a6c86462 Implement Shutdown() call
And fix some tests to call Fatal().
2014-08-18 22:06:29 +01:00
Miek Gieben 6cf24a5637 Add a Shutdown method to server.
Allow gracefull shutdown of a server.
2014-08-18 20:30:10 +01:00
Miek Gieben eb2d26cb96 Remove Pool from server.
A noop for some time, remove it.
2014-08-18 20:29:54 +01:00
Miek Gieben fb3a1585ad fmt 2014-07-27 20:38:11 +01:00
Luke Young 0a6f133b26 Match format of other code 2014-07-27 10:44:39 -07:00
Luke Young 12f91af6ed Added ResponseWriter.LocalAddr support 2014-07-27 10:43:07 -07:00
Miek Gieben 62ee88c895 Documentation 2014-07-22 08:27:59 +01:00
Miek Gieben e1cb18539a Systemd support
Rename StartAndServe to ActivateAndServe and only use one PacketConn or
Listener. This just adds a new entry point into starting a server.
2014-07-21 15:24:55 +01:00
Miek Gieben d80ad4aae5 Add support for systemd socket activation 2014-07-18 20:32:17 +01:00
Miek Gieben d161b9087e Cleanup the PR a bit
Remove code and simplify some functions. Documentation is still on the
todo.
Also don't export any of these functions and/or types.
2014-07-09 21:02:21 +01:00
Omri Bahumi dea4cb300a [ISSUE-95] Send replies from the right source IP address
Fixes #95
2014-07-07 18:16:42 +03:00
Miek Gieben 2ec512f89b server: pool: remove pool implementation
Quite a lot of code for a tiny improvement. Lease the Pool boolean
option in server so current code does not break. Will be removed
in later versions.
2014-04-10 12:59:50 +00:00
Miek Gieben 8e37d3660d Merge branch 'master' of github.com:miekg/dns 2014-01-07 07:45:29 +00: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
Miek Gieben aafa94f352 better docs 2014-01-05 19:45:30 +00:00
Miek Gieben ac2ee587b1 Pool cleanups, readd wait for TCP 2014-01-05 16:29:07 +00:00
Miek Gieben 05ace47df8 Start of better documentation 2014-01-05 14:14:19 +00:00
Miek Gieben 5c37b9e564 Merge conflict resolved 2014-01-05 14:09:03 +00:00
Miek Gieben 8954a6e7c5 Remove debug logging 2014-01-05 13:51:59 +00:00
Miek Gieben 77345b2073 Don't set timeout
This leads to fake connection in the udp query handling.
2014-01-05 13:41:40 +00:00
Miek Gieben 49ece3e490 Add a memory pool
Re-use memory for UDP queries.
2014-01-05 13:39:33 +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
Armon Dadgar 0cf549278c Simplify the Write() for TCP based connections
Simplify the code path by using io.Copy to handle partial writes. Allocate `l` large enough to avoid a re-allocation. Potential short write fix.
2014-01-03 15:19:35 -08:00
Andrew Tunnell-Jones 58bb85e9b4 ServeMux's match should only case fold A-Z 2013-12-14 09:04:29 +00:00
Miek Gieben 39c7a972c3 typo in doc 2013-10-26 21:36:43 +01:00
Miek Gieben 717a8179f5 Use recommendation from RFC5966 and set idle timeout much lower 2013-10-19 22:00:17 +01:00
Miek Gieben 949e660b37 Better comments 2013-10-19 11:44:13 +01:00
Miek Gieben 3b832a072a Add TODO 2013-10-19 11:10:51 +01:00
Miek Gieben 08578961f5 Add a limit after which the connection is closed 2013-10-19 10:18:20 +01:00
Miek Gieben 5eca59c9e7 Correctly implement multiple queries over 1 tcp conn.
Completely transparant give users another query to handle.
2013-10-18 23:06:28 +01:00
Miek Gieben ed0b128bd2 Add some groundwork for implementing rfc5966 recommendations 2013-10-18 11:59:19 +00:00
Miek Gieben 5e674212d0 Nobody uses these author/version handlers, kill them 2013-10-17 20:23:30 +01:00
Miek Gieben 145242b519 Cleanup the defer from serve()
Close the connection when returning.
2013-10-16 21:45:29 +01:00
Miek Gieben 075c815ff1 Fix udp handling
Make the Close() for the udp message a nop, as closing it would
close the udp listener.
Make the serve function simpler as this does not need to be in a
for-loop.
2013-10-16 21:38:11 +01:00
Miek Gieben 104d9bf0ba remove mutex here 2013-10-15 20:44:55 +01:00
Miek Gieben 68083bc956 Fix merge conflict from net branch 2013-10-12 17:59:46 +01:00
Eric Gavaletz 41945815b8 Further patching for GAE compatibility.
Since net.ListenTCP, net.ListenUDP and net.TCPListener are not defined
in the GAE standard library these build flags will stop those files from
being imported.  A better solution would have been to break up this
monolithic package into smaller parts.
2013-10-02 11:50:35 -04:00
Miek Gieben 9a38f97391 Fix timeouts, Tsig and EDNS0 update size 2013-09-29 11:21:18 +01:00
Miek Gieben 2b6e9122bd Use the better name: SingleInflight 2013-09-06 09:49:07 +00:00
Miek Gieben ac0703bbe6 Handle MixCase queries again.
Thanks Ask for reporting.
2013-07-25 08:32:10 +01:00
Miek Gieben baa7ca4a82 Fix as212 server 2013-06-22 21:40:19 +01:00
Miek Gieben 5f6228d4cc Use the non-exported version err 2013-06-20 07:27:28 +01:00
Miek Gieben 5d094e6e2d gofmt 2013-06-14 19:42:55 +01:00
Miek Gieben 72f4cd81d8 Rename these internal values
_UDP and _TCP are ugly, just lowercase them.
2013-05-13 12:02:29 +02:00
Miek Gieben 5537ac771d Recheck the server mux match logic
And a test to make sure it all works. The root zone can still
be configured as a last resort (wildcard) match.
2013-05-12 15:56:12 +02:00
Miek Gieben d53d9eab81 gofmt 2013-05-05 20:30:44 +02:00
Miek Gieben 07d0e08366 Remove radix from core go dns 2013-05-04 23:21:01 +02:00
Miek Gieben 45775dff76 Remove the radix.Radix dependency
Put everything in maps. This removes to a major dependency and
makes Go DNS only depend on the core Go packages. This will
probably also be faster than the current setup -- although this
needs to be benchmarked.
2013-05-04 22:28:44 +02:00
Miek Gieben 602f3f4a49 typo 2012-12-28 09:20:15 +01:00
Miek Gieben 8cadf1d662 protect ServeMux access with a mutex
Make it "concurrent-use-safe"
2012-12-28 09:19:37 +01:00
Miek Gieben 3c4e9a95b4 update the documentation 2012-12-14 13:48:26 +01:00
Miek Gieben 235e892dfc Rename the RR types drop the RR_ prefix
This is also done in the official Go library. It also make the
code shorter.
2012-12-09 19:23:25 +01:00
Miek Gieben d758825590 more documentation 2012-12-02 10:14:53 +01:00
Miek Gieben 267cfaab11 Make ResponseWriter a io.Writer
The WriteBuf() is renamed Write() and returns and int and
an error. The old Write() call, is now WriteBuf()
2012-11-18 12:21:02 +01:00
Miek Gieben 00c4f46c7e Make WriteBuf ala io.Write 2012-11-18 12:05:18 +01:00
Miek Gieben ea947838d8 Do the TCP write in one write
Before the tcp writes were done like NSD does them:
2 bytes length, and the rest of the message.

Now a complete buffer is created with LLMMM...MMM, where
LL is the 2 byte length and MMM...MMM is the message to be send.
This makes the reply faster at the cost of doing a realloc of the
message buffer.
2012-10-17 12:40:57 +02:00
Miek Gieben 006fae01d1 added 1.0 as version 2012-10-12 14:20:43 +02:00
Miek Gieben 3560da6104 conn is gone 2012-10-12 14:18:01 +02:00
Miek Gieben 9ab211d660 small tweaks 2012-10-12 14:03:56 +02:00
Miek Gieben 7ca43a2a3f no nill message 2012-10-10 21:09:33 +02:00
Miek Gieben fdd3e70f19 Older version back 2012-10-10 21:09:11 +02:00
Miek Gieben 506a4237e5 no nil checks 2012-10-10 21:00:47 +02:00
Miek Gieben 56b5d926aa even faster, by smarter checking for tsig 2012-10-10 17:28:10 +02:00
Miek Gieben a35f8defbf even faster, by smarter checking for tsig 2012-10-10 17:27:03 +02:00
Miek Gieben a8f2ce51c7 Eliminate the conn structure for speed
conn isn't needed, we can encode the info directly in the
reponsewriter. This saves on allocations and gc for each connection
2012-10-10 15:37:25 +02:00
Miek Gieben 8a49e9da90 newConn is useless 2012-10-09 21:38:17 +02:00
Miek Gieben 570bf8dc69 Use proper error in packing and unpacking
All the relevant functions now return an error instead of
a simple boolean. This greatly approves the feedback to coders.

Spotted some fishy error handling along the way and fix that too.
2012-10-09 21:17:54 +02:00
Miek Gieben d5e6aaba0b adapt to v2 radix tree impl. 2012-09-09 23:38:01 +02:00
Miek Gieben 288bb6f812 the panic isnt right, we can still hit it, just return nil 2012-09-08 11:09:40 +02:00
Miek Gieben 7fce26e781 work better with the latest radix 2012-09-08 08:07:35 +02:00
Miek Gieben cacd7c4dcd fix merge 2012-09-07 20:37:45 +02:00
Miek Gieben aeb4c7d310 Use new radix api
Find return a boolean if it has an exact match, predecessor has
been removed
2012-09-07 19:32:22 +02:00
Miek Gieben b00354cc65 tweaks for the new radix stuff 2012-09-07 18:48:36 +02:00
Miek Gieben 9b74e1bc28 dns is 8bit clean 2012-09-04 08:08:44 +02:00
Miek Gieben c03a914cec add version.server and version.bind 2012-09-03 13:56:43 +02:00
Miek Gieben ac51a3e97d add authors.bind and friends. 2012-09-03 13:01:39 +02:00
Miek Gieben 88902fc943 Add authors helper function 2012-09-03 12:54:18 +02:00
Miek Gieben 12c7bc1021 First set the timeouts, then use the socket 2012-09-01 09:28:19 +02:00
Miek Gieben 0a586f5ebb Merge branch 'master' of github.com:miekg/dns 2012-08-31 15:10:46 +02:00
Miek Gieben 7a0877d090 Merge conflict fixed 2012-08-31 15:10:43 +02:00
Miek Gieben 4a4292c1b9 fix merge 2012-08-31 15:05:59 +02:00
Miek Gieben 9242855153 fix rest 2012-08-31 10:13:21 +02:00
Miek Gieben a0e3423d8e dont bail out when accepting the conn fails 2012-08-31 10:08:36 +02:00
Miek Gieben 2e13e0e10c req in response is not needed 2012-08-30 09:34:40 +02:00
Miek Gieben 1f29674505 small tweaks 2012-08-29 09:59:08 +02:00
Miek Gieben 14a8b3c2f2 Fix documentation 2012-08-28 19:53:21 +02:00
Miek Gieben b2fadde636 Fix hijack 2012-08-28 19:46:29 +02:00
Miek Gieben 0eae2d1735 implement Hijack 2012-08-28 19:41:23 +02:00
Miek Gieben e4fb00c34d Fix handling of non fully qualified domain names
When PackDomain sees such a name it calls panic.
All panic now use the prefix 'dns:'
2012-08-28 18:21:23 +02:00
Miek Gieben 8bc979fe1e make it compile 2012-08-28 13:30:59 +02:00
Miek Gieben a8737b6741 check if the packet has a valid answer section 2012-08-28 13:21:51 +02:00
Miek Gieben 9e318901a6 preparing to use hijack 2012-08-28 13:12:55 +02:00
Miek Gieben afd8cbf39d Add TsigTimersOnly function 2012-08-27 21:27:49 +02:00
Miek Gieben 68961f2f5b Make the IsTsig and IsEdn0 more usefull by returning the record 2012-08-25 11:24:01 +02:00
Miek Gieben b6342d94f9 typos 2012-08-24 15:20:20 +02:00
Ask Bjørn Hansen ffb28d97f9 Clarify comment 2012-08-23 20:21:33 -07:00
Miek Gieben 6f7aad15d8 documenation 2012-08-21 17:36:58 +02:00
Miek Gieben 47c859bc81 documentation 2012-08-21 17:21:47 +02:00
Miek Gieben a9637eeff1 documentation tweaks 2012-08-21 16:52:36 +02:00
Miek Gieben b720003623 make api smaller 2012-08-17 08:31:38 +02:00
Miek Gieben 6aee81ad74 refacter this code 2012-08-08 14:43:59 +02:00
Miek Gieben f05b532a3f gofmt 2012-08-08 11:13:28 +02:00
Miek Gieben 466496a23b Fix chaos 2012-08-08 11:08:25 +02:00
Miek Gieben 755bb11fde update the documentation 2012-08-08 09:26:29 +02:00
Miek Gieben 8646c8c6e6 Update fks-shield and remove ListenAndServeTsig
ListenAndServeTsig can be handled much more easier
if you create your own server object
2012-08-08 09:19:14 +02:00
Miek Gieben 468348fc28 user mgmt 2012-08-07 20:24:57 +02:00
Miek Gieben 07f206352a Add writebuf 2012-08-05 21:15:15 +02:00
Miek Gieben ae14f9a645 add bogus nl zone 2012-08-05 09:10:07 +02:00
Miek Gieben f204d99f07 documenation 2012-08-05 08:55:25 +02:00
Miek Gieben 77b74b02b0 Use Radix tree for the mux 2012-08-05 08:13:09 +02:00
Miek Gieben 4668fcfee4 Add Up method 2012-08-05 07:43:13 +02:00
Miek Gieben 3e33a3cb3a zone matching does not work ok 2012-08-05 05:39:47 +02:00
Miek Gieben 0a28fb5c6a Fixes for predecessor 2012-08-05 05:35:30 +02:00
Miek Gieben 74cb343482 add zone and put them in z dir 2012-08-05 04:55:27 +02:00
Miek Gieben 7a885b0c6b fqdn the handlers 2012-08-04 19:40:09 -07:00
Miek Gieben f62863dc27 Split of main and fix some dumb erros 2012-08-03 09:28:00 -07:00
Miek Gieben e08a87a991 Use the more correct SERVAIL instead of REFUSED 2012-08-03 08:38:41 -07:00
Miek Gieben 95c1154930 documentation 2012-05-08 14:17:17 +02:00
Miek Gieben fc599d23fe Save rtts for clients 2012-05-04 23:18:29 +02:00
Miek Gieben ac713d3128 Fix panic
Reported by Tomás Aparicio.
Closed #15
2012-05-02 22:54:57 +02:00
Miek Gieben 874787c537 Allow deregistration of handler
Implemented in both the server and client.
Renamed to client function to match the server side functions
Example progs need to be "ported" as this *is* an API change.
2012-03-26 23:15:15 +02:00
Miek Gieben 4f61f8621b More server side TSIG stuff - does not validate (yet) 2012-03-04 22:32:23 +01:00
Miek Gieben c53cddf38c TSIG overhauled
This lead to some changes in the Write() function. Both
server side and client side are now more similar.
2012-03-04 21:00:09 +01:00
Miek Gieben 1744a80850 add a TsigStatus to the client as well
Bring server and client side more inline
with each other. For a client we also
use TsigStatus() to retrieve the tsig info.
2012-03-04 14:47:20 +01:00
Miek Gieben fd6bdd4bba Elegant Tsig handling in the server
Lowlevel, but flexible. i.e. usable when building a server
2012-02-26 22:38:15 +01:00
Miek Gieben acba7a84fc Add server side tsig support 2012-02-26 22:02:55 +01:00
Miek Gieben f7f1d2ab42 Add listenAndServerTsig function 2012-02-26 21:33:50 +01:00
Miek Gieben 7981d35886 remove todos, it is working already 2012-02-26 20:09:03 +01:00
Miek Gieben 8b4957fe2e Tweaks 2012-02-25 22:12:01 +01:00
Miek Gieben 76c087f5ba docs for the RR interface 2012-02-15 23:34:41 +01:00
Miek Gieben bfffc15db4 Documentation 2012-02-15 13:16:09 +01:00
Miek Gieben 974f4214a2 More documentation updates 2012-02-12 11:37:52 +01:00
Miek Gieben 3ebacbaac8 udp msg size 2012-01-29 00:21:12 +01:00
Miek Gieben 09ac6c8dc5 gofmt 2012-01-28 00:35:37 +01:00
Miek Gieben f4dd746e14 return error if the buffer is to large 2012-01-27 08:46:41 +01:00
Miek Gieben bc2b826f38 Remove udpsize from ListenAndServer, too ugly 2012-01-27 08:45:33 +01:00
Miek Gieben 5917838cbb gofmt 2012-01-20 12:24:20 +01:00
Miek Gieben 780b49e3cc Fixes for weekly.2012-01-20 2012-01-20 12:16:32 +01:00
Miek Gieben 3069fd41a2 Remove print 2012-01-15 16:02:10 +01:00
Miek Gieben ee11948fcb Make the name more descriptive 2012-01-13 11:38:08 +01:00
Miek Gieben 189de95957 Make the udp msg size configurable 2012-01-12 22:47:36 +01:00