coredns-override/override.go

21 lines
436 B
Go
Raw Normal View History

2022-03-31 19:46:56 +00:00
package overide
import (
"context"
"github.com/coredns/coredns/plugin"
"github.com/miekg/dns"
)
type Override struct {
Next plugin.Handler
Rules []Rule
}
func (o Override) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {
rw := &ResponseWrapper{ResponseWriter: w, Rules: o.Rules}
return plugin.NextOrFailure(o.Name(), o.Next, ctx, rw, r)
}
func (o Override) Name() string { return "override" }