aboutsummaryrefslogtreecommitdiff
path: root/middleware/cache (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-09-14Remove the word middleware (#1067)Gravatar Miek Gieben 10-1130/+0
* 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-08-04Misspell correction (#826)Gravatar Yong Tang 2-2/+2
Did a `misspell . | grep -v ^vendor` and fixed several typos. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-06-26middleware/cache: fix race (#757)Gravatar Miek Gieben 4-25/+65
While adding a parallel performance benchmark I stumbled on a race condition (another reason to add performance benchmarks!), so this PR makes sure the msg is created in a race free manor and adds the parallel benchmark.
2017-06-14cleanup: go vet and golint run (#736)Gravatar Miek Gieben 1-1/+2
* cleanup: go vet and golint run Various cleanups trickered by go vet and golint. * Fix tests and lowercase all errors Lowercase all errors, some tests in kubernetes use errors from kubernetes which do start with a capital letter.
2017-06-13New cache implementation and prefetch handing in mw/cache (#731)Gravatar Miek Gieben 11-101/+335
* cache: add sharded cache implementation Add Cache impl and a few tests. This cache is 256-way sharded, mainly so each shard has it's own lock. The main cache structure is a readonly jump plane into the right shard. This should remove the single lock contention on the main lock and provide more concurrent throughput - Obviously this hasn't been tested or measured. The key into the cache was made a uint32 (hash.fnv) and the hashing op is not using strings.ToLower anymore remove any GC in that code path. * here too * Minimum shard size * typos * blurp * small cleanups no defer * typo * Add freq based on Johns idea * cherry-pick conflict resolv * typo * update from early code review from john * add prefetch to the cache * mw/cache: add prefetch * remove println * remove comment * Fix tests * Test prefetch in setup * Add start of cache * try add diff cache options * Add hacky testcase * not needed * allow the use of a percentage for prefetch If the TTL falls below xx% do a prefetch, if the record was popular. Some other fixes and correctly prefetch only popular records.
2017-04-29middleware/cache: don't cache expired RRSIGs (#641)Gravatar Miek Gieben 2-6/+61
Check message for expired sig and don't cache those. Aside: This hack of caching entire messages is probably something we should stop doing at some point in the future and do this on a per RRset basis. Fixes #367 #635
2017-02-22Fix import path `github.com/miekg/coredns` -> `github.com/coredns/coredns` ↵Gravatar Yong Tang 5-10/+10
(#547) This fix fixes import path from `github.com/miekg/coredns` -> `github.com/coredns/coredns`
2017-01-22truncated cache fix (#485)Gravatar Dmytro Kislov 1-1/+1
2016-12-20Add middleware.NextOrFailure (#462)Gravatar Miek Gieben 1-1/+1
This checks if the next middleware to be called is nil, and if so returns ServerFailure and an error. This makes the next calling more robust and saves some lines of code. Also prefix the error with the name of the middleware to aid in debugging.
2016-11-26middleware/httpproxy: Add (#439)Gravatar Miek Gieben 1-1/+1
This PR adds a middleware that talks to dns.google.com over HTTPS, meaning all your DNS traffic is encrypted when traversing your ISP and the internet. The `dns.google.com` address is re-resolved every 30 seconds.
2016-11-14Add docsGravatar Michael Grosser 1-4/+6
Provide TTL examples for cache middleware. Fixes: #364 Add interaction docs to make non invalidation for cache middleware clear. Cache might serve stale records. Fixes: #403
2016-11-14Fix several typos in docs. (#426)Gravatar Yong Tang 1-1/+1
Fixes several typos in docs. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-11-13Fix various issues with formatting and typos (#424)Gravatar Michael Grosser 2-2/+2
* Fix typos * Simplify code * Fix error usage
2016-11-09middleware/cache: cache 0 will be capped at 5 (#408)Gravatar Miek Gieben 5-6/+27
* middleware/cache: cache 0 will be capped at 5 cache 0 would return TTL=0 records, up that to the documented minimum of 5 seconds. * middleware/cache: check for 0 TTL Handle 0 TTL differently and return an error, we might need to special case this in the future.
2016-11-07middleware/cache: only cache query and responses (#397)Gravatar Miek Gieben 1-3/+7
Extent typify to check the transfers, dynamic updates and notifies. Extend *cache* to not put these in the cache. Fixes #393
2016-10-31Add metrics for cache hits/misses (#375)Gravatar Ben Kochie 2-2/+25
* Add metrics for cache hits/misses Add counters for cache middleware hits and misses. * Add test for cache middleware hit/miss counters. * Fix cache hit metric incrementing. * Add cache hit/miss metrics to dnssec middleware. * Update README metric documentation.
2016-10-30Update metric names (#371)Gravatar Ben Kochie 2-6/+6
Cleanup names/typos to match standard naming conventions.
2016-10-28middleware/caching (#360)Gravatar Miek Gieben 2-1/+28
Add the rcode to the cached item and use this when we synthesize the answer again. We could also infer the rcode from the reassembled message, but this seems easier and is only an integer. Also set the autoritative bit to 0 for all from-cache answers. Fixes 357
2016-10-27golintGravatar Miek Gieben 1-0/+1
2016-10-26middleware/metrics: cleanup (#355)Gravatar Miek Gieben 4-24/+33
* middleware/metrics: add more metrics middleware/cache: Add metrics for number of elements in the cache. Also export the total size. Update README to detail the new metrics. middleware/metrics Move metrics into subpackage called "vars". This breaks the import cycle and is cleaner. This allows vars.Report to be used in the the dnsserver to log refused queries. middleware/metrics: tests Add tests to the metrics framework. The metrics/test subpackage allows scraping of the local server. Do a few test scrape of the metrics that are defined in the metrics middleware. This also allows metrics integration tests to check if the caching and dnssec middleware export their metrics correctly. * update README * typos * fix tests
2016-10-10docs: rewrite using manpage style (#327)Gravatar Miek Gieben 1-15/+16
This still needs cleanup, but this is a first pass the cleans some cruft and documents our style (in middleware.md) and makes all the docs match that style.
2016-10-10middleware/log: allows logging based on response classes (#325)Gravatar Miek Gieben 4-6/+6
Add the ability to add a class of responses to be logged; success, denial or error. The default is to log everything (all). Fixes #258
2016-10-08middleware/file: proper support for wildcard (#323)Gravatar Miek Gieben 1-0/+17
Add support for wildcard records, while taking care of wildcard-cnames and DNSSEC. Add enough tests to check all the corner cases.
2016-10-08middleware/cache: rename categories (#321)Gravatar Miek Gieben 4-15/+21
Rename: positive -> success negative -> denial There is a third (unused category) which is error. Start using these new in the caching middleware and later in the logging middleware.
2016-10-08middleware/proxy: make it scale (#287)Gravatar Miek Gieben 1-0/+1
* middleware/proxy Use connection pooling for communicating with an upstream, instead of opening a new socket every time. This makes the proxy more efficient and allowed for some cleanups. * Some cleanups * Some fixes * more * Kill pool * Add nil check * remove pool
2016-10-03Fix a typo (#315)Gravatar Yong Tang 1-1/+1
This fix fixes a typo in middle/cache/README.md: `1 hours` => `1 hour` Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-10-02middleware/cache: split cache in positive and negative and use lru (#298)Gravatar Miek Gieben 8-176/+294
Make the cache memory bounded, by using a LRU cache. Also split the cache in a positive and negative one - each with its own controls. Extend the cache stanza to allow for this: cache { positive limit [ttl] negative limit [ttl] } is now possible. This also add a cache_test.go in the toplevel test/ directory that exercises the caching path. Fixes #260
2016-09-23Golint2 (#280)Gravatar Miek Gieben 3-22/+28
* 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-21Run golint and go vet (#276)Gravatar Miek Gieben 1-1/+1
Cleanup the errors and removed deadcode along the way. The leaves some error laying around, mostly about commenting exported identifier. We should look hard if those really are needed.
2016-09-19Cleanups and tests (#272)Gravatar Miek Gieben 1-1/+1
For some reasons there was a dnsserver/middleware.go that defined the middleware handlers. This code was a repeat from middleware/middleware.go. Removed dnsserver/middleware.go and replaced all uses of dnsserver.Middleware with middleware.Middleware. Added dnsserver/address_test.go to test the zone normalization (and to improve the test coverage). The deleted file will also improve the test coverage :)
2016-09-10Startup notification (#250)Gravatar Miek Gieben 1-1/+1
Stop the caddy message and start our own init notifications. Log the version of CoreDNS when starting up. Fix all middleware's setup functions so that return the error prefixed with *which* middleware was failing; leads to better debuggable errors when starting up.
2016-09-07Cleanup: put middleware helper functions in pkgs (#245)Gravatar Miek Gieben 3-17/+20
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-08-22Update README.mdGravatar cricketliu 1-7/+7
More grammatical fixes.
2016-08-22Doc updatesGravatar Miek Gieben 1-5/+4
Remove miek.nl in favor of example.org and other smaller cleanups.
2016-08-19Make CoreDNS a server type plugin for Caddy (#220)Gravatar Miek Gieben 1-0/+66
* Make CoreDNS a server type plugin for Caddy Remove code we don't need and port all middleware over. Fix all tests and rework the documentation. Also make `go generate` build a caddy binary which we then copy into our directory. This means `go build`-builds remain working as-is. And new etc instances in each etcd test for better isolation. Fix more tests and rework test.Server with the newer support Caddy offers. Fix Makefile to support new mode of operation.
2016-06-23Add monitoring metrics docs to middleware/cacheGravatar Miek Gieben 1-0/+6
2016-05-22middleware/caching: don't set TTL on OPTGravatar Miek Gieben 2-1/+8
When setting the TTL on all RR in the message we would also do this for the OPT RR. This is wrong as the OPT RR does *not* have a TTL.
2016-04-26Some tiny changes and new benchmark test function (#136)Gravatar Miek Gieben 1-1/+2
2016-04-26Add middleware/dnssec (#133)Gravatar Miek Gieben 3-81/+22
This adds an online dnssec middleware. The middleware will sign responses on the fly. Negative responses are signed with NSEC black lies.
2016-04-21middleware/cache: Add metrics (#132)Gravatar Miek Gieben 1-0/+28
Add prometheus metrics to the cache handler. This just used prometheus, if the metrics middleware does not setup the handler, there is nobody reading these metrics, but they are still reported. Seems the simplest solution while keeping the whole middleware separation in tact.
2016-04-19Updates to READMEGravatar Miek Gieben 1-2/+11
2016-04-19Cache (#126)Gravatar Miek Gieben 6-0/+504
* Add middleware/cache Add a caching middleware that caches nxdomain, nodata and successful responses. It differentiates between DNSSEC on normal DNS replies. Each reply is compress and scrubbed so it will fit the specific client asking for it. * first simple test, less exporting of stuff * more * Add middleware/cache Add a caching middleware that caches nxdomain, nodata and successful responses. It differentiates between DNSSEC on normal DNS replies. Each reply is compressed and scrubbed so it will fit the specific client asking for it. The TTL is decremented with the time spend in the cache. There is syntax that allows you to cap the TTL for all records, no matter what. This allows for a shortlived cache, just to absorb query peaks. +Tests * cache test infrastructure * Testing