mirror of
https://github.com/coredns/coredns.git
synced 2025-12-16 15:25:11 -05:00
EDNS: return error on wrong version. (#95)
Split up the previous changes a bit. This PR only returns the expected error when the received packet has the wrong EDNS version. EDNS0 handling in the middleware needs a nicer abstraction, like ReflectEdns() or something.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/miekg/dns"
|
||||
@@ -54,27 +53,16 @@ func (r *ResponseRecorder) Write(buf []byte) (int, error) {
|
||||
}
|
||||
|
||||
// Size returns the size.
|
||||
func (r *ResponseRecorder) Size() int {
|
||||
return r.size
|
||||
}
|
||||
func (r *ResponseRecorder) Size() int { return r.size }
|
||||
|
||||
// Rcode returns the rcode.
|
||||
func (r *ResponseRecorder) Rcode() string {
|
||||
if rcode, ok := dns.RcodeToString[r.rcode]; ok {
|
||||
return rcode
|
||||
}
|
||||
return "RCODE" + strconv.Itoa(r.rcode)
|
||||
}
|
||||
func (r *ResponseRecorder) Rcode() string { return RcodeToString(r.rcode) }
|
||||
|
||||
// Start returns the start time of the ResponseRecorder.
|
||||
func (r *ResponseRecorder) Start() time.Time {
|
||||
return r.start
|
||||
}
|
||||
func (r *ResponseRecorder) Start() time.Time { return r.start }
|
||||
|
||||
// Msg returns the written message from the ResponseRecorder.
|
||||
func (r *ResponseRecorder) Msg() *dns.Msg {
|
||||
return r.msg
|
||||
}
|
||||
func (r *ResponseRecorder) Msg() *dns.Msg { return r.msg }
|
||||
|
||||
// Hijack implements dns.Hijacker. It simply wraps the underlying
|
||||
// ResponseWriter's Hijack method if there is one, or returns an error.
|
||||
|
||||
Reference in New Issue
Block a user