2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# template
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-10 11:45:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								## Name
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								*template* - allows for dynamic responses based on the incoming query.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								## Description
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-10 15:08:08 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								The * template *  plugin allows you to dynamically respond to queries by just writing a (Go) template.
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								## Syntax
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~~~
							 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								template CLASS TYPE [ZONE...] {
							 
						 
					
						
							
								
									
										
										
										
											2019-01-13 16:54:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    match REGEX...
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    answer RR
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    additional RR
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    authority RR
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    rcode CODE
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 23:23:28 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    fallthrough [FALLTHROUGH-ZONE...]
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~~~
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								*  **CLASS** the query class (usually IN or ANY). 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								*  **TYPE** the query type (A, PTR, ... can be ANY to match all types). 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								*  **ZONE** the zone scope(s) for this template. Defaults to the server zones. 
						 
					
						
							
								
									
										
										
										
											2022-05-17 10:29:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								*  `match`  **REGEX **  [Go regexp ](https://golang.org/pkg/regexp/ ) that are matched against the incoming question name. 
						 
					
						
							
								
									
										
										
										
											2022-05-13 23:23:28 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  Specifying no regex matches everything (default: `.*` ). First matching regex wins.
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 13:13:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								*  `answer|additional|authority`  **RR **  A [RFC 1035 ](https://tools.ietf.org/html/rfc1035#section-5 ) style resource record fragment 
						 
					
						
							
								
									
										
										
										
											2022-05-13 23:23:28 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  built by a [Go template ](https://golang.org/pkg/text/template/ ) that contains the reply. Specifying no answer will result
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  in a response with an empty answer section.
							 
						 
					
						
							
								
									
										
										
										
											2022-04-23 16:51:56 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								*  `rcode`  **CODE **  A response code (`NXDOMAIN, SERVFAIL, ...` ). The default is `NOERROR` . Valid response code values are 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  per the `RcodeToString`  map defined by the `miekg/dns`  package in `msg.go` .
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 23:23:28 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								*  `fallthrough`  Continue with the next _ template _  instance if the _ template _ 's **ZONE **  matches a query name but no regex match. 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  If there is no next _ template _ , continue resolution with the next plugin. If * * [FALLTHROUGH-ZONE...]** are listed (for example
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  `in-addr.arpa`  and `ip6.arpa` ), then only queries for those zones will be subject to fallthrough. Without
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  `fallthrough` , when the _ template _ 's **ZONE **  matches a query but no regex match then a `SERVFAIL`  response is returned.
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								[Also see ](#also-see ) contains an additional reading list.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								## Templates
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Each resource record is a full-featured [Go template ](https://golang.org/pkg/text/template/ ) with the following predefined data
							 
						 
					
						
							
								
									
										
										
										
											2018-01-15 14:55:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								*  `.Zone`  the matched zone string (e.g. `example.` ). 
						 
					
						
							
								
									
										
										
										
											2018-01-08 13:13:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								*  `.Name`  the query name, as a string (lowercased). 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								*  `.Class`  the query class (usually `IN` ). 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								*  `.Type`  the RR type requested (e.g. `PTR` ). 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								*  `.Match`  an array of all matches. `index .Match 0`  refers to the whole match. 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								*  `.Group`  a map of the named capture groups. 
						 
					
						
							
								
									
										
										
										
											2018-01-08 13:13:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								*  `.Message`  the complete incoming DNS message. 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								*  `.Question`  the matched question section. 
						 
					
						
							
								
									
										
										
										
											2020-08-10 10:38:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
										 
							
							
								*  `.Remote`  client’  
						 
					
						
							
								
									
										
										
										
											2019-07-03 16:10:56 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								*  `.Meta`  a function that takes a metadata name and returns the value, if the 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  metadata plugin is enabled. For example, `.Meta "kubernetes/client-namespace"` 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-15 18:27:47 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								The output of the template must be a [RFC 1035 ](https://tools.ietf.org/html/rfc1035 ) style resource record (commonly referred to as a "zone file").
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 13:13:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								**WARNING** there is a syntactical problem with Go templates and CoreDNS config files. Expressions
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								 like `{{$var}}`  will be interpreted as a reference to an environment variable by CoreDNS (and
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								 Caddy) while `{{ $var }}`  will work. See [Bugs ](#bugs ) and corefile(5).
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								## Metrics
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-08 10:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								If monitoring is enabled (via the * prometheus *  plugin) then the following metrics are exported:
							 
						 
					
						
							
								
									
										
										
										
											2018-01-15 14:55:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-15 15:36:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								*  `coredns_template_matches_total{server, zone, view, class, type}`  the total number of matched requests by regex. 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								*  `coredns_template_template_failures_total{server, zone, view, class, type, section, template}`  the number of times the Go templating failed. Regex, section and template label values can be used to map the error back to the config file. 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								*  `coredns_template_rr_failures_total{server, zone, view, class, type, section, template}`  the number of times the templated resource record was invalid and could not be parsed. Regex, section and template label values can be used to map the error back to the config file. 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-04-27 19:37:12 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Both failure cases indicate a problem with the template configuration. The `server`  label indicates
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								the server incrementing the metric, see the * metrics *  plugin for details.
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								## Examples
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								### Resolve everything to NXDOMAIN
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								The most simplistic template is
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~~~ corefile
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								. {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    template ANY ANY {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      rcode NXDOMAIN
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~~~
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								1.  This template uses the default zone (`.`  or all queries) 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								2.  All queries will be answered (no `fallthrough` ) 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								3.  The answer is always NXDOMAIN 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								### Resolve .invalid as NXDOMAIN
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-25 11:43:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								The `.invalid`  domain is a reserved TLD (see [RFC 2606 Reserved Top Level DNS Names ](https://tools.ietf.org/html/rfc2606#section-2 )) to indicate invalid domains.
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~~~ corefile
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								. {
							 
						 
					
						
							
								
									
										
										
										
											2019-03-03 23:32:38 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    forward . 8.8.8.8
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template ANY ANY invalid {
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      rcode NXDOMAIN
							 
						 
					
						
							
								
									
										
										
										
											2018-01-15 14:55:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								      authority "invalid. 60 {{ .Class }} SOA ns.invalid. hostmaster.invalid. (1 60 60 60 60)"
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~~~
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								1.  A query to .invalid will result in NXDOMAIN (rcode) 
						 
					
						
							
								
									
										
										
										
											2018-01-10 15:08:08 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								2.  A dummy SOA record is sent to hand out a TTL of 60s for caching purposes 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								3.  Querying `.invalid`  in the `CH`  class will also cause a NXDOMAIN/SOA response 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								4.  The default regex is `.*`  
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								### Block invalid search domain completions
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Imagine you run `example.com`  with a datacenter `dc1.example.com` . The datacenter domain
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								is part of the DNS search domain.
							 
						 
					
						
							
								
									
										
										
										
											2018-01-10 15:08:08 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								However `something.example.com.dc1.example.com`  would indicate a fully qualified
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								domain name (`something.example.com` ) that inadvertently has the default domain or search
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								path (`dc1.example.com` ) added.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~~~ corefile
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								. {
							 
						 
					
						
							
								
									
										
										
										
											2019-03-03 23:32:38 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    forward . 8.8.8.8
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template IN ANY example.com.dc1.example.com {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      rcode NXDOMAIN
							 
						 
					
						
							
								
									
										
										
										
											2018-01-15 14:55:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								      authority "{{ .Zone }} 60 IN SOA ns.example.com hostmaster.example.com (1 60 60 60 60)"
							 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~~~
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								A more verbose regex based equivalent would be
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~~~ corefile
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								. {
							 
						 
					
						
							
								
									
										
										
										
											2019-03-03 23:32:38 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    forward . 8.8.8.8
							 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    template IN ANY example.com {
							 
						 
					
						
							
								
									
										
										
										
											2018-01-15 14:55:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								      match "example\.com\.(dc1\.example\.com\.)$"
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      rcode NXDOMAIN
							 
						 
					
						
							
								
									
										
										
										
											2018-01-15 14:55:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								      authority "{{ index .Match 1 }} 60 IN SOA ns.{{ index .Match 1 }} hostmaster.{{ index .Match 1 }} (1 60 60 60 60)"
							 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								      fallthrough
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~~~
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-10 15:08:08 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								The regex-based version can do more complex matching/templating while zone-based templating is easier to read and use.
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								### Resolve A/PTR for .example
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~~~ corefile
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								. {
							 
						 
					
						
							
								
									
										
										
										
											2019-03-03 23:32:38 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    forward . 8.8.8.8
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-17 03:29:16 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    # ip-a-b-c-d.example A a.b.c.d
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template IN A example {
							 
						 
					
						
							
								
									
										
										
										
											2019-02-17 03:29:16 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								      match (^|[.])ip-(?P<a>[0-9]*)-(?P<b>[0-9]*)-(?P<c>[0-9]*)-(?P<d>[0-9]*)[.]example[.]$
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      answer "{{ .Name }} 60 IN A {{ .Group.a }}.{{ .Group.b }}.{{ .Group.c }}.{{ .Group.d }}"
							 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								      fallthrough
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    # d.c.b.a.in-addr.arpa PTR ip-a-b-c-d.example
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-17 03:29:16 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template IN PTR in-addr.arpa {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      match ^(?P<d>[0-9]*)[. ](?P<c>[0-9]* )[. ](?P<b>[0-9]* )[. ](?P<a>[0-9]* )[.]in-addr[.]arpa[.]$
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      answer "{{ .Name }} 60 IN PTR ip-{{ .Group.a }}-{{ .Group.b }}-{{ .Group.c }}-{{ .Group.d }}.example."
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~~~
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-10 15:08:08 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								An IPv4 address consists of 4 bytes, `a.b.c.d` . Named groups make it less error-prone to reverse the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								IP address in the PTR case. Try to use named groups to explain what your regex and template are doing.
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-10 15:08:08 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Note that the A record is actually a wildcard: any subdomain of the IP address will resolve to the IP address.
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Having templates to map certain PTR/A pairs is a common pattern.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Fallthrough is needed for mixed domains where only some responses are templated.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								### Resolve multiple ip patterns
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~~~ corefile
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								. {
							 
						 
					
						
							
								
									
										
										
										
											2019-03-03 23:32:38 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    forward . 8.8.8.8
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template IN A example {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      match "^ip-(?P<a>10)-(?P<b>[0-9]*)-(?P<c>[0-9]*)-(?P<d>[0-9]*)[.]dc[.]example[.]$"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      match "^(?P<a>[0-9]*)[. ](?P<b>[0-9]* )[. ](?P<c>[0-9]* )[. ](?P<d>[0-9]* )[.]ext[.]example[.]$"
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      answer "{{ .Name }} 60 IN A {{ .Group.a}}.{{ .Group.b }}.{{ .Group.c }}.{{ .Group.d }}"
							 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								      fallthrough
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~~~
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Named capture groups can be used to template one response for multiple patterns.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-10 15:08:08 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								### Resolve A and MX records for IP templates in .example
  
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~~~ corefile
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								. {
							 
						 
					
						
							
								
									
										
										
										
											2019-03-03 23:32:38 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    forward . 8.8.8.8
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template IN A example {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      match ^ip-10-(?P<b>[0-9]*)-(?P<c>[0-9]*)-(?P<d>[0-9]*)[.]example[.]$
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      answer "{{ .Name }} 60 IN A 10.{{ .Group.b }}.{{ .Group.c }}.{{ .Group.d }}"
							 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								      fallthrough
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template IN MX example {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      match ^ip-10-(?P<b>[0-9]*)-(?P<c>[0-9]*)-(?P<d>[0-9]*)[.]example[.]$
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      answer "{{ .Name }} 60 IN MX 10 {{ .Name }}"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      additional "{{ .Name }} 60 IN A 10.{{ .Group.b }}.{{ .Group.c }}.{{ .Group.d }}"
							 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								      fallthrough
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~~~
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								### Adding authoritative nameservers to the response
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~~~ corefile
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								. {
							 
						 
					
						
							
								
									
										
										
										
											2019-03-03 23:32:38 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    forward . 8.8.8.8
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template IN A example {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      match ^ip-10-(?P<b>[0-9]*)-(?P<c>[0-9]*)-(?P<d>[0-9]*)[.]example[.]$
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      answer "{{ .Name }} 60 IN A 10.{{ .Group.b }}.{{ .Group.c }}.{{ .Group.d }}"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      authority  "example. 60 IN NS ns0.example."
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      authority  "example. 60 IN NS ns1.example."
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      additional "ns0.example. 60 IN A 203.0.113.8"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      additional "ns1.example. 60 IN A 198.51.100.8"
							 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								      fallthrough
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    template IN MX example {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      match ^ip-10-(?P<b>[0-9]*)-(?P<c>[0-9]*)-(?P<d>[0-9]*)[.]example[.]$
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      answer "{{ .Name }} 60 IN MX 10 {{ .Name }}"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      additional "{{ .Name }} 60 IN A 10.{{ .Group.b }}.{{ .Group.c }}.{{ .Group.d }}"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      authority  "example. 60 IN NS ns0.example."
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      authority  "example. 60 IN NS ns1.example."
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      additional "ns0.example. 60 IN A 203.0.113.8"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      additional "ns1.example. 60 IN A 198.51.100.8"
							 
						 
					
						
							
								
									
										
										
										
											2018-01-09 22:30:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								      fallthrough
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~~~
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-03 06:51:49 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								### Fabricate a CNAME
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								This example responds with a CNAME to `google.com`  for any DNS query made exactly for `foogle.com` .
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								The answer will also contain a record for `google.com`  if the upstream nameserver can return a record for it of the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								requested type.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~~~ corefile
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								. {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  template IN ANY foogle.com {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    match "^foogle\.com\.$"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    answer "foogle.com 60 IN CNAME google.com"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  forward . 8.8.8.8
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~~~
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-10 11:45:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								## Also see
  
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-15 14:55:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								*  [Go regexp ](https://golang.org/pkg/regexp/ ) for details about the regex implementation 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								*  [RE2 syntax reference ](https://github.com/google/re2/wiki/Syntax ) for details about the regex syntax 
						 
					
						
							
								
									
										
										
										
											2018-05-25 11:43:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								*  [RFC 1034 ](https://tools.ietf.org/html/rfc1034#section-3.6.1 ) and [RFC 1035 ](https://tools.ietf.org/html/rfc1035#section-5 ) for the resource record format 
						 
					
						
							
								
									
										
										
										
											2018-01-15 14:55:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								*  [Go template ](https://golang.org/pkg/text/template/ ) for the template language reference 
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-10 11:45:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								## Bugs
  
						 
					
						
							
								
									
										
										
										
											2018-01-08 11:52:25 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								CoreDNS supports [caddyfile environment variables ](https://caddyserver.com/docs/caddyfile#env )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								with notion of `{$ENV_VAR}` . This parser feature will break [Go template variables ](https://golang.org/pkg/text/template/#hdr-Variables ) notations like`{{$variable}}` .
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								The equivalent notation `{{ $variable }}`  will work.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Try to avoid Go template variables in the context of this plugin.