// LookupTXT returns the DNS TXT records for the given domain name.
973813
func (r *MiekgDNSResolver) LookupTXT(name string) ([]string, error) {
	req := new(dns.Msg)
	req.SetQuestion(name, dns.TypeTXT)

	res, err := r.exchange(req)
	if err != nil {
		return nil, err
	}

	txts := make([]string, 0, len(res.Answer))
	for _, a := range res.Answer {
		if r, ok := a.(*dns.TXT); ok {
			txts = append(txts, strings.Join(r.Txt,""))
		}
	}
	return txts, nil
}
740028
func (d *DNSProvider) getTLDs() (map[string]string, error) {
	request, err := d.newRequestGet("namecheap.domains.getTldList")
	if err != nil {
		return nil, err
	}

	var gtr getTldsResponse
	err = d.do(request, &gtr)
	if err != nil {
		return nil, err
	}

	if len(gtr.Errors) > 0 {
		return nil, fmt.Errorf("%s [%d]", gtr.Errors[0].Description, gtr.Errors[0].Number)
	}

	tlds := make(map[string]string)
	for _, t := range gtr.Result {
		tlds[t.Name] = t.Name
	}
	return tlds, nil
}
251252
func BindTextdomain(domainname string, dirname string) string {
	cdirname := C.CString(dirname)
	defer C.free(unsafe.Pointer(cdirname))

	cdomainname := C.CString(domainname)
	defer C.free(unsafe.Pointer(cdomainname))

	return C.GoString(C.bindtextdomain(cdomainname, cdirname))
}
232447
func LookupMX(host string, server string, c *dns.Client, m *dns.Msg) (addrs []string, err error) {
	m.SetQuestion(dns.Fqdn(host), dns.TypeMX)
	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.MX); ok {
			mxstring := strconv.Itoa(int(t.Preference)) + " " + t.Mx
			addrs = append(addrs, mxstring)
		}
	}

	return
}
465097
func LookupNS(host string, server string, c *dns.Client, m *dns.Msg) (addrs []string, err error) {
	m.SetQuestion(dns.Fqdn(host), dns.TypeNS)
	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.NS); ok {
			addrs = append(addrs, t.Ns)
		}
	}

	return
}
368368
func (d *domainClient) GetStyleSheetText(ctx context.Context, args *GetStyleSheetTextArgs) (reply *GetStyleSheetTextReply, err error) {
	reply = new(GetStyleSheetTextReply)
	if args != nil {
		err = rpcc.Invoke(ctx, "CSS.getStyleSheetText", args, reply, d.conn)
	} else {
		err = rpcc.Invoke(ctx, "CSS.getStyleSheetText", nil, reply, d.conn)
	}
	if err != nil {
		err = &internal.OpError{Domain: "CSS", Op: "GetStyleSheetText", Err: err}
	}
	return
}
1103625
func (re *Regexp) FindNextMatch(m *Match) (*Match, error) {
	if m == nil {
		return nil, nil
	}

	// If previous match was empty, advance by one before matching to prevent
	// infinite loop
	startAt := m.textpos
	if m.Length == 0 {
		if m.textpos == len(m.text) {
			return nil, nil
		}

		if re.RightToLeft() {
			startAt--
		} else {
			startAt++
		}
	}
	return re.run(false, startAt, m.text)
}
86140
func (c *Client) FindTxtRecord(zoneID, fqdn string) (*TXTRecord, error) {
	result, err := c.doRequest(http.MethodGet, fmt.Sprintf("record/%s?host_id=0&offset=0&row_num=2000", zoneID), nil)
	if err != nil {
		return nil, err
	}

	var records []TXTRecord
	err = json.Unmarshal(result, &records)
	if err != nil {
		return nil, fmt.Errorf("CloudXNS: TXT record unmarshaling error: %v", err)
	}

	for _, record := range records {
		if record.Host == dns01.UnFqdn(fqdn) && record.Type == "TXT" {
			return &record, nil
		}
	}

	return nil, fmt.Errorf("CloudXNS: no existing record found for %q", fqdn)
}
1062921
func (x *Xz) CheckExt(filename string) error {
	if filepath.Ext(filename) != ".xz" {
		return fmt.Errorf("filename must have a .xz extension")
	}
	return nil
}
587046
func (client *Client) GetDomain(ctx context.Context, name string) (*DNSDomain, error) {
	resp, err := client.dnsRequest(ctx, "/v1/domains/"+name, nil, "", "GET")
	if err != nil {
		return nil, err
	}

	var d *DNSDomainResponse
	if err := json.Unmarshal(resp, &d); err != nil {
		return nil, err
	}

	return d.Domain, nil
}
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
}
1140168
func (t *templateHandler) Lookup(name string) (tpl.Template, bool) {

	if strings.HasPrefix(name, textTmplNamePrefix) {
		// The caller has explicitly asked for a text template, so only look
		// in the text template collection.
		// The templates are stored without the prefix identificator.
		name = strings.TrimPrefix(name, textTmplNamePrefix)

		return t.applyTemplateInfo(t.text.Lookup(name))
	}

	// Look in both
	if te, found := t.html.Lookup(name); found {
		return t.applyTemplateInfo(te, true)
	}

	return t.applyTemplateInfo(t.text.Lookup(name))

}
126330
func (d *Decoder) VarLenTxt() (string, uint32, error) {
	var l uint32
	var err error
	var n uint32

	if l, n, err = d.VarLen(); err != nil {
		return "", n, err
	}
	buf := make([]byte, l)
	err = d.Read(buf)
	return string(buf), n, err
}
1029136
func (t *SimpleStyledText) LookupStyle(r rune) tcell.Style {
	return t.styles[r]
}
617250
func (h *DefaultPluginHandler) Lookup(filename string) (string, bool) {
	for _, prefix := range h.ValidPrefixes {
		path, err := exec.LookPath(fmt.Sprintf("%s-%s", prefix, filename))
		if err != nil || len(path) == 0 {
			continue
		}
		return path, true
	}

	return "", false
}
324332
func (r Dns_Domain_Registration) LookupDomain(domainName *string) (resp []datatypes.Container_Dns_Domain_Registration_Lookup, err error) {
	params := []interface{}{
		domainName,
	}
	err = r.Session.DoRequest("SoftLayer_Dns_Domain_Registration", "lookupDomain", params, &r.Options, &resp)
	return
}
853361
func LookupPTR(addr string, server string, c *dns.Client, m *dns.Msg) (name []string, err error) {

	reverse, err := dns.ReverseAddr(addr)
	if err != nil {
		return nil, err
	}

	m.SetQuestion(reverse, dns.TypePTR)

	r, _, err := c.Exchange(m, net.JoinHostPort(server, "53"))
	if err != nil {
		return nil, err
	}

	for _, ans := range r.Answer {
		name = append(name, ans.(*dns.PTR).Ptr)
	}

	return
}