mirror of
https://github.com/coredns/coredns.git
synced 2025-12-21 17:45:15 -05:00
Add set EDNS0 with variable substitution (#937)
* Add set EDNS0 with variable substitution
* Change variable from $ to {}. Un-export constants
* Update README
* Change getRuleData() to ruleData(); Change to use string match from regexp
This commit is contained in:
@@ -41,8 +41,9 @@ Currently supported are `EDNS0_LOCAL` and `EDNS0_NSID`.
|
||||
|
||||
### `EDNS0_LOCAL`
|
||||
|
||||
This has two fields, code and data. A match is defined as having the same code. Data may be a string, or if
|
||||
it starts with `0x` it will be treated as hex. Example:
|
||||
This has two fields, code and data. A match is defined as having the same code. Data may be a string or a variable.
|
||||
|
||||
* A string data can be treated as hex if it starts with `0x`. Example:
|
||||
|
||||
~~~
|
||||
rewrite edns0 local set 0xffee 0x61626364
|
||||
@@ -54,6 +55,21 @@ rewrites the first local option with code 0xffee, setting the data to "abcd". Eq
|
||||
rewrite edns0 local set 0xffee abcd
|
||||
~~~
|
||||
|
||||
* A variable data is specified with a pair of curly brackets `{}`. Following are the supported variables:
|
||||
* {qname}
|
||||
* {qtype}
|
||||
* {client_ip}
|
||||
* {client_port}
|
||||
* {protocol}
|
||||
* {server_ip}
|
||||
* {server_port}
|
||||
|
||||
Example:
|
||||
|
||||
~~~
|
||||
rewrite edns0 local set 0xffee {client_ip}
|
||||
~~~
|
||||
|
||||
### `EDNS0_NSID`
|
||||
|
||||
This has no fields; it will add an NSID option with an empty string for the NSID. If the option already exists
|
||||
|
||||
Reference in New Issue
Block a user