Add state.SizeAndDo()

This methods returns an OPT record which can be used to create a new
message with the same bufsize and Do bit as the original one.
This commit is contained in:
Miek Gieben
2016-03-25 17:23:06 +00:00
parent e8982dc99c
commit 16e50ec5f8
3 changed files with 31 additions and 30 deletions

View File

@@ -55,8 +55,10 @@ func New(hosts []string) Proxy {
func (p Proxy) Lookup(state middleware.State, name string, tpe uint16) (*dns.Msg, error) {
req := new(dns.Msg)
req.SetQuestion(name, tpe)
// TODO(miek):
// USE STATE FOR DNSSEC ETCD BUFSIZE BLA BLA
opt := state.SizeAndDo()
req.Extra = []dns.RR{opt}
return p.lookup(state, req)
}

View File

@@ -12,7 +12,6 @@ type ReverseProxy struct {
}
func (p ReverseProxy) ServeDNS(w dns.ResponseWriter, r *dns.Msg, extra []dns.RR) error {
// TODO(miek): use extra to EDNS0.
var (
reply *dns.Msg
err error