This commit is contained in:
Miek Gieben 2016-10-27 11:48:37 +00:00
parent 7ce7100122
commit 94dc28646d
18 changed files with 21 additions and 3 deletions

View file

@ -100,4 +100,5 @@ func (a Auto) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (i
return dns.RcodeSuccess, nil
}
// Name implements the Handler interface.
func (a Auto) Name() string { return "auto" }

View file

@ -37,6 +37,7 @@ func (c *Cache) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
return c.Next.ServeDNS(ctx, crr, r)
}
// Name implements the Handler interface.
func (c *Cache) Name() string { return "cache" }
func (c *Cache) get(qname string, qtype uint16, do bool) (*item, bool, bool) {

View file

@ -51,6 +51,7 @@ func (c Chaos) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
return 0, nil
}
// Name implements the Handler interface.
func (c Chaos) Name() string { return "chaos" }
func trim(s string) string {

View file

@ -55,6 +55,7 @@ var (
}, []string{"type"})
)
// Name implements the Handler interface.
func (d Dnssec) Name() string { return "dnssec" }
const subsystem = "dnssec"

View file

@ -117,6 +117,7 @@ func (e *Etcd) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
return dns.RcodeSuccess, nil
}
// Name implements the Handler interface.
func (e *Etcd) Name() string { return "etcd" }
// Err write an error response to the client.

View file

@ -110,6 +110,7 @@ func (f File) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (i
return dns.RcodeSuccess, nil
}
// Name implements the Handler interface.
func (f File) Name() string { return "file" }
// Parse parses the zone in filename and returns a new Zone or an error.

View file

@ -101,6 +101,7 @@ func (k Kubernetes) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.M
return dns.RcodeSuccess, nil
}
// Name implements the Handler interface.
func (k Kubernetes) Name() string { return "kubernetes" }
// Err writes an error response back to the client.

View file

@ -61,7 +61,7 @@ var requiredSymbols = []string{
// symbol consumes the other segments. Most likely this would be the servicename.
// Also consider how to handle static strings in the format template.
// TODO(infoblox): docs
// Template holds the kubernetes template.
type Template struct {
formatString string
splitFormat []string
@ -69,7 +69,7 @@ type Template struct {
Element map[string]int
}
// TODO(infoblox): docs
// SetTemplate use the string s the set the template.
func (t *Template) SetTemplate(s string) error {
var err error
@ -185,7 +185,8 @@ func (t *Template) IsValid() bool {
return result
}
// TODO(infoblox): what's this?
// NameValues contains a number of values.
// TODO(...): better docs.
type NameValues struct {
ServiceName string
Namespace string

View file

@ -19,4 +19,5 @@ func (rr RoundRobin) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.
return rr.Next.ServeDNS(ctx, wrr, r)
}
// Name implements the Handler interface.
func (rr RoundRobin) Name() string { return "loadbalance" }

View file

@ -64,6 +64,7 @@ func (l Logger) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
return l.Next.ServeDNS(ctx, w, r)
}
// Name implements the Handler interface.
func (l Logger) Name() string { return "log" }
// Rule configures the logging middleware.

View file

@ -30,4 +30,5 @@ func (m *Metrics) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg
return status, err
}
// Name implements the Handler interface.
func (m *Metrics) Name() string { return "prometheus" }

View file

@ -87,4 +87,5 @@ func prometheusParse(c *caddy.Controller) (*Metrics, error) {
var metricsOnce sync.Once
// Addr is the address the where the metrics are exported by default.
const Addr = "localhost:9153"

View file

@ -6,6 +6,7 @@ import (
"github.com/prometheus/client_golang/prometheus"
)
// Request* and Reponse* are the prometheus counters and gauges we are using for exporting metrics.
var (
RequestCount = prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: middleware.Namespace,

View file

@ -59,6 +59,7 @@ func (f HandlerFunc) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.
return f(ctx, w, r)
}
// Name implements the Handler interface.
func (f HandlerFunc) Name() string { return "handlerfunc" }
// Error returns err with 'middleware/name: ' prefixed to it.

View file

@ -102,6 +102,7 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
return p.Next.ServeDNS(ctx, w, r)
}
// Name implements the Handler interface.
func (p Proxy) Name() string { return "proxy" }
// defaultTimeout is the default networking timeout for DNS requests.

View file

@ -52,6 +52,7 @@ func (rw Rewrite) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg
return rw.Next.ServeDNS(ctx, w, r)
}
// Name implements the Handler interface.
func (rw Rewrite) Name() string { return "rewrite" }
// Rule describes an internal location rewrite rule.

View file

@ -292,4 +292,5 @@ func (f HandlerFunc) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.
return f(ctx, w, r)
}
// Name implements the Handler interface.
func (f HandlerFunc) Name() string { return "handlerfunc" }

View file

@ -56,4 +56,5 @@ func (wh Whoami) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
return 0, nil
}
// Name implements the Handler interface.
func (wh Whoami) Name() string { return "whoami" }