Documentation ¶
Overview ¶
Package proxy is plugin that proxies requests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( RequestCount = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: plugin.Namespace, Subsystem: "proxy", Name: "request_count_total", Help: "Counter of requests made per protocol, proxy protocol, family and upstream.", }, []string{"server", "proto", "proxy_proto", "family", "to"}) RequestDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{ Namespace: plugin.Namespace, Subsystem: "proxy", Name: "request_duration_seconds", Buckets: plugin.TimeBuckets, Help: "Histogram of the time (in seconds) each request took.", }, []string{"server", "proto", "proxy_proto", "family", "to"}) )
Metrics the proxy plugin exports.
Functions ¶
This section is empty.
Types ¶
type Exchanger ¶
type Exchanger interface { Exchange(ctx context.Context, addr string, state request.Request) (*dns.Msg, error) Protocol() string // Transport returns the only transport protocol used by this Exchanger or "". // If the return value is "", Exchange must use `state.Proto()`. Transport() string OnStartup(*Proxy) error OnShutdown(*Proxy) error }
Exchanger is an interface that specifies a type implementing a DNS resolver that can use whatever transport it likes.
type Options ¶
type Options struct {
ForceTCP bool // If true use TCP for upstream no matter what
}
Options define the options understood by dns.Exchange.
type Proxy ¶
type Proxy struct { Next plugin.Handler Upstreams *[]Upstream // Trace is the Trace plugin, if it is installed // This is used by the grpc exchanger to trace through the grpc calls Trace plugin.Handler }
Proxy represents a plugin instance that can proxy requests to another (DNS) server.
func NewLookupWithOption ¶
NewLookupWithOption process creates a simple round robin forward with potentially forced proto for upstream.
func (Proxy) Forward ¶
Forward forward the request in state as-is. Unlike Lookup that adds EDNS0 suffix to the message.
type Upstream ¶
type Upstream interface { // The domain name this upstream host should be routed on. From() string // Selects an upstream host to be routed to. Select() *healthcheck.UpstreamHost // Checks if subpdomain is not an ignored. IsAllowedDomain(string) bool // Exchanger returns the exchanger to be used for this upstream. Exchanger() Exchanger // Stops the upstream from proxying requests to shutdown goroutines cleanly. Stop() error }
Upstream manages a pool of proxy upstream hosts. Select should return a suitable upstream host, or nil if no such hosts are available.
func NewStaticUpstream ¶
NewStaticUpstream parses the configuration of a single upstream starting from the FROM