plugin/rewrite: add handling of TTL field rewrites (#2048)

Resolves: #1981

Signed-off-by: Paul Greenberg <greenpau@outlook.com>
This commit is contained in:
Paul G
2018-08-29 10:41:03 -04:00
committed by GitHub
parent 52147cd657
commit 38051b9089
6 changed files with 453 additions and 25 deletions

View File

@@ -133,7 +133,7 @@ func newNameRule(nextAction string, args ...string) (Rule, error) {
if err != nil {
return nil, fmt.Errorf("Invalid regex pattern in a name rule: %s", args[1])
}
return &regexNameRule{nextAction, regexPattern, plugin.Name(args[2]).Normalize(), ResponseRule{}}, nil
return &regexNameRule{nextAction, regexPattern, plugin.Name(args[2]).Normalize(), ResponseRule{Type: "name"}}, nil
default:
return nil, fmt.Errorf("A name rule supports only exact, prefix, suffix, substring, and regex name matching")
}
@@ -162,6 +162,7 @@ func newNameRule(nextAction string, args ...string) (Rule, error) {
plugin.Name(args[2]).Normalize(),
ResponseRule{
Active: true,
Type: "name",
Pattern: responseRegexPattern,
Replacement: plugin.Name(args[6]).Normalize(),
},