aboutsummaryrefslogtreecommitdiff
path: root/middleware
diff options
context:
space:
mode:
Diffstat (limited to 'middleware')
-rw-r--r--middleware/file/zone.go1
-rw-r--r--middleware/kubernetes/autopath.go1
-rw-r--r--middleware/kubernetes/kubernetes.go3
-rw-r--r--middleware/pkg/tls/tls.go2
-rw-r--r--middleware/proxy/proxy.go2
-rw-r--r--middleware/proxy/upstream.go10
6 files changed, 11 insertions, 8 deletions
diff --git a/middleware/file/zone.go b/middleware/file/zone.go
index a216f8af8..3f3bcf0f7 100644
--- a/middleware/file/zone.go
+++ b/middleware/file/zone.go
@@ -56,6 +56,7 @@ func NewZone(name, file string) *Zone {
return z
}
+// Copy copies a zone.
func (z *Zone) Copy() *Zone {
z1 := NewZone(z.origin, z.file)
z1.TransferTo = z.TransferTo
diff --git a/middleware/kubernetes/autopath.go b/middleware/kubernetes/autopath.go
index ac86cfd6b..fa79212a9 100644
--- a/middleware/kubernetes/autopath.go
+++ b/middleware/kubernetes/autopath.go
@@ -14,7 +14,6 @@ import "github.com/miekg/dns"
// is NXDOMAIN (NameError). This is needed to support the AutoPath.OnNXDOMAIN
// function, which returns a NOERROR to client instead of NXDOMAIN if the final
// search in the path fails to produce results.
-
type AutoPathWriter struct {
dns.ResponseWriter
original dns.Question
diff --git a/middleware/kubernetes/kubernetes.go b/middleware/kubernetes/kubernetes.go
index f70f8fcbf..4482de024 100644
--- a/middleware/kubernetes/kubernetes.go
+++ b/middleware/kubernetes/kubernetes.go
@@ -49,6 +49,7 @@ type Kubernetes struct {
interfaceAddrsFunc func() net.IP
}
+// AutoPath enables server side search path lookups for pods
type AutoPath struct {
Enabled bool
NDots int
@@ -683,6 +684,8 @@ func splitSearch(zone, question, namespace string) (name, search string, ok bool
}
const (
+ // Svc is the DNS schema for kubernetes services
Svc = "svc"
+ // Pod is the DNS schema for kubernetes pods
Pod = "pod"
)
diff --git a/middleware/pkg/tls/tls.go b/middleware/pkg/tls/tls.go
index 13882c353..04044422b 100644
--- a/middleware/pkg/tls/tls.go
+++ b/middleware/pkg/tls/tls.go
@@ -106,7 +106,7 @@ func loadRoots(caPath string) (*x509.CertPool, error) {
return roots, nil
}
-// NetHTTPSTransport returns an HTTP transport configured using tls.Config
+// NewHTTPSTransport returns an HTTP transport configured using tls.Config
func NewHTTPSTransport(cc *tls.Config) *http.Transport {
// this seems like a bad idea but was here in the previous version
if cc != nil {
diff --git a/middleware/proxy/proxy.go b/middleware/proxy/proxy.go
index b3156e818..4a574982d 100644
--- a/middleware/proxy/proxy.go
+++ b/middleware/proxy/proxy.go
@@ -61,7 +61,7 @@ type UpstreamHost struct {
FailTimeout time.Duration
OkUntil time.Time
CheckDown UpstreamHostDownFunc
- CheckUrl string
+ CheckURL string
WithoutPathPrefix string
Checking bool
checkMu sync.Mutex
diff --git a/middleware/proxy/upstream.go b/middleware/proxy/upstream.go
index b20165eeb..380b585be 100644
--- a/middleware/proxy/upstream.go
+++ b/middleware/proxy/upstream.go
@@ -273,7 +273,7 @@ func parseBlock(c *caddyfile.Dispenser, u *staticUpstream) error {
// otherwise checks will back up, potentially a lot of them if a host is
// absent for a long time. This arrangement makes checks quickly see if
// they are the only one running and abort otherwise.
-func healthCheckUrl(nextTs time.Time, host *UpstreamHost) {
+func healthCheckURL(nextTs time.Time, host *UpstreamHost) {
// lock for our bool check. We don't just defer the unlock because
// we don't want the lock held while http.Get runs
@@ -294,7 +294,7 @@ func healthCheckUrl(nextTs time.Time, host *UpstreamHost) {
// when the remote host is not merely not serving, but actually
// absent, then tcp syn timeouts can be very long, and so one
// fetch could last several check intervals
- if r, err := http.Get(host.CheckUrl); err == nil {
+ if r, err := http.Get(host.CheckURL); err == nil {
io.Copy(ioutil.Discard, r.Body)
r.Body.Close()
@@ -317,7 +317,7 @@ func healthCheckUrl(nextTs time.Time, host *UpstreamHost) {
func (u *staticUpstream) healthCheck() {
for _, host := range u.Hosts {
- if host.CheckUrl == "" {
+ if host.CheckURL == "" {
var hostName, checkPort string
// The DNS server might be an HTTP server. If so, extract its name.
@@ -338,14 +338,14 @@ func (u *staticUpstream) healthCheck() {
checkPort = u.HealthCheck.Port
}
- host.CheckUrl = "http://" + net.JoinHostPort(checkHostName, checkPort) + u.HealthCheck.Path
+ host.CheckURL = "http://" + net.JoinHostPort(checkHostName, checkPort) + u.HealthCheck.Path
}
// calculate this before the get
nextTs := time.Now().Add(u.Future)
// locks/bools should prevent requests backing up
- go healthCheckUrl(nextTs, host)
+ go healthCheckURL(nextTs, host)
}
}