// cnamer will prefix the answer section with a cname that points from original qname to the
// name of the first RR. It will also update the question section and put original in there.
330575
func cnamer(m *dns.Msg, original string) {
	for _, a := range m.Answer {
		if strings.EqualFold(original, a.Header().Name) {
			continue
		}
		m.Answer = append(m.Answer, nil)
		copy(m.Answer[1:], m.Answer)
		m.Answer[0] = &dns.CNAME{
			Hdr:    dns.RR_Header{Name: original, Rrtype: dns.TypeCNAME, Class: dns.ClassINET, Ttl: a.Header().Ttl},
			Target: a.Header().Name,
		}
		break
	}
	m.Question[0].Name = original
}
246840
func (s *DomainNameConfiguration) SetCertificateName(v string) *DomainNameConfiguration {
	s.CertificateName = &v
	return s
}
171037
func (rule *nameRule) Rewrite(w dns.ResponseWriter, r *dns.Msg) Result {
	if rule.From == r.Question[0].Name {
		r.Question[0].Name = rule.To
		return RewriteDone
	}
	return RewriteIgnored
}
280222
func (client *Client) GetMainDomainName(args *GetMainDomainNameArgs) (response *GetMainDomainNameResponse, err error) {
	action := "GetMainDomainName"
	response = &GetMainDomainNameResponse{}
	err = client.Invoke(action, args, response)
	if err == nil {
		return response, nil
	} else {
		return nil, err
	}
}
1193490
func (n *Namer) Previous() *Namer {
	if n.IsStart() {
		log.Fatal("[F] Already at the start of the series")
	}
	if n.count <= n.opts.start {
		n.count = n.opts.zero
	} else {
		n.count--
	}
	return n
}
211387
func (s *Input) SetNamePrefix(v string) *Input {
	s.NamePrefix = &v
	return s
}
342289
func (hr *Resolver) CNAMEFlatten(ctx context.Context, host string) string {
	if hr.cache == nil {
		hr.cache = cache.New(30*time.Minute, 5*time.Minute)
	}

	result := host
	request := host

	value, found := hr.cache.Get(host)
	if found {
		return value.(string)
	}

	logger := log.FromContext(ctx)
	var cacheDuration = 0 * time.Second
	for depth := 0; depth < hr.ResolvDepth; depth++ {
		resolv, err := cnameResolve(ctx, request, hr.ResolvConfig)
		if err != nil {
			logger.Error(err)
			break
		}
		if resolv == nil {
			break
		}

		result = resolv.Record
		if depth == 0 {
			cacheDuration = resolv.TTL
		}
		request = resolv.Record
	}

	if err := hr.cache.Add(host, result, cacheDuration); err != nil {
		logger.Error(err)
	}

	return result
}
1240656
func (f *File) RenameSectionRaw(name, value string) {
	s := f.GetSection(name)
	s.name = value
}
806714
func NewKeyRenamer(patternKeys ...string) (KeyRenamer, error) {
	var renames []keyRename
	for i := 0; i < len(patternKeys); i += 2 {
		g, err := glob.Compile(strings.ToLower(patternKeys[i]), '/')
		if err != nil {
			return KeyRenamer{}, err
		}
		renames = append(renames, keyRename{pattern: g, newKey: patternKeys[i+1]})
	}

	return KeyRenamer{renames: renames}, nil
}
394246
func (c *Context) FormErr(names ...string) {
	for i := range names {
		c.Data["Err_"+names[i]] = true
	}
}
464780
func (s *DomainName) SetCertificateName(v string) *DomainName {
	s.CertificateName = &v
	return s
}
286168
func (c *ClassifierSerializer) Prefix(prefix string, suffix string) string {
	if prefix == "" {
		return suffix
	}
	return fmt.Sprintf("%s/%s", prefix, suffix)
}
536635
func LookupCNAME(host string, server string, c *dns.Client, m *dns.Msg) (addrs []string, err error) {
	m.SetQuestion(dns.Fqdn(host), dns.TypeCNAME)
	r, _, err := c.Exchange(m, net.JoinHostPort(server, "53"))
	if err != nil {
		return nil, err
	}

	for _, ans := range r.Answer {
		if t, ok := ans.(*dns.CNAME); ok {
			addrs = append(addrs, t.Target)
		}
	}

	return
}
634008
func (ca *CoreAdmin) Rename(core, other string) (*SolrResponse, error) {
	params := &url.Values{}
	params.Add("core", core)
	params.Add("other", other)
	return ca.Action("RENAME", params)
}
1132432
func dnsMsgContainsCNAME(msg *dns.Msg) bool {
	for _, ans := range msg.Answer {
		if _, ok := ans.(*dns.CNAME); ok {
			return true
		}
	}
	return false
}
389161
func (rule *prefixNameRule) Rewrite(ctx context.Context, state request.Request) Result {
	if strings.HasPrefix(state.Name(), rule.Prefix) {
		state.Req.Question[0].Name = rule.Replacement + strings.TrimPrefix(state.Name(), rule.Prefix)
		return RewriteDone
	}
	return RewriteIgnored
}
657980
func (s *CodeSigningCertificateChain) SetCertificateName(v string) *CodeSigningCertificateChain {
	s.CertificateName = &v
	return s
}