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:
parent
5e9991556e
commit
3f05f7e6c0
7 changed files with 304 additions and 10 deletions
|
@ -35,7 +35,7 @@ type Rewrite struct {
|
|||
func (rw Rewrite) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {
|
||||
wr := NewResponseReverter(w, r)
|
||||
for _, rule := range rw.Rules {
|
||||
switch result := rule.Rewrite(r); result {
|
||||
switch result := rule.Rewrite(w, r); result {
|
||||
case RewriteDone:
|
||||
if rw.noRevert {
|
||||
return middleware.NextOrFailure(rw.Name(), rw.Next, ctx, w, r)
|
||||
|
@ -59,7 +59,7 @@ func (rw Rewrite) Name() string { return "rewrite" }
|
|||
// Rule describes a rewrite rule.
|
||||
type Rule interface {
|
||||
// Rewrite rewrites the current request.
|
||||
Rewrite(*dns.Msg) Result
|
||||
Rewrite(dns.ResponseWriter, *dns.Msg) Result
|
||||
}
|
||||
|
||||
func newRule(args ...string) (Rule, error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue