Typo fixes (#2031)
This commit is contained in:
parent
18a77cd045
commit
6d8a078704
34 changed files with 41 additions and 41 deletions
|
@ -44,7 +44,7 @@ Currently CoreDNS is able to:
|
||||||
* Use k8s (kubernetes) as a backend (*kubernetes*).
|
* Use k8s (kubernetes) as a backend (*kubernetes*).
|
||||||
* Serve as a proxy to forward queries to some other (recursive) nameserver (*proxy*, and *forward*).
|
* Serve as a proxy to forward queries to some other (recursive) nameserver (*proxy*, and *forward*).
|
||||||
* Provide metrics (by using Prometheus) (*metrics*).
|
* Provide metrics (by using Prometheus) (*metrics*).
|
||||||
* Provide query (*log*) and error (*error*) logging.
|
* Provide query (*log*) and error (*errors*) logging.
|
||||||
* Support the CH class: `version.bind` and friends (*chaos*).
|
* Support the CH class: `version.bind` and friends (*chaos*).
|
||||||
* Support the RFC 5001 DNS name server identifier (NSID) option (*nsid*).
|
* Support the RFC 5001 DNS name server identifier (NSID) option (*nsid*).
|
||||||
* Profiling support (*pprof*).
|
* Profiling support (*pprof*).
|
||||||
|
|
|
@ -36,7 +36,7 @@ properties than can have arguments, see the documentation for each plugin.
|
||||||
Comments are allowed and begin with an unquoted hash `#` and continue to the end of the line.
|
Comments are allowed and begin with an unquoted hash `#` and continue to the end of the line.
|
||||||
Comments may be started anywhere on a line.
|
Comments may be started anywhere on a line.
|
||||||
|
|
||||||
Enviroment variables are supported and either the Unix or Windows form may be used: `{$ENV_VAR_1}`
|
Environment variables are supported and either the Unix or Windows form may be used: `{$ENV_VAR_1}`
|
||||||
or `{%ENV_VAR_2%}`.
|
or `{%ENV_VAR_2%}`.
|
||||||
|
|
||||||
You can use the `import` "plugin" to include parts of other files, see <https://coredns.io/explugins/import>.
|
You can use the `import` "plugin" to include parts of other files, see <https://coredns.io/explugins/import>.
|
||||||
|
|
|
@ -42,7 +42,7 @@ func Run() {
|
||||||
caddy.TrapSignals()
|
caddy.TrapSignals()
|
||||||
|
|
||||||
// Reset flag.CommandLine to get rid of unwanted flags for instance from glog (used in kubernetes).
|
// Reset flag.CommandLine to get rid of unwanted flags for instance from glog (used in kubernetes).
|
||||||
// And readd the once we want to keep.
|
// And read the ones we want to keep.
|
||||||
flag.VisitAll(func(f *flag.Flag) {
|
flag.VisitAll(func(f *flag.Flag) {
|
||||||
if _, ok := flagsBlacklist[f.Name]; ok {
|
if _, ok := flagsBlacklist[f.Name]; ok {
|
||||||
return
|
return
|
||||||
|
|
|
@ -24,7 +24,7 @@ auto [ZONES...] {
|
||||||
**ZONES** zones it should be authoritative for. If empty, the zones from the configuration block
|
**ZONES** zones it should be authoritative for. If empty, the zones from the configuration block
|
||||||
are used.
|
are used.
|
||||||
|
|
||||||
* `directory` loads zones from the speficied **DIR**. If a file name matches **REGEXP** it will be
|
* `directory` loads zones from the specified **DIR**. If a file name matches **REGEXP** it will be
|
||||||
used to extract the origin. **ORIGIN_TEMPLATE** will be used as a template for the origin. Strings
|
used to extract the origin. **ORIGIN_TEMPLATE** will be used as a template for the origin. Strings
|
||||||
like `{<number>}` are replaced with the respective matches in the file name, e.g. `{1}` is the
|
like `{<number>}` are replaced with the respective matches in the file name, e.g. `{1}` is the
|
||||||
first match, `{2}` is the second. The default is: `db\.(.*) {1}` i.e. from a file with the
|
first match, `{2}` is the second. The default is: `db\.(.*) {1}` i.e. from a file with the
|
||||||
|
|
|
@ -72,7 +72,7 @@ func autoPathParse(c *caddy.Controller) (*AutoPath, string, error) {
|
||||||
}
|
}
|
||||||
ap.search = rc.Search
|
ap.search = rc.Search
|
||||||
plugin.Zones(ap.search).Normalize()
|
plugin.Zones(ap.search).Normalize()
|
||||||
ap.search = append(ap.search, "") // sentinal value as demanded.
|
ap.search = append(ap.search, "") // sentinel value as demanded.
|
||||||
}
|
}
|
||||||
ap.Zones = zoneAndresolv[:len(zoneAndresolv)-1]
|
ap.Zones = zoneAndresolv[:len(zoneAndresolv)-1]
|
||||||
if len(ap.Zones) == 0 {
|
if len(ap.Zones) == 0 {
|
||||||
|
|
|
@ -62,7 +62,7 @@ etcd [ZONES...] {
|
||||||
## Special Behaviour
|
## Special Behaviour
|
||||||
CoreDNS etcd plugin leverages directory structure to look for related entries. For example an entry `/skydns/test/skydns/mx` would have entries like `/skydns/test/skydns/mx/a`, `/skydns/test/skydns/mx/b` and so on. Similarly a directory `/skydns/test/skydns/mx1` will have all `mx1` entries.
|
CoreDNS etcd plugin leverages directory structure to look for related entries. For example an entry `/skydns/test/skydns/mx` would have entries like `/skydns/test/skydns/mx/a`, `/skydns/test/skydns/mx/b` and so on. Similarly a directory `/skydns/test/skydns/mx1` will have all `mx1` entries.
|
||||||
|
|
||||||
With etcd3, support for [hierarchial keys are dropped](https://coreos.com/etcd/docs/latest/learning/api.html). This means there are no directories but only flat keys with prefixes in etcd3. To accomodate lookups, etcdv3 plugin now does a lookup on prefix `/skydns/test/skydns/mx/` to search for entries like `/skydns/test/skydns/mx/a` etc, and if there is nothing found on `/skydns/test/skydns/mx/`, it looks for `/skydns/test/skydns/mx` to find entries like `/skydns/test/skydns/mx1`.
|
With etcd3, support for [hierarchial keys are dropped](https://coreos.com/etcd/docs/latest/learning/api.html). This means there are no directories but only flat keys with prefixes in etcd3. To accommodate lookups, etcdv3 plugin now does a lookup on prefix `/skydns/test/skydns/mx/` to search for entries like `/skydns/test/skydns/mx/a` etc, and if there is nothing found on `/skydns/test/skydns/mx/`, it looks for `/skydns/test/skydns/mx` to find entries like `/skydns/test/skydns/mx1`.
|
||||||
|
|
||||||
This causes two lookups from CoreDNS to etcdv3 in certain cases.
|
This causes two lookups from CoreDNS to etcdv3 in certain cases.
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ func targetStrip(name string, targetStrip int) string {
|
||||||
offset, end = dns.NextLabel(name, offset)
|
offset, end = dns.NextLabel(name, offset)
|
||||||
}
|
}
|
||||||
if end {
|
if end {
|
||||||
// We overshot the name, use the orignal one.
|
// We overshot the name, use the original one.
|
||||||
offset = 0
|
offset = 0
|
||||||
}
|
}
|
||||||
name = name[offset:]
|
name = name[offset:]
|
||||||
|
|
|
@ -103,7 +103,7 @@ func less(a, b uint32) bool {
|
||||||
|
|
||||||
// Update updates the secondary zone according to its SOA. It will run for the life time of the server
|
// Update updates the secondary zone according to its SOA. It will run for the life time of the server
|
||||||
// and uses the SOA parameters. Every refresh it will check for a new SOA number. If that fails (for all
|
// and uses the SOA parameters. Every refresh it will check for a new SOA number. If that fails (for all
|
||||||
// server) it wil retry every retry interval. If the zone failed to transfer before the expire, the zone
|
// server) it will retry every retry interval. If the zone failed to transfer before the expire, the zone
|
||||||
// will be marked expired.
|
// will be marked expired.
|
||||||
func (z *Zone) Update() error {
|
func (z *Zone) Update() error {
|
||||||
// If we don't have a SOA, we don't have a zone, wait for it to appear.
|
// If we don't have a SOA, we don't have a zone, wait for it to appear.
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
|
|
||||||
// TODO(miek): should test notifies as well, ie start test server (a real coredns one)...
|
// TODO(miek): should test notifies as well, ie start test server (a real coredns one)...
|
||||||
// setup other test server that sends notify, see if CoreDNS comes calling for a zone
|
// setup other test server that sends notify, see if CoreDNS comes calling for a zone
|
||||||
// tranfer
|
// transfer
|
||||||
|
|
||||||
func TestLess(t *testing.T) {
|
func TestLess(t *testing.T) {
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -55,7 +55,7 @@ func (x Xfr) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (in
|
||||||
return dns.RcodeSuccess, nil
|
return dns.RcodeSuccess, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Name implements the plugin.Hander interface.
|
// Name implements the plugin.Handler interface.
|
||||||
func (x Xfr) Name() string { return "xfr" }
|
func (x Xfr) Name() string { return "xfr" }
|
||||||
|
|
||||||
const transferLength = 1000 // Start a new envelop after message reaches this size in bytes. Intentionally small to test multi envelope parsing.
|
const transferLength = 1000 // Start a new envelop after message reaches this size in bytes. Intentionally small to test multi envelope parsing.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Package forward implements a forwarding proxy. It caches an upstream net.Conn for some time, so if the same
|
// Package forward implements a forwarding proxy. It caches an upstream net.Conn for some time, so if the same
|
||||||
// client returns the upstream's Conn will be precached. Depending on how you benchmark this looks to be
|
// client returns the upstream's Conn will be precached. Depending on how you benchmark this looks to be
|
||||||
// 50% faster than just openening a new connection for every client. It works with UDP and TCP and uses
|
// 50% faster than just opening a new connection for every client. It works with UDP and TCP and uses
|
||||||
// inband healthchecking.
|
// inband healthchecking.
|
||||||
package forward
|
package forward
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Package forward implements a forwarding proxy. It caches an upstream net.Conn for some time, so if the same
|
// Package forward implements a forwarding proxy. It caches an upstream net.Conn for some time, so if the same
|
||||||
// client returns the upstream's Conn will be precached. Depending on how you benchmark this looks to be
|
// client returns the upstream's Conn will be precached. Depending on how you benchmark this looks to be
|
||||||
// 50% faster than just openening a new connection for every client. It works with UDP and TCP and uses
|
// 50% faster than just opening a new connection for every client. It works with UDP and TCP and uses
|
||||||
// inband healthchecking.
|
// inband healthchecking.
|
||||||
package forward
|
package forward
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Package forward implements a forwarding proxy. It caches an upstream net.Conn for some time, so if the same
|
// Package forward implements a forwarding proxy. It caches an upstream net.Conn for some time, so if the same
|
||||||
// client returns the upstream's Conn will be precached. Depending on how you benchmark this looks to be
|
// client returns the upstream's Conn will be precached. Depending on how you benchmark this looks to be
|
||||||
// 50% faster than just openening a new connection for every client. It works with UDP and TCP and uses
|
// 50% faster than just opening a new connection for every client. It works with UDP and TCP and uses
|
||||||
// inband healthchecking.
|
// inband healthchecking.
|
||||||
package forward
|
package forward
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/miekg/dns"
|
"github.com/miekg/dns"
|
||||||
)
|
)
|
||||||
|
|
||||||
// truncated looks at the error and if truncated return a nil errror
|
// truncated looks at the error and if truncated return a nil error
|
||||||
// and a possible reconstructed dns message if that was nil.
|
// and a possible reconstructed dns message if that was nil.
|
||||||
func truncated(state request.Request, ret *dns.Msg, err error) (*dns.Msg, error) {
|
func truncated(state request.Request, ret *dns.Msg, err error) (*dns.Msg, error) {
|
||||||
// If you query for instance ANY isc.org; you get a truncated query back which miekg/dns fails to unpack
|
// If you query for instance ANY isc.org; you get a truncated query back which miekg/dns fails to unpack
|
||||||
|
|
|
@ -74,7 +74,7 @@ func (h *hostsMap) Len() int {
|
||||||
type Hostsfile struct {
|
type Hostsfile struct {
|
||||||
sync.RWMutex
|
sync.RWMutex
|
||||||
|
|
||||||
// list of zones we are authoritive for
|
// list of zones we are authoritative for
|
||||||
Origins []string
|
Origins []string
|
||||||
|
|
||||||
// hosts maps for lookups
|
// hosts maps for lookups
|
||||||
|
|
|
@ -92,7 +92,7 @@ kubernetes [ZONES...] {
|
||||||
* `noendpoints` will turn off the serving of endpoint records by disabling the watch on endpoints.
|
* `noendpoints` will turn off the serving of endpoint records by disabling the watch on endpoints.
|
||||||
All endpoint queries and headless service queries will result in an NXDOMAIN.
|
All endpoint queries and headless service queries will result in an NXDOMAIN.
|
||||||
* `transfer` enables zone transfers. It may be specified multiples times. `To` signals the direction
|
* `transfer` enables zone transfers. It may be specified multiples times. `To` signals the direction
|
||||||
(only `to` is alllow). **ADDRESS** must be denoted in CIDR notation (127.0.0.1/32 etc.) or just as
|
(only `to` is allow). **ADDRESS** must be denoted in CIDR notation (127.0.0.1/32 etc.) or just as
|
||||||
plain addresses. The special wildcard `*` means: the entire internet.
|
plain addresses. The special wildcard `*` means: the entire internet.
|
||||||
Sending DNS notifies is not supported.
|
Sending DNS notifies is not supported.
|
||||||
* `fallthrough` **[ZONES...]** If a query for a record in the zones for which the plugin is authoritative
|
* `fallthrough` **[ZONES...]** If a query for a record in the zones for which the plugin is authoritative
|
||||||
|
|
|
@ -35,7 +35,7 @@ func (k *Kubernetes) AutoPath(state request.Request) []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
search = append(search, k.autoPathSearch...)
|
search = append(search, k.autoPathSearch...)
|
||||||
search = append(search, "") // sentinal
|
search = append(search, "") // sentinel
|
||||||
return search
|
return search
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
func TestKubernetesParse(t *testing.T) {
|
func TestKubernetesParse(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
input string // Corefile data as string
|
input string // Corefile data as string
|
||||||
shouldErr bool // true if test case is exected to produce an error.
|
shouldErr bool // true if test case is expected to produce an error.
|
||||||
expectedErrContent string // substring from the expected error. Empty for positive cases.
|
expectedErrContent string // substring from the expected error. Empty for positive cases.
|
||||||
expectedZoneCount int // expected count of defined zones.
|
expectedZoneCount int // expected count of defined zones.
|
||||||
expectedNSCount int // expected count of namespaces.
|
expectedNSCount int // expected count of namespaces.
|
||||||
|
@ -494,7 +494,7 @@ kubernetes cluster.local`,
|
||||||
func TestKubernetesParseEndpointPodNames(t *testing.T) {
|
func TestKubernetesParseEndpointPodNames(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
input string // Corefile data as string
|
input string // Corefile data as string
|
||||||
shouldErr bool // true if test case is exected to produce an error.
|
shouldErr bool // true if test case is expected to produce an error.
|
||||||
expectedErrContent string // substring from the expected error. Empty for positive cases.
|
expectedErrContent string // substring from the expected error. Empty for positive cases.
|
||||||
expectedEndpointMode bool
|
expectedEndpointMode bool
|
||||||
}{
|
}{
|
||||||
|
@ -557,7 +557,7 @@ func TestKubernetesParseEndpointPodNames(t *testing.T) {
|
||||||
func TestKubernetesParseNoEndpoints(t *testing.T) {
|
func TestKubernetesParseNoEndpoints(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
input string // Corefile data as string
|
input string // Corefile data as string
|
||||||
shouldErr bool // true if test case is exected to produce an error.
|
shouldErr bool // true if test case is expected to produce an error.
|
||||||
expectedErrContent string // substring from the expected error. Empty for positive cases.
|
expectedErrContent string // substring from the expected error. Empty for positive cases.
|
||||||
expectedEndpointsInit bool
|
expectedEndpointsInit bool
|
||||||
}{
|
}{
|
||||||
|
@ -619,7 +619,7 @@ func TestKubernetesParseNoEndpoints(t *testing.T) {
|
||||||
func TestKubernetesParseIgnoreEmptyService(t *testing.T) {
|
func TestKubernetesParseIgnoreEmptyService(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
input string // Corefile data as string
|
input string // Corefile data as string
|
||||||
shouldErr bool // true if test case is exected to produce an error.
|
shouldErr bool // true if test case is expected to produce an error.
|
||||||
expectedErrContent string // substring from the expected error. Empty for positive cases.
|
expectedErrContent string // substring from the expected error. Empty for positive cases.
|
||||||
expectedEndpointsInit bool
|
expectedEndpointsInit bool
|
||||||
}{
|
}{
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
//
|
//
|
||||||
// Basic example:
|
// Basic example:
|
||||||
//
|
//
|
||||||
// Implement the Provder interface for a plugin:
|
// Implement the Provider interface for a plugin:
|
||||||
//
|
//
|
||||||
// func (p P) Metadata(ctx context.Context, state request.Request) context.Context {
|
// func (p P) Metadata(ctx context.Context, state request.Request) context.Context {
|
||||||
// cached := ""
|
// cached := ""
|
||||||
|
|
|
@ -60,7 +60,7 @@ Use an alternative address:
|
||||||
}
|
}
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
Or via an enviroment variable (this is supported throughout the Corefile): `export PORT=9253`, and
|
Or via an environment variable (this is supported throughout the Corefile): `export PORT=9253`, and
|
||||||
then:
|
then:
|
||||||
|
|
||||||
~~~ corefile
|
~~~ corefile
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"github.com/miekg/dns"
|
"github.com/miekg/dns"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Report reports the metrics data associcated with request.
|
// Report reports the metrics data associated with request.
|
||||||
func Report(ctx context.Context, req request.Request, zone, rcode string, size int, start time.Time) {
|
func Report(ctx context.Context, req request.Request, zone, rcode string, size int, start time.Time) {
|
||||||
// Proto and Family.
|
// Proto and Family.
|
||||||
net := req.Proto()
|
net := req.Proto()
|
||||||
|
|
|
@ -53,7 +53,7 @@ func NewRequest(method, url string, m *dns.Msg) (*http.Request, error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResponseToMsg converts a http.Repsonse to a dns message.
|
// ResponseToMsg converts a http.Response to a dns message.
|
||||||
func ResponseToMsg(resp *http.Response) (*dns.Msg, error) {
|
func ResponseToMsg(resp *http.Response) (*dns.Msg, error) {
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ type Probe struct {
|
||||||
// Func is used to determine if a target is alive. If so this function must return nil.
|
// Func is used to determine if a target is alive. If so this function must return nil.
|
||||||
type Func func() error
|
type Func func() error
|
||||||
|
|
||||||
// New returns a pointer to an intialized Probe.
|
// New returns a pointer to an initialized Probe.
|
||||||
func New() *Probe { return &Probe{} }
|
func New() *Probe { return &Probe{} }
|
||||||
|
|
||||||
// Do will probe target, if a probe is already in progress this is a noop.
|
// Do will probe target, if a probe is already in progress this is a noop.
|
||||||
|
|
|
@ -169,7 +169,7 @@ func (w *Manager) Stop() {
|
||||||
wr := pb.WatchResponse{WatchId: id, Canceled: true}
|
wr := pb.WatchResponse{WatchId: id, Canceled: true}
|
||||||
err := stream.Send(&wr)
|
err := stream.Send(&wr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warningf("Error notifiying client of cancellation: %s\n", err)
|
log.Warningf("Error notifying client of cancellation: %s\n", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete(w.watches, wn)
|
delete(w.watches, wn)
|
||||||
|
|
|
@ -99,7 +99,7 @@ If monitoring is enabled (via the *prometheus* directive) then the following met
|
||||||
Where `proxy_proto` is the protocol used (`dns` or `grpc`) and `to` is **TO**
|
Where `proxy_proto` is the protocol used (`dns` or `grpc`) and `to` is **TO**
|
||||||
specified in the config, `proto` is the protocol used by the incoming query ("tcp" or "udp"), family
|
specified in the config, `proto` is the protocol used by the incoming query ("tcp" or "udp"), family
|
||||||
the transport family ("1" for IPv4, and "2" for IPv6). `Server` is the server responsible for the
|
the transport family ("1" for IPv4, and "2" for IPv6). `Server` is the server responsible for the
|
||||||
request (and metric). See the documention in the metrics plugin.
|
request (and metric). See the documentation in the metrics plugin.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
|
||||||
// Note this keeps looping and trying until tryDuration is hit, at which point our client
|
// Note this keeps looping and trying until tryDuration is hit, at which point our client
|
||||||
// might be long gone...
|
// might be long gone...
|
||||||
if oe.Timeout() {
|
if oe.Timeout() {
|
||||||
// Our upstream's upstream is problably messing up, continue with next selected
|
// Our upstream's upstream is probably messing up, continue with next selected
|
||||||
// host - which my be the *same* one as we don't set any uh.Fails.
|
// host - which my be the *same* one as we don't set any uh.Fails.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,7 +269,7 @@ junky resolv.conf
|
||||||
|
|
||||||
path, rm, err := test.TempFile(".", tc.filedata)
|
path, rm, err := test.TempFile(".", tc.filedata)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Test %d could not creat temp file %v", i, err)
|
t.Fatalf("Test %d could not create temp file %v", i, err)
|
||||||
}
|
}
|
||||||
defer rm()
|
defer rm()
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ is already listening on that port. The process reloads and performs the followin
|
||||||
3. fail to start a new listener on 443
|
3. fail to start a new listener on 443
|
||||||
4. fail loading the new Corefile, abort and keep using the old process
|
4. fail loading the new Corefile, abort and keep using the old process
|
||||||
|
|
||||||
After the aborted attempt to reload we are left with the old proceses running, but the listener is
|
After the aborted attempt to reload we are left with the old processes running, but the listener is
|
||||||
closed in step 1; so the health endpoint is broken. The same can hopen in the prometheus metrics plugin.
|
closed in step 1; so the health endpoint is broken. The same can hopen in the prometheus metrics plugin.
|
||||||
|
|
||||||
In general be careful with assigning new port and expecting reload to work fully.
|
In general be careful with assigning new port and expecting reload to work fully.
|
||||||
|
|
|
@ -197,7 +197,7 @@ func (rule *substringNameRule) GetResponseRule() ResponseRule { return ResponseR
|
||||||
// GetResponseRule return a rule to rewrite the response with.
|
// GetResponseRule return a rule to rewrite the response with.
|
||||||
func (rule *regexNameRule) GetResponseRule() ResponseRule { return rule.ResponseRule }
|
func (rule *regexNameRule) GetResponseRule() ResponseRule { return rule.ResponseRule }
|
||||||
|
|
||||||
// validName returns true if s is valid domain name and shortern than 256 characters.
|
// validName returns true if s is valid domain name and shorter than 256 characters.
|
||||||
func validName(s string) bool {
|
func validName(s string) bool {
|
||||||
_, ok := dns.IsDomainName(s)
|
_, ok := dns.IsDomainName(s)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
|
@ -89,7 +89,7 @@ func TestRoot(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// getTempDirPath returnes the path to the system temp directory. If it does not exists - an error is returned.
|
// getTempDirPath returns the path to the system temp directory. If it does not exist - an error is returned.
|
||||||
func getTempDirPath() (string, error) {
|
func getTempDirPath() (string, error) {
|
||||||
tempDir := os.TempDir()
|
tempDir := os.TempDir()
|
||||||
_, err := os.Stat(tempDir)
|
_, err := os.Stat(tempDir)
|
||||||
|
|
|
@ -187,7 +187,7 @@ func TestHandler(t *testing.T) {
|
||||||
return fmt.Errorf("expected 1 answer, got %v", len(r.Answer))
|
return fmt.Errorf("expected 1 answer, got %v", len(r.Answer))
|
||||||
}
|
}
|
||||||
if r.Answer[0].Header().Rrtype != dns.TypeA {
|
if r.Answer[0].Header().Rrtype != dns.TypeA {
|
||||||
return fmt.Errorf("expected an A record anwser, got %v", dns.TypeToString[r.Answer[0].Header().Rrtype])
|
return fmt.Errorf("expected an A record answer, got %v", dns.TypeToString[r.Answer[0].Header().Rrtype])
|
||||||
}
|
}
|
||||||
if r.Answer[0].(*dns.A).A.String() != "10.95.12.8" {
|
if r.Answer[0].(*dns.A).A.String() != "10.95.12.8" {
|
||||||
return fmt.Errorf("expected an A record for 10.95.12.8, got %v", r.Answer[0].String())
|
return fmt.Errorf("expected an A record for 10.95.12.8, got %v", r.Answer[0].String())
|
||||||
|
@ -206,7 +206,7 @@ func TestHandler(t *testing.T) {
|
||||||
return fmt.Errorf("expected 1 answer, got %v", len(r.Answer))
|
return fmt.Errorf("expected 1 answer, got %v", len(r.Answer))
|
||||||
}
|
}
|
||||||
if r.Answer[0].Header().Rrtype != dns.TypeMX {
|
if r.Answer[0].Header().Rrtype != dns.TypeMX {
|
||||||
return fmt.Errorf("expected an A record anwser, got %v", dns.TypeToString[r.Answer[0].Header().Rrtype])
|
return fmt.Errorf("expected an A record answer, got %v", dns.TypeToString[r.Answer[0].Header().Rrtype])
|
||||||
}
|
}
|
||||||
if len(r.Extra) != 1 {
|
if len(r.Extra) != 1 {
|
||||||
return fmt.Errorf("expected 1 extra record, got %v", len(r.Extra))
|
return fmt.Errorf("expected 1 extra record, got %v", len(r.Extra))
|
||||||
|
@ -228,7 +228,7 @@ func TestHandler(t *testing.T) {
|
||||||
return fmt.Errorf("expected 1 answer, got %v", len(r.Answer))
|
return fmt.Errorf("expected 1 answer, got %v", len(r.Answer))
|
||||||
}
|
}
|
||||||
if r.Answer[0].Header().Rrtype != dns.TypeA {
|
if r.Answer[0].Header().Rrtype != dns.TypeA {
|
||||||
return fmt.Errorf("expected an A record anwser, got %v", dns.TypeToString[r.Answer[0].Header().Rrtype])
|
return fmt.Errorf("expected an A record answer, got %v", dns.TypeToString[r.Answer[0].Header().Rrtype])
|
||||||
}
|
}
|
||||||
if len(r.Extra) != 1 {
|
if len(r.Extra) != 1 {
|
||||||
return fmt.Errorf("expected 1 extra record, got %v", len(r.Extra))
|
return fmt.Errorf("expected 1 extra record, got %v", len(r.Extra))
|
||||||
|
@ -257,7 +257,7 @@ func TestHandler(t *testing.T) {
|
||||||
return fmt.Errorf("expected 1 answer, got %v", len(r.Answer))
|
return fmt.Errorf("expected 1 answer, got %v", len(r.Answer))
|
||||||
}
|
}
|
||||||
if r.Answer[0].Header().Rrtype != dns.TypeSOA {
|
if r.Answer[0].Header().Rrtype != dns.TypeSOA {
|
||||||
return fmt.Errorf("expected an SOA record anwser, got %v", dns.TypeToString[r.Answer[0].Header().Rrtype])
|
return fmt.Errorf("expected an SOA record answer, got %v", dns.TypeToString[r.Answer[0].Header().Rrtype])
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
|
@ -338,7 +338,7 @@ func TestMultiSection(t *testing.T) {
|
||||||
template CH TXT coredns.invalid {
|
template CH TXT coredns.invalid {
|
||||||
answer "{{ .Name }} 60 CH TXT \"test\""
|
answer "{{ .Name }} 60 CH TXT \"test\""
|
||||||
}
|
}
|
||||||
# Anwser example. ip templates and fallthrough otherwise
|
# Answer example. ip templates and fallthrough otherwise
|
||||||
template IN A example {
|
template IN A example {
|
||||||
match ^ip-10-(?P<b>[0-9]*)-(?P<c>[0-9]*)-(?P<d>[0-9]*)[.]example[.]$
|
match ^ip-10-(?P<b>[0-9]*)-(?P<c>[0-9]*)-(?P<d>[0-9]*)[.]example[.]$
|
||||||
answer "{{ .Name }} 60 IN A 10.{{ .Group.b }}.{{ .Group.c }}.{{ .Group.d }}"
|
answer "{{ .Name }} 60 IN A 10.{{ .Group.b }}.{{ .Group.c }}.{{ .Group.d }}"
|
||||||
|
|
|
@ -267,7 +267,7 @@ func (r *Request) Scrub(reply *dns.Msg) (*dns.Msg, Result) {
|
||||||
sub = optLen
|
sub = optLen
|
||||||
}
|
}
|
||||||
|
|
||||||
// substract to make spaces for re-added EDNS0 OPT RR.
|
// subtract to make spaces for re-added EDNS0 OPT RR.
|
||||||
re := len(reply.Extra) - sub
|
re := len(reply.Extra) - sub
|
||||||
size -= sub
|
size -= sub
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ func TestProxyThreeWay(t *testing.T) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// We would previously get SERVFAIL, so just getting answers here
|
// We would previously get SERVFAIL, so just getting answers here
|
||||||
// is a good sign. The actuall timeouts are handled in the err != nil case
|
// is a good sign. The actual timeouts are handled in the err != nil case
|
||||||
// above.
|
// above.
|
||||||
if r.Rcode != dns.RcodeSuccess {
|
if r.Rcode != dns.RcodeSuccess {
|
||||||
t.Fatalf("Expected success rcode, got %d", r.Rcode)
|
t.Fatalf("Expected success rcode, got %d", r.Rcode)
|
||||||
|
|
|
@ -108,7 +108,7 @@ func corefileFromReadme(readme string) ([]*Input, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if corefile {
|
if corefile {
|
||||||
temp += line + "\n" // readd newline stripped by s.Text()
|
temp += line + "\n" // read newline stripped by s.Text()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue