本文整理汇总了Golang中github.com/patchwork-toolkit/patchwork/Godeps/_workspace/src/github.com/miekg/dns.Msg.SetReply方法的典型用法代码示例。如果您正苦于以下问题:Golang Msg.SetReply方法的具体用法?Golang Msg.SetReply怎么用?Golang Msg.SetReply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/patchwork-toolkit/patchwork/Godeps/_workspace/src/github.com/miekg/dns.Msg
的用法示例。
在下文中一共展示了Msg.SetReply方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: handleQuery
// handleQuery is used to handle an incoming query
func (s *server) handleQuery(query *dns.Msg, from net.Addr) error {
// Ignore answer for now
if len(query.Answer) > 0 {
return nil
}
// Ignore questions with Authorative section for now
if len(query.Ns) > 0 {
return nil
}
// Handle each question
var (
resp dns.Msg
err error
)
if len(query.Question) > 0 {
for i, _ := range query.Question {
resp = dns.Msg{}
resp.SetReply(query)
resp.Answer = []dns.RR{}
resp.Extra = []dns.RR{}
if err = s.handleQuestion(query.Question[i], &resp); err != nil {
log.Printf("[ERR] bonjour: failed to handle question %v: %v",
query.Question[i], err)
continue
}
// Check if there is an answer
if len(resp.Answer) > 0 {
//return s.sendResponse(&resp, from)
//log.Println("====== BEGIN ======")
//log.Println(resp.String())
//log.Println("======= END =======")
if e := s.multicastResponse(&resp); e != nil {
err = e
}
}
}
}
return err
}