provider/rfc2136.go
func (r rfc2136Provider) Records() ([]*endpoint.Endpoint, error) {
	rrs, err := r.List()
	if err != nil {
		return nil, err
	}

	var eps []*endpoint.Endpoint

OuterLoop:
	for _, rr := range rrs {
		log.Debugf("Record=%s", rr)

		if rr.Header().Class != dns.ClassINET {
			continue
		}

		rrFqdn := rr.Header().Name
		rrTTL := endpoint.TTL(rr.Header().Ttl)
		var rrType string
		var rrValues []string
		switch rr.Header().Rrtype {
		case dns.TypeCNAME:
			rrValues = []string{rr.(*dns.CNAME).Target}
			rrType = "CNAME"
		case dns.TypeA:
			rrValues = []string{rr.(*dns.A).A.String()}
			rrType = "A"
		case dns.TypeAAAA:
			rrValues = []string{rr.(*dns.AAAA).AAAA.String()}
			rrType = "AAAA"
		case dns.TypeTXT:
			rrValues = (rr.(*dns.TXT).Txt)
			rrType = "TXT"
		default:
			continue // Unhandled record type
		}

		for idx, existingEndpoint := range eps {
			if existingEndpoint.DNSName == rrFqdn && existingEndpoint.RecordType == rrType {
				eps[idx].Targets = append(eps[idx].Targets, rrValues...)
				continue OuterLoop
			}
		}

		ep := endpoint.NewEndpointWithTTL(
			rrFqdn,
			rrType,
			rrTTL,
			rrValues...,
		)

		eps = append(eps, ep)
	}

	return eps, nil
}
func (r rfc2136Provider) Records() ([]*endpoint.Endpoint, error) {
	rrs, err := r.List()
	if err != nil {
		return nil, err
	}

	var eps []*endpoint.Endpoint

OuterLoop:
	for _, rr := range rrs {
		log.Debugf("Record=%s", rr)

		if rr.Header().Class != dns.ClassINET {
			continue
		}

		rrFqdn := rr.Header().Name
		rrTTL := endpoint.TTL(rr.Header().Ttl)
		var rrType string
		var rrValues []string
		switch rr.Header().Rrtype {
		case dns.TypeCNAME:
			rrValues = []string{rr.(*dns.CNAME).Target}
			rrType = "CNAME"
		case dns.TypeA:
			rrValues = []string{rr.(*dns.A).A.String()}
			rrType = "A"
		case dns.TypeAAAA:
			rrValues = []string{rr.(*dns.AAAA).AAAA.String()}
			rrType = "AAAA"
		case dns.TypeTXT:
			rrValues = (rr.(*dns.TXT).Txt)
			rrType = "TXT"
		default:
			continue // Unhandled record type
		}

		for idx, existingEndpoint := range eps {
			if existingEndpoint.DNSName == rrFqdn && existingEndpoint.RecordType == rrType {
				eps[idx].Targets = append(eps[idx].Targets, rrValues...)
				continue OuterLoop
			}
		}

		ep := endpoint.NewEndpointWithTTL(
			rrFqdn,
			rrType,
			rrTTL,
			rrValues...,
		)

		eps = append(eps, ep)
	}

	return eps, nil
}
func ( r rfc2136Provider ) Records ( ) ( [ ] * endpoint . Endpoint , error ) { rrs , err := r . List ( ) if err != nil { return nil , err } var eps [ ] * endpoint . Endpoint OuterLoop : for _ , rr := range rrs { log . Debugf ( " " , rr ) if rr . Header ( ) . Class != dns . ClassINET { continue } rrFqdn := rr . Header ( ) . Name rrTTL := endpoint . TTL ( rr . Header ( ) . Ttl ) var rrType string var rrValues [ ] string switch rr . Header ( ) . Rrtype { case dns . TypeCNAME : rrValues = [ ] string { rr . ( * dns . CNAME ) . Target } rrType = " " case dns . TypeA : rrValues = [ ] string { rr . ( * dns . A ) . A . String ( ) } rrType = " " case dns . TypeAAAA : rrValues = [ ] string { rr . ( * dns . AAAA ) . AAAA . String ( ) } rrType = " " case dns . TypeTXT : rrValues = ( rr . ( * dns . TXT ) . Txt ) rrType = " " default : continue // Unhandled record type } for idx , existingEndpoint := range eps { if existingEndpoint . DNSName == rrFqdn && existingEndpoint . RecordType == rrType { eps [ idx ] . Targets = append ( eps [ idx ] . Targets , rrValues ... ) continue OuterLoop } } ep := endpoint . NewEndpointWithTTL ( rrFqdn , rrType , rrTTL , rrValues ... , ) eps = append ( eps , ep ) } return eps , nil }
// Records returns the list of records.
Records returns the list of records .