aboutsummaryrefslogtreecommitdiff
path: root/middleware/file/xfr.go
diff options
context:
space:
mode:
Diffstat (limited to 'middleware/file/xfr.go')
-rw-r--r--middleware/file/xfr.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/middleware/file/xfr.go b/middleware/file/xfr.go
index e4fcd7efa..3cb21aa11 100644
--- a/middleware/file/xfr.go
+++ b/middleware/file/xfr.go
@@ -4,6 +4,7 @@ import (
"fmt"
"log"
+ "github.com/miekg/coredns/middleware"
"github.com/miekg/coredns/request"
"github.com/miekg/dns"
@@ -22,7 +23,7 @@ func (x Xfr) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (in
return dns.RcodeServerFailure, nil
}
if state.QType() != dns.TypeAXFR && state.QType() != dns.TypeIXFR {
- return 0, fmt.Errorf("xfr called with non transfer type: %d", state.QType())
+ return 0, middleware.Error(x.Name(), fmt.Errorf("xfr called with non transfer type: %d", state.QType()))
}
records := x.All()
@@ -55,4 +56,7 @@ func (x Xfr) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (in
return dns.RcodeSuccess, nil
}
+// Name implements the middleware.Hander interface.
+func (x Xfr) Name() string { return "xfr" } // Or should we return "file" here?
+
const transferLength = 1000 // Start a new envelop after message reaches this size in bytes. Intentionally small to test multi envelope parsing.