mirror of
https://github.com/coredns/coredns.git
synced 2025-11-02 02:03:13 -05:00
plugin/template: Add client IP data (#4034)
Signed-off-by: Maxime Guyot <maxime@root314.com>
This commit is contained in:
@@ -48,6 +48,7 @@ type templateData struct {
|
||||
Type string
|
||||
Message *dns.Msg
|
||||
Question *dns.Question
|
||||
Remote string
|
||||
md map[string]metadata.Func
|
||||
}
|
||||
|
||||
@@ -145,7 +146,7 @@ func executeRRTemplate(server, section string, template *gotmpl.Template, data *
|
||||
|
||||
func (t template) match(ctx context.Context, state request.Request) (*templateData, bool, bool) {
|
||||
q := state.Req.Question[0]
|
||||
data := &templateData{md: metadata.ValueFuncs(ctx)}
|
||||
data := &templateData{md: metadata.ValueFuncs(ctx), Remote: state.IP()}
|
||||
|
||||
zone := plugin.Zones(t.zones).Matches(state.Name())
|
||||
if zone == "" {
|
||||
|
||||
Reference in New Issue
Block a user