Add field keywords to rewrite middleware (#497)

* Require Field for rewrite rules

* review feedback changes

* fix ut

* fix typo, add warning message
This commit is contained in:
Bob Wasniak
2017-02-07 16:53:16 -05:00
committed by Miek Gieben
parent b8e75509cc
commit fa1c90a479
8 changed files with 124 additions and 76 deletions

View File

@@ -7,24 +7,26 @@ accommodate most dynamic back-end applications.
## Syntax
~~~
rewrite FROM TO
rewrite FIELD FROM TO
~~~
* **FIELD** is (`type`, `class`, `name`, ...)
* **FROM** is the exact name of type to match
* **TO** is the destination name or type to rewrite to
If from *and* to look like a DNS type (`A`, `MX`, etc.), the type of the message will be rewriten;
e.g., to rewrite ANY queries to HINFO, use `rewrite ANY HINFO`.
When the FIELD is `type` and FROM is (`A`, `MX`, etc.), the type of the message will be rewritten;
e.g., to rewrite ANY queries to HINFO, use `rewrite type ANY HINFO`.
If from *and* to look like a DNS class (`IN`, `CH`, or `HS`) the class of the message will be
rewritten; e.g., to rewrite CH queries to IN use `rewrite CH IN`.
When the FIELD is `class` and FROM is (`IN`, `CH`, or `HS`) the class of the message will be
rewritten; e.g., to rewrite CH queries to IN use `rewrite class CH IN`.
If it does not look like a type a name is assumed and the qname in the message is rewritten; this
needs to be a full match of the name, e.g., `rewrite miek.nl example.org`.
When the FIELD is `name` the query name in the message is rewritten; this
needs to be a full match of the name, e.g., `rewrite name miek.nl example.org`.
If you specify multiple rules and an incoming query matches on multiple (simple) rules, only
the first rewrite is applied.
> Everything below this line has not been implemented, yet.
~~~