code: func syncExtra(index map[string]dns.RR, resp *dns.Msg) {
  	extra := make([]dns.RR, 0, len(resp.Answer))
  	resolved := make(map[string]struct{}, len(resp.Answer))
  	for _, ansRR := range resp.Answer {
  		srv, ok := ansRR.(*dns.SRV)
  		if !ok {
  			continue
  		}
  
  		// Note that we always use lower case when using the index so
  		// that compares are not case-sensitive. We don't alter the actual
  		// RRs we add into the extra section, however.
  		target := strings.ToLower(srv.Target)
  
  	RESOLVE:
  		if _, ok := resolved[target]; ok {
  			continue
  		}
  		resolved[target] = struct{}{}
  
  		extraRR, ok := index[target]
  		if ok {
  			extra = append(extra, extraRR)
  			if cname, ok := extraRR.(*dns.CNAME); ok {
  				target = strings.ToLower(cname.Target)
  				goto RESOLVE
  			}
  		}
  	}
  	resp.Extra = extra
  }
docs: // syncExtra takes a DNS response message and sets the extra data to the most
  // minimal set needed to cover the answer data. A pre-made index of RRs is given
  // so that can be re-used between calls. This assumes that the extra data is
  // only used to provide info for SRV records. If that's not the case, then this
  // will wipe out any additional data.