func filterAndFixLinks(links []string, filter DomainFilter) []string {
	var result []string
	for _, link := range links {

		// link looks like /REST/CNAMERecord/acme.com/exchange.acme.com/349386875

		// strip /REST/
		link = strings.TrimPrefix(link, restAPIPrefix)

		// simply ignore all record types we don't care about
		if !strings.HasPrefix(link, endpoint.RecordTypeA) &&
			!strings.HasPrefix(link, endpoint.RecordTypeCNAME) &&
			!strings.HasPrefix(link, endpoint.RecordTypeTXT) {
			continue
		}

		// strip ID suffix
		domain := link[0:strings.LastIndexByte(link, '/')]
		// strip zone prefix
		domain = domain[strings.LastIndexByte(domain, '/')+1:]
		if filter.Match(domain) {
			result = append(result, link)
		}
	}

	return result
}
func filterAndFixLinks(links []string, filter DomainFilter) []string {
	var result []string
	for _, link := range links {

		// link looks like /REST/CNAMERecord/acme.com/exchange.acme.com/349386875

		// strip /REST/
		link = strings.TrimPrefix(link, restAPIPrefix)

		// simply ignore all record types we don't care about
		if !strings.HasPrefix(link, endpoint.RecordTypeA) &&
			!strings.HasPrefix(link, endpoint.RecordTypeCNAME) &&
			!strings.HasPrefix(link, endpoint.RecordTypeTXT) {
			continue
		}

		// strip ID suffix
		domain := link[0:strings.LastIndexByte(link, '/')]
		// strip zone prefix
		domain = domain[strings.LastIndexByte(domain, '/')+1:]
		if filter.Match(domain) {
			result = append(result, link)
		}
	}

	return result
}
// filterAndFixLinks removes from `links` all the records we don't care about
// and strops the /REST/ prefix