![]() |
![]()
| ![]() |
![]()
NAMEview - defines conditions that must be met for a DNS request to be routed to the server block. DESCRIPTIONview defines an expression that must evaluate to true for a DNS request to be routed to the server block. This enables advanced server block routing functions such as split dns. SYNTAXview NAME {
For expression syntax and examples, see the Expressions and Examples sections. EXAMPLESImplement CIDR based split DNS routing. This will return a different answer for test. depending on client's IP address. It returns ... * test. 3600 IN A 1.1.1.1, for queries with a source address in 127.0.0.0/24 * test. 3600 IN A 2.2.2.2, for queries with a source address in 192.168.0.0/16 * test. 3600 IN A 3.3.3.3, for all others . { Send all A and AAAA requests to 10.0.0.6, and all other requests to 10.0.0.1. . { Send all requests for abc.*.example.com (where * can be any number of labels), to 10.0.0.2, and all other requests to 10.0.0.1. Note that the regex pattern is enclosed in single quotes, and backslashes are escaped with backslashes. . { EXPRESSIONSTo evaluate expressions, view uses the expr-lang/expr package (https://github.com/expr-lang/expr ⟨https://github.com/expr-lang/expr⟩). For example, an expression could look like: (type() == 'A' && name() == 'example.com') || client_ip() == '1.2.3.4'. All expressions should be written to evaluate to a boolean value. See https://github.com/expr-lang/expr/blob/master/docs/Language-Definition.md ⟨https://github.com/expr-lang/expr/blob/master/docs/Language-Definition.md⟩ as a detailed reference for valid syntax. AVAILABLE EXPRESSION FUNCTIONSIn the context of the view plugin, expressions can reference DNS query information by using utility functions defined below. DNS QUERY FUNCTIONS
UTILITY FUNCTIONS
METADATAThe view plugin will publish the following metadata, if the metadata plugin is also enabled:
|