aboutsummaryrefslogtreecommitdiff
path: root/plugin/forward/setup.go (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-06-10fix cidr multi-zone check (#4682)Gravatar Chris O'Haver 1-2/+3
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-05-27deprecate Normalize and MustNormalize (#4648)Gravatar Chris O'Haver 1-2/+2
* deprecate normalize and mustnormalize Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * add runtime warning Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * elaborate runtime warning Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * include caller info Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-05-20plugin/forward: Document and warn for unsupported FROM CIDR notations (#4639)Gravatar Chris O'Haver 1-0/+5
* trap unsupported FROM cidr notations Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * make is a warning Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-05-17reverse zone: fix Normalize (#4621)Gravatar Miek Gieben 1-3/+2
Make normalize return multiple "hosts" (= reverse zones) when a non-octet boundary cidr is given. Added pkg/cidr package that holds the cidr calculation routines; felt they didn't really fit dnsutil. This change means the IPNet return parameter isn't needed, the hosts are all correct. The tests that tests this is also removed: TestSplitHostPortReverse The fallout was that zoneAddr _also_ doesn't need the IPNet member, that in turn make it visible that zoneAddr in address.go duplicated a bunch of stuff from register.go; removed/refactored that too. Created a plugin.OriginsFromArgsOrServerBlock to help plugins do the right things, by consuming ZONE arguments; this now expands reverse zones correctly. This is mostly mechanical. Remove the reverse test in plugin/kubernetes which is a copy-paste from a core test (which has since been fixed). Remove MustNormalize as it has no plugin users. This change is not backwards compatible to plugins that have a ZONE argument that they parse in the setup util. All in-tree plugins have been updated. Signed-off-by: Miek Gieben <miek@miek.nl>
2020-10-12plugin/dnstap: various cleanups (#4179)Gravatar Miek Gieben 1-0/+9
* plugin/dnstap: various cleanups A recent issue made me look into this plugin, I suspect various other cleanups (hopefully deletion of code) can be made as well Remove identical functions ToClientQuery etc, and just use tap.Message as the base type in plugin. Keep msg/ for a few helper functions that may proof useful. This remove the whole test directory as we will just check the things we are interested in which gives much better feedback and keeps that code closer together. tapwr dir is also not needed, writer_test.go was just duplicating the tests already done. This moves writer.go to the top directory. Make the only user of dnstap, the forward plugin, use the newer code also remove the test, a better test there would be a full e2e test to see the correct thing happens. Cleanup the Tapper interface and move it to dnstapio where it belongs, remove higher level interfaces that are not used. This remove dnstap.Tapper and dnstap.IORoutines. Use the standard mechanism for getting access to a plugin and remove shuffling the plugin into the context. Signed-off-by: Miek Gieben <miek@miek.nl> * use opts to get the correct proto Signed-off-by: Miek Gieben <miek@miek.nl> * Various fixes Signed-off-by: Miek Gieben <miek@miek.nl> * Remove bad addr test, as dnstap is only called from within coredns where these fields have been preparsed Signed-off-by: Miek Gieben <miek@miek.nl> * dnstap: remove saving the error all these fields have been preparsed, no need for dnstap to be pedantic and check (and save!) this error again. Simplifies it a bit more. Signed-off-by: Miek Gieben <miek@miek.nl> * Update plugin/forward/dnstap.go Co-authored-by: Ruslan Drozhdzh <30860269+rdrozhdzh@users.noreply.github.com> * Code review Signed-off-by: Miek Gieben <miek@miek.nl> * add back in preferUDP Signed-off-by: Miek Gieben <miek@miek.nl> * nit Signed-off-by: Miek Gieben <miek@miek.nl> Co-authored-by: Ruslan Drozhdzh <30860269+rdrozhdzh@users.noreply.github.com>
2020-09-24For caddy v1 in our org (#4018)Gravatar Miek Gieben 1-2/+1
* For caddy v1 in our org This RP changes all imports for caddyserver/caddy to coredns/caddy. This is the v1 code of caddy. For the coredns/caddy repo the following changes have been made: * anything not needed by us is deleted * all `telemetry` stuff is deleted * all its import paths are also changed to point to coredns/caddy * the v1 branch has been moved to the master branch * a v1.1.0 tag has been added to signal the latest release Signed-off-by: Miek Gieben <miek@miek.nl> * Fix imports Signed-off-by: Miek Gieben <miek@miek.nl> * Group coredns/caddy with out plugins Signed-off-by: Miek Gieben <miek@miek.nl> * remove this file Signed-off-by: Miek Gieben <miek@miek.nl> * Relax import ordering github.com/coredns is now also a coredns dep, this makes github.com/coredns/caddy fit more natural in the list. Signed-off-by: Miek Gieben <miek@miek.nl> * Fix final import Signed-off-by: Miek Gieben <miek@miek.nl>
2020-09-08plugin/forward: init ClientSessionCache in tls.Config (#4108)Gravatar Ruslan Drozhdzh 1-0/+6
* plugin/forward: init ClientSessionCache in tls.Config - ClientSessionCache may speed up a TLS handshake in upcoming connections to the same TLS server Signed-off-by: Ruslan Drozhdzh <rdrozhdzh@infoblox.com> * add comment Signed-off-by: Ruslan Drozhdzh <rdrozhdzh@infoblox.com>
2020-07-25using promauto package to ensure all created metrics are properly registered ↵Gravatar Zou Nengren 1-2/+0
(#4025) Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-07-24register HealthcheckBrokenCount (#4021)Gravatar Chris O'Haver 1-1/+1
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-05-29plugin/forward/grpc: Revert forward/grpc policy dedup (#3919)Gravatar Chris O'Haver 1-4/+3
* revert de-dup Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * unit test Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * use roundrobin policy in test Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-04-09plugin/forward: crash if using https (#3817)Gravatar kadern0 1-0/+5
Signed-off-by: kadern0 <kaderno@gmail.com>
2020-03-17register missing metric (#3756)Gravatar Chris O'Haver 1-1/+1
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-03-06Add configuration flag to set if RecursionDesired should be set on health ↵Gravatar Christian Tryti 1-0/+11
checkers in Forward-plugin (#3679) * Make the RD-flag in health-checks in the Forward-plugin configurable Introduces a new configuration flag; `health_check_non_recursive`. This flag makes the health-checker do non-recursive requests when checking the health of upstream servers. Signed-off-by: Geir Haugom <ghagit@haugom.org> Signed-off-by: Christian Tryti <ctryti@gmail.com> * Changes after feedback from reviewer * Better tests of health-checks with and without recursion * Removed the health_check_non_recursive configuration in favor of extending the existing health_check configuration. Now supports an optional `no_rec` argument. Signed-off-by: Christian Tryti <ctryti@gmail.com> * Add new test that checks setup of health_check. Signed-off-by: Christian Tryti <ctryti@gmail.com>
2020-02-04plugins/forward: Add max_concurrent option (#3640)Gravatar Chris O'Haver 1-0/+15
* count and limit concurrent queries Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * add option Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * return servfail when limit exceeded Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * docs Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * docs Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * docs Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * review feedback Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * move atomic counter to beginning of struct Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * add comment for ErrLimitExceeded Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * rename option to max_concurrent Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * add metric Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * response REFUSED; incl max in error; add more docs Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * avoid err setup race Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * respond SERVFAIL; doc memory usage Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-01-17gofmt -w -s **/*.go (#3603)Gravatar Miek Gieben 1-1/+1
format and remove trailing white space; makes 'make presubmit' pass again. Signed-off-by: Miek Gieben <miek@miek.nl>
2019-12-17Dedup policy implement between grpc and proxy plugin (#3537)Gravatar Zou Nengren 1-3/+4
Signed-off-by: zouyee <zounengren@cmss.chinamobile.com>
2019-10-01plugin/forward: make Yield not block (#3336)Gravatar Miek Gieben 1-4/+1
* plugin/forward: may Yield not block Yield may block when we're super busy with creating (and looking) for connection. Set a small timeout on Yield, to skip putting the connection back in the queue. Use persistentConn troughout the socket handling code to be more consistent. Signed-off-by: Miek Gieben <miek@miek.nl> Dont do Signed-off-by: Miek Gieben <miek@miek.nl> * Set used in Yield This gives one central place where we update used in the persistConns Signed-off-by: Miek Gieben <miek@miek.nl>
2019-09-28plugins: calling Dispenser itself is a mistake (#3323)Gravatar Miek Gieben 1-5/+3
Remove all these uses and just make them work on caddy.Controller. Also don't export parsing functions as their should be private to the plugin. Signed-off-by: Miek Gieben <miek@miek.nl>
2019-09-20all: simply registering plugins (#3287)Gravatar Miek Gieben 1-6/+1
Abstract the caddy call and make it simpler. See #3261 for some part of the discussion. Go from: ~~~ go func init() { caddy.RegisterPlugin("any", caddy.Plugin{ ServerType: "dns", Action: setup, }) } ~~~ To: ~~~ go func init() { plugin.Register("any", setup) } ~~~ This requires some external documents in coredns.io to be updated as well; the old way still works, so it's backwards compatible. Signed-off-by: Miek Gieben <miek@miek.nl>
2019-07-03Update Caddy to 1.0.1, and update import path (#2961)Gravatar Yong Tang 1-2/+2
* Update Caddy to 1.0.1, and update import path This fix updates caddy to 1.0.1 and also updates the import path to github.com/caddyserver/caddy This fix fixes 2959 Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Also update plugin.cfg Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Update and bump zplugin.go Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-09-19Ensure Re-register of metrics variables after a reload (#2080)Gravatar Francois Tur 1-3/+1
* - ensure plugins that use prometheus.MustRegister, re-register after reload - removing once.Do on the startup function was simplest way to do it. * - fix underscored names (advice of bot) * - tune existing UT for reload, and add a test verifying failing reload does not prevent correct registering for metrics * - ensure different ports for tests that can run in same time ..
2018-09-19Better naming (#2104)Gravatar Miek Gieben 1-3/+3
* 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 1-33/+7
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-15plugin/forward: Split setup to reuse it from external plugins (#2034)Gravatar Eugen Kleiner 1-49/+62
2018-07-09plugin/forward: add HealthChecker interface (#1950)Gravatar Miek Gieben 1-1/+1
* plugin/forward: add HealthChecker interface Make the HealthChecker interface and morph the current DNS health checker into that interface. Remove all whole bunch of method on Forward that didn't make sense. This is done in preparation of adding a DoH client to forward - which requires a completely different healthcheck implementation (and more, but lets start here) Signed-off-by: Miek Gieben <miek@miek.nl> * Use protocol Signed-off-by: Miek Gieben <miek@miek.nl> * Dial doesnt need to be method an Forward either Signed-off-by: Miek Gieben <miek@miek.nl> * Address comments Address various comments on the PR. Signed-off-by: Miek Gieben <miek@miek.nl>
2018-07-07plugin/forward: add prefer_udp option (#1944)Gravatar Ruslan Drozhdzh 1-1/+6
* plugin/forward: add prefer_udp option * updated according to code review - fixed linter warning - removed metric parameter in Proxy.Connect()
2018-04-20adding sequential policy to forward plugin (#1704)Gravatar Scott Donovan 1-0/+2
* adding sequential policy to forward plugin * making sequential an alias to first in proxy plugin
2018-04-13plugin/forward: test TLS setup (#1677)Gravatar Miek Gieben 1-1/+1
2018-04-01plugin/metrics: add MustRegister function (#1648)Gravatar Miek Gieben 1-11/+1
This registers the Collectors iff the metrics plugin has been loaded. Safes a bunch of code in each and every plugin's setup code.
2018-03-30plugin/forward: improve tls configuration (#1643)Gravatar Ruslan Drozhdzh 1-2/+2
2018-02-28return an error for multiple use of some plugins (#1559)Gravatar Miek Gieben 1-0/+6
* plugins: Return error for multiple use of some Return plugin.ErrOnce when a plugin that doesn't support it, is called mutliple times. This now adds it for: cache, dnssec, errors, forward, hosts, nsid. And changes it slightly in kubernetes, pprof, reload, root. * more tests
2018-02-23doc: some function/vars/const/package level updates (#1558)Gravatar Miek Gieben 1-1/+1
* 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-15plugin/forward using pkg/up (#1493)Gravatar Miek Gieben 1-23/+4
* 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-05plugin/forward: add it (#1447)Gravatar Miek Gieben 1-0/+262
* plugin/forward: add it This moves coredns/forward into CoreDNS. Fixes as a few bugs, adds a policy option and more tests to the plugin. Update the documentation, test IPv6 address and add persistent tests. * Always use random policy when spraying * include scrub fix here as well * use correct var name * Code review * go vet * Move logging to metrcs * Small readme updates * Fix readme