middleware/hosts for /etc/hosts parsing (#695)

* add hosts middleware

* forgot pointer receiver

* add appropriately modified hostsfile tests from golang repo

* remove test artifacts, separate hostsfile parsing from caching and opening, remove unused metrics references, move middleware up the chain

* refactored the logic for creating records and filtering ip address versions. also got PTR lookups working

* Add README.md. Modify config to be more concise. Add zones list to config. Filter PTR responses based on zones list.

* add Fallthrough and return correct dns response code otherwise

* Simplified Hostsfile to only store hosts in the zones we care about, and by ip version. Added handler tests and improved other tests.

* oops, goimports loaded a package from a different repo
This commit is contained in:
Pat Moroney
2017-06-08 13:48:04 -06:00
committed by Miek Gieben
parent 990460ee7c
commit 92dd947c51
10 changed files with 864 additions and 8 deletions

View File

@@ -34,13 +34,14 @@
120:loadbalance:loadbalance
130:dnssec:dnssec
140:reverse:reverse
150:kubernetes:kubernetes
160:file:file
170:auto:auto
180:secondary:secondary
190:etcd:etcd
200:proxy:proxy
210:whoami:whoami
220:erratic:erratic
150:hosts:hosts
160:kubernetes:kubernetes
170:file:file
180:auto:auto
190:secondary:secondary
200:etcd:etcd
210:proxy:proxy
220:whoami:whoami
230:erratic:erratic
500:startup:github.com/mholt/caddy/startupshutdown
510:shutdown:github.com/mholt/caddy/startupshutdown