* 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> |
||
---|---|---|
.. | ||
log_test.go | ||
metadata.go | ||
metadata_test.go | ||
provider.go | ||
README.md | ||
setup.go | ||
setup_test.go |
metadata
Name
metadata - enables a metadata collector.
Description
By enabling metadata any plugin that implements metadata.Provider interface will be called for each DNS query, at the beginning of the process for that query, in order to add its own metadata to context.
The metadata collected will be available for all plugins, via the Context parameter provided in the ServeDNS function. The package (code) documentation has examples on how to inspect and retrieve metadata a plugin might be interested in.
The metadata is added by setting a label with a value in the context. These labels should be named
plugin/NAME
, where NAME is something descriptive. The only hard requirement the metadata
plugin enforces is that the labels contain a slash. See the documentation for
metadata.SetValueFunc
.
The value stored is a string. The empty string signals "no metadata". See the documentation for
metadata.ValueFunc
on how to retrieve this.
Syntax
metadata [ZONES... ]
- ZONES zones metadata should be invoked for.
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.
Examples
The rewrite plugin uses meta data to rewrite requests.
Also See
The Provider interface and the package level documentation.