use the service specific address in SRV response

This commit is contained in:
Daniel Malon 2015-01-05 22:48:30 +00:00
parent e56b3861dc
commit 1889841acd
1 changed files with 7 additions and 1 deletions

View File

@ -628,8 +628,14 @@ func (d *DNSServer) serviceSRVRecords(dc string, nodes structs.CheckServiceNodes
} }
resp.Answer = append(resp.Answer, srvRec) resp.Answer = append(resp.Answer, srvRec)
// Determine advertised address
addr := node.Node.Address
if node.Service.Address != "" {
addr = node.Service.Address
}
// Add the extra record // Add the extra record
records := d.formatNodeRecord(&node.Node, node.Node.Address, srvRec.Target, dns.TypeANY, ttl) records := d.formatNodeRecord(&node.Node, addr, srvRec.Target, dns.TypeANY, ttl)
if records != nil { if records != nil {
resp.Extra = append(resp.Extra, records...) resp.Extra = append(resp.Extra, records...)
} }