| 
									
										
										
										
											2019-08-30 15:58:25 +01:00
										 |  |  | .\" Generated by Mmark Markdown Processer - mmark.miek.nl | 
					
						
							| 
									
										
										
										
											2021-03-08 11:15:45 +00:00
										 |  |  | .TH "COREDNS-METADATA" 7 "March 2021" "CoreDNS" "CoreDNS Plugins" | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-24 12:37:27 +01:00
										 |  |  | .SH "NAME" | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | .PP | 
					
						
							| 
									
										
										
										
											2019-09-27 13:30:22 +01:00
										 |  |  | \fImetadata\fP - enables a metadata collector. | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-24 12:37:27 +01:00
										 |  |  | .SH "DESCRIPTION" | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | .PP | 
					
						
							|  |  |  | By enabling \fImetadata\fP any plugin that implements metadata.Provider | 
					
						
							|  |  |  | interface | 
					
						
							|  |  |  | \[la]https://godoc.org/github.com/coredns/coredns/plugin/metadata#Provider\[ra] will be called for | 
					
						
							| 
									
										
										
										
											2019-09-27 13:30:22 +01:00
										 |  |  | each DNS query, at the beginning of the process for that query, in order to add its own metadata to | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | context. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .PP | 
					
						
							| 
									
										
										
										
											2019-09-27 13:30:22 +01:00
										 |  |  | The metadata collected will be available for all plugins, via the Context parameter provided in the | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | ServeDNS function. The package (code) documentation has examples on how to inspect and retrieve | 
					
						
							|  |  |  | metadata a plugin might be interested in. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .PP | 
					
						
							| 
									
										
										
										
											2019-09-27 13:30:22 +01:00
										 |  |  | The metadata is added by setting a label with a value in the context. These labels should be named | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | \fB\fCplugin/NAME\fR, where \fBNAME\fP is something descriptive. The only hard requirement the \fImetadata\fP | 
					
						
							| 
									
										
										
										
											2019-09-27 13:30:22 +01:00
										 |  |  | plugin enforces is that the labels contain a slash. See the documentation for | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | \fB\fCmetadata.SetValueFunc\fR. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .PP | 
					
						
							| 
									
										
										
										
											2019-09-27 13:30:22 +01:00
										 |  |  | The value stored is a string. The empty string signals "no metadata". See the documentation for | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | \fB\fCmetadata.ValueFunc\fR on how to retrieve this. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-24 12:37:27 +01:00
										 |  |  | .SH "SYNTAX" | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | .PP | 
					
						
							|  |  |  | .RS | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-09 07:58:14 +01:00
										 |  |  | .nf | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | metadata [ZONES... ] | 
					
						
							| 
									
										
										
										
											2018-07-09 07:58:14 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | .fi | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | .RE | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .IP \(bu 4 | 
					
						
							|  |  |  | \fBZONES\fP zones metadata should be invoked for. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-24 12:37:27 +01:00
										 |  |  | .SH "PLUGINS" | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | .PP | 
					
						
							|  |  |  | \fB\fCmetadata.Provider\fR 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. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .PP | 
					
						
							|  |  |  | Note: this method should work quickly, because it is called for every request. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-24 12:37:27 +01:00
										 |  |  | .SH "EXAMPLES" | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | .PP | 
					
						
							|  |  |  | The \fIrewrite\fP plugin uses meta data to rewrite requests. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-05 13:37:38 +00:00
										 |  |  | .SH "SEE ALSO" | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | .PP | 
					
						
							|  |  |  | The Provider interface | 
					
						
							|  |  |  | \[la]https://godoc.org/github.com/coredns/coredns/plugin/metadata#Provider\[ra] and | 
					
						
							|  |  |  | the package level | 
					
						
							|  |  |  | \[la]https://godoc.org/github.com/coredns/coredns/plugin/metadata\[ra] documentation. | 
					
						
							|  |  |  | 
 |