2016-03-20 21:36:55 +00:00
|
|
|
package etcd
|
|
|
|
|
|
|
|
|
|
import (
|
2016-04-05 16:23:03 +01:00
|
|
|
"fmt"
|
2016-03-25 20:26:42 +00:00
|
|
|
|
2016-03-20 21:36:55 +00:00
|
|
|
"github.com/miekg/coredns/middleware"
|
Allow debug queries to etcd middleware (#150)
With this you can retreive the raw data that the etcd middleware
used to create the reply. The debug data is put in TXT records
that are stuffed in the CH classs. This is only enabled if you
specify `debug` in the etcd stanza.
You can retrieve it by prefixing your query with 'o-o.debug.'
For instance:
; <<>> DiG 9.10.3-P4-Ubuntu <<>> @localhost -p 1053 SRV o-o.debug.production.*.skydns.local
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47798
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 3
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;o-o.debug.production.*.skydns.local. IN SRV
;; ANSWER SECTION:
production.*.skydns.local. 154 IN SRV 10 50 8080 service1.example.com.
production.*.skydns.local. 154 IN SRV 10 50 8080 service2.example.com.
;; ADDITIONAL SECTION:
skydns.local.skydns.east.production.rails.1. 154 CH TXT "service1.example.com:8080(10,0,,false)[0,]"
skydns.local.skydns.west.production.rails.2. 154 CH TXT "service2.example.com:8080(10,0,,false)[0,]"
2016-05-22 21:16:26 +01:00
|
|
|
"github.com/miekg/coredns/middleware/etcd/msg"
|
2016-09-23 09:14:12 +01:00
|
|
|
"github.com/miekg/coredns/middleware/pkg/dnsutil"
|
2016-09-07 11:10:16 +01:00
|
|
|
"github.com/miekg/coredns/request"
|
2016-03-22 22:44:50 +00:00
|
|
|
|
2016-03-20 21:36:55 +00:00
|
|
|
"github.com/miekg/dns"
|
|
|
|
|
"golang.org/x/net/context"
|
|
|
|
|
)
|
|
|
|
|
|
2016-09-23 09:14:12 +01:00
|
|
|
// ServeDNS implements the middleware.Handler interface.
|
2016-08-08 19:18:55 -07:00
|
|
|
func (e *Etcd) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {
|
|
|
|
|
opt := Options{}
|
2016-09-07 11:10:16 +01:00
|
|
|
state := request.Request{W: w, Req: r}
|
2016-04-04 15:45:17 +01:00
|
|
|
if state.QClass() != dns.ClassINET {
|
2016-04-05 16:23:03 +01:00
|
|
|
return dns.RcodeServerFailure, fmt.Errorf("can only deal with ClassINET")
|
2016-04-04 15:45:17 +01:00
|
|
|
}
|
Allow debug queries to etcd middleware (#150)
With this you can retreive the raw data that the etcd middleware
used to create the reply. The debug data is put in TXT records
that are stuffed in the CH classs. This is only enabled if you
specify `debug` in the etcd stanza.
You can retrieve it by prefixing your query with 'o-o.debug.'
For instance:
; <<>> DiG 9.10.3-P4-Ubuntu <<>> @localhost -p 1053 SRV o-o.debug.production.*.skydns.local
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47798
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 3
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;o-o.debug.production.*.skydns.local. IN SRV
;; ANSWER SECTION:
production.*.skydns.local. 154 IN SRV 10 50 8080 service1.example.com.
production.*.skydns.local. 154 IN SRV 10 50 8080 service2.example.com.
;; ADDITIONAL SECTION:
skydns.local.skydns.east.production.rails.1. 154 CH TXT "service1.example.com:8080(10,0,,false)[0,]"
skydns.local.skydns.west.production.rails.2. 154 CH TXT "service2.example.com:8080(10,0,,false)[0,]"
2016-05-22 21:16:26 +01:00
|
|
|
name := state.Name()
|
|
|
|
|
if e.Debug {
|
|
|
|
|
if debug := isDebug(name); debug != "" {
|
2016-08-08 19:18:55 -07:00
|
|
|
opt.Debug = r.Question[0].Name
|
Allow debug queries to etcd middleware (#150)
With this you can retreive the raw data that the etcd middleware
used to create the reply. The debug data is put in TXT records
that are stuffed in the CH classs. This is only enabled if you
specify `debug` in the etcd stanza.
You can retrieve it by prefixing your query with 'o-o.debug.'
For instance:
; <<>> DiG 9.10.3-P4-Ubuntu <<>> @localhost -p 1053 SRV o-o.debug.production.*.skydns.local
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47798
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 3
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;o-o.debug.production.*.skydns.local. IN SRV
;; ANSWER SECTION:
production.*.skydns.local. 154 IN SRV 10 50 8080 service1.example.com.
production.*.skydns.local. 154 IN SRV 10 50 8080 service2.example.com.
;; ADDITIONAL SECTION:
skydns.local.skydns.east.production.rails.1. 154 CH TXT "service1.example.com:8080(10,0,,false)[0,]"
skydns.local.skydns.west.production.rails.2. 154 CH TXT "service2.example.com:8080(10,0,,false)[0,]"
2016-05-22 21:16:26 +01:00
|
|
|
state.Clear()
|
|
|
|
|
state.Req.Question[0].Name = debug
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-03-25 20:26:42 +00:00
|
|
|
|
|
|
|
|
// We need to check stubzones first, because we may get a request for a zone we
|
|
|
|
|
// are not auth. for *but* do have a stubzone forward for. If we do the stubzone
|
|
|
|
|
// handler will handle the request.
|
2016-03-28 10:49:28 +01:00
|
|
|
if e.Stubmap != nil && len(*e.Stubmap) > 0 {
|
2016-06-11 08:00:47 +10:00
|
|
|
for zone := range *e.Stubmap {
|
2016-04-12 23:26:46 +01:00
|
|
|
if middleware.Name(zone).Matches(name) {
|
2016-03-25 20:26:42 +00:00
|
|
|
stub := Stub{Etcd: e, Zone: zone}
|
|
|
|
|
return stub.ServeDNS(ctx, w, r)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-22 11:04:56 +00:00
|
|
|
zone := middleware.Zones(e.Zones).Matches(state.Name())
|
|
|
|
|
if zone == "" {
|
2016-04-15 20:22:37 +01:00
|
|
|
if e.Next == nil {
|
|
|
|
|
return dns.RcodeServerFailure, nil
|
|
|
|
|
}
|
2016-08-08 19:18:55 -07:00
|
|
|
if opt.Debug != "" {
|
|
|
|
|
r.Question[0].Name = opt.Debug
|
|
|
|
|
}
|
2016-03-22 11:04:56 +00:00
|
|
|
return e.Next.ServeDNS(ctx, w, r)
|
|
|
|
|
}
|
2016-03-20 21:36:55 +00:00
|
|
|
|
2016-03-22 11:04:56 +00:00
|
|
|
var (
|
|
|
|
|
records, extra []dns.RR
|
Allow debug queries to etcd middleware (#150)
With this you can retreive the raw data that the etcd middleware
used to create the reply. The debug data is put in TXT records
that are stuffed in the CH classs. This is only enabled if you
specify `debug` in the etcd stanza.
You can retrieve it by prefixing your query with 'o-o.debug.'
For instance:
; <<>> DiG 9.10.3-P4-Ubuntu <<>> @localhost -p 1053 SRV o-o.debug.production.*.skydns.local
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47798
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 3
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;o-o.debug.production.*.skydns.local. IN SRV
;; ANSWER SECTION:
production.*.skydns.local. 154 IN SRV 10 50 8080 service1.example.com.
production.*.skydns.local. 154 IN SRV 10 50 8080 service2.example.com.
;; ADDITIONAL SECTION:
skydns.local.skydns.east.production.rails.1. 154 CH TXT "service1.example.com:8080(10,0,,false)[0,]"
skydns.local.skydns.west.production.rails.2. 154 CH TXT "service2.example.com:8080(10,0,,false)[0,]"
2016-05-22 21:16:26 +01:00
|
|
|
debug []msg.Service
|
2016-03-22 11:04:56 +00:00
|
|
|
err error
|
|
|
|
|
)
|
2016-03-22 10:29:48 +00:00
|
|
|
switch state.Type() {
|
|
|
|
|
case "A":
|
2016-08-08 19:18:55 -07:00
|
|
|
records, debug, err = e.A(zone, state, nil, opt)
|
2016-03-22 10:29:48 +00:00
|
|
|
case "AAAA":
|
2016-08-08 19:18:55 -07:00
|
|
|
records, debug, err = e.AAAA(zone, state, nil, opt)
|
2016-03-22 10:29:48 +00:00
|
|
|
case "TXT":
|
2016-08-08 19:18:55 -07:00
|
|
|
records, debug, err = e.TXT(zone, state, opt)
|
2016-03-22 10:29:48 +00:00
|
|
|
case "CNAME":
|
2016-08-08 19:18:55 -07:00
|
|
|
records, debug, err = e.CNAME(zone, state, opt)
|
2016-06-08 10:29:46 +01:00
|
|
|
case "PTR":
|
2016-08-08 19:18:55 -07:00
|
|
|
records, debug, err = e.PTR(zone, state, opt)
|
2016-03-22 10:29:48 +00:00
|
|
|
case "MX":
|
2016-08-08 19:18:55 -07:00
|
|
|
records, extra, debug, err = e.MX(zone, state, opt)
|
2016-03-22 10:29:48 +00:00
|
|
|
case "SRV":
|
2016-08-08 19:18:55 -07:00
|
|
|
records, extra, debug, err = e.SRV(zone, state, opt)
|
2016-04-12 23:26:46 +01:00
|
|
|
case "SOA":
|
2016-08-08 19:18:55 -07:00
|
|
|
records, debug, err = e.SOA(zone, state, opt)
|
2016-04-12 23:26:46 +01:00
|
|
|
case "NS":
|
2016-04-13 08:03:56 +01:00
|
|
|
if state.Name() == zone {
|
2016-08-08 19:18:55 -07:00
|
|
|
records, extra, debug, err = e.NS(zone, state, opt)
|
2016-04-13 08:03:56 +01:00
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
fallthrough
|
2016-03-22 10:29:48 +00:00
|
|
|
default:
|
Allow debug queries to etcd middleware (#150)
With this you can retreive the raw data that the etcd middleware
used to create the reply. The debug data is put in TXT records
that are stuffed in the CH classs. This is only enabled if you
specify `debug` in the etcd stanza.
You can retrieve it by prefixing your query with 'o-o.debug.'
For instance:
; <<>> DiG 9.10.3-P4-Ubuntu <<>> @localhost -p 1053 SRV o-o.debug.production.*.skydns.local
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47798
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 3
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;o-o.debug.production.*.skydns.local. IN SRV
;; ANSWER SECTION:
production.*.skydns.local. 154 IN SRV 10 50 8080 service1.example.com.
production.*.skydns.local. 154 IN SRV 10 50 8080 service2.example.com.
;; ADDITIONAL SECTION:
skydns.local.skydns.east.production.rails.1. 154 CH TXT "service1.example.com:8080(10,0,,false)[0,]"
skydns.local.skydns.west.production.rails.2. 154 CH TXT "service2.example.com:8080(10,0,,false)[0,]"
2016-05-22 21:16:26 +01:00
|
|
|
// Do a fake A lookup, so we can distinguish between NODATA and NXDOMAIN
|
2016-08-08 19:18:55 -07:00
|
|
|
_, debug, err = e.A(zone, state, nil, opt)
|
2016-03-22 11:04:56 +00:00
|
|
|
}
|
Allow debug queries to etcd middleware (#150)
With this you can retreive the raw data that the etcd middleware
used to create the reply. The debug data is put in TXT records
that are stuffed in the CH classs. This is only enabled if you
specify `debug` in the etcd stanza.
You can retrieve it by prefixing your query with 'o-o.debug.'
For instance:
; <<>> DiG 9.10.3-P4-Ubuntu <<>> @localhost -p 1053 SRV o-o.debug.production.*.skydns.local
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47798
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 3
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;o-o.debug.production.*.skydns.local. IN SRV
;; ANSWER SECTION:
production.*.skydns.local. 154 IN SRV 10 50 8080 service1.example.com.
production.*.skydns.local. 154 IN SRV 10 50 8080 service2.example.com.
;; ADDITIONAL SECTION:
skydns.local.skydns.east.production.rails.1. 154 CH TXT "service1.example.com:8080(10,0,,false)[0,]"
skydns.local.skydns.west.production.rails.2. 154 CH TXT "service2.example.com:8080(10,0,,false)[0,]"
2016-05-22 21:16:26 +01:00
|
|
|
|
2016-08-08 19:18:55 -07:00
|
|
|
if opt.Debug != "" {
|
2016-05-23 09:16:57 +01:00
|
|
|
// Substitute this name with the original when we return the request.
|
Allow debug queries to etcd middleware (#150)
With this you can retreive the raw data that the etcd middleware
used to create the reply. The debug data is put in TXT records
that are stuffed in the CH classs. This is only enabled if you
specify `debug` in the etcd stanza.
You can retrieve it by prefixing your query with 'o-o.debug.'
For instance:
; <<>> DiG 9.10.3-P4-Ubuntu <<>> @localhost -p 1053 SRV o-o.debug.production.*.skydns.local
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47798
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 3
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;o-o.debug.production.*.skydns.local. IN SRV
;; ANSWER SECTION:
production.*.skydns.local. 154 IN SRV 10 50 8080 service1.example.com.
production.*.skydns.local. 154 IN SRV 10 50 8080 service2.example.com.
;; ADDITIONAL SECTION:
skydns.local.skydns.east.production.rails.1. 154 CH TXT "service1.example.com:8080(10,0,,false)[0,]"
skydns.local.skydns.west.production.rails.2. 154 CH TXT "service2.example.com:8080(10,0,,false)[0,]"
2016-05-22 21:16:26 +01:00
|
|
|
state.Clear()
|
2016-08-08 19:18:55 -07:00
|
|
|
state.Req.Question[0].Name = opt.Debug
|
Allow debug queries to etcd middleware (#150)
With this you can retreive the raw data that the etcd middleware
used to create the reply. The debug data is put in TXT records
that are stuffed in the CH classs. This is only enabled if you
specify `debug` in the etcd stanza.
You can retrieve it by prefixing your query with 'o-o.debug.'
For instance:
; <<>> DiG 9.10.3-P4-Ubuntu <<>> @localhost -p 1053 SRV o-o.debug.production.*.skydns.local
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47798
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 3
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;o-o.debug.production.*.skydns.local. IN SRV
;; ANSWER SECTION:
production.*.skydns.local. 154 IN SRV 10 50 8080 service1.example.com.
production.*.skydns.local. 154 IN SRV 10 50 8080 service2.example.com.
;; ADDITIONAL SECTION:
skydns.local.skydns.east.production.rails.1. 154 CH TXT "service1.example.com:8080(10,0,,false)[0,]"
skydns.local.skydns.west.production.rails.2. 154 CH TXT "service2.example.com:8080(10,0,,false)[0,]"
2016-05-22 21:16:26 +01:00
|
|
|
}
|
|
|
|
|
|
2016-03-22 11:04:56 +00:00
|
|
|
if isEtcdNameError(err) {
|
2016-08-08 19:18:55 -07:00
|
|
|
return e.Err(zone, dns.RcodeNameError, state, debug, err, opt)
|
2016-03-22 11:04:56 +00:00
|
|
|
}
|
|
|
|
|
if err != nil {
|
2016-08-08 19:18:55 -07:00
|
|
|
return e.Err(zone, dns.RcodeServerFailure, state, debug, err, opt)
|
2016-03-20 21:36:55 +00:00
|
|
|
}
|
2016-03-23 22:59:05 +00:00
|
|
|
|
|
|
|
|
if len(records) == 0 {
|
2016-08-08 19:18:55 -07:00
|
|
|
return e.Err(zone, dns.RcodeSuccess, state, debug, err, opt)
|
2016-03-22 11:04:56 +00:00
|
|
|
}
|
2016-03-25 10:32:12 +00:00
|
|
|
|
Allow debug queries to etcd middleware (#150)
With this you can retreive the raw data that the etcd middleware
used to create the reply. The debug data is put in TXT records
that are stuffed in the CH classs. This is only enabled if you
specify `debug` in the etcd stanza.
You can retrieve it by prefixing your query with 'o-o.debug.'
For instance:
; <<>> DiG 9.10.3-P4-Ubuntu <<>> @localhost -p 1053 SRV o-o.debug.production.*.skydns.local
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47798
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 3
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;o-o.debug.production.*.skydns.local. IN SRV
;; ANSWER SECTION:
production.*.skydns.local. 154 IN SRV 10 50 8080 service1.example.com.
production.*.skydns.local. 154 IN SRV 10 50 8080 service2.example.com.
;; ADDITIONAL SECTION:
skydns.local.skydns.east.production.rails.1. 154 CH TXT "service1.example.com:8080(10,0,,false)[0,]"
skydns.local.skydns.west.production.rails.2. 154 CH TXT "service2.example.com:8080(10,0,,false)[0,]"
2016-05-22 21:16:26 +01:00
|
|
|
m := new(dns.Msg)
|
|
|
|
|
m.SetReply(r)
|
|
|
|
|
m.Authoritative, m.RecursionAvailable, m.Compress = true, true, true
|
2016-04-09 16:17:53 +01:00
|
|
|
m.Answer = append(m.Answer, records...)
|
|
|
|
|
m.Extra = append(m.Extra, extra...)
|
2016-08-08 19:18:55 -07:00
|
|
|
if opt.Debug != "" {
|
Allow debug queries to etcd middleware (#150)
With this you can retreive the raw data that the etcd middleware
used to create the reply. The debug data is put in TXT records
that are stuffed in the CH classs. This is only enabled if you
specify `debug` in the etcd stanza.
You can retrieve it by prefixing your query with 'o-o.debug.'
For instance:
; <<>> DiG 9.10.3-P4-Ubuntu <<>> @localhost -p 1053 SRV o-o.debug.production.*.skydns.local
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47798
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 3
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;o-o.debug.production.*.skydns.local. IN SRV
;; ANSWER SECTION:
production.*.skydns.local. 154 IN SRV 10 50 8080 service1.example.com.
production.*.skydns.local. 154 IN SRV 10 50 8080 service2.example.com.
;; ADDITIONAL SECTION:
skydns.local.skydns.east.production.rails.1. 154 CH TXT "service1.example.com:8080(10,0,,false)[0,]"
skydns.local.skydns.west.production.rails.2. 154 CH TXT "service2.example.com:8080(10,0,,false)[0,]"
2016-05-22 21:16:26 +01:00
|
|
|
m.Extra = append(m.Extra, servicesToTxt(debug)...)
|
|
|
|
|
}
|
2016-04-09 16:17:53 +01:00
|
|
|
|
2016-09-23 09:14:12 +01:00
|
|
|
m = dnsutil.Dedup(m)
|
2016-04-09 16:17:53 +01:00
|
|
|
state.SizeAndDo(m)
|
2016-03-26 09:26:54 +00:00
|
|
|
m, _ = state.Scrub(m)
|
2016-04-09 16:17:53 +01:00
|
|
|
w.WriteMsg(m)
|
|
|
|
|
return dns.RcodeSuccess, nil
|
2016-03-22 10:29:48 +00:00
|
|
|
}
|
2016-03-20 21:36:55 +00:00
|
|
|
|
2016-10-26 10:01:52 +01:00
|
|
|
func (e *Etcd) Name() string { return "etcd" }
|
|
|
|
|
|
Allow debug queries to etcd middleware (#150)
With this you can retreive the raw data that the etcd middleware
used to create the reply. The debug data is put in TXT records
that are stuffed in the CH classs. This is only enabled if you
specify `debug` in the etcd stanza.
You can retrieve it by prefixing your query with 'o-o.debug.'
For instance:
; <<>> DiG 9.10.3-P4-Ubuntu <<>> @localhost -p 1053 SRV o-o.debug.production.*.skydns.local
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47798
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 3
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;o-o.debug.production.*.skydns.local. IN SRV
;; ANSWER SECTION:
production.*.skydns.local. 154 IN SRV 10 50 8080 service1.example.com.
production.*.skydns.local. 154 IN SRV 10 50 8080 service2.example.com.
;; ADDITIONAL SECTION:
skydns.local.skydns.east.production.rails.1. 154 CH TXT "service1.example.com:8080(10,0,,false)[0,]"
skydns.local.skydns.west.production.rails.2. 154 CH TXT "service2.example.com:8080(10,0,,false)[0,]"
2016-05-22 21:16:26 +01:00
|
|
|
// Err write an error response to the client.
|
2016-09-07 11:10:16 +01:00
|
|
|
func (e *Etcd) Err(zone string, rcode int, state request.Request, debug []msg.Service, err error, opt Options) (int, error) {
|
2016-04-09 16:17:53 +01:00
|
|
|
m := new(dns.Msg)
|
|
|
|
|
m.SetRcode(state.Req, rcode)
|
2016-05-23 09:16:57 +01:00
|
|
|
m.Authoritative, m.RecursionAvailable, m.Compress = true, true, true
|
2016-08-08 19:18:55 -07:00
|
|
|
m.Ns, _, _ = e.SOA(zone, state, opt)
|
|
|
|
|
if opt.Debug != "" {
|
2016-06-07 20:57:45 +01:00
|
|
|
m.Extra = servicesToTxt(debug)
|
|
|
|
|
txt := errorToTxt(err)
|
|
|
|
|
if txt != nil {
|
|
|
|
|
m.Extra = append(m.Extra, errorToTxt(err))
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-04-09 16:17:53 +01:00
|
|
|
state.SizeAndDo(m)
|
|
|
|
|
state.W.WriteMsg(m)
|
2016-06-07 20:57:45 +01:00
|
|
|
// Return success as the rcode to signal we have written to the client.
|
|
|
|
|
return dns.RcodeSuccess, nil
|
2016-03-20 21:36:55 +00:00
|
|
|
}
|