parent
4a8cf09877
commit
07c4f74d85
13
defaults.go
13
defaults.go
|
@ -17,8 +17,10 @@ func (dns *Msg) SetReply(request *Msg) *Msg {
|
||||||
dns.MsgHdr.Response = true
|
dns.MsgHdr.Response = true
|
||||||
dns.MsgHdr.Opcode = OpcodeQuery
|
dns.MsgHdr.Opcode = OpcodeQuery
|
||||||
dns.MsgHdr.Rcode = RcodeSuccess
|
dns.MsgHdr.Rcode = RcodeSuccess
|
||||||
dns.Question = make([]Question, 1)
|
if len(request.Question) > 0 {
|
||||||
dns.Question[0] = request.Question[0]
|
dns.Question = make([]Question, 1)
|
||||||
|
dns.Question[0] = request.Question[0]
|
||||||
|
}
|
||||||
return dns
|
return dns
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,8 +49,11 @@ func (dns *Msg) SetRcode(request *Msg, rcode int) *Msg {
|
||||||
dns.MsgHdr.Opcode = OpcodeQuery
|
dns.MsgHdr.Opcode = OpcodeQuery
|
||||||
dns.MsgHdr.Response = true
|
dns.MsgHdr.Response = true
|
||||||
dns.MsgHdr.Id = request.MsgHdr.Id
|
dns.MsgHdr.Id = request.MsgHdr.Id
|
||||||
dns.Question = make([]Question, 1)
|
// Note that this is actually a FORMERR
|
||||||
dns.Question[0] = request.Question[0]
|
if len(request.Question) > 0 {
|
||||||
|
dns.Question = make([]Question, 1)
|
||||||
|
dns.Question[0] = request.Question[0]
|
||||||
|
}
|
||||||
return dns
|
return dns
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue