Fix various issues with formatting and typos (#424)
* Fix typos * Simplify code * Fix error usage
This commit is contained in:
parent
f402b8f726
commit
ece3cf8ecf
13 changed files with 19 additions and 19 deletions
|
@ -9,7 +9,7 @@ import (
|
||||||
|
|
||||||
// ServiceBackend defines a (dynamic) backend that returns a slice of service definitions.
|
// ServiceBackend defines a (dynamic) backend that returns a slice of service definitions.
|
||||||
type ServiceBackend interface {
|
type ServiceBackend interface {
|
||||||
// Services communicates with the backend to retrieve the service defintion. Exact indicates
|
// Services communicates with the backend to retrieve the service definition. Exact indicates
|
||||||
// on exact much are that we are allowed to recurs.
|
// on exact much are that we are allowed to recurs.
|
||||||
Services(state request.Request, exact bool, opt Options) ([]msg.Service, []msg.Service, error)
|
Services(state request.Request, exact bool, opt Options) ([]msg.Service, []msg.Service, error)
|
||||||
|
|
||||||
|
|
2
middleware/cache/cache.go
vendored
2
middleware/cache/cache.go
vendored
|
@ -130,7 +130,7 @@ const (
|
||||||
|
|
||||||
defaultCap = 10000 // default capacity of the cache.
|
defaultCap = 10000 // default capacity of the cache.
|
||||||
|
|
||||||
// Success is the class for caching postive caching.
|
// Success is the class for caching positive caching.
|
||||||
Success = "success"
|
Success = "success"
|
||||||
// Denial is the class defined for negative caching.
|
// Denial is the class defined for negative caching.
|
||||||
Denial = "denial"
|
Denial = "denial"
|
||||||
|
|
2
middleware/cache/item.go
vendored
2
middleware/cache/item.go
vendored
|
@ -47,7 +47,7 @@ func newItem(m *dns.Msg, d time.Duration) *item {
|
||||||
}
|
}
|
||||||
|
|
||||||
// toMsg turns i into a message, it tailers the reply to m.
|
// toMsg turns i into a message, it tailers the reply to m.
|
||||||
// The Autoritative bit is always set to 0, because the answer is from the cache.
|
// The Authoritative bit is always set to 0, because the answer is from the cache.
|
||||||
func (i *item) toMsg(m *dns.Msg) *dns.Msg {
|
func (i *item) toMsg(m *dns.Msg) *dns.Msg {
|
||||||
m1 := new(dns.Msg)
|
m1 := new(dns.Msg)
|
||||||
m1.SetReply(m)
|
m1.SetReply(m)
|
||||||
|
|
|
@ -43,7 +43,7 @@ func TestZoneSigningBlackLies(t *testing.T) {
|
||||||
|
|
||||||
func testNxdomainMsg() *dns.Msg {
|
func testNxdomainMsg() *dns.Msg {
|
||||||
return &dns.Msg{MsgHdr: dns.MsgHdr{Rcode: dns.RcodeNameError},
|
return &dns.Msg{MsgHdr: dns.MsgHdr{Rcode: dns.RcodeNameError},
|
||||||
Question: []dns.Question{dns.Question{Name: "ww.miek.nl.", Qclass: dns.ClassINET, Qtype: dns.TypeTXT}},
|
Question: []dns.Question{{Name: "ww.miek.nl.", Qclass: dns.ClassINET, Qtype: dns.TypeTXT}},
|
||||||
Ns: []dns.RR{test.SOA("miek.nl. 1800 IN SOA linode.atoom.net. miek.miek.nl. 1461471181 14400 3600 604800 14400")},
|
Ns: []dns.RR{test.SOA("miek.nl. 1800 IN SOA linode.atoom.net. miek.miek.nl. 1461471181 14400 3600 604800 14400")},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ func TransferParse(c *caddy.Controller, secondary bool) (tos, froms []string, er
|
||||||
for i := range tos {
|
for i := range tos {
|
||||||
if tos[i] != "*" {
|
if tos[i] != "*" {
|
||||||
if x := net.ParseIP(tos[i]); x == nil {
|
if x := net.ParseIP(tos[i]); x == nil {
|
||||||
return nil, nil, fmt.Errorf("must specify an IP addres: `%s'", tos[i])
|
return nil, nil, fmt.Errorf("must specify an IP address: `%s'", tos[i])
|
||||||
}
|
}
|
||||||
tos[i] = middleware.Addr(tos[i]).Normalize()
|
tos[i] = middleware.Addr(tos[i]).Normalize()
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ func TransferParse(c *caddy.Controller, secondary bool) (tos, froms []string, er
|
||||||
for i := range froms {
|
for i := range froms {
|
||||||
if froms[i] != "*" {
|
if froms[i] != "*" {
|
||||||
if x := net.ParseIP(froms[i]); x == nil {
|
if x := net.ParseIP(froms[i]); x == nil {
|
||||||
return nil, nil, fmt.Errorf("must specify an IP addres: `%s'", froms[i])
|
return nil, nil, fmt.Errorf("must specify an IP address: `%s'", froms[i])
|
||||||
}
|
}
|
||||||
froms[i] = middleware.Addr(froms[i]).Normalize()
|
froms[i] = middleware.Addr(froms[i]).Normalize()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -56,7 +56,7 @@ func (q *queue) pop() *Node {
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
// empty returns true when the queue containes zero nodes.
|
// empty returns true when the queue contains zero nodes.
|
||||||
func (q *queue) empty() bool {
|
func (q *queue) empty() bool {
|
||||||
return len(*q) == 0
|
return len(*q) == 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -286,7 +286,7 @@ func (k *Kubernetes) getServiceRecordForIP(ip, name string) []msg.Service {
|
||||||
}
|
}
|
||||||
for _, service := range svcList {
|
for _, service := range svcList {
|
||||||
if service.Spec.ClusterIP == ip {
|
if service.Spec.ClusterIP == ip {
|
||||||
return []msg.Service{msg.Service{Host: ip}}
|
return []msg.Service{{Host: ip}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@ const (
|
||||||
// Map of format string :: expected locations of name symbols in the format.
|
// Map of format string :: expected locations of name symbols in the format.
|
||||||
// -1 value indicates that symbol does not exist in format.
|
// -1 value indicates that symbol does not exist in format.
|
||||||
var exampleTemplates = map[string][]int{
|
var exampleTemplates = map[string][]int{
|
||||||
"{service}.{namespace}.{type}.{zone}": []int{3, 1, 0}, // service symbol expected @ position 0, namespace @ 1, zone @ 3
|
"{service}.{namespace}.{type}.{zone}": {3, 1, 0}, // service symbol expected @ position 0, namespace @ 1, zone @ 3
|
||||||
"{namespace}.{type}.{zone}": []int{2, 0, -1},
|
"{namespace}.{type}.{zone}": {2, 0, -1},
|
||||||
"": []int{-1, -1, -1},
|
"": {-1, -1, -1},
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSetTemplate(t *testing.T) {
|
func TestSetTemplate(t *testing.T) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Request* and Reponse* are the prometheus counters and gauges we are using for exporting metrics.
|
// Request* and Response* are the prometheus counters and gauges we are using for exporting metrics.
|
||||||
var (
|
var (
|
||||||
RequestCount = prometheus.NewCounterVec(prometheus.CounterOpts{
|
RequestCount = prometheus.NewCounterVec(prometheus.CounterOpts{
|
||||||
Namespace: middleware.Namespace,
|
Namespace: middleware.Namespace,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Package edns provides function usefull for adding/inspecting OPT records to/in messages.
|
// Package edns provides function useful for adding/inspecting OPT records to/in messages.
|
||||||
package edns
|
package edns
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/miekg/dns"
|
"github.com/miekg/dns"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ToString convert the rcode to the offical DNS string, or to "RCODE"+value if the RCODE
|
// ToString convert the rcode to the official DNS string, or to "RCODE"+value if the RCODE
|
||||||
// value is unknown.
|
// value is unknown.
|
||||||
func ToString(rcode int) string {
|
func ToString(rcode int) string {
|
||||||
if str, ok := dns.RcodeToString[rcode]; ok {
|
if str, ok := dns.RcodeToString[rcode]; ok {
|
||||||
|
|
|
@ -24,7 +24,7 @@ type dir http.Dir
|
||||||
// Dexample.org/...
|
// Dexample.org/...
|
||||||
// Db.example.org/...
|
// Db.example.org/...
|
||||||
//
|
//
|
||||||
// CoreDir will default to "$HOME/.coredns" on Unix, but it's location can be overriden with the COREDNSPATH
|
// CoreDir will default to "$HOME/.coredns" on Unix, but it's location can be overridden with the COREDNSPATH
|
||||||
// environment variable.
|
// environment variable.
|
||||||
var CoreDir = dir(fsPath())
|
var CoreDir = dir(fsPath())
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ func TestAuto(t *testing.T) {
|
||||||
|
|
||||||
udp, _ := CoreDNSServerPorts(i, 0)
|
udp, _ := CoreDNSServerPorts(i, 0)
|
||||||
if udp == "" {
|
if udp == "" {
|
||||||
t.Fatalf("Could not get UDP listening port")
|
t.Fatal("Could not get UDP listening port")
|
||||||
}
|
}
|
||||||
defer i.Stop()
|
defer i.Stop()
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ func TestAutoNonExistentZone(t *testing.T) {
|
||||||
|
|
||||||
udp, _ := CoreDNSServerPorts(i, 0)
|
udp, _ := CoreDNSServerPorts(i, 0)
|
||||||
if udp == "" {
|
if udp == "" {
|
||||||
t.Fatalf("Could not get UDP listening port")
|
t.Fatal("Could not get UDP listening port")
|
||||||
}
|
}
|
||||||
defer i.Stop()
|
defer i.Stop()
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ func TestAutoAXFR(t *testing.T) {
|
||||||
|
|
||||||
udp, _ := CoreDNSServerPorts(i, 0)
|
udp, _ := CoreDNSServerPorts(i, 0)
|
||||||
if udp == "" {
|
if udp == "" {
|
||||||
t.Fatalf("Could not get UDP listening port")
|
t.Fatal("Could not get UDP listening port")
|
||||||
}
|
}
|
||||||
defer i.Stop()
|
defer i.Stop()
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ func TestAutoAXFR(t *testing.T) {
|
||||||
t.Fatal("Expected to receive reply, but didn't")
|
t.Fatal("Expected to receive reply, but didn't")
|
||||||
}
|
}
|
||||||
if len(resp.Answer) != 5 {
|
if len(resp.Answer) != 5 {
|
||||||
t.Fatal("Expected response with %d RRs, got %d", 5, len(resp.Answer))
|
t.Fatalf("Expected response with %d RRs, got %d", 5, len(resp.Answer))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue