plugin/metadata: add metadata plugin (#1894)

* 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
This commit is contained in:
Eugen Kleiner
2018-06-29 12:44:16 +03:00
committed by Miek Gieben
parent dae506b563
commit 17d807f05f
19 changed files with 655 additions and 130 deletions

View File

@@ -206,13 +206,17 @@ rewrites the first local option with code 0xffee, setting the data to "abcd". Eq
}
~~~
* A variable data is specified with a pair of curly brackets `{}`. Following are the supported variables:
* A variable data is specified with a pair of curly brackets `{}`. Following are the supported variables by default:
{qname}, {qtype}, {client_ip}, {client_port}, {protocol}, {server_ip}, {server_port}.
Any plugin that can provide it's own additional variables by implementing metadata.Provider interface. If you are going to use metadata variables then metadata plugin must be enabled.
Example:
~~~
rewrite edns0 local set 0xffee {client_ip}
~~~ corefile
. {
metadata
rewrite edns0 local set 0xffee {client_ip}
}
~~~
### EDNS0_NSID