mirror of
https://github.com/coredns/coredns.git
synced 2025-12-16 15:25:11 -05:00
Add server instance to the context in ServerTLS and ServerHTTPS (#2840)
* Add server instance to the context in ServerTLS and ServerHTTPS The problem with the current code is that there's no way to get the server instance inside a plugin. Because of that "metrics" plugin sets empty "server" label for requests served over TLS or HTTPS. * use s.Server instead of s * Added server to the context of grpc requests
This commit is contained in:
committed by
Miek Gieben
parent
c5f49257be
commit
aebbc4883d
@@ -44,7 +44,7 @@ func (s *ServerTLS) Serve(l net.Listener) error {
|
||||
|
||||
// Only fill out the TCP server for this one.
|
||||
s.server[tcp] = &dns.Server{Listener: l, Net: "tcp-tls", Handler: dns.HandlerFunc(func(w dns.ResponseWriter, r *dns.Msg) {
|
||||
ctx := context.Background()
|
||||
ctx := context.WithValue(context.Background(), Key{}, s.Server)
|
||||
s.ServeDNS(ctx, w, r)
|
||||
})}
|
||||
s.m.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user