Skip to content

Commit

Permalink
Merge pull request #34 from Tantalor93/upstream
Browse files Browse the repository at this point in the history
add fanout/upstream metadata
  • Loading branch information
denis-tingaikin authored Jun 23, 2021
2 parents 241bb94 + 4176222 commit 42cacc5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fanout.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/plugin/debug"
"github.com/coredns/coredns/plugin/dnstap"
"github.com/coredns/coredns/plugin/metadata"
clog "github.com/coredns/coredns/plugin/pkg/log"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"
Expand Down Expand Up @@ -102,6 +103,9 @@ func (f *Fanout) ServeDNS(ctx context.Context, w dns.ResponseWriter, m *dns.Msg)
if result == nil {
return dns.RcodeServerFailure, timeoutContext.Err()
}
metadata.SetValueFunc(ctx, "fanout/upstream", func() string {
return result.client.Endpoint()
})
if result.err != nil {
return dns.RcodeServerFailure, result.err
}
Expand Down

0 comments on commit 42cacc5

Please sign in to comment.