mirror of
https://github.com/coredns/coredns.git
synced 2025-12-06 10:25:10 -05:00
plugin/metadata: add metadata plugin (#1894)
* plugin/metadata: add metadata plugin * plugin/metadata: Add MD struct, refactor code, fix doc * plugin/metadata: simplify metadata key * plugin/metadata: improve setup_test * Support of metadata by rewrite plugin. Move calculated variables to metadata. * Move variables from metadata to pkg, add UTs, READMEs change, metadata small fixes * Add client port validation to variables_test * plugin/metadata: improve README * plugin/metadata: rename methods * plugin/metadata: Update Metadataer interface, update doc, cosmetic code changes * plugin/metadata: move colllisions check to OnStartup(). Fix default variables metadataer. * plugin/metadata: Fix comment for method setValue * plugin/metadata: change variables order to fix linter warning * plugin/metadata: rename Metadataer to Provider
This commit is contained in:
committed by
Miek Gieben
parent
dae506b563
commit
17d807f05f
@@ -1,6 +1,7 @@
|
||||
package rewrite
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
@@ -27,7 +28,7 @@ func newClassRule(nextAction string, args ...string) (Rule, error) {
|
||||
}
|
||||
|
||||
// Rewrite rewrites the the current request.
|
||||
func (rule *classRule) Rewrite(w dns.ResponseWriter, r *dns.Msg) Result {
|
||||
func (rule *classRule) Rewrite(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) Result {
|
||||
if rule.fromClass > 0 && rule.toClass > 0 {
|
||||
if r.Question[0].Qclass == rule.fromClass {
|
||||
r.Question[0].Qclass = rule.toClass
|
||||
|
||||
Reference in New Issue
Block a user