Commit graph

29 commits

Author SHA1 Message Date
Miek Gieben
d8714e64e4 Remove the word middleware (#1067)
* Rename middleware to plugin

first pass; mostly used 'sed', few spots where I manually changed
text.

This still builds a coredns binary.

* fmt error

* Rename AddMiddleware to AddPlugin

* Readd AddMiddleware to remain backwards compat
2017-09-14 09:36:06 +01:00
Yong Tang
7ca018374f golint cleanup (#828)
Clean up some golint related issues.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-04 09:46:40 -07:00
Miek Gieben
9fb266aebe middleware/secondary: multiple fixes (#745)
Fix transferring the zone from a master and the matching of notifies
to source and dst IP addresses.

Add `upstream` keyword as well, because it is needed for the same
reasons as in the *file* middlware.
Add some dire warning about upstream in the readme of both middlewares.

Out of band testing, hidden by net build tag was added. Integration
testing still needs to be setup.
2017-06-21 23:46:20 -07:00
Miek Gieben
990460ee7c middleware/file: don't reload zone when SOA isn't changed (#707)
* middleware/file: don't reload zone when SOA isn't changed

Give Parse an extra argument which is the SOA's serial, if > 0 we check
against the just parsed SOA and then just return.

Most notable use is in reload.go which is both used in the file and auto
middleware.

Fixes #415

* PR comments
2017-06-08 18:43:11 +01:00
Yong Tang
81af74aad0 Fix import path github.com/miekg/coredns -> github.com/coredns/coredns (#547)
This fix fixes import path from
`github.com/miekg/coredns`
->
`github.com/coredns/coredns`
2017-02-22 06:51:47 +00:00
Miek Gieben
0919216d3c middleware/{file, auto}: resolve external CNAMEs
Do the same thing as in etcd and give the option of externally resolving
CNAME. This is needed when CoreDNS is a proxy as well is serving zones.
2016-11-09 21:26:49 +00:00
Miek Gieben
e210b06e89 middleware/file: also react to rename events. (#406)
* middleware/file: also react to rename events.

* React to all events
2016-11-09 10:02:52 +00:00
Miek Gieben
2cca527d9f middleware/file: fix delegations (#376)
Fix the delegation handling in the *file* and *dnssec* middleware.
Refactor tests a bit and show that they are failling.

Add a Tree printer, cleanups and tests.
Fix wildcard test - should get no answer from empty-non-terminal
2016-11-05 14:39:49 +00:00
Miek Gieben
0509f4b4ac middleware/file: reload on file mv (#365)
When a file is moved into position we should also reload the zones'
content.

This also fixes deadlock bug in the locking, a reload would block any
further lookups.
2016-10-28 12:57:02 +01:00
Miek Gieben
039596f319 middleware/file: add test for reload (#361)
This add a highlevel integration test for zone reloading. It also
fixes a data race in the actual reloading process.
2016-10-27 21:01:04 +01:00
Miek Gieben
d536272201 middleware/auto: add (#333)
Add auto-load middleware that automatically picks up zones.

Every X seconds it will scan for new zones.
Add tests and documentation.

Make 'make test' use -race.
2016-10-17 18:37:56 +01:00
Miek Gieben
090d1872e9 Golint2 (#280)
* Fix linter errors

* More linting fixes

* More docs and making members private that dont need to be public

* Fix linter errors

* More linting fixes

* More docs and making members private that dont need to be public

* More lint fixes

This leaves:

~~~
middleware/kubernetes/nametemplate/nametemplate.go:64:6: exported type NameTemplate should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:71:1: exported method NameTemplate.SetTemplate should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:108:1: exported method NameTemplate.GetZoneFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:116:1: exported method NameTemplate.GetNamespaceFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:120:1: exported method NameTemplate.GetServiceFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:124:1: exported method NameTemplate.GetTypeFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:135:1: exported method NameTemplate.GetSymbolFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:167:1: exported method NameTemplate.IsValid should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:182:6: exported type NameValues should have comment or be unexported
middleware/kubernetes/util/util.go:1:1: package comment should be of the form "Package util ..."
middleware/kubernetes/util/util.go:27:2: exported const WildcardStar should have comment (or a comment on this block) or be unexported
middleware/proxy/lookup.go:66:1: exported method Proxy.Forward should have comment or be unexported
middleware/proxy/proxy.go:24:6: exported type Client should have comment or be unexported
middleware/proxy/proxy.go:107:1: exported function Clients should have comment or be unexported
middleware/proxy/reverseproxy.go:10:6: exported type ReverseProxy should have comment or be unexported
middleware/proxy/reverseproxy.go:16:1: exported method ReverseProxy.ServeDNS should have comment or be unexported
middleware/proxy/upstream.go:42:6: exported type Options should have comment or be unexported
~~~

I plan on reworking the proxy anyway, so I'll leave that be.
2016-09-23 09:14:12 +01:00
Miek Gieben
d1f17fa7e0 Cleanup: put middleware helper functions in pkgs (#245)
Move all (almost all) Go files in middleware into their
own packages. This makes for better naming and discoverability.

Lot of changes elsewhere to make this change.

The middleware.State was renamed to request.Request which is better,
but still does not cover all use-cases. It was also moved out middleware
because it is used by `dnsserver` as well.

A pkg/dnsutil packages was added for shared, handy, dns util functions.

All normalize functions are now put in normalize.go
2016-09-07 11:10:16 +01:00
Miek Gieben
99170ac62e Better logging for NSEC3
When dropping NSEC3 records provide better logging and add test
for NSEC3 records.
2016-09-03 09:37:36 +01:00
Miek Gieben
e294c95582 middleware/file: Support delegations (#124)
Return a delegation when seeing one while traversing the tree in
search of an answer.

Put the SOA and NS record in the zone.Apex as these are to be handled
somewhat special.

Lowercase record on insert to make compares easier. This lowercases
all RR that have domain names in their rdata as well.
2016-04-16 16:16:52 +01:00
Miek Gieben
f783634174 Send notifies after reload 2016-04-15 20:29:32 +01:00
Miek Gieben
a4bf01e1ee Clean paths 2016-04-15 20:14:04 +01:00
Miek Gieben
dcd05032a4 Watch the entire directory
Instead of watching a single file watch the entire directory and
catch the .Name from the event. On any event, just reload the damn
thing. This also fixes the problem of loosing events when the inode
changes.
2016-04-15 20:00:17 +01:00
Miek Gieben
aa0ba0c3b4 Re-add the watcher 2016-04-15 17:09:01 +00:00
Miek Gieben
c9d8a57ed6 Reload zone when a write is detected (#122)
Zone reloading
2016-04-15 14:26:27 +01:00
Miek Gieben
982377516b Only transfer a zone once (#117)
Use sync.Once to only transfer a zone once.

Fixes #115
2016-04-13 20:14:03 +01:00
Miek Gieben
e4c72719bf Test and fix notify
More tests and add RemoteAddr to State, prolly LocalAddr will be

useful as well.

Fixed and tested IsNotify method.
2016-04-07 07:42:58 +01:00
Miek Gieben
c961acbb6e Add complete secondary support
Respond to notifies and allow a secondary to follow the SOA parameters

to update a zone from a primary. Also sprinkle it with logging.



Also extend monitoring to include qtype in more metrics.
2016-04-05 10:53:23 +01:00
Miek Gieben
20e16491ec Add more logging
Put some more logging in CoreDNS.
2016-04-05 07:37:05 +01:00
Miek Gieben
f58f1e4285 Add secondary support
Allow specifying a primary server and retrieve the zone's content.

Add tests and an Expired bool to zone struct, to stop server zones

that are expired. The zone is retrieved on Startup, no updates of

changed content are done. We also don't respond to notifies yet.
2016-04-03 09:02:34 +01:00
Miek Gieben
6ecbdef112 Add notifies to master servers
This adds a bunch of supporting code to send notifies to a primary

name server.
2016-04-03 07:37:41 +01:00
Miek Gieben
9b21646954 empty non-terminal support
When looking for a name in tree, return wether we got to a longer one -

if so we had an ent. Add tests + dnssec tests and refactor the tests as

well a bit.
2016-04-02 16:56:16 +01:00
Miek Gieben
e56d206542 Support outgoing zone transfers
These can be enabled by adding "transfer out" to the Corefile. Without
it no AXFR is allowed.

For now only AXFR and no IXFR. No TSIG and no ACLs.
2016-03-28 18:23:17 +01:00
Miek Gieben
5387c162c9 Implement a DNS zone
Full implementation, DNS (and in the future DNSSEC). Returns answer in a
hopefully standards compliant way.
Testing with my miek.nl zone are included as well.
This should correctly handle nodata, nxdomain and cnames.
2016-03-28 10:15:05 +01:00