Merge pull request #10 from richtr/no_recursive_dns

Suppress recursive mDNS queries and query for PTR records only
This commit is contained in:
Armon Dadgar 2014-09-13 15:34:53 -07:00
commit c4aa495dc0

View File

@ -167,7 +167,8 @@ func (c *client) query(params *QueryParam) error {
// Send the query // Send the query
m := new(dns.Msg) m := new(dns.Msg)
m.SetQuestion(serviceAddr, dns.TypeANY) m.SetQuestion(serviceAddr, dns.TypePTR)
m.RecursionDesired = false
if err := c.sendQuery(m); err != nil { if err := c.sendQuery(m); err != nil {
return nil return nil
} }
@ -229,7 +230,8 @@ func (c *client) query(params *QueryParam) error {
} else { } else {
// Fire off a node specific query // Fire off a node specific query
m := new(dns.Msg) m := new(dns.Msg)
m.SetQuestion(inp.Name, dns.TypeANY) m.SetQuestion(inp.Name, dns.TypePTR)
m.RecursionDesired = false
if err := c.sendQuery(m); err != nil { if err := c.sendQuery(m); err != nil {
log.Printf("[ERR] mdns: Failed to query instance %s: %v", inp.Name, err) log.Printf("[ERR] mdns: Failed to query instance %s: %v", inp.Name, err)
} }