dnsserver.go
func (ds *DNSServer) GetSRV(spec string) []*dns.SRV {
	ds.srvMutex.RLock()
	defer ds.srvMutex.RUnlock()

	srv, ok := ds.srvRecords[spec]

	if ok {
		records := []*dns.SRV{}
		for _, record := range srv {
			srvRecord := &dns.SRV{
				Hdr: dns.RR_Header{
					Name:   spec,
					Rrtype: dns.TypeSRV,
					Class:  dns.ClassINET,
					// 0 TTL results in UB for DNS resolvers and generally causes problems.
					Ttl: 1,
				},
				Priority: 0,
				Weight:   0,
				Port:     record.Port,
				Target:   record.Host,
			}

			records = append(records, srvRecord)
		}

		return records
	}

	return nil
}
func (ds *DNSServer) GetSRV(spec string) []*dns.SRV {
	ds.srvMutex.RLock()
	defer ds.srvMutex.RUnlock()

	srv, ok := ds.srvRecords[spec]

	if ok {
		records := []*dns.SRV{}
		for _, record := range srv {
			srvRecord := &dns.SRV{
				Hdr: dns.RR_Header{
					Name:   spec,
					Rrtype: dns.TypeSRV,
					Class:  dns.ClassINET,
					// 0 TTL results in UB for DNS resolvers and generally causes problems.
					Ttl: 1,
				},
				Priority: 0,
				Weight:   0,
				Port:     record.Port,
				Target:   record.Host,
			}

			records = append(records, srvRecord)
		}

		return records
	}

	return nil
}
// Given a service spec, looks up and returns an array of *dns.SRV objects.
// These must be massaged into the []dns.RR after the fact.