本文整理匯總了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
}