Implement NS queries to Etcd middleware

Copy and port the NS record stuff from SkyDNS. Slightly cleaner
implementation.
This commit is contained in:
Miek Gieben
2016-04-13 08:03:56 +01:00
parent a441f93e0c
commit e979acba1b
5 changed files with 73 additions and 8 deletions

View File

@@ -71,6 +71,12 @@ func (s *Service) NewTXT(name string) *dns.TXT {
return &dns.TXT{Hdr: dns.RR_Header{Name: name, Rrtype: dns.TypeTXT, Class: dns.ClassINET, Ttl: s.Ttl}, Txt: split255(s.Text)}
}
// NewNS returns a new NS record based on the Service.
func (s *Service) NewNS(name string) *dns.NS {
host := targetStrip(dns.Fqdn(s.Host), s.TargetStrip)
return &dns.NS{Hdr: dns.RR_Header{Name: name, Rrtype: dns.TypeNS, Class: dns.ClassINET, Ttl: s.Ttl}, Ns: host}
}
// Group checks the services in sx, it looks for a Group attribute on the shortest
// keys. If there are multiple shortest keys *and* the group attribute disagrees (and
// is not empty), we don't consider it a group.