2017-01-15 08:12:58 +00:00
|
|
|
package proxy
|
|
|
|
|
|
|
|
|
|
import (
|
2017-02-11 16:56:04 +00:00
|
|
|
"context"
|
|
|
|
|
|
2017-02-21 22:51:47 -08:00
|
|
|
"github.com/coredns/coredns/request"
|
2017-01-15 08:12:58 +00:00
|
|
|
"github.com/miekg/dns"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Exchanger is an interface that specifies a type implementing a DNS resolver that
|
|
|
|
|
// can use whatever transport it likes.
|
|
|
|
|
type Exchanger interface {
|
2017-02-11 16:56:04 +00:00
|
|
|
Exchange(ctx context.Context, addr string, state request.Request) (*dns.Msg, error)
|
2017-02-06 19:32:48 +00:00
|
|
|
Protocol() string
|
2017-01-15 08:12:58 +00:00
|
|
|
|
2017-09-01 12:41:41 +02:00
|
|
|
// Transport returns the only transport protocol used by this Exchanger or "".
|
|
|
|
|
// If the return value is "", Exchange must use `state.Proto()`.
|
|
|
|
|
Transport() string
|
|
|
|
|
|
2017-02-06 19:32:48 +00:00
|
|
|
OnStartup(*Proxy) error
|
|
|
|
|
OnShutdown(*Proxy) error
|
|
|
|
|
}
|