aboutsummaryrefslogtreecommitdiff
path: root/plugin/pkg (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-10-19plugin/cache: fix TTL for negative DNS responses (#2197)Gravatar Ruslan Drozhdzh 2-33/+13
2018-10-10Revert "plugin/log: Change time format to be consistent with pkg/log ↵Gravatar Miek Gieben 1-1/+1
(#2135)" (#2179) This reverts commit ae2a0c62b71f18e594bc5565b00fb8a4d6ef44fc.
2018-09-27plugin/log: Change time format to be consistent with pkg/log (#2135)Gravatar Eugen Kleiner 1-1/+1
2018-09-22K8s remove string ops (#2119)Gravatar Miek Gieben 2-6/+5
* 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-09-19Better naming (#2104)Gravatar Miek Gieben 8-69/+81
* Move functions from pkg/transport to pkg/parse Although "parse" is a fairly generic name I believe this is somewhat better named. pkg/transport keeps a few constants that are uses throughout for the rest is is renaming a bunch (and the fallout from there to make things compile again). Signed-off-by: Miek Gieben <miek@miek.nl> * Fix tests Signed-off-by: Miek Gieben <miek@miek.nl>
2018-09-19Cleanup ParseHostOrFile (#2100)Gravatar Miek Gieben 3-7/+93
Create plugin/pkg/transport that holds the transport related functions. This needed to be a new pkg to prevent cyclic import errors. This cleans up a bunch of duplicated code in core/dnsserver that also tried to parse a transport (now all done in transport.Parse). Signed-off-by: Miek Gieben <miek@miek.nl>
2018-08-31Move cache Keys to 64bit for a better dispersion and lower collision ↵Gravatar Francois Tur 2-18/+20
frequency (#2077) * - change Key for cache to 64bits. * - change Key for cache to 64bits.
2018-08-29lower cache min limit (#2065)Gravatar Chris O'Haver 1-2/+2
2018-08-21Metrics listener fix (#2036)Gravatar Zach Eddy 1-0/+7
* Create test to verify correct listener behavior * Create Unset function to remove todo items * Reset address for prometheus listener before restarting * Add inline documentation for Unset function * Make shutdownTimeout a constant and change to five seconds * Revert ForEach behavior in uniq package
2018-08-14Typo fixes (#2031)Gravatar Karsten Weiss 3-3/+3
2018-07-20New plugin: loop (#1989)Gravatar Miek Gieben 1-0/+7
* New plugin: loop Add a plugin that detects loops. It does this by sending an unique query to our selves. If we see the query more than twice we stop the process. If there isn't a loop, the plugin disables it self and becomes a noop plugin. Signed-off-by: Miek Gieben <miek@miek.nl>
2018-07-20Logfatalf (#1990)Gravatar Miek Gieben 1-1/+11
* bliep Signed-off-by: Miek Gieben <miek@miek.nl> * plugin/log: add log.Fatal[f] Add log.Fatal(f) to mimic more of the log package. The first and only use is in the (new) loop plugin. Signed-off-by: Miek Gieben <miek@miek.nl>
2018-07-19Clean up tests logging (#1979)Gravatar Miek Gieben 2-0/+9
* 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-07Doh: put in pkg/doh (#1946)Gravatar Miek Gieben 2-0/+171
* DoH: put in pkg/doh Factor out the DoH stuff into its own package, add function to request a DoH response. This can be used by forward (and maybe proxy) to implement DoH client support. Signed-off-by: Miek Gieben <miek@miek.nl> * lint Signed-off-by: Miek Gieben <miek@miek.nl> * ... and make it compile Signed-off-by: Miek Gieben <miek@miek.nl>
2018-07-05Fix typo in comment (#1939)Gravatar Marcus André 1-1/+1
Automatically submitted.
2018-07-01plugin/metadata: metadata is just label=value (#1914)Gravatar Miek Gieben 2-187/+0
This revert 17d807f0 and re-adds the metadata plugin as a plugin that just sets a label to a value function. Add package documentation on how to use the metadata package. Make it clear that any caching is up to the Func implemented. There are now - no in tree users. We could add the request metadata by default under names that copy request.Request, i.e request/ip - remote IP request/port - remote port Variables.go has been deleted. Signed-off-by: Miek Gieben <miek@miek.nl>
2018-06-29plugin/metadata: some cleanups (#1906)Gravatar Miek Gieben 2-16/+14
* plugin/metadata: some cleanups Name to provider.go as that's what being defined right now in the file. Use request.Request because that's done in variables.go anyway. Name the main storage M, because there is no further meaning behind. Remove superfluous methods Signed-off-by: Miek Gieben <miek@miek.nl> * Fix test Signed-off-by: Miek Gieben <miek@miek.nl>
2018-06-29plugin/metadata: add metadata plugin (#1894)Gravatar Eugen Kleiner 2-0/+189
* plugin/metadata: add metadata plugin * plugin/metadata: Add MD struct, refactor code, fix doc * plugin/metadata: simplify metadata key * plugin/metadata: improve setup_test * Support of metadata by rewrite plugin. Move calculated variables to metadata. * Move variables from metadata to pkg, add UTs, READMEs change, metadata small fixes * Add client port validation to variables_test * plugin/metadata: improve README * plugin/metadata: rename methods * plugin/metadata: Update Metadataer interface, update doc, cosmetic code changes * plugin/metadata: move colllisions check to OnStartup(). Fix default variables metadataer. * plugin/metadata: Fix comment for method setValue * plugin/metadata: change variables order to fix linter warning * plugin/metadata: rename Metadataer to Provider
2018-06-27Fix max-age in http server (#1890)Gravatar Miek Gieben 2-0/+144
* Fix max-age in http server Move the minMsgTTL to dnsutil and rename it MinimalTTL, move some constants there as well. Use these new function in server_https to correctly set the max-age HTTP header. Fixes: #1823 * Linter
2018-06-27Watch feature (#1527)Gravatar John Belamaric 2-0/+201
* Add part 1 watch functionality. (squashed) * add funcs for service/endpoint fqdns * add endpoints watch * document exposed funcs * only send subset deltas * locking for watch map * tests and docs * add pod watch * remove debugs prints * feedback part 1 * add error reporting to proto * inform clients of server stop+errors * add grpc options param * use proper context * Review feedback: * Removed client (will move to another repo) * Use new log functions * Change watchChan to be for string not []string * Rework how k8s plugin stores watch tracking info to simplify * Normalize the qname on watch request * Add blank line back * Revert another spurious change * Fix tests * Add stop channel. Fix tests. Better docs for plugin interface. * fmt.Printf -> log.Warningf * Move from dnsserver to plugin/pkg/watch * gofmt * remove dead client watches * sate linter * linter omg
2018-06-22retry creating dnstest.Server if tcp or udp port is in use (#1799)Gravatar Ruslan Drozhdzh 1-10/+20
* retry creating dnstest.Server if tcp or udp port is in use * changes according to review
2018-06-15plugin/forward: add REFUSED test (#1878)Gravatar Miek Gieben 1-3/+3
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-7/+10
* 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-11Remove dnsutil.Dedup (#1867)Gravatar Miek Gieben 1-12/+0
Remove the code and remove the call in etcd and kubernetes handlers. This does mean we should not add dups in the first place, which means adding maps in backend_lookup to prevent dups from begin added. This should cut down on the allocations because dnsutil.Dedup is very expensive by converting everything to strings, we avoid doing that now.
2018-06-07Normalizing Response Duration in Log Plugin (#1860)Gravatar Malcolm Akinje 2-1/+5
* Current stage of the log files. Test need to be done as well as formatting of times. * Finished testing. All altered classes test pass along with my additions * Updated the replacer package to print the units as well. May take out. * Changed the time units to be within the rules. Fixed the test as well. * Fixed some tests, updated the readme, fixed the replacer class. * Updates of standardizing only to seconds in response duration. Need to revert README. * Reverted readme. * Added a small test in new replacer. * Changed replacer to inline the strconv for duration.
2018-06-02presubmit: Check errorf as well (#1845)Gravatar Miek Gieben 3-10/+10
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-23Revert pkg/nonwriter changes (#1829)Gravatar Miek Gieben 1-13/+0
The DoH work (#1619) made changes to pkg/nonwriter.Writer that in hindsight were not backwards compatible; it added override for the LocalAddr() and RemoteAddr(). Instead of rolling back that PR, this PR reverts those changes and creates a DoHWriter for use in the https-server.go side of things. This was only caught in the integration test making this hard to catch, so we add a upstream_file_test.go that tries (doesn't work yet) to test this in the unit tests as well. Esp. helpful when 'git bisecting'. Fixes #1826
2018-05-21make CoreDNS DoH Server (#1619)Gravatar Miek Gieben 1-1/+12
* WIP: make CoreDNS DoH Server * It works * Fix tests * Review from Tom - on diff. PR * correct mime type * Cleanups and use the pkg/nonwriter * rename and updates * implement get * implement GET * Code review comments * correct context * tweaks * code review
2018-05-16Probe simplification (#1784)Gravatar Ruslan Drozhdzh 1-49/+42
* Probe simplification - the main reason of rework is that previous implementation hung when calling Do() after Stop() * replace atomics with mutex * access Probe.interval under lock
2018-05-08fix TestNewServer() hanging (#1786)Gravatar Ruslan Drozhdzh 2-2/+18
2018-05-04gofmt some stuff (#1769)Gravatar John Belamaric 1-2/+2
2018-04-25plugin/pkg/uniq: add (#1733)Gravatar Miek Gieben 2-0/+69
Spin this out the metrics package so we can use it in the health one of well to fix some reload bugs.
2018-04-22Use logging (#1718)Gravatar Miek Gieben 2-16/+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 1-2/+2
Got a bit messed up with stb lib "context" usage.
2018-04-22plugin/pkg/log: add plugin logging (#1716)Gravatar Miek Gieben 2-0/+95
Add per plugin logging to make it explicit what is logging, if you include this package under the name clog (coredns log), you can do the following: log := clog.NewWithPlugin{whoami{}} // e.g. And then just log.Info(...); these will then include the plugin ala: [INFO] plugin/whoami: stuff So we only need to init the logger and then just use it.
2018-04-20global: move to context (#1699)Gravatar Miek Gieben 1-1/+2
* 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-20adding sequential policy to forward plugin (#1704)Gravatar Scott Donovan 1-0/+3
* adding sequential policy to forward plugin * making sequential an alias to first in proxy plugin
2018-04-19Update all plugins to use plugin/pkg/log (#1694)Gravatar Miek Gieben 3-9/+7
* 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-04-18pkg/log: ability for debug logs (#1689)Gravatar Miek Gieben 2-0/+130
* pkg/log: ability for debug logs When the debug plugin is enabled all log.Debug calls will print to standard; if not there are a noop (almost). The log package wraps some standard log functions as well, so just replacing "log" with "plugin/pkg/log" should be enough to use this package. * docs * Add docs * lint * Test fallthrough to log pkg as well * simple package - up test coverage * add other log levels as well * update docs
2018-04-13pkg/up: stop *all* goroutines (#1676)Gravatar Miek Gieben 1-5/+20
Stop all goroutines after we get the stop signal.
2018-02-28plugin/log: log remote port addr as well (#1573)Gravatar Miek Gieben 1-1/+9
Log the remote's port, for IPv6 addr this means we should enclose the v6 address in brackets; make this the default for 'remote'.
2018-02-28Rename reverse zone constants (#1568)Gravatar Miek Gieben 2-11/+39
Rename the constants to IP4arpa and IP6arpa (shorter and exported) and make IsReverse return the type of the reverse zone which could be handy for some callers. Also add tests for IsReverse()
2018-02-28plugin/kubernetes: PTR/A reverse query corner cases (#1551)Gravatar Chris O'Haver 1-0/+5
* better handle non PTR rev zone qrys * vice versa * tests * comment typo * much cleaner
2018-02-23doc: some function/vars/const/package level updates (#1558)Gravatar Miek Gieben 4-2/+5
* doc: some function/vars/const/package level updates Various update that stood out while reading godoc.org for CoreDNS. * Fix some misspellings as well
2018-02-17Type.extra (#1538)Gravatar Miek Gieben 2-23/+0
* Revert "pkg/typify: empty messages are OtherError (#1531)" This reverts commit fc1d73ffa9ae193c4cfca4adc194ae43f9360dbb. * plugin/cache: add failsafeTTL If we can not see what TTL we should put on a message to be cached, use 5 seconds as minimal TTL. We used to apply the maximum TTL to these messages.
2018-02-16pkg/typify: empty messages are OtherError (#1531)Gravatar Miek Gieben 2-0/+23
Messages with nothing in them are considered OtherError, they can not serve any purpose for normal clients (i.e. dyn update or notifies might have a use for them). Also update a test in the cache plugin, so that we explicitaly test for this case.
2018-02-15plugin/forward using pkg/up (#1493)Gravatar Miek Gieben 2-9/+10
* plugin/forward: on demand healtchecking Only start doing health checks when we encouner an error (any error). This uses the new pluing/pkg/up package to abstract away the actual checking. This reduces the LOC quite a bit; does need more testing, unit testing and tcpdumping a bit. * fix tests * Fix readme * Use pkg/up for healthchecks * remove unused channel * more cleanups * update readme * * Again do go generate and go build; still referencing the wrong forward repo? Anyway fixed. * Use pkg/up for doing the healtchecks to cut back on unwanted queries * Change up.Func to return an error instead of a boolean. * Drop the string target argument as it doesn't make sense. * Add healthcheck test on failing to get an upstream answer. TODO(miek): double check Forward and Lookup and how they interact with HC, and if we correctly call close() on those * actual test * Tests here * more tests * try getting rid of host * Get rid of the host indirection * Finish removing hosts * moar testing * import fmt * field is not used * docs * move some stuff * bring back health_check * maxfails=0 test * git and merging, bah * review
2018-02-14plugin/kubernetes: Add upstream @self and loop count (#1484)Gravatar Chris O'Haver 1-0/+55
* add upstream @self and loop count * 1st round of feedback * allow argless upstream * update test * readmes * feedback
2018-02-05pkg/up: add generic run-this-functions (#1481)Gravatar Miek Gieben 2-0/+106
This adds a generic way of start a check function to check a backend. This package can be used to kick off healthchecks. The package makes sure only 1 is run at any one time. It should allow for: See upstream error -> kick off healthcheck and not to worry about overwhelming the upstream with a barrage of queries.
2018-01-30Plugin/Proxy - add new policy always_first to mimic windows dns resolvers ↵Gravatar Francois Tur 2-2/+40
(#1459) * add new policy always_first to mimic windows dns resolvers fill documentation, add UT and cleanup fmt * change name of policy from always_first to first. Update docs