Documentation ¶
Overview ¶
Package proxy is plugin that proxies requests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
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.
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 subdomain 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 ¶ added in v1.0.6
NewStaticUpstream parses the configuration of a single upstream starting from the FROM
Click to show internal directories.
Click to hide internal directories.