aboutsummaryrefslogtreecommitdiff
path: root/plugin/file (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-10-21Use filepath when manipulating file paths (#2221)Gravatar Manuel Stocker 2-5/+5
Automatically submitted.
2018-10-19Remove whitespace and pass presubmit (#2217)Gravatar Yong Tang 1-2/+2
While running the following, noticed the whitespace warning from presubmit: ``` ubuntu@ubuntu:~/coredns$ docker run -i -t --rm -v $PWD:/go/src/github.com/coredns/coredns --net=host golang:1.11 root@ubuntu:/go# cd src/github.com/coredns/coredns/ root@ubuntu:/go/src/github.com/coredns/coredns# make ** presubmit/context ** presubmit/filename-hyphen ** presubmit/test-lowercase ** presubmit/trailing-whitespace plugin/auto/README.md:* `reload` interval to perform reload of zone if SOA version changes. Default is one minute. plugin/auto/README.md: Value of `0` means to not scan for changes and reload. eg. `30s` checks zonefile every 30 seconds plugin/file/README.md:* `reload` interval to perform reload of zone if SOA version changes. Default is one minute. plugin/file/README.md: Value of `0` means to not scan for changes and reload. eg. `30s` checks zonefile every 30 seconds ** presubmit/trailing-whitespace: please remove any trailing white space ``` Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-10-13plugin/file: Fix memory leak in Parse (#2194)Gravatar Tom Thorogood 1-0/+6
For zone files with more than 10,000 records, the goroutines and memory pinned by dns.ParseZone won't be released unless the tokens chan is drained. As Parse is called by (*Zone).Reload very frequently, this causes memory leaks and OOM conditions. Updates miekg/dns#786
2018-09-29Configurable zone reload interval in file plugin (#2110)Gravatar marqc 7-14/+35
* Configurable zone reload interval in file plugin * passing reload config from auto plugin to file plugin. removed noReload property from Zone struct. fixed tests based on short file reload hack
2018-09-22K8s remove string ops (#2119)Gravatar Miek Gieben 1-1/+1
* plugin/kubernetes: remove bunch a string ops This removes a bunch of appends to where not needed, makes dnsutil.Join take variadic args which removes the need to wrap in a new string slice. Signed-off-by: Miek Gieben <miek@miek.nl> * Fix calls to dnsutil.Join Signed-off-by: Miek Gieben <miek@miek.nl> * Revert these Signed-off-by: Miek Gieben <miek@miek.nl>
2018-08-29Default to scrubbing replies in the server (#2012)Gravatar Miek Gieben 7-46/+14
Every plugin needs to deal with EDNS0 and should call Scrub to make a message fit the client's buffer. Move this functionality into the server and wrapping the ResponseWriter into a ScrubWriter that handles these bits for us. Result: Less code and faster, because multiple chained plugins could all be calling scrub and SizeAndDo - now there is just one place. Most tests in file/* and dnssec/* needed adjusting because in those unit tests you don't see OPT RRs anymore. The DNSSEC signer was also looking at the returned OPT RR to see if it needed to sign - as those are now added by the server (and thus later), this needed to change slightly. Scrub itself still exist (for backward compat reasons), but has been made a noop. Scrub has been renamed to scrub as it should not be used by external plugins. Fixes: #2010 Signed-off-by: Miek Gieben <miek@miek.nl>
2018-08-14Typo fixes (#2031)Gravatar Karsten Weiss 3-3/+3
2018-07-28Fix ineffassign (#1959)Gravatar Yong Tang 2-3/+2
* Fix ineffassign This fix tries to fix ineffassign, as was reported in: https://goreportcard.com/report/github.com/coredns/coredns#ineffassign Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Update setup.go Revert this one change, so this can be merged.
2018-07-19Clean up tests logging (#1979)Gravatar Miek Gieben 1-0/+5
* Clean up tests logging This cleans up the travis logs so you can see the failures better. Older tests in tests/ would call log.SetOutput(ioutil.Discard) in a haphazard way. This add log.Discard and put an `init` function in each package's dir (no way to do this globally). The cleanup in tests/ is clear. All plugins also got this init function to have some uniformity and kill any (future) logging there in the tests as well. There is a one-off in pkg/healthcheck because that does log. Signed-off-by: Miek Gieben <miek@miek.nl> * bring back original log_test.go Signed-off-by: Miek Gieben <miek@miek.nl> * suppress logging here as well Signed-off-by: Miek Gieben <miek@miek.nl>
2018-07-03plugin/file: fix zone expiration (#1933)Gravatar Isolus 1-12/+15
2018-07-03Updating filepath in auto plugin if existing zone's file changes location ↵Gravatar Joey Espinosa 2-4/+19
(#1901) (#1910) Exporting Zone.File to avoid getters and setters Updating getter and setter for Zone.File to be less racy Renaming GetFile to File in zone plugin
2018-06-15plugin/forward: add REFUSED test (#1878)Gravatar Miek Gieben 2-2/+2
add a test to see if we copy the rcode correctly. Some minor cleanup in import ordering and renaming NewUpstream to New as we already are in the upstream package.
2018-06-12plugin/file: fix local CNAME lookup (#1866)Gravatar Miek Gieben 1-14/+11
* plugin/file: fix local CNAME lookup Issue #1864 explains it will, when we serve the child zone as well we should just recursive into ourself (upstream self). Thus relax the IsSubDomain check in file/lookup.go and just query (even if the query will hit a remote server). I've looped over all other plugins that do something similar (CNAME resolving) and they didn't do the IsSubDomain check; therefor I've removed it from *file* as well. Added test in file_upstream_test that shows this failed before but now results in a reply. Fixes #1864 * self does not need to be exported * Fix test We don't know if we had a valid reply. Check this.
2018-06-02presubmit: Check errorf as well (#1845)Gravatar Miek Gieben 2-2/+2
Uppercase all these test errors as well. And extend the presubmit to check for these in the future. Also do a slightly smarter grep to only get t.<something>. as (because dump regexp) this also grep over non test files.
2018-05-07presubmit: check for uppercase (#1774)Gravatar Miek Gieben 7-32/+32
Another thing we can test automatically, we sorta settled on using an uppercase letter in in t.Log and t.Fatal calls. Let's just check for this.
2018-05-01Do Compress only when need in request.Scrub (#1760)Gravatar Miek Gieben 1-2/+2
* Remove Compress by default Set Compress = true in Scrub only when the message doesn not fit the advertized buffer. Doing compression is expensive, so try to avoid it. Master vs this branch pkg: github.com/coredns/coredns/plugin/cache BenchmarkCacheResponse-2 50000 24774 ns/op pkg: github.com/coredns/coredns/plugin/cache BenchmarkCacheResponse-2 100000 21960 ns/op * and make it compile
2018-04-22Use logging (#1718)Gravatar Miek Gieben 5-7/+3
* update docs * plugins: use plugin specific logging Hooking up pkg/log also changed NewWithPlugin to just take a string instead of a plugin.Handler as that is more flexible and for instance the Root "plugin" doesn't implement it fully. Same logging from the reload plugin: .:1043 2018/04/22 08:56:37 [INFO] CoreDNS-1.1.1 2018/04/22 08:56:37 [INFO] linux/amd64, go1.10.1, CoreDNS-1.1.1 linux/amd64, go1.10.1, 2018/04/22 08:56:37 [INFO] plugin/reload: Running configuration MD5 = ec4c9c55cd19759ea1c46b8c45742b06 2018/04/22 08:56:54 [INFO] Reloading 2018/04/22 08:56:54 [INFO] plugin/reload: Running configuration MD5 = 9e2bfdd85bdc9cceb740ba9c80f34c1a 2018/04/22 08:56:54 [INFO] Reloading complete * update docs * better doc
2018-04-22all: fix plugin import ordering (#1717)Gravatar Miek Gieben 11-22/+11
Got a bit messed up with stb lib "context" usage.
2018-04-20global: move to context (#1699)Gravatar Miek Gieben 11-11/+22
* global: move to context Move from golang.org/x/net/context to std lib's context. Change done with: for i in $(grep -l '/context' **/*.go); do sed -e 's|golang.org/x/net/context|context|' -i $i; echo $i; done for i in **/*.go; do goimports -w $i; done * drop from dns.pb.go as well
2018-04-19Update all plugins to use plugin/pkg/log (#1694)Gravatar Miek Gieben 7-29/+24
* Update all plugins to use plugin/pkg/log I wish this could have been done with sed. Alas manually changed all callers to use the new plugin/pkg/log package. * Error -> Info * Add docs to debug plugin as well
2018-03-09logging: Don't use PrintF when not needed (#1599)Gravatar Miek Gieben 1-1/+1
These log print don't have any verbs, so just use plain Print
2018-02-28plugin/file: shutdown reload goroutine (#1571)Gravatar Miek Gieben 5-3/+30
* plugin/file: shutdown reload goroutine Shutdown the z.Reload() routine (if started in the first place) on shutdow and reload. Fixes #1508 * Must be put in c.OnShutdown() * up test coverage
2018-02-16plugin/auto/file/secondary: Use new upstream resolver (#1534)Gravatar Chris O'Haver 6-16/+13
* move file, auto, secondary to new upstream * include context in request
2018-02-08Add OWNERS file (#1486)Gravatar Miek Gieben 1-0/+7
This should have everyone, but the process was quite manual. The rename from middleware -> plugin also meant I had to do some extra digging on who actually submitted the PR. I also double checked the current list of people with commit access. Every plugin now has an OWNERS, except *reverse*. I'll file a bug for that.
2018-01-23plugin/secondary: don't duplicate apex records (#1413)Gravatar Miek Gieben 2-1/+11
See #1400 and the discussion in that bug. Fixes #1400
2018-01-23plugin/secondary: fix a bunch of things and tests (#1406)Gravatar Miek Gieben 1-16/+13
Fix the error handling. Log when we have an error during any of the transfer state. And if there isn't an error transfer the zones. Also fix the tests in test/ so we, at least, check the initial transfer. Update the docs to show more about how errors are handled. Ref #1400
2018-01-04Manual pages (#1346)Gravatar Miek Gieben 1-1/+5
* Add manual pages Generate manual pages from the README and extend README with Name and Description sections. The generation requires 'ronn' which may not be available. Just check in all generated manual pages.
2017-12-13Moving TransferParse from file to its own package (#1286)Gravatar Brad Beam 1-41/+2
* Moving TransferParse from file to its own package * Adding tests for parse
2017-12-11plugin/file: fix crash (#1301)Gravatar Miek Gieben 1-1/+4
When z.Tree.Prev returns zero we should break out of this loop, not use elem as if nothing has happened. Can be triggered by sending edns0 to unsigned zone.
2017-12-11plugin/file: Fix response for qtype=DS (#1300)Gravatar Miek Gieben 2-1/+27
DS is peculiar and needs some special cases to do the right things. For a direct query return the DS, but if we're hitting below the delegation return the NS+DS in a delegation response.
2017-12-11file/plugin: if there is a delegation use that (#1299)Gravatar Miek Gieben 2-7/+5
Don't put NS records in the answer section; if we see it is delegated we should put the records in the AUTHORITY section. This removes a special case, which is good.
2017-11-10fuzz: put fuzzing stuff in own build tag (#1215)Gravatar Miek Gieben 1-0/+2
No need to have this build all the time.
2017-10-31readme: more tests (#1184)Gravatar Miek Gieben 1-3/+16
* readme: more tests Add dnssec and file plugin to the test readme. This requires creating a bunch of files with the right content. Doing so already unconvered an unconditional type assertion in DNSSEC. This PR will include the fix for that as well. Also extended the snippets in the file plugin README, so that they are whole Corefile - showing more value and checking all corefile snippets. Create outliner right now is the kubernetes plugin, because even setting the right env vars will result in: open /var/run/secrets/kubernetes.io/serviceaccount/token: no such file or directory": Which we can't create for a test. * lint
2017-09-29Add fuzzing infrastructure (#1118)Gravatar Miek Gieben 1-0/+48
Fix file/fuzz.go build and docs in Makefile.fuzz Each plugin can add a fuzz.go to join the fuzzing craze. pkg/fuzz/do.go could be made a lot smarter, but is probably good enough for starters. $ make -f Makefile.fuzz <plugin> will build with go-fuzz-build and then execute a go-fuzz run. Each plugin's fuzz run uses a per-plugin directory to store the fuzz data.
2017-09-26test: fix zone file (#1112)Gravatar Miek Gieben 1-0/+3
* test: fix zone file Add missing $TTL 3600 as the top. Recent change in Go DNS made this mandatory - old behavior wasn't standards compliant. * and here
2017-09-22go lint/vet/misspell cleanup (#1105)Gravatar Yong Tang 1-1/+1
This fix address several issues related to golint/vet/misspell. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-09-21pkg: add dnstest (#1098)Gravatar Miek Gieben 9-26/+26
Add a full test server impl in this new package + tests. Move dnsrecorder into this package as well and finish up the commented out tests that were left in the old dnsrecorder package. Update all callers and tests.
2017-09-20plugin/{file,auto}: drop fsnotify (#1090)Gravatar Miek Gieben 4-40/+46
* plugin/{file,auto}: drop fsnotify Reload every minute. This is more deterministic then fsnotify. Also other thing cropped up: sharing zone files between zone; there is only 1 fsnotify event and we need to fan out the reload to all zone files. This is a large rewrite (which could still be done), for now, poll the zone file on disk. Give serial no change a special error type so we can check for this. Improve the logging for reloading: 2017/09/19 07:34:39 [INFO] Successfully reloaded zone "miek.nl." in "db.miek.nl" with serial 128263060 2017/09/19 07:34:45 [INFO] Successfully reloaded zone "miek.nl." in "db.miek.nl" with serial 128263059 2017/09/19 07:34:51 [INFO] Successfully reloaded zone "miek.nl." in "db.miek.nl" with serial 128263060 Fixes #1013 * typo
2017-09-14Remove the word middleware (#1067)Gravatar Miek Gieben 38-0/+5095
* 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