plugin/rewrite: regular expression and substring match/replace (#1296) (#1297)

This commit is contained in:
Paul Greenberg
2017-12-13 11:31:19 -05:00
committed by John Belamaric
parent 556a289d9a
commit d35f2c73ec
4 changed files with 210 additions and 11 deletions

View File

@@ -100,12 +100,12 @@ func newRule(args ...string) (Rule, error) {
startArg = 1
}
if ruleType != "edns0" && expectNumArgs != 3 {
if ruleType != "edns0" && ruleType != "name" && expectNumArgs != 3 {
return nil, fmt.Errorf("%s rules must have exactly two arguments", ruleType)
}
switch ruleType {
case "name":
return newNameRule(args[startArg], args[startArg+1])
return newNameRule(mode, args[startArg:]...)
case "class":
return newClassRule(args[startArg], args[startArg+1])
case "type":