2022-03-31 20:00:17 +00:00
|
|
|
package override
|
2022-03-31 19:46:56 +00:00
|
|
|
|
|
|
|
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" }
|