Slowly adding all the tests from skydns
This commit is contained in:
parent
c1d5b5d0db
commit
a655a5735b
3 changed files with 31 additions and 25 deletions
|
@ -44,12 +44,24 @@ func (e Etcd) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (i
|
|||
return 0, nil
|
||||
}
|
||||
if isEtcdNameError(err) {
|
||||
NameError(zone, state)
|
||||
m := new(dns.Msg)
|
||||
m.SetRcode(state.Req, dns.RcodeNameError)
|
||||
m.Ns = []dns.RR{e.SOA(zone, state)}
|
||||
state.W.WriteMsg(m)
|
||||
return dns.RcodeNameError, nil
|
||||
}
|
||||
if err != nil {
|
||||
return dns.RcodeServerFailure, err
|
||||
}
|
||||
|
||||
if len(records) == 0 {
|
||||
m := new(dns.Msg)
|
||||
m.SetReply(state.Req)
|
||||
m.Ns = []dns.RR{e.SOA(zone, state)}
|
||||
state.W.WriteMsg(m)
|
||||
return dns.RcodeNameError, nil
|
||||
|
||||
}
|
||||
if len(records) > 0 {
|
||||
m.Answer = append(m.Answer, records...)
|
||||
}
|
||||
|
@ -60,15 +72,7 @@ func (e Etcd) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (i
|
|||
return 0, nil
|
||||
}
|
||||
|
||||
// NameError writes a name error to the client.
|
||||
func NameError(zone string, state middleware.State) {
|
||||
m := new(dns.Msg)
|
||||
m.SetRcode(state.Req, dns.RcodeNameError)
|
||||
m.Ns = []dns.RR{SOA(zone)}
|
||||
state.W.WriteMsg(m)
|
||||
}
|
||||
|
||||
// NoData write a nodata response to the client.
|
||||
func NoData(zone string, state middleware.State) {
|
||||
func (e Etcd) NoData(zone string, state middleware.State) {
|
||||
// TODO(miek): write it
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue