mirror of
https://github.com/coredns/coredns.git
synced 2025-12-07 19:05:19 -05:00
Use context.Context
Rename the old Context to State and use context.Context in the middleware for intra-middleware communication and more.
This commit is contained in:
@@ -12,15 +12,15 @@ type ReverseProxy struct {
|
||||
}
|
||||
|
||||
func (p ReverseProxy) ServeDNS(w dns.ResponseWriter, r *dns.Msg, extra []dns.RR) error {
|
||||
// TODO(miek): use extra!
|
||||
// TODO(miek): use extra to EDNS0.
|
||||
var (
|
||||
reply *dns.Msg
|
||||
err error
|
||||
)
|
||||
context := middleware.Context{W: w, Req: r}
|
||||
state := middleware.State{W: w, Req: r}
|
||||
|
||||
// tls+tcp ?
|
||||
if context.Proto() == "tcp" {
|
||||
if state.Proto() == "tcp" {
|
||||
reply, err = middleware.Exchange(p.Client.TCP, r, p.Host)
|
||||
} else {
|
||||
reply, err = middleware.Exchange(p.Client.UDP, r, p.Host)
|
||||
|
||||
Reference in New Issue
Block a user