mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 18:53:43 -04:00
@@ -22,7 +22,7 @@ type Config struct {
|
|||||||
Root string
|
Root string
|
||||||
|
|
||||||
// Server is the server that handles this config
|
// Server is the server that handles this config
|
||||||
Server *Server
|
Server *Server
|
||||||
|
|
||||||
// Middleware stack.
|
// Middleware stack.
|
||||||
Middleware []middleware.Middleware
|
Middleware []middleware.Middleware
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package loadbalance
|
package loadbalance
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/mholt/caddy"
|
|
||||||
"github.com/coredns/coredns/core/dnsserver"
|
"github.com/coredns/coredns/core/dnsserver"
|
||||||
"github.com/coredns/coredns/middleware"
|
"github.com/coredns/coredns/middleware"
|
||||||
|
"github.com/mholt/caddy"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/miekg/dns"
|
"github.com/miekg/dns"
|
||||||
ot "github.com/opentracing/opentracing-go"
|
ot "github.com/opentracing/opentracing-go"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package pprof
|
|||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/mholt/caddy"
|
|
||||||
"github.com/coredns/coredns/middleware"
|
"github.com/coredns/coredns/middleware"
|
||||||
|
|
||||||
|
"github.com/mholt/caddy"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package reverse
|
package reverse
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
"net"
|
"net"
|
||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Test converting from hostname to IP and back again to hostname
|
// Test converting from hostname to IP and back again to hostname
|
||||||
@@ -23,18 +23,18 @@ func TestNetworkConversion(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
network{
|
network{
|
||||||
IPnet:net4,
|
IPnet: net4,
|
||||||
Template: "dns-{ip}.domain.internal.",
|
Template: "dns-{ip}.domain.internal.",
|
||||||
RegexMatchIP:regexIP4,
|
RegexMatchIP: regexIP4,
|
||||||
},
|
},
|
||||||
"dns-10-1-1-23.domain.internal.",
|
"dns-10-1-1-23.domain.internal.",
|
||||||
net.ParseIP("10.1.1.23"),
|
net.ParseIP("10.1.1.23"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
network{
|
network{
|
||||||
IPnet:net6,
|
IPnet: net6,
|
||||||
Template: "dns-{ip}.domain.internal.",
|
Template: "dns-{ip}.domain.internal.",
|
||||||
RegexMatchIP:regexIP6,
|
RegexMatchIP: regexIP6,
|
||||||
},
|
},
|
||||||
"dns-fd01000000000000000000000000a32f.domain.internal.",
|
"dns-fd01000000000000000000000000a32f.domain.internal.",
|
||||||
net.ParseIP("fd01::a32f"),
|
net.ParseIP("fd01::a32f"),
|
||||||
@@ -70,56 +70,56 @@ func TestNetworkHostnameToIP(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
network{
|
network{
|
||||||
IPnet:net4,
|
IPnet: net4,
|
||||||
RegexMatchIP:regexIP4,
|
RegexMatchIP: regexIP4,
|
||||||
},
|
},
|
||||||
// domain does not match
|
// domain does not match
|
||||||
"dns-10-1-1-23.domain.internals.",
|
"dns-10-1-1-23.domain.internals.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
network{
|
network{
|
||||||
IPnet:net4,
|
IPnet: net4,
|
||||||
RegexMatchIP:regexIP4,
|
RegexMatchIP: regexIP4,
|
||||||
},
|
},
|
||||||
// IP does match / contain in subnet
|
// IP does match / contain in subnet
|
||||||
"dns-200-1-1-23.domain.internals.",
|
"dns-200-1-1-23.domain.internals.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
network{
|
network{
|
||||||
IPnet:net4,
|
IPnet: net4,
|
||||||
RegexMatchIP:regexIP4,
|
RegexMatchIP: regexIP4,
|
||||||
},
|
},
|
||||||
// template does not match
|
// template does not match
|
||||||
"dns-10-1-1-23-x.domain.internal.",
|
"dns-10-1-1-23-x.domain.internal.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
network{
|
network{
|
||||||
IPnet:net4,
|
IPnet: net4,
|
||||||
RegexMatchIP:regexIP4,
|
RegexMatchIP: regexIP4,
|
||||||
},
|
},
|
||||||
// template does not match
|
// template does not match
|
||||||
"IP-dns-10-1-1-23.domain.internal.",
|
"IP-dns-10-1-1-23.domain.internal.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
network{
|
network{
|
||||||
IPnet:net6,
|
IPnet: net6,
|
||||||
RegexMatchIP:regexIP6,
|
RegexMatchIP: regexIP6,
|
||||||
},
|
},
|
||||||
// template does not match
|
// template does not match
|
||||||
"dnx-fd01000000000000000000000000a32f.domain.internal.",
|
"dnx-fd01000000000000000000000000a32f.domain.internal.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
network{
|
network{
|
||||||
IPnet:net6,
|
IPnet: net6,
|
||||||
RegexMatchIP:regexIP6,
|
RegexMatchIP: regexIP6,
|
||||||
},
|
},
|
||||||
// no valid v6 (missing one 0, only 31 chars)
|
// no valid v6 (missing one 0, only 31 chars)
|
||||||
"dns-fd0100000000000000000000000a32f.domain.internal.",
|
"dns-fd0100000000000000000000000a32f.domain.internal.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
network{
|
network{
|
||||||
IPnet:net6,
|
IPnet: net6,
|
||||||
RegexMatchIP:regexIP6,
|
RegexMatchIP: regexIP6,
|
||||||
},
|
},
|
||||||
// IP does match / contain in subnet
|
// IP does match / contain in subnet
|
||||||
"dns-ed01000000000000000000000000a32f.domain.internal.",
|
"dns-ed01000000000000000000000000a32f.domain.internal.",
|
||||||
|
|||||||
Reference in New Issue
Block a user