Cleanup: put middleware helper functions in pkgs (#245)
Move all (almost all) Go files in middleware into their own packages. This makes for better naming and discoverability. Lot of changes elsewhere to make this change. The middleware.State was renamed to request.Request which is better, but still does not cover all use-cases. It was also moved out middleware because it is used by `dnsserver` as well. A pkg/dnsutil packages was added for shared, handy, dns util functions. All normalize functions are now put in normalize.go
This commit is contained in:
parent
684330fd28
commit
d1f17fa7e0
90 changed files with 680 additions and 1037 deletions
|
@ -4,13 +4,13 @@ package kubernetes
|
|||
import (
|
||||
"errors"
|
||||
"log"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/miekg/coredns/middleware"
|
||||
"github.com/miekg/coredns/middleware/kubernetes/msg"
|
||||
"github.com/miekg/coredns/middleware/kubernetes/nametemplate"
|
||||
"github.com/miekg/coredns/middleware/kubernetes/util"
|
||||
"github.com/miekg/coredns/middleware/pkg/dnsutil"
|
||||
"github.com/miekg/coredns/middleware/proxy"
|
||||
|
||||
"github.com/miekg/dns"
|
||||
|
@ -100,8 +100,8 @@ func (k *Kubernetes) getZoneForName(name string) (string, []string) {
|
|||
func (k *Kubernetes) Records(name string, exact bool) ([]msg.Service, error) {
|
||||
// TODO: refector this.
|
||||
// Right now GetNamespaceFromSegmentArray do not supports PRE queries
|
||||
if strings.HasSuffix(name, arpaSuffix) {
|
||||
ip, _ := extractIP(name)
|
||||
ip := dnsutil.ExtractAddressFromReverse(name)
|
||||
if ip != "" {
|
||||
records := k.getServiceRecordForIP(ip, name)
|
||||
return records, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue