Commit Graph
37 Commits
Author SHA1 Message Date
Michael Bridgen db9bae4162 Use the fallback for reverse lookups too
I considered a couple of different factorings, that is

 * Implementing the fallback as a Lookup
 * Having a server struct that held the resolv.conf and methods for
   handling queries

but ultimately, this is simple and works.
2015-01-14 16:44:12 +00:00
Michael Bridgen fd90212db4 Get the format string right 2015-01-14 13:37:10 +00:00
Michael Bridgen ff45bcf945 Change Lookup method names
The Local was redundant (and inaccurate in the case of the mDNS client
implementation), and otherwise they are too nondescript.
2015-01-12 17:42:23 +00:00
Michael Bridgen 5f642d390c Pass queries for non-local names on to the configured nameserver 2015-01-12 17:12:15 +00:00
Michael Bridgen c76e213f76 Fix up common/testing confusions 2015-01-12 16:33:51 +00:00
rade 344eadfd8e Merge pull request #336 from squaremo/reform_dns_logging
Reform logging in weaveDNS

Closes #311.
2015-01-12 12:36:36 +00:00
rade 73e1d0c12e Merge pull request #314 from squaremo/issue289_exclude_test
Move testing utils to its own package

Fixes #289.
2015-01-12 11:42:55 +00:00
Bryan Boreham 15852dfa42 Remove repeated 'iota' in const lists, since Go knows what you mean 2015-01-09 15:55:35 +00:00
Michael Bridgen b114735a41 Reform logging in weaveDNS
* Put prefixes (including msg IDs) in front of log messages to
   distinguish them
 * Failed lookups get logged under Info as per issue #311
 * More accurate messages as per issue #311
2015-01-09 12:49:07 +00:00
Michael Bridgen 97bece2d7b Move testing utils to its own package
So as not to pollute command-line flags with test.* options.

It appears that importing "testing" (from stdlib) will add flags. To
avoid this, we need code to not depend on testing. But, since
testing_utils was previously in the same package as the rest of the
code, it dragged testing in.

Renaming testing_util.go to e.g., util_for_test.go might be enough to
avoid it being compiled with the regular code. We may want it to be
available to tests for other packages -- after all it is utilities for
testing -- so it goes in its own package.
2015-01-09 12:36:32 +00:00
Michael Bridgen 15ebc2c9a7 Factor the making of handlers out
NB I removed free variables from the LookupFunc implementations, to
avoid confusion between `s` the receiver and the closed-over `s`.

Also corrected a mistake in the write error log message.
2015-01-09 12:29:28 +00:00
Bryan Boreham f24edf755f Add tests for server.go 2015-01-08 18:38:38 +00:00
Bryan Boreham bd2844d186 Split http-startup code from server-startup 2015-01-08 18:38:38 +00:00
Michael Bridgen 89fa52818c Account for PTR answers in mdns_client
En passant, ResponseA -> the more versatile Response.
2015-01-08 18:30:30 +00:00
Michael Bridgen e9b84c968d Clean up the mdns_server tests so we can test PTR queries 2015-01-08 15:32:59 +00:00
Michael Bridgen dd6ca5ab92 Factor out the particulars of looking up A or PTR queries 2015-01-08 15:32:59 +00:00
Michael Bridgen bf752d2d1f Implement zone lookup with MDNSCLient
This separates Zone into the DB ops and the Lookup ops, and implements
the latter for MDNSClient so it can be used just like the zonedb.

A notable change is that Lookup methods only ever return one result,
while MDNSClient.SendQuery could in theory return multiple results
(though it wouldn't, because no server would supply more than one
result in a response, and it stops waiting after getting one response
..).

ReverseLookupLocal is implemented even though no MDNSServer will
answer at present (hence no test yet).

Lastly, the handler (creating) functions can now be given a list of
Lookup implementations to try in order.
2015-01-08 13:39:33 +00:00
Michael Bridgen 3866bd5e63 Parse reverse address lookup IPs in the Zone
.. rather than making clients of the zone do it. At the minute there's
only one call site, but soon there will be more.
2015-01-08 13:39:33 +00:00
Bryan Boreham 0af9b2cbab Fix up nameserver tests for previous refactoring 2015-01-02 17:12:21 +00:00
Bryan Boreham 82b54aabcd Move logging, updating and testing utils into common directory 2015-01-02 14:49:49 +00:00
Michael Bridgen b08c28c038 Cope with duplicate name->IP entries
The zone DB no longer considers duplciates of (IP, name); it will
reject duplicates of (IP, name, ident), but this ultimately doesn't
matter since those are all the fields it records anyway.

The HTTP interface treats these duplicates as trivial success (i.e.,
it acts as if it's idempotent, which it is).

This changes the behaviour for removals: if (IP, name) is recorded for
two different containers, removing one will leave the other extant.
2014-12-01 15:44:44 +00:00
rade a17425989e Merge pull request #256 from squaremo/dont_splode
Don't splode in error type checks if given nil
2014-12-01 14:34:02 +00:00
Michael Bridgen 0764d7aaaf Don't splode in error type checks if given nil
These two testing utils assumed that they got an error, and checked
its type; however, the most likely failure case is that there's no
error (i.e., nil). In that case they would cause a NPE panic.
2014-12-01 14:13:41 +00:00
Matthias Radestock 2680e594dd rename 2014-11-28 16:27:11 +00:00
Matthias Radestock 56bfb09656 s/weaveIP/ip 2014-11-27 16:31:42 +00:00
Matthias Radestock 24702e3a7a stop weavedns from complaining when a container has no docker ip
e.g. when it was started with --net=none

weavedns wasn't actually using the docker-assigned ip for anything, so
this change is a simple matter of eradicating it from the code.
2014-11-27 16:13:06 +00:00
Michael Bridgen b3d19d6e9d Wait for weaveDNS HTTP to be running before sending it names
This adds a no-op endpoint to the HTTP API at `/status`. The script
simply tries this until it succeeds or gets bored.
2014-11-26 14:18:26 +00:00
Bryan Boreham 5cc24fe55e Rename 'server' to 'listener' to better match how it is used 2014-11-20 16:37:25 +00:00
Bryan Boreham 22c3ff9f60 Set 'Unsafe' flag to allow dns.Server to handle responses 2014-11-20 16:36:13 +00:00
Matthias Radestock 3cb6f1b3cc handle AAAA queries for external IPs
Closes #188.
2014-11-17 12:25:46 +00:00
Matthias Radestock fda412a151 refactor: rename badly named function
makeAddressReply handles both A and AAAA records
2014-11-17 12:06:06 +00:00
Bryan Boreham 91b6719924 Fetch docker version, to check things are working 2014-11-05 16:57:59 +00:00
Bryan Boreham 5d8045f5ee Factor out error check 2014-11-05 16:57:24 +00:00
Bryan Boreham a0a5921148 Check for error return from AddEventListener 2014-11-05 12:44:39 +00:00
Michael Bridgen 27beebf5d5 Factor out the wait-for-interface code 2014-11-03 17:47:16 +00:00
Michael Bridgen 822ec90606 Rename weavedns package to nameserver, and fix up 2014-10-29 11:41:58 +00:00
Michael Bridgen 8469fea215 Move files around in preparation for melding into weave code
* library code will go in weave/nameserver/
 * main.go for the server goes in weavedns/ with the containerising
2014-10-29 11:34:56 +00:00