// Subdomain returns the subdomain of this request, if any.
// Note that this is a fast method which does not cover all cases.
354077
func (ctx *context) Subdomain() (subdomain string) {
	host := ctx.Host()
	if index := strings.IndexByte(host, '.'); index > 0 {
		subdomain = host[0:index]
	}

	// listening on mydomain.com:80
	// subdomain = mydomain, but it's wrong, it should return ""
	vhost := ctx.Application().ConfigurationReadOnly().GetVHost()
	if strings.Contains(vhost, subdomain) { // then it's not subdomain
		return ""
	}

	return
}
601949
func (s *ListClosedWorkflowExecutionsInput) SetDomain(v string) *ListClosedWorkflowExecutionsInput {
	s.Domain = &v
	return s
}
669809
func Domain(named Named) string {
	if r, ok := named.(namedRepository); ok {
		return r.Domain()
	}
	domain, _ := splitDomain(named.Name())
	return domain
}
509764
func isSubdomain(s, domain string) bool {
	if s == domain {
		return true
	}
	if strings.HasSuffix(s, "."+domain) {
		return true
	}
	return false
}
1362671
func NameIsDNSSubdomain(name string, prefix bool) []string {
	if prefix {
		name = maskTrailingDash(name)
	}
	return validation.IsDNS1123Subdomain(name)
}
630518
func (Ctx *Context) ListDomain() (glist []Dominfo) {
	err := Ctx.CheckOpen()
	if err != nil {
		return
	}

	var nbDomain C.int
	clist := C.libxl_list_domain(Ctx.ctx, &nbDomain)
	defer C.libxl_dominfo_list_free(clist, nbDomain)

	if int(nbDomain) == 0 {
		return
	}

	gslice := (*[1 << 30]C.libxl_dominfo)(unsafe.Pointer(clist))[:nbDomain:nbDomain]
	for i := range gslice {
		info := gslice[i].toGo()
		glist = append(glist, *info)
	}

	return
}
629654
func getMainDomain(domain string) string {
	domain = dns01.UnFqdn(domain)

	split := dns.Split(domain)
	if strings.HasSuffix(strings.ToLower(domain), "duckdns.org") {
		if len(split) < 3 {
			return ""
		}

		firstSubDomainIndex := split[len(split)-3]
		return domain[firstSubDomainIndex:]
	}

	return domain[split[len(split)-1]:]
}
262027
func (api *Client) GetDomains(query ...*GetDomainsQuery) ([]*Domain, error) {
	var options *GetDomainsQuery
	if len(query) > 0 {
		options = query[0]
	}
	result, _, err := api.makeRequest(http.MethodGet, api.concatUserPath(domainsPath), &[]*Domain{}, options)
	if err != nil {
		return nil, err
	}
	return *(result.(*[]*Domain)), nil
}
1249201
func GetDomain() string {
	var dom string
	globalConfig.RLock()
	if globalConfig.storage != nil {
		dom = globalConfig.storage.GetDomain()
	}
	if dom == "" {
		dom = globalConfig.domain
	}
	globalConfig.RUnlock()

	return dom
}
395219
func (d *DNS) GetDomain(domain string) (*Domain, error) {
	list, err := d.GetDomains(nil)
	if err != nil {
		return nil, err
	}

	for _, d := range list {
		if strings.EqualFold(d.Domain, domain) {
			return d, nil
		}
	}

	return nil, linode.NewError(errors.New("dns: requested domain not found"))
}
137348
func (s *ListOpenWorkflowExecutionsInput) SetDomain(v string) *ListOpenWorkflowExecutionsInput {
	s.Domain = &v
	return s
}
871008
func (s *RequestCancelWorkflowExecutionInput) SetDomain(v string) *RequestCancelWorkflowExecutionInput {
	s.Domain = &v
	return s
}
1227419
func (s *GetDomainStatisticsReportInput) SetDomain(v string) *GetDomainStatisticsReportInput {
	s.Domain = &v
	return s
}
962878
func (s *DomainsService) GetDomain(accountID string, domainIdentifier string) (*domainResponse, error) {
	path := versioned(domainPath(accountID, domainIdentifier))
	domainResponse := &domainResponse{}

	resp, err := s.client.get(path, domainResponse)
	if err != nil {
		return nil, err
	}

	domainResponse.HttpResponse = resp
	return domainResponse, nil
}
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
}
1065704
func (s *CountOpenWorkflowExecutionsInput) SetDomain(v string) *CountOpenWorkflowExecutionsInput {
	s.Domain = &v
	return s
}
926076
func (s *RestoreDBInstanceFromDBSnapshotInput) SetDomain(v string) *RestoreDBInstanceFromDBSnapshotInput {
	s.Domain = &v
	return s
}