aboutsummaryrefslogtreecommitdiff
path: root/plugin/template/template.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/template/template.go')
-rw-r--r--plugin/template/template.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugin/template/template.go b/plugin/template/template.go
index 0d1d0c251..0320d4c60 100644
--- a/plugin/template/template.go
+++ b/plugin/template/template.go
@@ -8,6 +8,7 @@ import (
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/plugin/pkg/fall"
+ "github.com/coredns/coredns/plugin/pkg/upstream"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"
@@ -32,6 +33,7 @@ type template struct {
qclass uint16
qtype uint16
fall fall.F
+ upstream upstream.Upstream
}
type templateData struct {
@@ -48,7 +50,7 @@ type templateData struct {
// ServeDNS implements the plugin.Handler interface.
func (h Handler) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {
- state := request.Request{W: w, Req: r}
+ state := request.Request{W: w, Req: r, Context: ctx}
zone := plugin.Zones(h.Zones).Matches(state.Name())
if zone == "" {
@@ -81,6 +83,10 @@ func (h Handler) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
return dns.RcodeServerFailure, err
}
msg.Answer = append(msg.Answer, rr)
+ if rr.Header().Rrtype == dns.TypeCNAME {
+ up, _ := template.upstream.Lookup(state, rr.(*dns.CNAME).Target, dns.TypeA)
+ msg.Answer = append(msg.Answer, up.Answer...)
+ }
}
for _, additional := range template.additional {
rr, err := executeRRTemplate("additional", additional, data)
Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/test/snippets/multiple-var.js (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2023-08-31JavaScript Debug Terminal == Bun TerminalGravatar Ashcon Partovi 1-0/+32
2023-08-31fix(runtime): `fs.cp` edge cases (#4439)Gravatar dave caruso 2-8/+44
2023-08-31only set initial debugger breakpoint once (#4441)Gravatar Dylan Conway 1-2/+11
2023-08-31Make breakpoints faster in VSCode extensionGravatar Ashcon Partovi 1-241/+327
2023-08-31`bun install` correctly join dependency URLs (#4421)Gravatar Julian 6-64/+243
2023-08-31get name if not provided in `FormData.append` (#4434)Gravatar Dylan Conway 4-5/+45
2023-08-31Fix vscode debug terminalGravatar Ashcon Partovi 1-21/+0