Files
coredns/plugin/metadata
Miek Gieben 99800a687c plugin/metadata: metadata is just label=value (#1914)
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-07-01 20:01:17 +01:00
..

metadata

Name

metadata - enable a metadata collector.

Description

By enabling metadata any plugin that implements metadata.Provider interface will be called for each DNS query, at being of the process for that query, in order to add it's own Metadata to context. The metadata collected will be available for all plugins handler, via the Context parameter provided in the ServeDNS function. Metadata plugin is automatically adding the so-called default medatada (extracted from the query) to the context. Those default metadata are: {qname}, {qtype}, {client_ip}, {client_port}, {protocol}, {server_ip}, {server_port}

Syntax

metadata [ZONES... ]

Plugins

metadata.Provider interface needs to be implemented by each plugin willing to provide metadata information for other plugins. It will be called by metadata and gather the information from all plugins in context. Note: this method should work quickly, because it is called for every request from the metadata plugin. If ZONES is specified then metadata add is limited by zones. Metadata is added to every context going through metadata.Provider if ZONES are not specified.

Examples

Enable metadata for all requests. Rewrite uses one of the provided by default metadata variables.

. {
    metadata
    rewrite edns0 local set 0xffee {client_ip}
    forward . 8.8.8.8:53
}

Add metadata for all requests within example.org.. Rewrite uses one of provided by default metadata variables. Any other requests won't have metadata.

. {
    metadata example.org
    rewrite edns0 local set 0xffee {client_ip}
    forward . 8.8.8.8:53
}